luehe 2003/09/02 13:41:00 Modified: jasper2/src/share/org/apache/jasper/runtime JspFactoryImpl.java Log: Fixed Bugtraq 4863026 ("JSP error page mechanism fails intermittently to display contents of error page") Problem was caused by the fact that one of the tests in the suite (JspFactoryTest.jsp) released a custom page context (of type com.sun.ts.tests.jsp.common.util.SimpleContext), like this: SimpleContext context = new SimpleContext(); factory.releasePageContext(context); The implementation of org.apache.jasper.runtime.JspFactoryImpl.releasePageContext would add the page context back to the pool of page contexts. Page contexts would be retrieved from the pool as follows: pc = (PageContextImpl) pool.get() Clearly, if the page context returned was an instance of com.sun.ts.tests.jsp.common.util.SimpleContext, the above assignment would result in a ClassCastException. The fix is to return only those page contexts that are instances of org.apache.jasper.runtime.PageContextImpl to the pool, since we don't have any control over the implementation of custom page contexts Revision Changes Path 1.4 +6 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspFactoryImpl.java Index: JspFactoryImpl.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspFactoryImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- JspFactoryImpl.java 22 Jan 2003 21:13:51 -0000 1.3 +++ JspFactoryImpl.java 2 Sep 2003 20:41:00 -0000 1.4 @@ -139,12 +139,12 @@ try { PageContext pc; if( USE_POOL ) { - pc=(PageContextImpl)pool.get(); + pc = (PageContext) pool.get(); if( pc == null ) { pc= new PageContextImpl(this); } } else { - pc = new PageContextImpl(this); + pc = new PageContextImpl(this); } pc.initialize(servlet, request, response, errorPageURL, needsSession, bufferSize, autoflush); @@ -158,7 +158,7 @@ private void internalReleasePageContext(PageContext pc) { pc.release(); - if( USE_POOL) { + if (USE_POOL && (pc instanceof PageContextImpl)) { pool.put( pc ); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]