On Wed, 15 Dec 2021 22:58:39 GMT, Sergey Bylokhov <[email protected]> wrote:

>> I would like to fix the bug reported in JDK-8277463.
>> 
>> As reporter's investigation, ShellFolder.getNormalizedFile() returns 
>> incorrect value for non-canonical Windows UNC path. getNormalizedFile() is 
>> used for symbolic link path, but Windows environment does not handle 
>> symbolic link. And, getCanonicalFile() returns correct path for a directory 
>> link in Windows which is made with `mklink` command. So getNormalizedFile() 
>> should perform to return getCanonicalFile() like 
>> WindowsFileChooserUI.addItem() at Windows environment.
>
> src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java line 301:
> 
>> 299:         if (f.equals(canonical) || OSInfo.getOSType() == 
>> OSInfo.OSType.WINDOWS) {
>> 300:             // path of f doesn't contain symbolic links
>> 301:             return canonical;
> 
> Is it possible that the code below was used when the "Libraries"  or some 
> "virtual folders" were navigated?

Yes. I traced with debugger. 
Even after this fix, JFileChooser displays and can navigate "Libraries" and 
"Recent". The paths of these folders are expressed as "::{CLSID}", that can be 
handled correctly only with Win32ShellFolder class. And, if "Videos" is 
selected, the path is canonicalized. (e.g. C:\Users\User\Videos)

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

PR: https://git.openjdk.java.net/jdk/pull/6796

Reply via email to