<Swing Dev> [12] RFR JDK-8198340: Test javax/swing/plaf/basic/Test6984643.java is unstable

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Nov 9 20:39:56 UTC 2018


Hi, Prasanta.

This also looks like a product bug, which was triggered by not strictly correct test.
The test creates a situation when the JFileChooser start initialization during VM shutdown.
This initialization tries to install shutdownHooks which unexpectedly fails, and causes the whole application
fail because of ExceptionInInitializerError.

On 09/11/2018 00:48, Prasanta Sadhukhan wrote:
> Hi All,
> 
> Please review this test fix for jdk12.
> 
> Bug: https://bugs.openjdk.java.net/browse/JDK-8198340
> webrev: http://cr.openjdk.java.net/~psadhukhan/8198340/webrev.0/
> 
> The test fails citing
> java.lang.ExceptionInInitializerError
> at java.desktop/javax.swing.filechooser.FileSystemView.getDefaultDirectory(FileSystemView.java:449)
> ...
> Caused by: java.lang.IllegalStateException: Shutdown in progress
> at java.base/java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66)
> 
> This is because test uses invokeLater() to call JFileChooser, which do not wait for runnable to complete and since
> jtreg will assume completion of main() is end of test, so it will try to stop EDT but it fails to interrupt the EDT.
> Although the test passes when run in standalone mode, it sometimes creates instability.
> 
> Proposed fix is to change invokeLater() to invokeAndWait().
> 
> Regards
> Prasanta


-- 
Best regards, Sergey.


More information about the swing-dev mailing list