http-client-branch: review comment: remove duplicate message type from synchronous send http-client-branch
authorchegar
Tue, 12 Jun 2018 16:07:19 +0100
branchhttp-client-branch
changeset 56748 00b64a0234f5
parent 56747 d7954a135b1e
child 56749 5c86a9790f5a
http-client-branch: review comment: remove duplicate message type from synchronous send
src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java
--- 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);
         }
     }