This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 89494 - StringBuffers should not be reused
StringBuffers should not be reused
Status: ON_QA
Product: Red Hat Web Application Framework
Classification: Retired
Component: other (Show other bugs)
nightly
All Linux
low Severity medium
: ---
: ---
Assigned To: ccm-bugs-list
Jon Orris
http://post-office.corp.redhat.com/ar...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-04-23 11:16 EDT by Vadim Nasardinov
Modified: 2008-05-01 11:39 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Vadim Nasardinov 2003-04-23 11:16:20 EDT
In the latest installment of his newsletter, Dr. Heinz Kabutz argues
that StringBuffers should not be reused.  If you use JDK 1.3, reusing
a string buffer is a misguided optimization.  If you use JDK 1.4, it
is a memory leak. For details, see
http://www.javaspecialists.co.za/archive/Issue068.html

We do have a couple of places in our code where StringBuffers are
reused:

$ find src/ -name \*.java | xargs grep -E 'setLength\( *0 *\)' | \
  sed 's/: */:/'
src/com/arsdigita/bebop/Table.java:coords.setLength(0);
src/com/arsdigita/bebop/parameters/ArrayParameter.java:buf.setLength(0);
src/com/arsdigita/dispatcher/BaseDispatcherServlet.java:m_buffer.setLength(0);
src/com/arsdigita/dispatcher/MapDispatcher.java:m_buffer.setLength(0);
src/com/arsdigita/persistence/metadata/Operation.java:m_key.setLength(0);
src/com/arsdigita/templating/html/XHTMLParser.java:m_buffer.setLength(0);
src/com/arsdigita/templating/html/XHTMLParser.java:m_buffer.setLength(0);
src/com/arsdigita/templating/html/XHTMLParser.java:m_buffer.setLength(0);
src/com/arsdigita/templating/html/demo/DemoTagHandler.java:m_footnoteBuffer.setLength(0);
$ cd ../../cms/dev/
$ find src/ -name \*.java | xargs grep -E 'setLength\( *0 *\)' | \
  sed 's/: */:/'
src/com/arsdigita/cms/dispatcher/ContentCenterDispatcher.java:m_buffer.setLength(0);
src/com/arsdigita/cms/dispatcher/ServiceDispatcher.java:m_buffer.setLength(0);



Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. grep as described above


Additional info:
Comment 1 Vadim Nasardinov 2003-11-12 15:53:50 EST
Someone (probably Jon) seems to have rooted out all of the
occurrences of sb.setLength(0).  The following commands finds nothing:

$ find core/src/ cms/src/ -name \*.java |
  xargs grep -E 'setLength\( *0 *\)' | sed 's/: */:/'

Marking QA_READY.

Comment 2 David Lawrence 2006-07-17 23:05:15 EDT
QA_READY has been deprecated in favor of ON_QA. Please use ON_QA in the future.
Moving to ON_QA.

Note You need to log in before you can comment on or make changes to this bug.