changeset 14762:4fc867f8ed51

8157045: NPE during websocket communication with wss Reviewed-by: michaelm, prappo
author chegar
date Wed, 15 Jun 2016 19:18:19 +0100
parents 31a2e3bd54fe
children 4f76d582eb0c
files src/java.httpclient/share/classes/java/net/http/SSLConnection.java src/java.httpclient/share/classes/java/net/http/SSLDelegate.java src/java.httpclient/share/classes/java/net/http/SSLTunnelConnection.java
diffstat 3 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.httpclient/share/classes/java/net/http/SSLConnection.java	Wed Jun 15 10:25:25 2016 -0700
+++ b/src/java.httpclient/share/classes/java/net/http/SSLConnection.java	Wed Jun 15 19:18:19 2016 +0100
@@ -142,6 +142,9 @@
         // TODO: check for closure
         String s = "Receive) ";
         //debugPrint(s, r.buf);
+        if (r.result.bytesProduced() > 0) {
+            assert buf == r.buf;
+        }
         return r.result.bytesProduced();
     }
 
--- a/src/java.httpclient/share/classes/java/net/http/SSLDelegate.java	Wed Jun 15 10:25:25 2016 -0700
+++ b/src/java.httpclient/share/classes/java/net/http/SSLDelegate.java	Wed Jun 15 19:18:19 2016 +0100
@@ -344,8 +344,8 @@
         /* we wait until some user data arrives */
         int mark = dst.position();
         WrapperResult r = null;
-        assert dst.position() == 0;
-        while (dst.position() == 0) {
+        int pos = dst.position();
+        while (dst.position() == pos) {
             r = wrapper.recvAndUnwrap (dst);
             dst = (r.buf != dst) ? r.buf: dst;
             Status status = r.result.getStatus();
--- a/src/java.httpclient/share/classes/java/net/http/SSLTunnelConnection.java	Wed Jun 15 10:25:25 2016 -0700
+++ b/src/java.httpclient/share/classes/java/net/http/SSLTunnelConnection.java	Wed Jun 15 19:18:19 2016 +0100
@@ -150,6 +150,10 @@
         // TODO: check for closure
         String s = "Receive) ";
         //debugPrint(s, r.buf);
+        if (r.result.bytesProduced() > 0) {
+            assert buf == r.buf;
+        }
+
         return r.result.bytesProduced();
     }