RFR: 8369313: java/net/httpclient/TimeoutBasic.java should accept that HttpTimeoutException should be somewhere down the cause chain

Daniel Fuchs dfuchs at openjdk.org
Wed Oct 8 16:05:22 UTC 2025


On Wed, 8 Oct 2025 15:26:34 GMT, Francesco Andreuzzi <fandreuzzi at openjdk.org> wrote:

>> The TimeoutBasic.java test expects that HttpTimeoutException will be either the root cause, or the cause of the root cause of a CompletionException, while in fact it could be further down the cause chain. The test logic should be relaxed to allow that.
>> 
>> In addition I have logged a followup RFE ([JDK-8369315](https://bugs.openjdk.org/browse/JDK-8369315)) to possibly revisit the wrapping of HttpTimeoutExceptions.
>
> test/jdk/java/net/httpclient/TimeoutBasic.java line 153:
> 
>> 151:             }
>> 152:         }
>> 153:         assert x == null;
> 
> Is there a way to exit the loop without `x` being `null`?

@fandreuz why would you want to do that? x == null means the expected cause has not been found. In which case we want to throw the AssertionError, with the root exception as the cause, possibly stripping the outer CompletionException if any as that is of little interest.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27694#discussion_r2414357908


More information about the net-dev mailing list