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=13924>.
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=13924

error-page directive does not always work correctly

           Summary: error-page directive does not always work correctly
           Product: Tomcat 4
           Version: 4.1.12
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Under certain conditions, the default exception report is shown, instead
of the location 
configured in the web.xml deployment descriptor.

Unfortunately, the unit tests included 
with the tester application in the Tomcat sources test for neither of the two 
conditions under 
which the error occurs:

1) If the web.xml declares it wants to catch a subtype 
of
ServletException, like this:

  <error-page>
        <exception-
type>org.apache.tester.TesterServletException
         </exception-type>
        
<location>/ErrorPage04</location>
  </error-page>
  
and the exception is thrown from a 
servlet, like this:

    throw new TesterServletException
            (new 
Tester2Exception("ErrorPage031 Threw Exception"));

then we are not redirected to the 
given location, but the default Exception Report is shown instead.

However, if the same 
exception is thrown from a JSP, like this

<% if( true )
    throw new 
org.apache.tester.TesterServletException(
        new 
org.apache.tester.Tester2Exception("TesterPage031.jsp Threw 
Exception"));
%>

then we are redirected correctly.

2) Conversely, if the web.xml 
declares it wants to catch an
exception embedded in a ServletException, like this:

    <error-
page>
        <exception-type>org.apache.tester.TesterException</exception-type>
        
<location>/ErrorPage04</location>
    </error-page>

and the exception is thrown from a 
JSP, like this

<% if( true )
    throw new javax.servlet.ServletException(
        new 
org.apache.tester.TesterException("TesterPage03.jsp Threw Exception"));
%>

then 
we are not redirected to the given location, but
the default Exception Report is shown 
instead.


All this can be reproduced in the tester application:

I have written 
- 2 Test 
pages TesterPage03.jsp and TesterPage031.jsp
- the classes 
org.apache.tester.Tester2Exception.java, 
   
org.apache.tester.TesterServletException.java
- a servlet 
org.apache.tester.ErrorPage031.java, 
and included the relevant configuration in the 
web.xml. 

Is there any way for me to attach my code to this bug
report for you to use?

I am 
using JDK 1.3.1. The behavior is independent of whether the web.xml 
conforms to the web-
app_2_3.dtd or the web-app_2_2.dtd

-- Sebastian Millies

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

Reply via email to