From 55ea2ea1d90ecf130a225d98ea94a17ce8a3a798 Mon Sep 17 00:00:00 2001 From: James Holmes Date: Thu, 16 Aug 2007 02:57:03 +0000 Subject: [PATCH] WW-1977 Struts throws stack trace instead of 404 when an action doesn't exist git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@566475 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/struts2/dispatcher/Dispatcher.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java index de1d0ee4e..763bf7454 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java @@ -741,12 +741,15 @@ Caused by: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyExcepti } } else { try { - // send a http error response to use the servlet defined error handler - // make the exception availible to the web.xml defined error page - request.setAttribute("javax.servlet.error.exception", e); + // WW-1977: Only put errors in the request when code is a 500 error + if (code == HttpServletResponse.SC_INTERNAL_SERVER_ERROR) { + // send a http error response to use the servlet defined error handler + // make the exception availible to the web.xml defined error page + request.setAttribute("javax.servlet.error.exception", e); - // for compatibility - request.setAttribute("javax.servlet.jsp.jspException", e); + // for compatibility + request.setAttribute("javax.servlet.jsp.jspException", e); + } // send the error response response.sendError(code, e.getMessage());