On Wed, 23 Nov 2022 14:21:13 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.
src/java.net.http/share/classes/jdk/internal/net/http/ResponseSubscribers.java
line 485:
> 483: } catch (InterruptedException ex) {
> 484: close();
> 485: throw new IOException("interrupted", ex);
I'd suggest to throw `InterruptedIOException` here instead. Also it might be
better to swallow any exception close() might throw - using `try-finally`
around close() should do that.
-------------
PR: https://git.openjdk.org/jdk/pull/11323