test/jdk/java/net/httpclient/ThrowingPublishers.java
branchhttp-client-branch
changeset 56695 d219df0c7d24
parent 56451 9585061fdb04
child 56771 73a6534bce94
--- a/test/jdk/java/net/httpclient/ThrowingPublishers.java	Thu Jun 07 10:45:30 2018 +0100
+++ b/test/jdk/java/net/httpclient/ThrowingPublishers.java	Thu Jun 07 14:21:50 2018 +0100
@@ -345,8 +345,12 @@
                 try {
                     response = client.send(req, handler);
                 } catch (Error | Exception t) {
-                    if (thrower.test(where, t)) {
-                        System.out.println(now() + "Got expected exception: " + t);
+                    // synchronous send will rethrow exceptions
+                    Throwable throwable = t.getCause();
+                    assert throwable != null;
+
+                    if (thrower.test(where, throwable)) {
+                        System.out.println(now() + "Got expected exception: " + throwable);
                     } else throw causeNotFound(where, t);
                 }
             }