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

p-nima duke at openjdk.org
Tue Jun 10 13:51:30 UTC 2025


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

>> 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.

Thank you for your review. The changes have been made in 7a9eb0b2969991aafc3d1bdfba283ece6e458370

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

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


More information about the net-dev mailing list