Mantis - Resin
Viewing Issue Advanced Details
4051 major always 05-26-10 07:17 05-31-10 12:37
subwiz  
 
normal  
closed 4.0.7  
fixed  
none    
none 4.0.8  
0004051: Servlet 3.0 Upload API throws NPE
When using Servlet 3.0 API for file upload, I get the following NPE:

<snip>
java.lang.NullPointerException
    at com.caucho.server.http.HttpServletRequestImpl$PartImpl.write(HttpServletRequestImpl.java:2142)
    at org.wiztools.fileupload.ServletIndex.doPost(ServletIndex.java:39)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:158)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:96)
    at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:183)
    at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:103)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:286)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:789)
    at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:660)
    at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:624)
    at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:575)
    at com.caucho.network.listen.TcpSocketLink$AcceptTask.doTask(TcpSocketLink.java:1183)
    at com.caucho.network.listen.TcpSocketLink$ConnectionReadTask.runThread(TcpSocketLink.java:1118)
    at com.caucho.network.listen.TcpSocketLink$AcceptTask.run(TcpSocketLink.java:1150)
    at com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:901)
    at com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:866)
</snip>

This happens only when my Servlet has both doGet() and doPost() method. When I write a Multipart Servlet having only doPost() method, this exception is not thrown.

I have created a sample project to test this issue:

http://code.google.com/p/servlet30-file-upload/ [^]

(Maven based JavaEE 6 Web Project)

Only the third upload feature (*With Additional Parameters to Exclusive Servlet*) in this sample application works.

Notes
(0004623)
alex   
05-31-10 12:37   
qa/12wn