8157045: NPE during websocket communication with wss
Reviewed-by: michaelm, prappo
--- a/jdk/src/java.httpclient/share/classes/java/net/http/SSLConnection.java Wed Jun 15 10:25:25 2016 -0700
+++ b/jdk/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/jdk/src/java.httpclient/share/classes/java/net/http/SSLDelegate.java Wed Jun 15 10:25:25 2016 -0700
+++ b/jdk/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/jdk/src/java.httpclient/share/classes/java/net/http/SSLTunnelConnection.java Wed Jun 15 10:25:25 2016 -0700
+++ b/jdk/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();
}