Author: kkolinko Date: Fri Jun 6 14:36:36 2014 New Revision: 1600899 URL: http://svn.apache.org/r1600899 Log: Fix http://issues.apache.org/bugzilla/show_bug.cgi?id=56581 If an error on a JSP page occurs when response have already been committed, do not clear the buffer of JspWriter, but flush it.
Modified: tomcat/trunk/java/org/apache/jasper/compiler/Generator.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/jasper/compiler/Generator.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Generator.java?rev=1600899&r1=1600898&r2=1600899&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/Generator.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/Generator.java Fri Jun 6 14:36:36 2014 @@ -3393,7 +3393,19 @@ class Generator { out.printil("out = _jspx_out;"); out.printil("if (out != null && out.getBufferSize() != 0)"); out.pushIndent(); - out.printil("try { out.clearBuffer(); } catch (java.io.IOException e) {}"); + out.printil("try {"); + out.pushIndent(); + out.printil("if (response.isCommitted()) {"); + out.pushIndent(); + out.printil("out.flush();"); + out.popIndent(); + out.printil("} else {"); + out.pushIndent(); + out.printil("out.clearBuffer();"); + out.popIndent(); + out.printil("}"); + out.popIndent(); + out.printil("} catch (java.io.IOException e) {}"); out.popIndent(); out.printil("if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);"); out.printil("else throw new ServletException(t);"); Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1600899&r1=1600898&r2=1600899&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Fri Jun 6 14:36:36 2014 @@ -189,6 +189,11 @@ <bug>56568</bug>: Allow any HTTP method when a JSP is being used as an error page. (markt) </fix> + <update> + <bug>56581</bug>: If an error on a JSP page occurs when response have + already been committed, do not clear the buffer of JspWriter, but flush + it. Thus it will become more clear where the error occurred. (kkolinko) + </update> </changelog> </subsection> <subsection name="WebSocket"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org