Re-factor to try and determine if the root cause of https://issues.apache.org/bugzill...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 4 May 2011 19:53:54 +0000 (19:53 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 4 May 2011 19:53:54 +0000 (19:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1099575 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/runtime/BodyContentImpl.java
webapps/docs/changelog.xml

index d9fb0f8..ef2d9ff 100644 (file)
@@ -56,8 +56,8 @@ public class BodyContentImpl extends BodyContent {
      */
     public BodyContentImpl(JspWriter enclosingWriter) {
         super(enclosingWriter);
-        bufferSize = Constants.DEFAULT_TAG_BUFFER_SIZE;
-        cb = new char[bufferSize];
+        cb = new char[Constants.DEFAULT_TAG_BUFFER_SIZE];
+        bufferSize = cb.length;
         nextChar = 0;
         closed = false;
     }
@@ -495,8 +495,8 @@ public class BodyContentImpl extends BodyContent {
         } else {
             nextChar = 0;
             if (LIMIT_BUFFER && (cb.length > Constants.DEFAULT_TAG_BUFFER_SIZE)) {
-                bufferSize = Constants.DEFAULT_TAG_BUFFER_SIZE;
-                cb = new char[bufferSize];
+                cb = new char[Constants.DEFAULT_TAG_BUFFER_SIZE];
+                bufferSize = cb.length;
             }
         }
     }
@@ -644,13 +644,10 @@ public class BodyContentImpl extends BodyContent {
             len = cb.length;
         }
         
-        bufferSize = cb.length + len;
-        char[] tmp = new char[bufferSize];
-        
+        char[] tmp = new char[cb.length + len];
         System.arraycopy(cb, 0, tmp, 0, cb.length);
         cb = tmp;
-        tmp = null;
-        
+        bufferSize = cb.length;
     }
     
     
index 7792e81..3b3281b 100644 (file)
         Use a single TLD location cache for a web application rather than one
         per JSP compilation to speed up JSP compilation. (markt)
       </update>
+      <add>
+        <bug>51124</bug>: Refactor BodyContentImpl to assist in determining the
+        root cause of this bug. Based on a patch by Ramiro. (markt)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Web applications">