src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java
branchhttp-client-branch
changeset 56748 00b64a0234f5
parent 56695 d219df0c7d24
child 56762 79e371a6462c
--- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java	Tue Jun 12 15:21:11 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java	Tue Jun 12 16:07:19 2018 +0100
@@ -528,20 +528,19 @@
                 cf.cancel(true);
             throw ie;
         } catch (ExecutionException e) {
-            Throwable throwable = e.getCause();
+            final Throwable throwable = e.getCause();
+            final String msg = throwable.getMessage();
 
             if (throwable instanceof IllegalArgumentException)
-                throw new IllegalArgumentException(throwable);
+                throw new IllegalArgumentException(msg, throwable);
             else if (throwable instanceof SecurityException)
-                throw new SecurityException(throwable);
+                throw new SecurityException(msg, throwable);
             else if (throwable instanceof HttpTimeoutException)
-                throw new HttpTimeoutException(throwable.getMessage());
+                throw new HttpTimeoutException(msg);
             else if (throwable instanceof IOException)
-                throw new IOException(throwable);
-            //else if (throwable instanceof UncheckedIOException)
-            //    throw new UncheckedIOException(((UncheckedIOException)throwable).getCause());
+                throw new IOException(msg, throwable);
             else
-                throw new IOException(throwable);
+                throw new IOException(msg, throwable);
         }
     }