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

Tejesh R tr at openjdk.org
Tue May 30 07:45:03 UTC 2023


On Mon, 22 May 2023 15:55:41 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Updated based on review comments
>
> Changes requested by aivanov (Reviewer).

As discuss with @aivanov-jdk , the fix validates shortcut links of format `.lnk` only, excluding both both [symbolic links](https://learn.microsoft.com/en-us/windows/win32/fileio/creating-symbolic-links) and [junctions](https://learn.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions#junctions). Since [IShellFolder::GetAttributesOf](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ishellfolder-getattributesof) checks only `.lnk` type of link, as we can seen from the attributes list provided by the native [ishellFolder interface](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ishellfolder) which are in [Attributes List](https://learn.microsoft.com/en-us/windows/win32/shell/sfgao). 
The `path` validation is done through `isFileSystem()` and `getPath().toLowerCase().endsWith(".lnk")`  validates if its a `.lnk` type without causing any regression (Which also fixes the bug - [JDK-8281966](https://bugs.openjdk.org/browse/JDK-8281966), without the need use `Files.isSymbolicLink`) .

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

PR Comment: https://git.openjdk.org/jdk/pull/13998#issuecomment-1567924357



More information about the client-libs-dev mailing list