RFR: 8307105: JFileChooser InvalidPathException when selecting some system folders on Windows [v3]

Tejesh R tr at openjdk.org
Fri May 26 14:29:56 UTC 2023


On Fri, 26 May 2023 14:07:12 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> No, what I'm proposing is to modify `isLink` only so that it returns `true` if and only if the file is a Windows shortcut `.lnk` file.
>> 
>> ---
>> 
>> Another option is to modify `isFileSystem` so that it returns `true` for all filesystem objects, excluding the added condition that it should be not a link to directory.
>
>> Another option is to modify `isFileSystem` so that it returns `true` for all filesystem objects, excluding the added condition that it should be not a link to directory.
> 
> I assume this is required to ensure `JFileChooser` doesn't return `.lnk` file when in directory-only selection mode, and probably doesn't report is directory is selected when you select `.lnk` file. Double-clicking the `.lnk` file resolves to its target, then the directory can be safely returned.

So now two modifications are required. 
1. Modify `isLink` of win32ShellFolder class to return true only if its  `.lnk`.
2. `isFileSystem` of FileSystemView to return true only if its valid fileSystem, except `isLink` which actually solves the problem of `isFileSystem ` returning false for links (hard/soft).
Am I right?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13998#discussion_r1206871175



More information about the client-libs-dev mailing list