RFR: 8368528: HttpClient.Builder.connectTimeout should accept arbitrarily large values [v6]

Daniel Fuchs dfuchs at openjdk.org
Tue Nov 4 15:36:10 UTC 2025


On Tue, 4 Nov 2025 11:04:38 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

>> Introduce necessary fixes to address exceptions thrown when excessive `Duration`s are provided to `Duration`-accepting `HttpClient` public APIs.
>
> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use `<p id="overflow">` in Javadoc as suggested in reviews

src/java.net.http/share/classes/jdk/internal/net/http/common/Deadline.java line 39:

> 37:  * This class is immutable and thread-safe.
> 38:  * <p id="overflow">
> 39:  * Operations that add durations to a {@code Deadline}, whether represented as a

Suggestion:

 * Operations that add or subtract durations to a {@code Deadline}, whether represented as a

src/java.net.http/share/classes/jdk/internal/net/http/common/Deadline.java line 43:

> 41:  * nanoseconds) do not throw on numeric overflow if the resulting
> 42:  * {@code Deadline} would exceed {@link #MAX} or be less than {@link #MIN}.
> 43:  * Instead, {@code MAX} or {@code MIN} is returned, respectively.

Suggestion:

 * Instead, {@code MAX} or {@code MIN} is returned, respectively.
 * Similarly, methods that return a duration as a {@code long} will either return 
 * {@link Long#MAX_VALUE} or {@link Long#MIN_VALUE} if the returned quantity would 
 * exceed the capacity of a {@code long}.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27973#discussion_r2490973411
PR Review Comment: https://git.openjdk.org/jdk/pull/27973#discussion_r2490983462


More information about the net-dev mailing list