tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r481615 - in /tomcat: connectors/trunk/util/java/org/apache/tomcat/util/buf/StringCache.java container/tc5.5.x/webapps/docs/changelog.xml
Date Sat, 02 Dec 2006 20:11:02 GMT
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message