Revision: 1443
          http://stripes.svn.sourceforge.net/stripes/?rev=1443&view=rev
Author:   bengunter
Date:     2011-12-01 20:43:22 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
Fixed STS-854: DefaultExceptionHandler does not unwrap 
InvocationTargetException when executing proxies

Modified Paths:
--------------
    
branches/1.5.x/stripes/src/net/sourceforge/stripes/exception/DefaultExceptionHandler.java

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/exception/DefaultExceptionHandler.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/exception/DefaultExceptionHandler.java
   2011-12-01 20:26:18 UTC (rev 1442)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/exception/DefaultExceptionHandler.java
   2011-12-01 20:43:22 UTC (rev 1443)
@@ -17,6 +17,7 @@
 
 import java.beans.PropertyDescriptor;
 import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.net.URL;
@@ -102,11 +103,22 @@
         }
 
         /** Invokes the handler and executes the resolution if one is 
returned. */
-        public void handle(Throwable t, HttpServletRequest req, 
HttpServletResponse res)  throws Exception {
-            Object resolution = handlerMethod.invoke(this.handler, t, req, 
res);
-            if (resolution != null && resolution instanceof Resolution) {
-                ((Resolution) resolution).execute(req, res);
+        public void handle(Throwable t, HttpServletRequest req, 
HttpServletResponse res) throws Exception {
+            try {
+                Object resolution = handlerMethod.invoke(this.handler, t, req, 
res);
+                if (resolution != null && resolution instanceof Resolution) {
+                    ((Resolution) resolution).execute(req, res);
+                }
             }
+            catch (InvocationTargetException e) {
+                Throwable cause = e.getCause();
+                if (cause instanceof Exception)
+                    throw (Exception) cause;
+                else if (cause instanceof Error)
+                    throw (Error) cause;
+                else
+                    throw e;
+            }
         }
 
         Method getHandlerMethod() {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to