<Swing Dev> Back port of fix JDK-7067885: FileChooser does not display soft link name if link is to nonexistent file/directory to OpenJDK-8

Sharma, Alok Kumar (OSTL) alok.sharma at hpe.com
Fri Nov 4 04:52:22 UTC 2016


Hi,

JDK-7067885<https://bugs.openjdk.java.net/browse/JDK-7067885> fix is applicable to OpenJDK-8, Code changes and testing for OpenJDK-8 are done.

Mercurial diff for updated source change:

-----------------------------------------------------------------------------------------------------------------------
diff -r 687fd7c7986d src/share/classes/sun/awt/shell/ShellFolder.java
--- a/src/share/classes/sun/awt/shell/ShellFolder.java  Tue Mar 04 11:51:53 2014 -0800
+++ b/src/share/classes/sun/awt/shell/ShellFolder.java  Wed Nov 02 11:15:16 2016 +0530
@@ -30,6 +30,10 @@
import java.awt.Toolkit;
import java.io.*;
import java.io.FileNotFoundException;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.Callable;

@@ -236,10 +240,11 @@
      * @exception FileNotFoundException if file does not exist
      */
     public static ShellFolder getShellFolder(File file) throws FileNotFoundException {
+        Path path = Paths.get(file.getPath());
         if (file instanceof ShellFolder) {
             return (ShellFolder)file;
         }
-        if (!file.exists()) {
+        if (!Files.exists(path, LinkOption.NOFOLLOW_LINKS)) {
             throw new FileNotFoundException();
         }
         return shellFolderManager.createShellFolder(file);
-----------------------------------------------------------------------------------------------------------------------


Regards,
Alok
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20161104/ac885ba6/attachment.html>


More information about the swing-dev mailing list