RFR: 8316017: Refactor timeout handler in PassFailJFrame [v2]

Alexey Ivanov aivanov at openjdk.org
Tue Oct 24 11:22:36 UTC 2023


On Tue, 19 Sep 2023 18:35:12 GMT, Phil Race <prr at openjdk.org> wrote:

>> Alexey Ivanov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Refactor failure reason
>>   
>>   Ensure the failure reason doesn't change after it's set.
>>   Removed 'failed' and 'timeout' fields:
>>   if failureReason is set, the test fails.
>
> test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 329:
> 
>> 327:                 timer.stop();
>> 328:                 testFailedReason = FAILURE_REASON
>> 329:                                    + "Timeout User did not perform testing.";
> 
> If the test was explicitly failed by the user (ie failed==true), why does the reason say that there was a time out ?

@prrace Eventually, I refactored handling of `failureReason`.  I removed `failed` and `timeout` fields; the `failureReason` is set via a synchronised method to ensure there cannot be data race. If `failureReason` is not `null`, the test fails. After `failureReason` is set to a non-`null` value, it cannot be changed.

The timeout handler relies on this behaviour: it calls `setFailureReason` unconditionally; if `failureReason` is already set, the timeout reason is ignored.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15668#discussion_r1369999854


More information about the client-libs-dev mailing list