Author: remy.maucherat(a)jboss.com
Date: 2007-08-15 11:34:42 -0400 (Wed, 15 Aug 2007)
New Revision: 225
Modified:
branches/2.0.x/src/share/classes/org/apache/jasper/servlet/JspServlet.java
branches/2.0.x/src/share/classes/org/apache/jasper/servlet/JspServletWrapper.java
Log:
- Improve error reporting of missing included resources.
Modified: branches/2.0.x/src/share/classes/org/apache/jasper/servlet/JspServlet.java
===================================================================
--- branches/2.0.x/src/share/classes/org/apache/jasper/servlet/JspServlet.java 2007-08-15
15:33:52 UTC (rev 224)
+++ branches/2.0.x/src/share/classes/org/apache/jasper/servlet/JspServlet.java 2007-08-15
15:34:42 UTC (rev 225)
@@ -305,8 +305,25 @@
// Check if the requested JSP page exists, to avoid
// creating unnecessary directories and files.
if (null == context.getResource(jspUri)) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND,
- request.getRequestURI());
+ String includeRequestUri = (String)
+ request.getAttribute(
+ "javax.servlet.include.request_uri");
+ if (includeRequestUri != null) {
+ // This file was included. Throw an exception as
+ // a response.sendError() will be ignored
+ throw new ServletException(Localizer.getMessage(
+ "jsp.error.file.not.found",jspUri));
+ } else {
+ try {
+ response.sendError(
+ HttpServletResponse.SC_NOT_FOUND,
+ request.getRequestURI());
+ } catch (IllegalStateException ise) {
+ log.error(Localizer.getMessage(
+ "jsp.error.file.not.found",
+ jspUri));
+ }
+ }
return;
}
boolean isErrorPage = exception != null;
Modified:
branches/2.0.x/src/share/classes/org/apache/jasper/servlet/JspServletWrapper.java
===================================================================
---
branches/2.0.x/src/share/classes/org/apache/jasper/servlet/JspServletWrapper.java 2007-08-15
15:33:52 UTC (rev 224)
+++
branches/2.0.x/src/share/classes/org/apache/jasper/servlet/JspServletWrapper.java 2007-08-15
15:34:42 UTC (rev 225)
@@ -333,25 +333,6 @@
return;
}
- } catch (FileNotFoundException ex) {
- ctxt.incrementRemoved();
- String includeRequestUri = (String)
- request.getAttribute("javax.servlet.include.request_uri");
- if (includeRequestUri != null) {
- // This file was included. Throw an exception as
- // a response.sendError() will be ignored by the
- // servlet engine.
- throw new ServletException(ex);
- } else {
- try {
- response.sendError(HttpServletResponse.SC_NOT_FOUND,
- ex.getMessage());
- } catch (IllegalStateException ise) {
- log.error(Localizer.getMessage("jsp.error.file.not.found",
- ex.getMessage()),
- ex);
- }
- }
} catch (ServletException ex) {
if (options.getDevelopment()) {
throw handleJspException(ex);
Show replies by date