tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 47893] New: Use StringBuilder instead of StringBuffer
Date Wed, 23 Sep 2009 09:28:41 GMT

           Summary: Use StringBuilder instead of StringBuffer
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina

Created an attachment (id=24305)
 --> (
Patch replacing usage of StringBuffer by StringBuilder for local variables

Tomcat code base uses a lot of StringBuffer where it should use StringBuilder
for performance reasons. StringBuilder's JavaDoc is quite explicit:

"This class is designed for use as a drop-in replacement for StringBuffer in
places where the string buffer was being used by a single thread (as is
generally the case). Where possible, it is recommended that this class be used
in preference to StringBuffer as it will be faster under most implementations.

The provided patch replaces all usage of StringBuffer by StringBuilder for
local variables. It doesn't change any public or protected API even if it would
probably make sense (for instance in
AccessLogValve.AccessLogElement#addElement) and it doesn't change class fields.

Note that the patch just change StringBuffer to StringBuilder even in places
where the java compiler would automatically use a StringBuilder when normal
string concatenation is used.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message