http-client-branch: 8196848: SplitResponseSSL test failing intermitently (but rarely) with HttpClientImpl shutting down.
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/HttpClientImpl.java Tue Feb 06 15:20:30 2018 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/HttpClientImpl.java Tue Feb 06 15:34:08 2018 +0000
@@ -520,8 +520,10 @@
void eventUpdated(AsyncEvent e) throws ClosedChannelException {
if (Thread.currentThread() == this) {
SelectionKey key = e.channel().keyFor(selector);
- SelectorAttachment sa = (SelectorAttachment) key.attachment();
- if (sa != null) sa.register(e);
+ if (key != null) {
+ SelectorAttachment sa = (SelectorAttachment) key.attachment();
+ if (sa != null) sa.register(e);
+ }
} else {
register(e);
}
@@ -775,7 +777,11 @@
pending.add(e);
if (reRegister) {
// first time registration happens here also
- chan.register(selector, interestOps, this);
+ try {
+ chan.register(selector, interestOps, this);
+ } catch (CancelledKeyException x) {
+ abortPending(x);
+ }
}
}
--- a/test/jdk/ProblemList.txt Tue Feb 06 15:20:30 2018 +0000
+++ b/test/jdk/ProblemList.txt Tue Feb 06 15:34:08 2018 +0000
@@ -217,7 +217,6 @@
java/net/DatagramSocket/SendDatagramToBadAddress.java 7143960 macosx-all
-java/net/httpclient/SplitResponseSSL.java 8194151 windows-all
############################################################################
--- a/test/jdk/java/net/httpclient/DigestEchoClient.java Tue Feb 06 15:20:30 2018 +0000
+++ b/test/jdk/java/net/httpclient/DigestEchoClient.java Tue Feb 06 15:34:08 2018 +0000
@@ -440,6 +440,11 @@
if (addHeaders && !preemptive && (i==0 || isSchemeDisabled())) {
assert resp.statusCode() == 401 || resp.statusCode() == 407;
+ Stream<String> respBody = resp.body();
+ if (respBody != null) {
+ System.out.printf("Response body (%s):\n", resp.statusCode());
+ respBody.forEach(System.out::println);
+ }
System.out.println(String.format("%s received: adding header %s: %s",
resp.statusCode(), authorizationKey(authType), auth));
request = HttpRequest.newBuilder(uri).version(clientVersion)