-
Bug
-
Resolution: Fixed
-
P3
-
8, 11, 12, 13, 14, 15
-
b16
-
x86
-
os_x
ADDITIONAL SYSTEM INFORMATION :
OS: macOS 10.14.4
JDK: openjdk-12.0.2
A DESCRIPTION OF THE PROBLEM :
When you abort the creation of a new folder with the "esc" key, a new folder named "uninitializedValue" is created.
I first run into this issue on openjdk-11.0.1. Could reproduce it on openjdk-12.0.2.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Open an instance of JFileChooser.
2. Navigate to a directory of your choice (e. g. "~/Desktop").
3. Click on "New folder".
4. Hit the "esc" key to close the "New folder" dialog.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Hitting the "esc" key is equivalently to pressing the "Cancel" button, i. e. no new folder is created when the "New folder" dialog is closed.
ACTUAL -
The directory to which you had last navigated with the JFileChooser before hitting "esc" now contains a directory named "uninitializedValue" (e. g. "~/Desktop/uninitializedValue"). The JFileChooser has navigated into this new folder.
If you continue the reproduction steps, you end up with multiple folders named "uninitializedValue" which are recursively nested into each other.
---------- BEGIN SOURCE ----------
public class Debugging_JFileChooserOnMac {
public static void main(String[] args) {
final JFrame frame = new JFrame();
final JFileChooser fileChooser = new JFileChooser();
final JButton fileChooserButton = new JButton("Save a file...");
fileChooserButton.addActionListener(event -> {
fileChooser.showSaveDialog(frame);
System.out.println(fileChooser.getSelectedFile());
});
frame.add(fileChooserButton);
frame.setSize(600, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
---------- END SOURCE ----------
OS: macOS 10.14.4
JDK: openjdk-12.0.2
A DESCRIPTION OF THE PROBLEM :
When you abort the creation of a new folder with the "esc" key, a new folder named "uninitializedValue" is created.
I first run into this issue on openjdk-11.0.1. Could reproduce it on openjdk-12.0.2.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Open an instance of JFileChooser.
2. Navigate to a directory of your choice (e. g. "~/Desktop").
3. Click on "New folder".
4. Hit the "esc" key to close the "New folder" dialog.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Hitting the "esc" key is equivalently to pressing the "Cancel" button, i. e. no new folder is created when the "New folder" dialog is closed.
ACTUAL -
The directory to which you had last navigated with the JFileChooser before hitting "esc" now contains a directory named "uninitializedValue" (e. g. "~/Desktop/uninitializedValue"). The JFileChooser has navigated into this new folder.
If you continue the reproduction steps, you end up with multiple folders named "uninitializedValue" which are recursively nested into each other.
---------- BEGIN SOURCE ----------
public class Debugging_JFileChooserOnMac {
public static void main(String[] args) {
final JFrame frame = new JFrame();
final JFileChooser fileChooser = new JFileChooser();
final JButton fileChooserButton = new JButton("Save a file...");
fileChooserButton.addActionListener(event -> {
fileChooser.showSaveDialog(frame);
System.out.println(fileChooser.getSelectedFile());
});
frame.add(fileChooserButton);
frame.setSize(600, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
---------- END SOURCE ----------