On Fri, 2 Dec 2022 15:34:55 GMT, Darragh Clarke <[email protected]> wrote:
>> Currently if a `HttpResonseInputStream` gets interrupted while reading it >> will just swallow the exception and continue, >> >> This PR changes it to close the stream and throw an IOException, I added a >> test to cover this which just uses two threads to read the stream then >> interrupt it. > > Darragh Clarke has updated the pull request incrementally with one additional > commit since the last revision: > > check cause of exception in test test/jdk/java/net/httpclient/HttpResponseInputStreamInterruptTest.java line 171: > 169: var thrown = assertThrows(IOException.class, () -> > response.body().readAllBytes(), "expected IOException"); > 170: var cause = thrown.getCause(); > 171: assertTrue(cause instanceof InterruptedException, cause > + " is not an InterruptedException"); Ah - and of course the test should verify that the thread interrupted status is set too, since we specified that :-) var thread = Thread.currentThread(); assertTrue(thread.isInterrupted(), "Thread " + thread + " is not interrupted"); ------------- PR: https://git.openjdk.org/jdk/pull/11323
