RFR: 8367067: Improve exception handling in HttpRequest.BodyPublishers
Daniel Fuchs
dfuchs at openjdk.org
Mon Sep 8 13:56:18 UTC 2025
On Thu, 21 Aug 2025 09:43:47 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/PullPublisher.java line 68:
> 66: try {
> 67: iterator = iterable.iterator();
> 68: } catch (Exception exception) {
Either CheckedIterable::iterator() should be declared to throw Exception, or we should catch `RuntimeException` here - or even maybe `RuntimeException | Error` ?
src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java line 395:
> 393: exception = new IOException("Stream supplier returned null");
> 394: }
> 395: } catch (Exception cause) {
Can we get anything but RuntimeException here?
test/jdk/java/net/httpclient/FilePublisherTest.java line 178:
> 176: }
> 177: }
> 178:
Maybe we could revert the changes to this file and do that in a followup
test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java line 122:
> 120:
> 121: // Flow.Publisher<ByteBuffer>
> 122:
Maybe we could revert changes to this file and do that in a followup
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26876#discussion_r2330256448
PR Review Comment: https://git.openjdk.org/jdk/pull/26876#discussion_r2330297271
PR Review Comment: https://git.openjdk.org/jdk/pull/26876#discussion_r2330319905
PR Review Comment: https://git.openjdk.org/jdk/pull/26876#discussion_r2330321263
More information about the net-dev
mailing list