RFR: 8281966: Absolute path of symlink is null in JFileChooser [v3]

Alexey Ivanov aivanov at openjdk.org
Wed Aug 3 15:17:56 UTC 2022


On Wed, 3 Aug 2022 14:04:34 GMT, Tejesh R <tr at openjdk.org> wrote:

>> Absolute path of Symbolic Link created in Windows is set to `null` in `BasicFileChooserUI` class. This happens when propertyChangeListener is implemented to get the Symbolic link's Absolute path on Mouse click through JFileChooser. The reason being that on click of Symbolic link, the _ValueChanged()_ in `BasicFileChooserUI` class has a logic which actually sets the  `chooser.SelectedFile()` to `null` even though the path is not null. Hence the issue is addressed by checking if its a Symbolic link and then setting the `chooser.SelectedFile()` to the value of clicked link without modifying the other logics.
>
> Tejesh R has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Added Dialog information for printing Absolute path
>  - Updated based on review comments

Changes requested by aivanov (Reviewer).

test/jdk/javax/swing/JFileChooser/FileChooserSymLinkTest.java line 37:

> 35: 
> 36: /** @test
> 37:   * @bug 8281966

Suggestion:

/*
 * @test
 * @bug 8281966


It is not a javadoc comment, only one asterisk should be used. Please align the following lines by removing one space.

test/jdk/javax/swing/JFileChooser/FileChooserSymLinkTest.java line 45:

> 43:   * @run main/manual FileChooserSymLinkTest
> 44: */
> 45: 

I'd rather remove this blank line so that the comment above is attached to the class declaration.

test/jdk/javax/swing/JFileChooser/FileChooserSymLinkTest.java line 80:

> 78:                 4. On click of the "link" directory, if the Absolute path of
> 79:                     Symbolic Link is valid then Click PASS, else if it is
> 80:                     null then Click FAIL.(Including MultiSelection Mode SET)

Is this possible? Your test does not allow for multi-selection mode.

test/jdk/javax/swing/JFileChooser/FileChooserSymLinkTest.java line 99:

> 97:                     JOptionPane.showMessageDialog(null, evt.getNewValue(),
> 98:                             "Absolute path",
> 99:                             JOptionPane.INFORMATION_MESSAGE);

I don't think it is a good idea. For each selection, the tester will get a modal dialog box with the path. It could even prevent the tester from navigating directories for testing.

I suggest adding a `JListBox` or `JTextArea` on top or bottom of the `JFileChooser` and add the messages there.

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

PR: https://git.openjdk.org/jdk/pull/9597



More information about the client-libs-dev mailing list