RFR: 8319938: com/sun/java/swing/plaf/gtk/TestFileChooserSingleDirectorySelection.java fails with "getSelectedFiles returned empty array for LAF: javax.swing.plaf.metal.MetalLookAndFeel" [v2]

Abhishek Kumar abhiscxk at openjdk.org
Thu Nov 16 05:19:46 UTC 2023


On Wed, 15 Nov 2023 18:40:57 GMT, Phil Race <prr at openjdk.org> wrote:

>> Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review comment fix
>
> 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.

Updated.

> 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");

There is no need to have the `home dir` to create the temporary folders and files. Since I was testing in my local mahine to create temp folders in home directory, I kept it as it is.

Changed `home dir` to `java.io.tmpdir` for creating temporary folders and files.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16674#discussion_r1395158783
PR Review Comment: https://git.openjdk.org/jdk/pull/16674#discussion_r1395160301


More information about the client-libs-dev mailing list