RFR: 8340182: Java HttpClient does not follow default retry limit of 3 retries [v2]
p-nima
duke at openjdk.org
Fri Jun 6 14:50:52 UTC 2025
On Fri, 30 May 2025 09:06:00 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:
>> p-nima has updated the pull request incrementally with one additional commit since the last revision:
>>
>> apply review feedback
>
> test/jdk/java/net/httpclient/HttpClientRetryLimitTest.java line 113:
>
>> 111: }
>> 112: e.printStackTrace();
>> 113: }
>
> AFAICT, you should be using `assertThrows` as follows:
>
>
> IOException exception = assertThrows(...);
> assertEquals(exception.message(), "too many authentication attempts. Limit: " + RETRY_LIMIT);
> assertEquals(requestCount.get(), RETRY_LIMIT > 0 ? RETRY_LIMIT : 1);
The changes have been made in 2d0325649e4d0f67e25aa30ba36c1c2555bc59b9- We decrement the request count because we authenticate the request at least once before the limit is checked. A call to math.max can be done but I think the ternary operator helps to reduce the overhead of the call, wdyt?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25490#discussion_r2132339249
More information about the net-dev
mailing list