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

Confusing and unneeded wrapping of SSLHandshakeException

XMLWordPrintable

    • b04
    • Verified

      When an SSLHandshakeException is thrown in the HTTP/1.1 stack, it gets wrapped in an IOException which decorates it with the state of the HTTP/1.1 parser. This is unneeded and confusing because knowing the state of the parser is usually not useful in this case, and the important message (handshake failed) gets buried down the exception stack (see example below).

      We should alter the logic of the wrapping to not wrap SSLHandshakeException.

      Example of stack:

      java.util.concurrent.CompletionException: java.io.IOException: HTTP/1.1 header parser received no bytes
      at java.base/java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:367)
      at java.base/java.util.concurrent.CompletableFuture.completeRelay(CompletableFuture.java:376)
      at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1148)
      at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
      at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2159)
      at java.net.http/jdk.internal.net.http.Http1Response.onReadError(Http1Response.java:536)
      at java.net.http/jdk.internal.net.http.Http1Response$HeadersReader.onReadError(Http1Response.java:657)
      at java.net.http/jdk.internal.net.http.Http1AsyncReceiver.checkForErrors(Http1AsyncReceiver.java:297)
      at java.net.http/jdk.internal.net.http.Http1AsyncReceiver.flush(Http1AsyncReceiver.java:263)
      ....
      Caused by: java.io.IOException: HTTP/1.1 header parser received no bytes
      at java.net.http/jdk.internal.net.http.common.Utils.wrapWithExtraDetail(Utils.java:315)
      at java.net.http/jdk.internal.net.http.Http1Response$HeadersReader.onReadError(Http1Response.java:656)
      ... 33 more
      Caused by: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
      ... 20 more

            dfuchs Daniel Fuchs
            dfuchs Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: