7012783: JFileChooser fails to resolve DFS links on Windows Vista SP2
authorvikram
Wed, 07 Sep 2011 03:17:21 -0700
changeset 10412 0c262c47967c
parent 10411 f63e5bab1676
child 10413 5bd4f81b6d45
7012783: JFileChooser fails to resolve DFS links on Windows Vista SP2 Summary: Changes to code to handle DFS links Reviewed-by: rupashka
jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Mon Sep 05 18:54:49 2011 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Wed Sep 07 03:17:21 2011 -0700
@@ -1153,10 +1153,15 @@
                 if (shellFolder.isLink()) {
                     File linkedTo = shellFolder.getLinkLocation();
 
-                    if (linkedTo != null && fc.isTraversable(linkedTo)) {
-                        dir = linkedTo;
+                    // If linkedTo is null we try to use dir
+                    if (linkedTo != null) {
+                        if (fc.isTraversable(linkedTo)) {
+                            dir = linkedTo;
+                        } else {
+                            return;
+                        }
                     } else {
-                        return;
+                        dir = shellFolder;
                     }
                 }
             } catch (FileNotFoundException ex) {