Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5049976

Unspecified NPE is thrown when streaming output mode is enabled

    XMLWordPrintable

Details

    • b55
    • generic
    • generic

    Description



      Name: vpR10197 Date: 05/19/2004


      --------------------------------------
      Test : http/HttpStreaming/Chunked/chunked001
      VM : ClientVM, ServerVM
      Mode : all
      Platform : all
      OS : all
      JDK : since tiger-b50
      ----------------------------------------
      The test checks up HttpURLConnection.setChunkedStreamingMode() method,
      for dummy HTTP server which implements no request method.
      According to the specification of the URLConnection.getInputStream method,
      IOException must be thrown when a request method is not implemented by HTTP
      server (I beleive it is a case when input stream can not be created).
      Indeed, IOException is thrown when no streaming mode is not set, but
      if some streaming mode is enabled via setChunkedStreamingMode() or
      setFixedLengthStreamingMode(), getInputStream() throws NullPointerException
      that contradicts spec.

      To reproduce the failure:
         cd /net/jano.sfbay/export/disk20/GammaBase/Bugs/<this bug number>
         sh run.sh $JAVA_HOME [-g] [JAVA_OPTS]
      where
           -g - run test with java_g binaries

      Here is an example of test's output:
          Settings:
          >Starting default Http-server
          Server started
          java.lang.NullPointerException
                  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:823)
                  at chunked001.main(chunked001.java:53)
          ***ERR***>UNEXPECTED exception: java.lang.NullPointerException
          TEST FAILED
          Java exit code: 97

      But if calling setChunkedStreamingMode would be commented (line 49 of
      chunked001.java) then output would be:
          Settings:
          >Starting default Http-server
          Server started
          HTTP version: HTTP/1.1
          java.io.IOException: Server returned HTTP response code: 501 for URL: http://localhost:8080
                  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1066)
                  at chunked001.main(chunked001.java:53)
          Expected exception: java.io.IOException: Server returned HTTP response code: 501 for URL: http://localhost:8080
          TEST PASSED
          Java exit code: 95

      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              michaelm Michael McMahon
              vitpsunw Vitp Vitp (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: