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

Daniel Fuchs dfuchs at openjdk.org
Thu Oct 16 11:31:03 UTC 2025


On Wed, 15 Oct 2025 19:37:33 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

>> test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java line 683:
>> 
>>> 681:         public boolean test(Throwable throwable) {
>>> 682:             // `UncheckedIOException` is peeled off by `HttpClientImpl::translateSendAsyncExecFailure`
>>> 683:             return throwable instanceof CustomIOException;
>> 
>> We want to preserve the UncheckedIOException here. We don't want to peel it off.
>
> I'm not able to follow. `UncheckedIOE` is peeled off by `Utils::toIOException` in `translateSendAsyncExecFailure()`. Mind elaborating on what are you suggesting?

Although it might look strange - we might want to wrap the UncheckedIOException instead of peeling it off.
If the UncheckedIOException is generated by us (HttpClient implementation) then we most likely want to peel it off. But if it originates from custom code, peeling it off might hide important stack trace information.
I am actually hesitating between the two possibilities.

We see here that peeling of the UncheckedIOException from within sendAsync forces you to modify one test, where the UncheckedIOException was originating from custom code. I am not 100% sure we want do that.

On the other hand - we don't want to add yet another version of toIOException.

Let me think about this a bit more.

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

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


More information about the net-dev mailing list