mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-04 13:10:15 +00:00
7067885: FileChooser does not display soft link name if link is to nonexistent file/directory
Reviewed-by: alexsch
This commit is contained in:
parent
b03a8f26db
commit
c365ea61b5
@ -30,6 +30,10 @@ import java.awt.Image;
|
||||
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;
|
||||
|
||||
@ -240,10 +244,11 @@ public abstract class ShellFolder extends File {
|
||||
* @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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user