Author: markt Date: Mon May 25 09:38:28 2009 New Revision: 778367 URL: http://svn.apache.org/viewvc?rev=778367&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46354 ArrayIndexOutOfBoundsException when using org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true Pathc provided by Konstantin Kolinko
Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml tomcat/current/tc5.5.x/STATUS.txt tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/runtime/BodyContentImpl.java 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?rev=778367&r1=778366&r2=778367&view=diff ============================================================================== --- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original) +++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Mon May 25 09:38:28 2009 @@ -79,6 +79,11 @@ <bug>45666</bug>: Fix infinite loop on include. Patch provided by Tom Wadzinski. (markt) </fix> + <fix> + <bug>46354</bug>: Fix ArrayIndexOutOfBoundsException when using + org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true. Patch + provided by Konstantin Kolinko. (markt) + </fix> </changelog> </subsection> <subsection name="Cluster"> Modified: tomcat/current/tc5.5.x/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/current/tc5.5.x/STATUS.txt?rev=778367&r1=778366&r2=778367&view=diff ============================================================================== --- tomcat/current/tc5.5.x/STATUS.txt (original) +++ tomcat/current/tc5.5.x/STATUS.txt Mon May 25 09:38:28 2009 @@ -210,13 +210,6 @@ +1: markt, rjung -1: -* Fix http://svn.apache.org/viewvc?rev=763681&view=rev - ArrayIndexOutOfBoundsException when using - org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true - Patch provided by Konstantin Kolinko - +1: markt, rjung, kkolinko - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42707 Make adding a host alias via jmx take effect immediately http://svn.apache.org/viewvc?view=rev&revision=734570 Modified: tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/runtime/BodyContentImpl.java URL: http://svn.apache.org/viewvc/tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/runtime/BodyContentImpl.java?rev=778367&r1=778366&r2=778367&view=diff ============================================================================== --- tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/runtime/BodyContentImpl.java (original) +++ tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/runtime/BodyContentImpl.java Mon May 25 09:38:28 2009 @@ -51,9 +51,6 @@ // Enclosed writer to which any output is written private Writer writer; - // See comment in setWriter() - private int bufferSizeSave; - /** * Constructor. */ @@ -508,6 +505,19 @@ } /** + * This method returns the size of the buffer used by the JspWriter. + * + * @return the size of the buffer in bytes, or 0 is unbuffered. + */ + public int getBufferSize() { + // According to the spec, the JspWriter returned by + // JspContext.pushBody(java.io.Writer writer) must behave as + // though it were unbuffered. This means that its getBufferSize() + // must always return 0. + return (writer == null) ? bufferSize : 0; + } + + /** * @return the number of bytes unused in the buffer */ public int getRemaining() { @@ -558,22 +568,7 @@ void setWriter(Writer writer) { this.writer = writer; closed = false; - if (writer != null) { - // According to the spec, the JspWriter returned by - // JspContext.pushBody(java.io.Writer writer) must behave as - // though it were unbuffered. This means that its getBufferSize() - // must always return 0. The implementation of - // JspWriter.getBufferSize() returns the value of JspWriter's - // 'bufferSize' field, which is inherited by this class. - // Therefore, we simply save the current 'bufferSize' (so we can - // later restore it should this BodyContentImpl ever be reused by - // a call to PageContext.pushBody()) before setting it to 0. - if (bufferSize != 0) { - bufferSizeSave = bufferSize; - bufferSize = 0; - } - } else { - bufferSize = bufferSizeSave; + if (writer == null) { clearBody(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org