Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4382063
Votes 6
Synopsis EOU: JFileChooser should not try to connect to all drives when instantiated.
Category java:classes_swing
Reported Against 1.3
Release Fixed
State 11-Closed, duplicate of 4290709, bug
Priority: 4-Low
Related Bugs 4290709
Submit Date 24-OCT-2000
Description




java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


The JFileChooser tries to connect to all the drives from 'C:' to 'Z:' when
instantiated to look for the root directory of each drive. This is done so that
the JComboBox of drives can be populated. If any of the drives was a network
drive and for some reason disconnected the check for the root directory
has to timeout before it returns the disconnected status. In that case the
drive is not included in the JComboBox of JFileChooser. This may take a few
seconds for each drive. Thus it takes a while for JFileChooser to come up.
The user may think that the application has crashed.

Some drives may indeed be found connected. Then the JFileChooser comes up.
However between that time and when the user selects a drive it might have been
disconnected. In that case user gets the error dialog anyways. Thus the failure
mode in case of first having checked for network drive vs not is the same. The
complete set of drives on MS windows platform is not unknowable (considering
UNC names are not supported by the JFileCHooser anyways).

This has other disadvantage. If a drive that is not in the JComboBox gets
connected after the creation of JFileChooser the user may not be able to
access it (if the application kept on reusing the JFileChooser instance
and did not allow the mechanism to refresh it).

So why not populate all the drive letters in the JComboBox in the first
place. In absense of which at least a refresh JComboBox button should
be provided on the JFileChooser.
(Review ID: 110549) 
======================================================================
Work Around




Install a custom subclass of -

javax.swing.filechooser.WindowsFileSystemView

override the

public File[] getRoots();

to return all drive letters.
======================================================================
Evaluation
Fixed in merlin-beta by fix to 4290709.
  xxxxx@xxxxx   2000-12-05
Comments
  
  Include a link with my name & email   

Submitted On 01-NOV-2000
jcaron
If launching under webstart (on Win2000), I get a "There is no disk in the drive. Please 
insert a disk into drive A:" and a "There is no disk in the drive. Please 
insert a disk into drive \Device\Harddisk0\DR0" dialog box when instantiating a JFileChooser.

(perhaps this deserves its own bug report?)


Submitted On 04-DEC-2000
JohnSutter
I don't like the idea of displaying all the driver letters, but I do like the
workaround of a 'refresh' button.  On some machines it can take forever
to create a JFileChooser (HP laptops are the worst for this).  We used to
just create one JFileChooser and then tweak it as needed.  Then people
wanted to see their network drives so we had to create a new JFileChooser
each time (ouch!).
  I'll look at writing my own UI, etc..  Add that 'refresh' button.
At least when the user presses 'refresh' they might expect a delay.
- j



PLEASE NOTE: JDK6 is formerly known as Project Mustang