craigmcc 2002/08/03 13:54:54 Modified: src/share/org/apache/struts/actions DispatchAction.java Log: If the method called by DispatchAction throws an exception, unwrap it from the returned InvocationTargetException and rethrow it. That way, the 1.1 exception handling machinery can be used to deal with it, exactly as if it had been thrown by a regular Action.execute() method. PR: Bugzilla #10217 Bug Report submitted by Chris Book <cbook at rim.net> Patch (thanks!) submitted by Kevin Henrickson <kevin at henrickson.com> Revision Changes Path 1.9 +18 -11 jakarta-struts/src/share/org/apache/struts/actions/DispatchAction.java Index: DispatchAction.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/actions/DispatchAction.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- DispatchAction.java 30 Jun 2002 03:38:30 -0000 1.8 +++ DispatchAction.java 3 Aug 2002 20:54:54 -0000 1.9 @@ -222,13 +222,20 @@ message); return (null); } catch (InvocationTargetException e) { - String message = - messages.getMessage("dispatch.error", mapping.getPath(), - name); - log.error(message, e); - response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, - message); - return (null); + // Rethrow the target exception if possible so that the + // exception handling machinery can deal with it + Throwable t = e.getTargetException(); + if (t instanceof Exception) { + throw ((Exception) t); + } else { + String message = + messages.getMessage("dispatch.error", mapping.getPath(), + name); + log.error(message, e); + response.sendError + (HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message); + return (null); + } } // Return the returned ActionForward instance
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>