JDK-4959456 : GTK: JFileChooser directory list is incorrect when an empty directory is passed
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-11-25
  • Updated: 2004-08-09
  • Resolved: 2003-12-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b32Fixed
Related Reports
Relates :  
Description

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);
    }
}
---------------------------------------------

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta FIXED IN: tiger-beta INTEGRATED IN: tiger-b32 tiger-beta
10-08-2004

EVALUATION Name: anR10225 Date: 11/26/2003 The current directory ('./' item in the directory list) is updated on GTKDirectoryModel data changes. When the FileChooser is created with an empty directory no changes are made in the model and the curDir field remains uninitialized. The current directory in the model should be updated on doDirectoryChanged() event. ======================================================================
10-08-2004