Author: markt Date: Sat Dec 2 12:11:01 2006 New Revision: 481615 URL: http://svn.apache.org/viewvc?view=rev&rev=481615 Log: Fix bug 41057. Port Remy's patch to limit the size of cached strings.
Modified: tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/StringCache.java tomcat/container/tc5.5.x/webapps/docs/changelog.xml Modified: tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/StringCache.java URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/StringCache.java?view=diff&rev=481615&r1=481614&r2=481615 ============================================================================== --- tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/StringCache.java (original) +++ tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/StringCache.java Sat Dec 2 12:11:01 2006 @@ -55,6 +55,8 @@ protected static int cacheSize = Integer.parseInt(System.getProperty("tomcat.util.buf.StringCache.cacheSize", "200")); + protected static int maxStringSize = + Integer.parseInt(System.getProperty("tomcat.util.buf.StringCache.maxStringSize", "128")); /** * Statistics hash map for byte chunk. @@ -210,7 +212,7 @@ // still training if (bcCache == null) { String value = bc.toStringInternal(); - if (byteEnabled) { + if (byteEnabled && (value.length() < maxStringSize)) { // If training, everything is synced synchronized (bcStats) { // If the cache has been generated on a previous invocation @@ -322,7 +324,7 @@ // still training if (ccCache == null) { String value = cc.toStringInternal(); - if (charEnabled) { + if (charEnabled && (value.length() < maxStringSize)) { // If training, everything is synced synchronized (ccStats) { // If the cache has been generated on a previous invocation Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?view=diff&rev=481615&r1=481614&r2=481615 ============================================================================== --- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original) +++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Sat Dec 2 12:11:01 2006 @@ -153,6 +153,10 @@ <bug>41017</bug>: Restore behaviour of MessageBytes.setString(null). (remm/markt) </fix> + <fix> + <bug>41057</bug>: Modify StringCache to add a configurable upper bound + to the length of cached strings. (remm/markt) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]