RFR: 8277463: JFileChooser with Metal L&F doesn't show non-canonical UNC path in - Look in

Sergey Bylokhov serb at openjdk.java.net
Wed Dec 15 23:02:02 UTC 2021


On Fri, 10 Dec 2021 08:59:55 GMT, Masanori Yano <myano at openjdk.org> 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?

test/jdk/javax/swing/JFileChooser/8277463/UNCFileChooserTest.java line 105:

> 103:             throw new RuntimeException("Enter the directory path to test.");
> 104:         }
> 105:         UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");

The test might be executed under some non-default L&F and switching it here might cause some issues for the instruction dialog which will not be updated to use the metal. So it is better to set metal at the start of the test.

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

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



More information about the client-libs-dev mailing list