From e7c2dc0b7ad6b1facf05d7bae13802ef9757636a Mon Sep 17 00:00:00 2001 From: Pavel Porvatov Date: Wed, 26 Nov 2008 19:08:41 +0300 Subject: [PATCH] 6560349: REGRESSION :folder having ".lnk" in the name can not be opened by 5.0 and later versions Reviewed-by: alexp --- .../swing/plaf/basic/BasicFileChooserUI.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java index 9b696868095..44f99d6d3e3 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java @@ -1134,11 +1134,16 @@ public class BasicFileChooserUI extends FileChooserUI { // 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;