Author: markt
Date: Wed Oct 19 15:09:07 2011
New Revision: 1186257

URL: http://svn.apache.org/viewvc?rev=1186257&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52051
Return a 404 if an attempt is made to process a resource that does not
exist

Modified:
    tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java
    tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java

Modified: tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java?rev=1186257&r1=1186256&r2=1186257&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java (original)
+++ tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java Wed Oct 19 
15:09:07 2011
@@ -611,6 +611,9 @@ public class JspCompilationContext {
                     jsw.setLastModificationTest(-1);
                 }
                 throw ex;
+            } catch (FileNotFoundException fnfe) {
+                // Re-throw to let caller handle this - will result in a 404
+                throw fnfe;
             } catch (Exception ex) {
                 JasperException je = new JasperException(
                             Localizer.getMessage("jsp.error.unable.compile"),

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java?rev=1186257&r1=1186256&r2=1186257&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java Wed Oct 19 
15:09:07 2011
@@ -17,6 +17,7 @@
 
 package org.apache.jasper.compiler;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -685,7 +686,8 @@ public class JspUtil {
             String jarEntryName = fname.substring(1, fname.length());
             ZipEntry jarEntry = jarFile.getEntry(jarEntryName);
             if (jarEntry == null) {
-                err.jspError("jsp.error.file.not.found", fname);
+                throw new FileNotFoundException(Localizer.getMessage(
+                        "jsp.error.file.not.found", fname));
             }
             in = jarFile.getInputStream(jarEntry);
         } else {
@@ -693,7 +695,8 @@ public class JspUtil {
         }
 
         if (in == null) {
-            err.jspError("jsp.error.file.not.found", fname);
+            throw new FileNotFoundException(Localizer.getMessage(
+                    "jsp.error.file.not.found", fname));
         }
 
         return in;



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

Reply via email to