On Thu, 15 May 2025 09:12:36 GMT, Abhishek Kumar <[email protected]> wrote:
>> **Analysis :**
>>
>> Whether the test passes on the main line or fails, the behavior is still
>> incorrect.
>> This test is meant to ensure that pressing ESC a second time while the file
>> dialog is open behaves correctly.
>>
>> However, the CountDownLatch is currently set to 1, which means the test only
>> waits for the first open/close interaction to complete. As a result, it does
>> not wait for the second attempt (opening the dialog again and pressing ESC
>> to close it), because the latch reaches zero after the first attempt.
>>
>> This causes the test to proceed immediately to the validation step:
>>
>> if (fd.isVisible()) {
>> throw new RuntimeException("File Dialog is not closed");
>> }
>>
>> At this point, whether the test passes or fails becomes unreliable and
>> undefined, as it depends on the state of the second attempt (whether the
>> file dialog is in the process of opening, being closed, or hasn't even
>> started yet)
>>
>> To ensure the test behaves correctly, the CountDownLatch should be set to 2,
>> so it waits for the two attempt of open-close interactions to be completed
>> before moving on to validation.
>>
>> **Proposed fix:**
>>
>> set the CountDownLatch to 2
>>
>> **Proposed enhancements :**
>>
>> Remove unnecessary threads (Thread and Thread-2)
>> Properly handle delays and robot.waitForIdle()
>> Avoid indefinite blocking on latch.await()
>>
>> With these enhancements, the test execution time is reduced from around 3
>> minutes to approximately 1 minute 30 seconds
>>
>> The adapted test uncovered a new bug in GTKFileDialog on Linux, which is
>> being tracked under
>> [JDK-8356981](https://bugs.openjdk.org/browse/JDK-8356981). As a result, it
>> has been added to the ProblemList. See
>> [JDK-8356981](https://bugs.openjdk.org/browse/JDK-8356981) for more details
>
> Ran updated test on JDK1.6.0_25 and JDK1.6.0_29 and I don't see any behavior
> difference and the test passes always on my local machine (Ubuntu 22.04).
> File dialog opened seems a XToolKit based dialog not the GTK based dialog.
>
> [JDK-5097243](https://bugs.openjdk.org/browse/JDK-5097243) says that issue is
> resolved in b29.
> So, test should **fail for b25** and **pass for b29**
>
> Did you verify the test as per
> [JDK-5097243](https://bugs.openjdk.org/browse/JDK-5097243) ?
Hello @kumarabhi006,
Thank you for your review.
Did you try to reproduce the bug manually first with b25 before proceeding with
the automated test ?
>From my side, I proceed that way: I revert the fix on the mainline, the test
>fails 20/20 times.
Then, when I reapply the fix, the test passes 20/20
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25184#issuecomment-2884009898