RFR: 8368249: HttpClient: Translate exceptions thrown by sendAsync [v5]
Jaikiran Pai
jpai at openjdk.org
Wed Oct 22 11:37:46 UTC 2025
On Thu, 16 Oct 2025 05:37:45 GMT, Volkan Yazici <vyazici at openjdk.org> 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 incrementally with one additional commit since the last revision:
>
> Revert `AbstractThrowingPublishers` changes
src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java line 981:
> 979: // Exceptions are often thrown from asynchronous code, making it
> 980: // difficult to trace back to the user's original entry point.
> 981: // Wrap exceptions explicitly to preserve that context.
Nit - Would it better to reword this as:
> // Exceptions are often thrown from asynchronous code, and the
// stacktrace may not always contain the application classes.
// That makes it difficult to trace back to the application code which
// invoked the HttpClient. Here we instantiate/recreate the
// exceptions to capture the application's calling code in the
// stacktrace of the thrown exception.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27787#discussion_r2451787001
More information about the net-dev
mailing list