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

[WebView] URLLoader throws an exception on 401 HTTP error with no body

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8u40
    • 8u20
    • javafx
    • None
    • java version "1.8.0"
      Java(TM) SE Runtime Environment (build 1.8.0-b132)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

    • web

      From JavaScript in WebView I am trying to GET a REST resource that returns 401 with no body, It results in an exception. The reason is that http.getErrorStream() on line 424 returns null and call on line 472 to getInputStream fails on this

      {code}
      WARNING: Unexpected error
      java.io.IOException: Server returned HTTP response code: 401 for URL: https://secure.gooddata.com/gdc/account/token
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
      at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1888)
      at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1883)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1882)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1455)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
      at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
      at com.sun.webkit.network.URLLoader.receiveResponse(URLLoader.java:472)
      at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:143)
      at com.sun.webkit.network.URLLoader.access$000(URLLoader.java:43)
      at com.sun.webkit.network.URLLoader$1.run(URLLoader.java:107)
      at com.sun.webkit.network.URLLoader$1.run(URLLoader.java:104)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.webkit.network.URLLoader.run(URLLoader.java:104)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:744)
      Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://secure.gooddata.com/gdc/account/token
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1838)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
      at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
      at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
      at com.sun.webkit.network.URLLoader.receiveResponse(URLLoader.java:387)
      ... 11 more
      {code}

            ant Anton Tarasov (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: