6560349: REGRESSION :folder having ".lnk" in the name can not be opened by 5.0 and later versions
authorrupashka
Wed, 26 Nov 2008 19:08:41 +0300
changeset 1841 516419c55144
parent 1840 984ba55ac827
child 1842 824c7f885a64
6560349: REGRESSION :folder having ".lnk" in the name can not be opened by 5.0 and later versions Reviewed-by: alexp
jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Tue Nov 25 16:42:10 2008 +0300
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Wed Nov 26 19:08:41 2008 +0300
@@ -1134,11 +1134,16 @@
         // Traverse shortcuts on Windows
         if (dir != null && FilePane.usesShellFolder(fc)) {
             try {
-                File linkedTo = ShellFolder.getShellFolder(dir).getLinkLocation();
-                if (linkedTo != null && fc.isTraversable(linkedTo)) {
-                    dir = linkedTo;
-                } else {
-                    return;
+                ShellFolder shellFolder = ShellFolder.getShellFolder(dir);
+
+                if (shellFolder.isLink()) {
+                    File linkedTo = shellFolder.getLinkLocation();
+
+                    if (linkedTo != null && fc.isTraversable(linkedTo)) {
+                        dir = linkedTo;
+                    } else {
+                        return;
+                    }
                 }
             } catch (FileNotFoundException ex) {
                 return;