Bug 49196 - NPE in PageContext.getErrorData()
NPE in PageContext.getErrorData()
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Catalina
5.5.28
PC Linux
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-04-27 10:37 UTC by Boris Folgmann
Modified: 2010-06-22 05:01 UTC (History)
0 users



Attachments
2010-06-07_tc55_bug49196.patch (1.11 KB, patch)
2010-06-06 16:07 UTC, Konstantin Kolinko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Folgmann 2010-04-27 10:37:16 UTC
This bug is present in some older versions also, but I haven't had time until now to file the report. Here it is:

I've got

  <error-page>
    <error-code>403</error-code>
    <location>/free/login/denied.jsp</location>
  </error-page>

in web.xml and call pageContext.getErrorData() in denied.jsp.

THIS WORKS FINE!

What does not work is if the user is HTTP-redirected to denied.jsp or simply calls it by entering the URL in his browser. In this case the JSP throws

java.lang.NullPointerException
        at javax.servlet.jsp.PageContext.getErrorData(PageContext.java:515)
        at org.apache.jsp.free.login.denied_jsp._jspService(denied_jsp.java:389)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.folgmann.filters.AuthFilter.doFilter(AuthFilter.java:446)
        at com.folgmann.filters.HttpFilterSupport.doFilter(HttpFilterSupport.java:41)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.folgmann.filters.ValidatingThreadPoolFilter.doFilter(ValidatingThreadPoolFilter.java:138)
        at com.folgmann.filters.HttpFilterSupport.doFilter(HttpFilterSupport.java:41)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.folgmann.filters.CharsetFilter.doFilter(CharsetFilter.java:114)
        at com.folgmann.filters.HttpFilterSupport.doFilter(HttpFilterSupport.java:41)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
        at java.lang.Thread.run(Thread.java:619)

I'm sure that this wasn't intended by the JSP spec. I suggest that pageContext.getErrorData() returns null instead when an error page is not called like an error page should be called.

Tnx,
     boris
Comment 1 Mark Thomas 2010-05-25 10:30:40 UTC
Fixed in trunk and proposed for 6.0.x
Comment 2 Konstantin Kolinko 2010-06-06 16:07:12 UTC
Created attachment 25534 [details]
2010-06-07_tc55_bug49196.patch

Patch for 5.5. It is backport of r948057 from trunk.
Comment 3 Konstantin Kolinko 2010-06-06 16:15:26 UTC
The fix was applied to 6.0 in r951941 and will be in 6.0.27.

Proposed for backport to 5.5, so I am changing Product and Version to track this issue further.
Comment 4 Mark Thomas 2010-06-22 05:01:05 UTC
This has been fixed in 5.5.x and will be included in 5.5.30 onwards.