RFR: 8307105: JFileChooser InvalidPathException when selecting some system folders on Windows
Damon Nguyen
dnguyen at openjdk.org
Wed May 17 04:28:45 UTC 2023
On Tue, 16 May 2023 06:40:20 GMT, Tejesh R <tr at openjdk.org> wrote:
> This is a regression from fix [JDK-8281966](https://bugs.openjdk.org/browse/JDK-8281966): Absolute path of symlink is null in JFileChooser. The fix checks whether the file path is a symbolic link using `Files.isSymbolicLink()` method with path as input. In windows for specific folders like "This PC"/"Network"/"Libraries" the path value will be a hex values which causes InvalidPathException. In order to resolve the issue, since no other checks are available to validate the path of these folders, checking if the file is link firstly and then for symbolic link resolves the problem (since File.isLink() doesn't take path as input rather file is a parameter). Since every symbolic link is a link, this fix seems logical to me.
> The fix is tested in CI for regression and is green. The regression fix is also tested for confirmation and works fine.
test/jdk/javax/swing/JFileChooser/FileChooserIPETest.java line 41:
> 39: * @build PassFailJFrame
> 40: * @summary Test to check if the certain windows like "This PC",
> 41: * "Library","network" does not throw Invalid Path Exception on selection.
Space after "," and capital "N" to maintain consistency
test/jdk/javax/swing/JFileChooser/FileChooserIPETest.java line 54:
> 52: public void run() {
> 53: initialize();
> 54: }
Does this need to be a "Runnable"? Can't initialize()'s contents just be put into main? I might be missing something
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13998#discussion_r1195912857
PR Review Comment: https://git.openjdk.org/jdk/pull/13998#discussion_r1195915673
More information about the client-libs-dev
mailing list