8167988: java.nio.file.InvalidPathException if click button in JFileChooser demo of SwingSet2
Reviewed-by: serb, ssadetsky
--- 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);