Bug 89494 - StringBuffers should not be reused
Summary: StringBuffers should not be reused
Status: ON_QA
Alias: None
Product: Red Hat Web Application Framework
Classification: Retired
Component: other   
(Show other bugs)
Version: nightly
Hardware: All Linux
low
medium
Target Milestone: ---
Assignee: ccm-bugs-list
QA Contact: Jon Orris
URL: http://post-office.corp.redhat.com/ar...
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-04-23 15:16 UTC by Vadim Nasardinov
Modified: 2008-05-01 15:39 UTC (History)
0 users

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)

Description Vadim Nasardinov 2003-04-23 15:16:20 UTC
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 20:53:50 UTC
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-18 03:05:15 UTC
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.