DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13864>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13864 DispatchAction handling of InvocationTargetException overrides standard servlet error handling Summary: DispatchAction handling of InvocationTargetException overrides standard servlet error handling Product: Struts Version: 1.0.2 Final Platform: All OS/Version: All Status: NEW Severity: Major Priority: Other Component: Standard Actions AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Line 232 of org.apache.struts.actions.DispatchAction contains the following block of code: // Dispatch to the specified method ActionForward forward = null; try { Object args[] = { mapping, form, request, response }; forward = (ActionForward) method.invoke(this, args); } catch (ClassCastException e) { String message = messages.getMessage("dispatch.return", mapping.getPath(), name); servlet.log(message); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message); return (null); } catch (IllegalAccessException e) { String message = messages.getMessage("dispatch.error", mapping.getPath(), name); servlet.log(message, e); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message); return (null); } catch (InvocationTargetException e) { String message = messages.getMessage("dispatch.error", mapping.getPath(), name); servlet.log(message, e); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message); return (null); } The real problem lies in the catch block for InvocationTargetException. If the dispatched method throws any exception, this block of code will cause the app to generate an internal server error. However, it's likely that the app developer would expect the exception to be propogated to the container (I know I did ;-)) so it could be handled by the error page mechanism. Something like the following would integrate better with the standard servlet error handling framework: } catch (InvocationTargetException e) { Throwable target = e.getTargetException(); if (target instanceof IOException) { throw (IOException)target; } else if (target instanceof ServletException) { throw (ServletException)target; } else { String message = messages.getMessage("dispatch.error", mapping.getPath(), name); throw new ServletException(message, target); } } -- To unsubscribe, e-mail: <mailto:struts-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>