Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004761 [Resin] minor always 09-13-11 09:43 10-04-11 15:24
Reporter stbu View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 4.0.22
Summary 0004761: NullPointerException in WebApp.getRealPath
Description The following piece of JSP code (sample) produces a NullPointerException in Resin's Code for implementation of ServletContext.getRealPath:

<%
 pageContext.getServletContext().getRealPath((String) request.getAttribute("javax.servlet.error.request_uri"));
%>

but the Servlet 2.5 Spec contains the following about getRealPath:

<quote>
This method returns null if the servlet container cannot translate the virtual path to a real path for ***any reason*** ...
</quote>


And any reason includes NULL as argument?
This happens if
   request.getAttribute("javax.servlet.error.request_uri")
returns null itself, e.g. when there is no error in a request.

It would be better and compliant to the 2.5 Servlet Spec if WebApp.getRealPath() would just return null.
Additional Information Stack Trace in Resin 4.0.22:

java.lang.NullPointerException
    at com.caucho.server.webapp.WebApp.getRealPath(WebApp.java:4318)
    at _jsp._real_22dpath_22dtest__jsp._jspService(real-path-test.jsp:2)
    at _jsp._real_22dpath_22dtest__jsp._jspService(_real_22dpath_22dtest__jsp.java:29)
    at com.caucho.jsp.JavaPage.service(JavaPage.java:64)
    at com.caucho.jsp.Page.pageservice(Page.java:542)
    at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:194)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
    at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:811)
    at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1203)
    at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1164)
    at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1148)
    at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1071)
    at com.caucho.network.listen.TcpSocketLink.handleAcceptTask(TcpSocketLink.java:907)
    at com.caucho.network.listen.AcceptTask.doTask(AcceptTask.java:74)
    at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:97)
    at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:80)
    at com.caucho.network.listen.AcceptTask.run(AcceptTask.java:59)
    at com.caucho.env.thread.ResinThread.runTasks(ResinThread.java:164)
    at com.caucho.env.thread.ResinThread.run(ResinThread.java:130)


Stack Trace in Resin 3.1.11:

java.lang.NullPointerException
    at com.caucho.server.webapp.WebApp.getRealPath(WebApp.java:2456)
    at _jsp._real_22dpath_22dtest__jsp._jspService(real-path-test.jsp:2)
    at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
    at com.caucho.jsp.Page.pageservice(Page.java:578)
    at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:195)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:265)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:273)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:682)
    at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:743)
    at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:662)
    at java.lang.Thread.run(Thread.java:619)
Attached Files

- Relationships

- Notes
(0005535)
ferg
10-04-11 15:24

server/10m7
 

- Issue History
Date Modified Username Field Change
09-13-11 09:43 stbu New Issue
09-13-11 09:43 stbu Issue Monitored: stbu
09-14-11 00:55 paru Issue Monitored: paru
10-04-11 15:24 ferg Note Added: 0005535
10-04-11 15:24 ferg Assigned To  => ferg
10-04-11 15:24 ferg Status new => closed
10-04-11 15:24 ferg Resolution open => fixed
10-04-11 15:24 ferg Fixed in Version  => 4.0.24


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
32 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker