struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r441881 - in /struts/struts2/trunk: apps/showcase/src/test/java/org/apache/struts2/showcase/tutorial/ core/src/main/java/org/apache/struts2/dispatcher/ core/src/main/java/org/apache/struts2/jsf/
Date Sun, 10 Sep 2006 00:18:09 GMT
Author: mrdon
Date: Sat Sep  9 17:18:08 2006
New Revision: 441881

URL: http://svn.apache.org/viewvc?view=rev&rev=441881
Log:
Changed JSF interceptors to fail fast and show problem report to users, fixed test in showcase,
ensured that config errors will show problem report when using filter dispatcher
WW-1424 
WW-1349

Modified:
    struts/struts2/trunk/apps/showcase/src/test/java/org/apache/struts2/showcase/tutorial/HelloTest.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java

Modified: struts/struts2/trunk/apps/showcase/src/test/java/org/apache/struts2/showcase/tutorial/HelloTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/org/apache/struts2/showcase/tutorial/HelloTest.java?view=diff&rev=441881&r1=441880&r2=441881
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/test/java/org/apache/struts2/showcase/tutorial/HelloTest.java
(original)
+++ struts/struts2/trunk/apps/showcase/src/test/java/org/apache/struts2/showcase/tutorial/HelloTest.java
Sat Sep  9 17:18:08 2006
@@ -1,3 +1,5 @@
+package org.apache.struts2.showcase.tutorial;
+
 import junit.framework.TestCase;
 
 /**

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=441881&r1=441880&r2=441881
==============================================================================
--- 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
Sat Sep  9 17:18:08 2006
@@ -555,7 +555,7 @@
      * @param code     the HttpServletResponse error code (see {@link javax.servlet.http.HttpServletResponse}
for possible error codes).
      * @param e        the Exception that is reported.
      */
-    private void sendError(HttpServletRequest request, HttpServletResponse response, 
+    public void sendError(HttpServletRequest request, HttpServletResponse response, 
             ServletContext ctx, int code, Exception e) {
         if (devMode) {
             response.setContentType("text/html");
@@ -613,8 +613,12 @@
     
     /** Simple accessor for a static method */
     public class Locator {
-        public Location getLocation(Throwable t) {
-            return LocationUtils.getLocation(t);
+        public Location getLocation(Object obj) {
+            Location loc = LocationUtils.getLocation(obj);
+            if (loc == null) {
+                return Location.UNKNOWN;
+            } 
+            return loc;
         }
     }
 

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java?view=diff&rev=441881&r1=441880&r2=441881
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java
Sat Sep  9 17:18:08 2006
@@ -49,8 +49,10 @@
 import org.apache.struts2.dispatcher.mapper.ActionMapperFactory;
 import org.apache.struts2.dispatcher.mapper.ActionMapping;
 
+import com.opensymphony.module.sitemesh.RequestConstants;
 import com.opensymphony.util.ClassLoaderUtil;
 import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.XWorkException;
 
 /**
  * Master filter for Struts that handles four distinct 
@@ -214,8 +216,16 @@
             Dispatcher.setInstance(du);
         }
 
-        ActionMapper mapper = ActionMapperFactory.getMapper();
-        ActionMapping mapping = mapper.getMapping(request, du.getConfigurationManager().getConfiguration());
+        ActionMapper mapper = null;
+        ActionMapping mapping = null;
+        try {
+            mapper = ActionMapperFactory.getMapper();
+            mapping = mapper.getMapping(request, du.getConfigurationManager().getConfiguration());
+        } catch (Exception ex) {
+            du.sendError(request, response, servletContext, response.SC_INTERNAL_SERVER_ERROR,
ex);
+            ActionContextCleanUp.cleanUp(req);
+            return;
+        }
 
         if (mapping == null) {
             // there is no action in this request, should we look for a static resource?

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java?view=diff&rev=441881&r1=441880&r2=441881
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java
Sat Sep  9 17:18:08 2006
@@ -229,7 +229,8 @@
                 }
             }
         } else {
-            log.error("Unable to initialize jsf interceptors probably due missing JSF implementation
libraries");
+            throw new StrutsException("Unable to initialize jsf interceptors probably due
missing JSF implementation libraries",
+                    invocation.getProxy().getConfig());
         }
         return invocation.invoke();
     }



Mime
View raw message