http-client-branch: merge http-client-branch
authorchegar
Mon, 05 Feb 2018 12:32:20 +0000
branchhttp-client-branch
changeset 56069 ffaea9a1eed5
parent 56068 34eabbaa1226 (diff)
parent 56067 31eb9176ba85 (current diff)
child 56070 66a9c3185028
http-client-branch: merge
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java	Mon Feb 05 12:07:33 2018 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java	Mon Feb 05 12:32:20 2018 +0000
@@ -439,12 +439,15 @@
                                 // s can be null if an exception occurred
                                 // asynchronously while sending the preface.
                                 Throwable t = c.getRecordedCause();
+                                IOException ioe;
                                 if (t != null) {
                                     if (!cached)
                                         c.close();
-                                    return MinimalFuture.failedFuture(
-                                            new IOException("Can't get stream 1: " + t, t));
+                                    ioe = new IOException("Can't get stream 1: " + t, t);
+                                } else {
+                                    ioe = new IOException("Can't get stream 1");
                                 }
+                                return MinimalFuture.failedFuture(ioe);
                             }
                             exchImpl.released();
                             Throwable t;
--- a/test/jdk/java/net/httpclient/websocket/WebSocketTest.java	Mon Feb 05 12:07:33 2018 +0000
+++ b/test/jdk/java/net/httpclient/websocket/WebSocketTest.java	Mon Feb 05 12:32:20 2018 +0000
@@ -145,6 +145,22 @@
         }
     }
 
+    private static DummyWebSocketServer serverWithCannedData(int... data) {
+        byte[] copy = new byte[data.length];
+        for (int i = 0; i < data.length; i++) {
+            copy[i] = (byte) data[i];
+        }
+        return new DummyWebSocketServer() {
+            @Override
+            protected void serve(SocketChannel channel) throws IOException {
+                ByteBuffer closeMessage = ByteBuffer.wrap(copy);
+                int wrote = channel.write(closeMessage);
+                System.out.println("Wrote bytes: " + wrote);
+                super.serve(channel);
+            }
+        };
+    }
+
     @Test
     public void testNull() throws IOException {
         try (DummyWebSocketServer server = new DummyWebSocketServer()) {
@@ -226,22 +242,6 @@
         };
     }
 
-    private static DummyWebSocketServer serverWithCannedData(int... data) {
-        byte[] copy = new byte[data.length];
-        for (int i = 0; i < data.length; i++) {
-            copy[i] = (byte) data[i];
-        }
-        return new DummyWebSocketServer() {
-            @Override
-            protected void serve(SocketChannel channel) throws IOException {
-                ByteBuffer closeMessage = ByteBuffer.wrap(copy);
-                int wrote = channel.write(closeMessage);
-                System.out.println("Wrote bytes: " + wrote);
-                super.serve(channel);
-            }
-        };
-    }
-
     @Test
     public void testIllegalArgument() throws IOException {
         try (DummyWebSocketServer server = new DummyWebSocketServer()) {
@@ -549,7 +549,6 @@
                 0x00, 0x01, 0x61,                         // a
                 0x80, 0x00,                               // "
                 0x88, 0x00                                // <CLOSE>
-
         };
         CompletableFuture<List<String>> actual = new CompletableFuture<>();