Author: markt Date: Thu Jan 11 21:06:44 2018 New Revision: 1820932 URL: http://svn.apache.org/viewvc?rev=1820932&view=rev Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=43925 Add a new system property (org.apache.jasper.runtime.BodyContentImpl.BUFFER_SIZE) to control the size of the buffer used by Jasper when buffering tag bodies.
Modified: tomcat/trunk/java/org/apache/jasper/runtime/BodyContentImpl.java tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/docs/config/systemprops.xml Modified: tomcat/trunk/java/org/apache/jasper/runtime/BodyContentImpl.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/BodyContentImpl.java?rev=1820932&r1=1820931&r2=1820932&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/runtime/BodyContentImpl.java (original) +++ tomcat/trunk/java/org/apache/jasper/runtime/BodyContentImpl.java Thu Jan 11 21:06:44 2018 @@ -40,7 +40,12 @@ import org.apache.jasper.Constants; public class BodyContentImpl extends BodyContent { private static final boolean LIMIT_BUFFER = - Boolean.parseBoolean(System.getProperty("org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER", "false")); + Boolean.parseBoolean(System.getProperty( + "org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER", "false")); + + private static final int TAG_BUFFER_SIZE = + Integer.getInteger("org.apache.jasper.runtime.BodyContentImpl.BUFFER_SIZE", + Constants.DEFAULT_TAG_BUFFER_SIZE).intValue(); private char[] cb; private int nextChar; @@ -57,7 +62,7 @@ public class BodyContentImpl extends Bod */ public BodyContentImpl(JspWriter enclosingWriter) { super(enclosingWriter); - cb = new char[Constants.DEFAULT_TAG_BUFFER_SIZE]; + cb = new char[TAG_BUFFER_SIZE]; bufferSize = cb.length; nextChar = 0; closed = false; @@ -512,8 +517,8 @@ public class BodyContentImpl extends Bod throw new IOException(); } else { nextChar = 0; - if (LIMIT_BUFFER && (cb.length > Constants.DEFAULT_TAG_BUFFER_SIZE)) { - cb = new char[Constants.DEFAULT_TAG_BUFFER_SIZE]; + if (LIMIT_BUFFER && (cb.length > TAG_BUFFER_SIZE)) { + cb = new char[TAG_BUFFER_SIZE]; bufferSize = cb.length; } } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1820932&r1=1820931&r2=1820932&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Thu Jan 11 21:06:44 2018 @@ -45,6 +45,16 @@ issues do not "pop up" wrt. others). --> <section name="Tomcat 9.0.4 (markt)" rtext="in development"> + <subsection name="Jasper"> + <changelog> + <add> + <bug>43925</bug>: Add a new system property + (<code>org.apache.jasper.runtime.BodyContentImpl.BUFFER_SIZE</code>) to + control the size of the buffer used by Jasper when buffering tag bodies. + (markt) + </add> + </changelog> + </subsection> </section> <section name="Tomcat 9.0.3 (markt)" rtext="release in progress"> <subsection name="Catalina"> Modified: tomcat/trunk/webapps/docs/config/systemprops.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/systemprops.xml?rev=1820932&r1=1820931&r2=1820932&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/systemprops.xml (original) +++ tomcat/trunk/webapps/docs/config/systemprops.xml Thu Jan 11 21:06:44 2018 @@ -154,10 +154,17 @@ <code>true</code> will be used.</p> </property> + <property name="org.apache.jasper.runtime. BodyContentImpl.BUFFER_SIZE"> + <p>The size (in characters) to use when creating a tag buffer.</p> + <p>If not specified, the default value of + <code>org.apache.jasper.Constants.DEFAULT_TAG_BUFFER_SIZE</code> (512) + will be used.</p> + </property> + <property name="org.apache.jasper.runtime. BodyContentImpl.LIMIT_BUFFER"> <p>If <code>true</code>, any tag buffer that expands beyond - <code>org.apache.jasper.Constants.DEFAULT_TAG_BUFFER_SIZE</code> will be - destroyed and a new buffer created of the default size.</p> + <code>org.apache.jasper.runtime.BodyContentImpl.BUFFER_SIZE</code> will be + destroyed and a new buffer created.</p> <p>If not specified, the default value of <code>false</code> will be used.</p> </property> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org