JDK-5075580 : JFileChooser in FILES_AND_DIRECTORIES mode doesn't contain fix for 4239219
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2,5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-07-19
  • Updated: 2006-08-02
  • Resolved: 2006-08-02
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 JDK 6
1.4.2_12Fixed 6 b94Fixed
Related Reports
Relates :  
Relates :  
Description
Name: jl125535			Date: 07/19/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
When JFileChooser is in FILES_AND_DIRECTORIES mode, it still exhibits the problematic behavior described in bug 4239219, i.e. you must be in the parent directory of directory x to select x.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the attached program on a windows machine. It should open up a file chooser in the My Documents directory.

2. Double-click on My Pictures.

3. Press Open.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Filename: C:\Documents and Settings\user\My Documents\My Pictures
File exists: true

ACTUAL -
Filename: C:\Documents and Settings\user\My Documents\My Pictures\My Pictures
File exists: false
REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.io.*;
import javax.swing.*;

public class FileChooserTest
{
  public static void main(String[] args)
  {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    fileChooser.showOpenDialog(new JFrame());
    File file = fileChooser.getSelectedFile();
    System.out.println("Filename: " + file.getAbsolutePath());
    System.out.println("File exists: " + file.exists());
    System.exit(0);
  }
}

---------- END SOURCE ----------
(Incident Review ID: 286195) 
======================================================================

Comments
EVALUATION The fix is to set the filename textfield path to the currently selected directory (in absolute form) when double clicked on FILES_AND_DIRECTORIES mode. The fix is specific only to filesystem folders otherwise it would return an incorrect path for special folders like "My Computer" when clicked from Desktop.
14-11-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
25-09-2004

EVALUATION Closely related to bug 5073778. Will address for next release. ###@###.### 2004-07-20
20-07-2004