-
Bug
-
Resolution: Fixed
-
P4
-
5.0
-
b32
-
x86
-
windows_xp
Name: ibR10256 Date: 11/25/2003
If an empty directory (it must not contain files and subdirectories)
is passed to the JFileChooser's constructor the first item in the
file chooser directory list is "null". When double-clicking "null"
NullPointerException is thrown.
The same happens when the directory is not really empty but a
FileFilter is used which filters out all the files located in the
directory.
This doesn't happen if the the same empty directory is browsed in the
directory list starting from another directory.
Here's a test case:
---------------------------------------------
import javax.swing.*;
import java.awt.*;
public class GTKFileChooserFilter {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
// The directory used in the constructor must be empty
JFileChooser fc = new JFileChooser("/home/iib/empty");
frame.getContentPane().add(fc);
frame.pack();
frame.setVisible(true);
}
}
---------------------------------------------
======================================================================
- relates to
-
JDK-5045464 Regression: GTK L&F, JFileChooser shows "null/" in folder list
-
- Resolved
-