Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-367

NullPointerException when POST method has no ordinary parameters

    XMLWordPrintable

Details

    • Hide

      Just send a POST request which method does not have a "content body" parameter.

      Show
      Just send a POST request which method does not have a "content body" parameter.

    Description

      After I upgraded Wildfly 8.1.0 to 8.2.0 I began to notice thousands of NullPointerExceptions:

      ERROR [io.undertow.request] (default task-54) Undertow request failed HttpServerExchange{ POST /myapp/logout}: java.lang.NullPointerException
              at io.undertow.servlet.spec.ServletInputStreamImpl.readIntoBuffer(ServletInputStreamImpl.java:171)
              at io.undertow.servlet.spec.ServletInputStreamImpl.close(ServletInputStreamImpl.java:245)
              at io.undertow.servlet.spec.HttpServletRequestImpl.closeAndDrainRequest(HttpServletRequestImpl.java:602)
              at io.undertow.servlet.core.ServletBlockingHttpExchange.close(ServletBlockingHttpExchange.java:87)
              at io.undertow.server.HttpServerExchange.endExchange(HttpServerExchange.java:1444)
              at io.undertow.server.Connectors.executeRootHandler(Connectors.java:213)
              at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_72]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_72]
              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_72]
      

      I could trace to problem to POST methods that had no parameters (except @HttpHeaders) in the methods' signature. So, the problem does not occur anymore if I change the method signature from:

          @POST
          @Path( "/logout" )
          @Consumes( MediaType.APPLICATION_JSON )
          @Produces( MediaType.APPLICATION_JSON )
          public Response logout( @Context HttpHeaders hh ) {
             ...
          }
      

      to

          @POST
          @Path( "/logout" )
          @Consumes( MediaType.APPLICATION_JSON )
          @Produces( MediaType.APPLICATION_JSON )
          public Response logout(String ignore, @Context HttpHeaders hh ) {
             ...
          }
      

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            renan.polo.montebelo Renan Polo Montebelo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: