On Wed, 15 Oct 2025 12:00:25 GMT, Volkan Yazici <[email protected]> wrote:

>> Ensure `HttpClient::sendAsync` translates every operational failure to an 
>> `IOException` as per specification.
>> 
>> `tier1-2` passes with the proposed changes.
>> 
>> **Context:** The parent issue, [JDK-8364733], reports that 
>> `HttpClient::sendAsync` leaks exceptions which do not extend from 
>> `IOException`, and this violates the method's specification. The 
>> [JDK-8367067] (#26876) sub-task improved issues around exceptions thrown by 
>> request body publishers – which triggered the first encounter with this 
>> problem. This PR (and its associated sub-task) is aimed to end this saga.
>> 
>> [JDK-8364733]: https://bugs.openjdk.org/browse/JDK-8364733
>> [JDK-8367067]: https://bugs.openjdk.org/browse/JDK-8367067
>
> Volkan Yazici has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains five additional 
> commits since the last revision:
> 
>  - Merge remote-tracking branch 'upstream/master' into sendAsyncExWrap
>  - Use `Utils::getCompletionCause`
>    
>    Co-authored-by: Daniel Fuchs <[email protected]>
>  - Document exception wrapping in `HttpClientImpl::send`
>  - Fix test failures
>  - Ensure `sendAsync` wraps execution failures in `IOException`

src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java line 
1145:

> 1143:                         // Except `Error`s, wrap failures inside an 
> `IOException`.
> 1144:                         // This is required to comply with the 
> specification of `HttpClient::sendAsync`.
> 1145:                         var translatedException = unwrappedException 
> instanceof Error

Suggestion:

                        var translatedException = unwrappedException instanceof 
Error
                                                    || unwrappedException 
instanceof CancelledException

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

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

Reply via email to