Author: jholmes
Date: Wed Aug 15 19:57:03 2007
New Revision: 566475

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

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

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


Reply via email to