On Thu, 21 Aug 2025 09:43:47 GMT, Volkan Yazici <[email protected]> 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/PullPublisher.java line
39:
> 37: class PullPublisher<T> implements Flow.Publisher<T> {
> 38:
> 39: // Only one of `iterable` or `throwable` should be null, and the
> other non-null. throwable is
`PullPublisher` logic is branching on the `throwable == null` condition on
several places – this increases code size and complexity. Plus, all
`PullPublisher::new` call sites know at compile time whether `throwable` is
null or not. I think `PullPublisher` should only accept a `CheckedIterable`,
and we should create a new, say, `ImmediatelyFailingPublisher` to cover the
cases where a `Throwable` needs to be passed to subscribers verbatim. I did not
carry out this improvement in this PR to avoid scope creep, but I'm inclined to
create a ticket for it. WDYT?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26876#discussion_r2329782120