FULL PRODUCT VERSION :
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+168)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+168, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.15063]
A DESCRIPTION OF THE PROBLEM :
Given a file C:\sym\sym.txt, where:
C:\sym is a symbolic link to C:\foo
C:\sym\sym.txt is a symbolic link to C:\foo\foo.txt
then when opening C:\sym\sym.txt with a FileChooser, the returned file is C:\foo\foo.txt instead
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
create the necessary files, from the command prompt:
mkdir foo
mklink /D sym foo
echo ok > foo\foo.txt
cd sym
mklink sym.txt foo.txt
run the JavaFX application below, which simply opens a FileChooser
select "sym\sym.txt"
an alert is shown with the result that was returned by the FileChooser, which points to "foo\foo.txt" instead of "sym\sym.txt"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the FileChooser must not follow symbolic links, in this case a File ending with sym\sym.txt
ACTUAL -
the FileChooser follows links, in this case a File ending with foo\foo.txt
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.File;
import javafx.application.Application;
import javafx.scene.control.Alert;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
public class JavaFXApplication2 extends Application {
@Override
public void start(Stage primaryStage) {
primaryStage.show();
FileChooser chooser = new FileChooser();
File f = chooser.showOpenDialog(primaryStage);
if (f != null) {
new Alert(Alert.AlertType.INFORMATION, f.toString()).showAndWait();
}
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+168)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+168, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.15063]
A DESCRIPTION OF THE PROBLEM :
Given a file C:\sym\sym.txt, where:
C:\sym is a symbolic link to C:\foo
C:\sym\sym.txt is a symbolic link to C:\foo\foo.txt
then when opening C:\sym\sym.txt with a FileChooser, the returned file is C:\foo\foo.txt instead
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
create the necessary files, from the command prompt:
mkdir foo
mklink /D sym foo
echo ok > foo\foo.txt
cd sym
mklink sym.txt foo.txt
run the JavaFX application below, which simply opens a FileChooser
select "sym\sym.txt"
an alert is shown with the result that was returned by the FileChooser, which points to "foo\foo.txt" instead of "sym\sym.txt"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the FileChooser must not follow symbolic links, in this case a File ending with sym\sym.txt
ACTUAL -
the FileChooser follows links, in this case a File ending with foo\foo.txt
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.File;
import javafx.application.Application;
import javafx.scene.control.Alert;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
public class JavaFXApplication2 extends Application {
@Override
public void start(Stage primaryStage) {
primaryStage.show();
FileChooser chooser = new FileChooser();
File f = chooser.showOpenDialog(primaryStage);
if (f != null) {
new Alert(Alert.AlertType.INFORMATION, f.toString()).showAndWait();
}
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8179937 DirectoryChooser returns the File after following links instead of the symbolic link itself
-
- Closed
-