8167988: java.nio.file.InvalidPathException if click button in JFileChooser demo of SwingSet2
authorprr
Thu, 27 Oct 2016 08:48:59 -0700
changeset 41808 1b2343088086
parent 41807 f9eb6cb54fed
child 41809 834f1177e70b
8167988: java.nio.file.InvalidPathException if click button in JFileChooser demo of SwingSet2 Reviewed-by: serb, ssadetsky
jdk/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java
--- a/jdk/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java	Thu Oct 20 12:18:15 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java	Thu Oct 27 08:48:59 2016 -0700
@@ -30,10 +30,6 @@
 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;
 
@@ -244,11 +240,10 @@
      * @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 (!Files.exists(path, LinkOption.NOFOLLOW_LINKS)) {
+        if (!file.exists()) {
             throw new FileNotFoundException();
         }
         return shellFolderManager.createShellFolder(file);