On Mon, 22 May 2023 15:39:32 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> Tejesh R has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Updated based on review comments
>
> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java 
> line 725:
> 
>> 723:                                     || 
>> (chooser.isDirectorySelectionEnabled()
>> 724:                                         && (fsv.isFileSystem(f)
>> 725:                                         || (fsv.isLink(f) && 
>> Files.isSymbolicLink(f.toPath())))
> 
> I don't think it's correct.
> 
> `Files.isSymbolicLink` should only be called for objects for which 
> `fsv.isFileSystem(f)` returns `true`.
> 
> `fsv.isLink(f)` returns `true` for `.lnk` files which are the common Windows 
> shortcuts; such a file can also be a symbolic link.

`Files.isSymbolicLink`  takes path as argument to check if its a symbolic link. 
For certain windows specific files as explained the path won't be exact path, 
rather a hex values. So directly validating with path is causing an exception. 
So `fsv.isLink()` is used as a first level validation which uses File to check 
if its valid. I didn't find any other alternatives to validate the file path, 
so used `fsv.isLink` as first level validation along with Symbolic Link check.

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

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

Reply via email to