tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BugRat Mail System <>
Subject BugRat Report #213 has been filed.
Date Wed, 04 Oct 2000 20:13:29 GMT
Bug report #213 has just been filed.

You can view the report at the following URL:


REPORT #213 Details.

Project: Tomcat
Category: Bug Report
SubCategory: New Bug Report
Class: swbug
State: received
Priority: medium
Severity: serious
Confidence: public
   Release: 3.1, 3.2
   JVM Release: any
   Operating System: any
   OS Release: any
   Platform: any

RequestDispatcher does not propagate errors

If a servlet uses a RequestDispatcher to forward or include a second servlet (or JSP), and
the second servlet throws and exception from it's service method, that exception is not propagated
to the first servlet.

This is a problem if you have a setup (like ours) where a single "master" servlet includes
a particular JSP depending on thing other than just the request URI, and you want it to be
able to handle the errors.  As it is, the error gets handled by Tomcat (using default error
page, or whatever error page you've configured in the JSP or web.xml file) and the main servlet
never knows anything went wrong.

In Tomcat 3.2, the RequestDispatcher forward/include methods call the Handler service method.
 This service method never throws an exception.  In Tomcat 3.1 it calls the ServletWrapper
handleRequest method, which also never throws and exception.

The reason I think exceptions should be propagated is because of section 8.5 of the servlet
spec, which strongly implies it:

Only runtime exceptions and checked exceptions of type ServletException or IOException should
be propagated to the calling servlet if thrown by the target of a request dispatcher.  All
other exceptions should be wrapped as a ServletException and the root cause of the exception
set to the original exception.

View raw message