RFR: 8367067: Improve exception handling in HttpRequest.BodyPublishers [v2]
Volkan Yazici
vyazici at openjdk.org
Thu Sep 18 09:44:09 UTC 2025
On Sun, 14 Sep 2025 09:37:26 GMT, Shaojin Wen <swen at openjdk.org> wrote:
>> Volkan Yazici has updated the pull request incrementally with three additional commits since the last revision:
>>
>> - Remove IOE rethrows
>> - Revert `FilePublisherTest` and `FlowAdapterPublisherTest` changes
>> - Make `CheckedIterable` throw exceptions
>
> src/java.net.http/share/classes/jdk/internal/net/http/CheckedIterable.java line 47:
>
>> 45: Iterator<E> iterator = iterable.iterator();
>> 46: return CheckedIterator.fromIterator(iterator);
>> 47: };
>
> Suggestion:
>
> return () -> CheckedIterator.fromIterator(iterable.iterator());
I will keep the current style which enables stepping convenience in the debugger.
> src/java.net.http/share/classes/jdk/internal/net/http/PullPublisher.java line 37:
>
>> 35: * Each new subscription gets a new {@link CheckedIterator}.
>> 36: */
>> 37: class PullPublisher<T> implements Flow.Publisher<T> {
>
> Suggestion:
>
> final class PullPublisher<T> implements Flow.Publisher<T> {
>
> add final
No unrelated improvements – see [my earlier comment].
[my earlier comment]: https://github.com/openjdk/jdk/pull/26876/files#r2358241186
> src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java line 202:
>
>> 200: }
>> 201:
>> 202: public static class StringPublisher extends ByteArrayPublisher {
>
> Suggestion:
>
> public static final class StringPublisher extends ByteArrayPublisher {
No unrelated improvements – see [my earlier comment].
[my earlier comment]: https://github.com/openjdk/jdk/pull/26876/files#r2358241186
> src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java line 208:
>
>> 206: }
>> 207:
>> 208: public static class EmptyPublisher implements BodyPublisher {
>
> Suggestion:
>
> public static final class EmptyPublisher implements BodyPublisher {
I kept unrelated improvements limited to the lines already touched, to avoid cluttering the diff and the VCS history. While I fully agree with your proposal, I'd prefer to address it some other time.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26876#discussion_r2358248786
PR Review Comment: https://git.openjdk.org/jdk/pull/26876#discussion_r2358250645
PR Review Comment: https://git.openjdk.org/jdk/pull/26876#discussion_r2358244313
PR Review Comment: https://git.openjdk.org/jdk/pull/26876#discussion_r2358241186
More information about the net-dev
mailing list