tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47893] New: Use StringBuilder instead of StringBuffer
Date Wed, 23 Sep 2009 09:28:41 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47893

           Summary: Use StringBuilder instead of StringBuffer
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: mguillemot@yahoo.fr


Created an attachment (id=24305)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?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: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message