JDK-6698013 : JFileChooser can no longer navigate non-local file systems.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6,6u4
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp,windows_vista
  • CPU: generic,x86
  • Submitted: 2008-05-06
  • Updated: 2011-02-16
  • Resolved: 2009-05-18
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.
JDK 6 JDK 7
6u14 b02Fixed 7Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)

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

A DESCRIPTION OF THE PROBLEM :
Our app uses JFileChooser to navigate a variety of non-local file systems (network, FTP, etc) by supplying a FileSystemView object to the chooser.

This worked fine until 1.6.0_04, when a change was made to BasicFileChooserUI.changeDirectory().  The problem occurs when the user opens the chooser and attempts to navigate into one of the displayed folders either by double clicking it, or single-clicking it then clicking the Open button.
The new version of changeDirectory() always calls ShellFolder.getShellFolder(dir) which uses File.getCanonicalFile() to retrieve the canonical path for the file then tests the file to see if it exists. This test is performed using the LOCAL file system and when the test fails it throws an exception and the chooser refuses to navigate into the selected folder.  Of course the test fails, because the folder doesn't exist on the LOCAL file system.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
invoke JFileChooser with a FileSystemView that describes a remote file system.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
chooser should allows the user to navigate into a selected subfolder
ACTUAL -
chooser does not change directories

ERROR MESSAGES/STACK TRACES THAT OCCUR :
no error message occurs

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
The only workaround we found was to hard code File.getCanonicalPath() to always return "C:\", this passes the "exists" test and JFileChooser is now permitted to navigate into the folder the user has selected.

Release Regression From : 6u3
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION The cause is brilliantly discovered by the CR initiator, see Description.
29-05-2008