On Wed, 15 Nov 2023 09:50:19 GMT, Abhishek Kumar <abhis...@openjdk.org> wrote:

> The test fails for JFileChooser selection mode set to `DIRECTORIES_ONLY`. For 
> `DIRECTORIES_ONLY `mode, there may not be any directories in home directory 
> and due to that test failed. Added the code to create temporary directories 
> and files for the test.
> Tested the current change on the machine it failed for multiple times, no 
> failure observed.
> CI link attached in JBS.

test/jdk/com/sun/java/swing/plaf/gtk/TestFileChooserSingleDirectorySelection.java
 line 46:

> 44:  * @run main TestFileChooserSingleDirectorySelection
> 45:  */
> 46: 

I don't know why it was necessary to move all around all the above lines.
And whilst import java.io sorts after java.awt, it is long standing convention 
that the "core"
packages (easily distinguished these days as those in the java.base module) are 
listed before the desktop / AWT / Swing ones. This is true of product source as 
well as tests.
So you should just undo all of the above except for adding the new bug id.

test/jdk/com/sun/java/swing/plaf/gtk/TestFileChooserSingleDirectorySelection.java
 line 66:

> 64:             // create test directory
> 65:             String tmpDir = System.getProperty("user.home");
> 66: 

Does this test HAVE to use the home dir to create the temporary folders and 
files ?
Is there some reason some part of the test absolutely requires the home 
directory ?
It isn't obvious to me.
Why can't you instead use  System.getProperty("java.io.tmpdir");

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16674#discussion_r1394632505
PR Review Comment: https://git.openjdk.org/jdk/pull/16674#discussion_r1394641413

Reply via email to