This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 8b152c2 Remove redundant sole path/URI from error page message on SC_NOT_FOUND 8b152c2 is described below commit 8b152c25f97b48cf05587bc29ad2ae1a09c27284 Author: Michael Osipov <micha...@apache.org> AuthorDate: Sat Apr 18 20:58:40 2020 +0200 Remove redundant sole path/URI from error page message on SC_NOT_FOUND When a component issues a SC_NOT_FOUND don't respond with the path/URI only in the error message because it does not offer any more detail about the error, plus the client knows the path/URI already. --- java/org/apache/catalina/servlets/DefaultServlet.java | 5 ++--- java/org/apache/catalina/servlets/WebdavServlet.java | 2 +- java/org/apache/catalina/ssi/SSIServlet.java | 6 +++--- java/org/apache/jasper/servlet/JspServlet.java | 3 +-- webapps/docs/changelog.xml | 12 ++++++++++++ 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index b1c019f..cacf06c 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -857,7 +857,7 @@ public class DefaultServlet extends HttpServlet { response.sendError(((Integer) request.getAttribute( RequestDispatcher.ERROR_STATUS_CODE)).intValue()); } else { - response.sendError(HttpServletResponse.SC_NOT_FOUND, requestUri); + response.sendError(HttpServletResponse.SC_NOT_FOUND); } return; } @@ -946,8 +946,7 @@ public class DefaultServlet extends HttpServlet { // Skip directory listings if we have been configured to // suppress them if (!listings) { - response.sendError(HttpServletResponse.SC_NOT_FOUND, - request.getRequestURI()); + response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } contentType = "text/html;charset=UTF-8"; diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index 5874488..371de11 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -622,7 +622,7 @@ public class WebdavServlet extends DefaultServlet { } if (!resource.exists()) { - resp.sendError(HttpServletResponse.SC_NOT_FOUND, path); + resp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } diff --git a/java/org/apache/catalina/ssi/SSIServlet.java b/java/org/apache/catalina/ssi/SSIServlet.java index dd5ecdc..f68389c 100644 --- a/java/org/apache/catalina/ssi/SSIServlet.java +++ b/java/org/apache/catalina/ssi/SSIServlet.java @@ -157,13 +157,13 @@ public class SSIServlet extends HttpServlet { // (the "toUpperCase()" avoids problems on Windows systems) if (path == null || path.toUpperCase(Locale.ENGLISH).startsWith("/WEB-INF") || path.toUpperCase(Locale.ENGLISH).startsWith("/META-INF")) { - res.sendError(HttpServletResponse.SC_NOT_FOUND, path); + res.sendError(HttpServletResponse.SC_NOT_FOUND); log("Can't serve file: " + path); return; } URL resource = servletContext.getResource(path); if (resource == null) { - res.sendError(HttpServletResponse.SC_NOT_FOUND, path); + res.sendError(HttpServletResponse.SC_NOT_FOUND); log("Can't find file: " + path); return; } @@ -223,4 +223,4 @@ public class SSIServlet extends HttpServlet { } bufferedReader.close(); } -} \ No newline at end of file +} diff --git a/java/org/apache/jasper/servlet/JspServlet.java b/java/org/apache/jasper/servlet/JspServlet.java index 396e333..3407aef 100644 --- a/java/org/apache/jasper/servlet/JspServlet.java +++ b/java/org/apache/jasper/servlet/JspServlet.java @@ -408,8 +408,7 @@ public class JspServlet extends HttpServlet implements PeriodicEventListener { throw new ServletException(Escape.htmlElementContent(msg)); } else { try { - response.sendError(HttpServletResponse.SC_NOT_FOUND, - request.getRequestURI()); + response.sendError(HttpServletResponse.SC_NOT_FOUND); } catch (IllegalStateException ise) { log.error(Localizer.getMessage("jsp.error.file.not.found", jspUri)); diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 869bfd7..471a9e9 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -58,6 +58,10 @@ that use a custom class loader that loads resources from non-standard locations. (markt) </fix> + <update> + Remove redundant sole path/URI from error page message on SC_NOT_FOUND. + (michaelo) + </update> </changelog> </subsection> <subsection name="Coyote"> @@ -72,6 +76,14 @@ </fix> </changelog> </subsection> + <subsection name="Jasper"> + <changelog> + <update> + Remove redundant sole path/URI from error page message on SC_NOT_FOUND. + (michaelo) + </update> + </changelog> + </subsection> <subsection name="Other"> <changelog> <update> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org