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

Daniel Fuchs dfuchs at openjdk.org
Mon Nov 3 14:34:02 UTC 2025


On Mon, 3 Nov 2025 14:10:47 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'upstream/master' into bigDuration
>  - Merge remote-tracking branch 'upstream/master' into bigDuration
>  - Simplify exception handling in `Deadline::between`
>    
>    Co-authored-by: Daniel Fuchs <67001856+dfuch at users.noreply.github.com>
>  - Move `delta == 0` in `until()` to the catch block
>  - Add `DeadlineOverflowTest`
>  - Fix duration overflows
>  - Add `DurationOverflowTest`

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

> 41:  * numeric overflow, {@link #plus(Duration) plus()} will return
> 42:  * {@link Deadline#MAX} if the provided duration is positive,
> 43:  * {@link Deadline#MIN} otherwise.

Instead of speaking of overflow I wonder if we should say:


Operations that add durations to a {@code Deadline}, whether represented as
a `Duration` or as a `long` time increment (such as seconds or nano seconds) do
not throw if the resulting {@code Deadline} would exceed {@link #MAX} or be less
than {@link #MIN}. Instead, {@code MAX} or {@code MIN} are returned, respectively.

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

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


More information about the net-dev mailing list