Author: markt
Date: Tue Jun 26 19:57:07 2012
New Revision: 1354197

URL: http://svn.apache.org/viewvc?rev=1354197&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53460
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.
Note: This is the version of the fix for back-porting to 7.0.x. There is some 
obvious but API changing clean-up that can simplify this in trunk.

Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/Generator.java
    tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java

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=1354197&r1=1354196&r2=1354197&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Generator.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Generator.java Tue Jun 26 
19:57:07 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/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java?rev=1354197&r1=1354196&r2=1354197&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java Tue Jun 26 
19:57:07 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;
         }



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

Reply via email to