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

Daniel Fuchs dfuchs at openjdk.org
Mon Nov 3 14:53:46 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.

Suggestion:

 * <p id="overflow"> 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 on numeric overflow if the resulting {@code Deadline} would 
 * exceed {@link #MAX} or be less than {@link #MIN}. Instead, {@code MAX} or {@code MIN}
 * are returned, respectively.

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

> 59:      * This instance is immutable and unaffected by this method call.
> 60:      * <p>
> 61:      * On numeric overflows, this method will return {@link Deadline#MAX} if

Suggestion:

     * On {@linkplain ##overflow numeric overflows}, this method will return {@link Deadline#MAX} if

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

> 105:      * This instance is immutable and unaffected by this method call.
> 106:      * <p>
> 107:      * On numeric overflows, this method will return {@link Deadline#MIN} if

Suggestion:

     * On {@linkplain ##overflow numeric overflows}, this method will return {@link Deadline#MIN} if

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

> 129:      * This instance is immutable and unaffected by this method call.
> 130:      * <p>
> 131:      * On numeric overflows, this method will return {@link Deadline#MAX} if

Suggestion:

     * On {@linkplain ##overflow numeric overflows}, this method will return {@link Deadline#MAX} if

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

> 153:      * This instance is immutable and unaffected by this method call.
> 154:      * <p>
> 155:      * On numeric overflows, this method will return {@link Deadline#MAX} if

Suggestion:

     * On {@linkplain ##overflow numeric overflows}, this method will return {@link Deadline#MAX} if

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

> 173:      * This instance is immutable and unaffected by this method call.
> 174:      * <p>
> 175:      * On numeric overflows, this method will return {@link Deadline#MAX} if

Suggestion:

     * On {@linkplain ##overflow numeric overflows}, this method will return {@link Deadline#MAX} if

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

> 193:      * This instance is immutable and unaffected by this method call.
> 194:      * <p>
> 195:      * On numeric overflows, this method will return {@link Deadline#MAX} if

Suggestion:

     * On {@linkplain ##overflow numeric overflows}, this method will return {@link Deadline#MAX} if

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27973#discussion_r2486703151
PR Review Comment: https://git.openjdk.org/jdk/pull/27973#discussion_r2486706972
PR Review Comment: https://git.openjdk.org/jdk/pull/27973#discussion_r2486717294
PR Review Comment: https://git.openjdk.org/jdk/pull/27973#discussion_r2486719109
PR Review Comment: https://git.openjdk.org/jdk/pull/27973#discussion_r2486722302
PR Review Comment: https://git.openjdk.org/jdk/pull/27973#discussion_r2486724207
PR Review Comment: https://git.openjdk.org/jdk/pull/27973#discussion_r2486726049


More information about the net-dev mailing list