You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2005/01/16 03:30:12 UTC

DO NOT REPLY [Bug 33119] New: - Minor changes to ExceptionHandler

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33119>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33119

           Summary: Minor changes to ExceptionHandler
           Product: Struts
           Version: 1.2.4
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Controller
        AssignedTo: dev@struts.apache.org
        ReportedBy: wboyce@panix.com


I'm finding the ExceptionHandler class to be frustrating for two reasons.

1.  ExceptionHandler does not allow IOException to propagate to the 
container.  It effectively filters out IOException.

What I'm specifically trying to do in this case is write an ExceptionHandler 
subclass that invokes HttpServletRequest.sendError, which throws an 
IOException.  The current implementation of ExceptionHandler forces me to wrap 
the IOException in a ServletException or a RuntimeException.

I think that it's useful to think of ExceptionHandler as an adapter between 
Action.execute, which can throw anything, and Servlet.service, which can only 
throw ServletException and IOException.  Changing ExceptionHandler.execute to 
throw both ServletException and IOException would allow ExceptionHandler to be 
used in this manner.  In addition, the try block in 
RequestProcessor.processException could be eliminated entirely.  (It's kind of 
strange as is, since it takes any Exception and wraps it in a 
ServletException, even though ExceptionHandler.execute can only throw 
ServletException in the first place.)

2.  ExceptionHandler logs every unhandled exception as a warning.  This 
includes IOException, which may be thrown for entirely legitimate reasons and 
hardly ever needs to be explicitly handled.  If I want to let the servlet 
container handle exceptions, then I'm guaranteed to get all sorts of spurious 
warnings about "unhandled" exceptions from Struts even though I'm handling 
them perfectly well elsewhere.  Struts shouldn't presume to know everything 
about the application's exception handling strategy.  Maybe a boolean could be 
added to the Struts configuration that would cause Struts to be silent 
about "unhandled" exceptions.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org