You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by jh...@apache.org on 2007/08/16 04:55:45 UTC

svn commit: r566474 - /struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java

Author: jholmes
Date: Wed Aug 15 19:55:44 2007
New Revision: 566474

URL: http://svn.apache.org/viewvc?view=rev&rev=566474
Log:
WW-1977 Struts throws stack trace instead of 404 when an action doesn't exist

Modified:
    struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java

Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java?view=diff&rev=566474&r1=566473&r2=566474
==============================================================================
--- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java (original)
+++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java Wed Aug 15 19:55:44 2007
@@ -746,12 +746,15 @@
             }
         } 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());