30 import java.io.IOException; |
30 import java.io.IOException; |
31 import java.io.UncheckedIOException; |
31 import java.io.UncheckedIOException; |
32 import java.lang.ref.Reference; |
32 import java.lang.ref.Reference; |
33 import java.lang.ref.WeakReference; |
33 import java.lang.ref.WeakReference; |
34 import java.net.Authenticator; |
34 import java.net.Authenticator; |
|
35 import java.net.ConnectException; |
35 import java.net.CookieHandler; |
36 import java.net.CookieHandler; |
36 import java.net.ProxySelector; |
37 import java.net.ProxySelector; |
37 import java.net.http.HttpTimeoutException; |
38 import java.net.http.HttpTimeoutException; |
38 import java.nio.ByteBuffer; |
39 import java.nio.ByteBuffer; |
39 import java.nio.channels.CancelledKeyException; |
40 import java.nio.channels.CancelledKeyException; |
529 throw ie; |
530 throw ie; |
530 } catch (ExecutionException e) { |
531 } catch (ExecutionException e) { |
531 final Throwable throwable = e.getCause(); |
532 final Throwable throwable = e.getCause(); |
532 final String msg = throwable.getMessage(); |
533 final String msg = throwable.getMessage(); |
533 |
534 |
534 if (throwable instanceof IllegalArgumentException) |
535 if (throwable instanceof IllegalArgumentException) { |
535 throw new IllegalArgumentException(msg, throwable); |
536 throw new IllegalArgumentException(msg, throwable); |
536 else if (throwable instanceof SecurityException) |
537 } else if (throwable instanceof SecurityException) { |
537 throw new SecurityException(msg, throwable); |
538 throw new SecurityException(msg, throwable); |
538 else if (throwable instanceof HttpTimeoutException) |
539 } else if (throwable instanceof HttpTimeoutException) { |
539 throw new HttpTimeoutException(msg); |
540 throw new HttpTimeoutException(msg); |
540 else if (throwable instanceof IOException) |
541 } else if (throwable instanceof ConnectException) { |
|
542 ConnectException ce = new ConnectException(msg); |
|
543 ce.initCause(throwable); |
|
544 throw ce; |
|
545 } else if (throwable instanceof IOException) { |
541 throw new IOException(msg, throwable); |
546 throw new IOException(msg, throwable); |
542 else |
547 } else { |
543 throw new IOException(msg, throwable); |
548 throw new IOException(msg, throwable); |
|
549 } |
544 } |
550 } |
545 } |
551 } |
546 |
552 |
547 private static final Executor ASYNC_POOL = new CompletableFuture<Void>().defaultExecutor(); |
553 private static final Executor ASYNC_POOL = new CompletableFuture<Void>().defaultExecutor(); |
548 |
554 |