Author: markt
Date: Tue Jun 26 20:09:37 2012
New Revision: 1354202

URL: http://svn.apache.org/viewvc?rev=1354202&view=rev
Log:
There are two parts to this fix:
- don't swallow exceptions when the PageContext can't be created
- if the PageContext is null when an error occurs (and therefore can't be used 
to handle the error) propagate the exception wrapped in a ServletException and 
let the container handle it.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Generator.java
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1354197

Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Generator.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Generator.java?rev=1354202&r1=1354201&r2=1354202&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Generator.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Generator.java Tue Jun 
26 20:09:37 2012
@@ -3395,7 +3395,7 @@ class Generator {
         out.printil("try { out.clearBuffer(); } catch (java.io.IOException e) 
{}");
         out.popIndent();
         out.printil("if (_jspx_page_context != null) 
_jspx_page_context.handlePageException(t);");
-        out.printil("else log(t.getMessage(), t);");
+        out.printil("else throw new ServletException(t);");
         out.popIndent();
         out.printil("}");
         out.popIndent();

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java?rev=1354202&r1=1354201&r2=1354202&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java Tue 
Jun 26 20:09:37 2012
@@ -114,6 +114,9 @@ public class JspFactoryImpl extends JspF
             return pc;
         } catch (Throwable ex) {
             ExceptionUtils.handleThrowable(ex);
+            if (ex instanceof RuntimeException) {
+                throw (RuntimeException) ex;
+            }
             log.fatal("Exception initializing page context", ex);
             return null;
         }

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1354202&r1=1354201&r2=1354202&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Jun 26 20:09:37 2012
@@ -100,6 +100,10 @@
         setter cannot be found for a bean property when using expression
         language. (markt)
       </fix>
+      <fix>
+       <bug>53460</bug>: Allow container to handle errors if the creation of 
the
+       PageContext fails rather than swallowing the error. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Web applications">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to