http-client-branch: review comment - PublishingBodySubscriber should throw ISE when already subscribed http-client-branch
authordfuchs
Tue, 03 Apr 2018 15:26:04 +0100
branchhttp-client-branch
changeset 56385 42b1d4cd5f08
parent 56384 b5451b2aca3d
child 56386 49faeb51d1ca
http-client-branch: review comment - PublishingBodySubscriber should throw ISE when already subscribed
test/jdk/java/net/httpclient/ResponsePublisher.java
--- a/test/jdk/java/net/httpclient/ResponsePublisher.java	Tue Apr 03 12:15:02 2018 +0100
+++ b/test/jdk/java/net/httpclient/ResponsePublisher.java	Tue Apr 03 15:26:04 2018 +0100
@@ -153,11 +153,11 @@
             response.body().subscribe(ofString2);
             try {
                 ofString2.getBody().toCompletableFuture().join();
-                throw new RuntimeException("Expected IOE not thrown");
+                throw new RuntimeException("Expected ISE not thrown");
             } catch (CompletionException x) {
                 Throwable cause = x.getCause();
-                if (cause instanceof  IOException) {
-                    System.out.println("Got expected IOE: " + cause);
+                if (cause instanceof  IllegalStateException) {
+                    System.out.println("Got expected ISE: " + cause);
                 } else {
                     throw x;
                 }
@@ -296,7 +296,8 @@
                     @Override public void request(long n) { }
                     @Override public void cancel() { }
                 });
-                subscriber.onError(new IOException("This publisher has already one subscriber"));
+                subscriber.onError(
+                        new IllegalStateException("This publisher has already one subscriber"));
             }
         }