RFR: 8368249: HttpClient: Translate exceptions thrown by sendAsync [v4]

Volkan Yazici vyazici at openjdk.org
Wed Oct 15 19:40:37 UTC 2025


On Wed, 15 Oct 2025 13:46:51 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> test/jdk/java/net/httpclient/InvalidInputStreamSubscriptionRequest.java line 476:
>> 
>>> 474:     }
>>> 475: 
>>> 476:     private static boolean throwableCausalChainContainsInstanceOf(
>> 
>> `HttpClientImpl::send` wraps `IOException` (wrapping `IllegalArgumentException`) thrown by `sendAsync` in an `IOException` again. As a result, the existing checks performing _"unwrapping of `IOException` once"_ do not work anymore. Since the existing unwrapping was not strict – that is, they're not enforced, but optionally unwrapping if types match in the causal chain – I've further relaxed it with scanning the causal chain.
>
> I wonder if we should add the wrapping only when sendAsync is not called by send?

Implemented in ec28a849112, and reverted this test change.

>> test/jdk/java/net/httpclient/http3/StopSendingTest.java line 184:
>> 
>>> 182:     }
>>> 183: 
>>> 184:     private static boolean throwableCausalChainContainsInstanceOf(
>> 
>> `HttpClientImpl::send` wraps `IOException` (wrapping `CancellationException`) thrown by `sendAsync` in an `IOException` again. As a result, the existing checks performing _"unwrapping of `IOException` once"_ do not work anymore. Since the existing unwrapping was not strict – that is, they're not enforced, but optionally unwrapping if types match in the causal chain – I've further relaxed it with scanning the causal chain.
>
> We don't want to wrap CancellationException. That's a valid exception for any CompletableFuture to throw.

Implemented in ec28a849112, and reverted this test change.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27787#discussion_r2433724894
PR Review Comment: https://git.openjdk.org/jdk/pull/27787#discussion_r2433725558


More information about the net-dev mailing list