RFR: 8281966: Absolute path of symlink is null in JFileChooser

Alexey Ivanov aivanov at openjdk.org
Fri Jul 29 18:31:15 UTC 2022


On Fri, 29 Jul 2022 18:14:14 GMT, Alexey Ivanov <aivanov 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.
>
> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java line 749:
> 
>> 747:                             } else {
>> 748:                                 chooser.setSelectedFile(null);
>> 749:                             }
> 
> What about the case where multiselection is enabled? It likely needs updating too.

Are symbolic links to files handled correctly?

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

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



More information about the client-libs-dev mailing list