RFR: 8367067: Improve exception handling in HttpRequest.BodyPublishers
Chen Liang
liach at openjdk.org
Mon Sep 8 13:22:18 UTC 2025
On Mon, 8 Sep 2025 08:10:06 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:
>> Improves exception handling of built-in `HttpClient.BodyPublisher`s to ensure exceptions get propagated in a way compliant with the reactive specification.
>
> src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java line 357:
>
>> 355: haveNext = false;
>> 356: need2Read = false;
>> 357: throw new IOException(e);
>
> We don't convert `IOE`s to `UncheckedIOE`s anymore. This effectively makes the `HttpClientImpl::send` exception translation logic branching on `if (throwable instanceof IOException)` to kick in.
Then why can't we simply `throw e` instead?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26876#discussion_r2330226401
More information about the net-dev
mailing list