tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 7227] - <error-code> directive don't work
Date Thu, 01 Aug 2002 18:31:37 GMT
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=7227>.
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=7227

<error-code> directive don't work





------- Additional Comments From coreym12065@yahoo.com  2002-08-01 18:31 -------
It should work for 500 errors if you explicitly call response.sendError(500),
however if an exception is allowed to propogate to container, it does not work.
 There was another bug filed for this, however it was closed because one can
interpret the Servlet spec 2.3 to mean that the current behavior is acceptable.  

Because there seem to be so many user questions about this, I don't think users
expect the server to respond the way it does.  Re-routing on 'Exception' doesn't
work either, because it won't allow you to handle specific Exceptions
differently (NullPointerExceptions going to one page, ClassNotFoundException
going to another, etc.).  All Exceptions that are thrown will be picked up by
the 'Exception' error page.

I've done some digging, and a fix for this is pretty simple.  In the
ErrorDispatcherValve.throwable(request, response, throwable) method, it attempts
to get the error page location by the type of the throwable (and if throwable is
a ServletException, by testing against the root cause).  If neither of these
match a registered error page, it then quits.  What I think it's safe to assume
here is that we should then look to see if the user has registered an error page
to the error code 500.  It ends up setting it to 500 later anyway, and this way,
at least we can handle it properly.  The code is simple:

        if(errorPage == null) {
            errorPage =
context.findErrorPage(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }

... and it even works... Now can someone give me some tips about how to get this
fix in?

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message