RFR: 8340182: Java HttpClient does not follow default retry limit of 3 retries [v3]

Daniel Fuchs dfuchs at openjdk.org
Mon Jun 9 14:25:58 UTC 2025


On Mon, 9 Jun 2025 14:19:04 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> p-nima has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   update summary
>
> test/jdk/java/net/httpclient/HttpClientAuthRetryLimitTest.java line 132:
> 
>> 130:                 assertEquals("too many authentication attempts. Limit: " + RETRY_LIMIT, exception.getMessage());
>> 131:                 assertEquals(RETRY_LIMIT > 0 ? RETRY_LIMIT : 0,
>> 132:                         RETRY_LIMIT > 0 ? requestCount.get():requestCount.decrementAndGet());
> 
> Could you split that in two statements for better readability? The double ternary operator makes it difficult to parse.
> 
> 
>     if (RETRY_LIMIT > 0) {
>         assertEquals(...);
>     } else {
>         assertEquals(...);
>     }

Also it would be better not to change the request count. The request count should only be changed by the Authenticator. Maybe introducing a variable:

   int expectedRequetedCount = ...;

would be beneficial.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25490#discussion_r2135819215


More information about the net-dev mailing list