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: 4168045
Votes 21
Synopsis File.isReady() - method to avoid media-insertion dialogs
Category java:classes_io
Reported Against 1.3.1 , 1.2beta4
Release Fixed
State 11-Closed, duplicate of 4089199, request for enhancement
Priority: 4-Low
Related Bugs 4089199
Submit Date 20-AUG-1998
Description


java.io.File  should have a method isReady() or
isDeviceReady() so that the OS doesn't launch
the infamous Abort/Retry/Cancel dialog when
calling such methods as listFiles(), exists(),
or canRead().

For example if you write a JExplorer (similar
to Windows Explorer) there is no way to listRoots() without throwing the 
NullPointerException or
canRead() without forcing the user to answer
the dialog for devices that are not ready.

Under Unix is the device is not mounted it's not
a root/subdirectory so this issue will never come
up.  However with listRoots() (presumeable for
Windows machines) it is an issue.
(Review ID: 37315)
======================================================================
Posted Date : 2005-08-25 08:33:20.0
Work Around




There is no work around as far as I can see other
than forcing the user to answer the abort/retry/
cancel dialog on windows platform.
======================================================================
Evaluation
It would be very nice to implement this, but unfortunately we know of no way to
do it on Win32.  See also 4089199.  --   xxxxx@xxxxx   9/1/1998
--

The issue with the dialog poping up to prompt for media was addressed in mustang b55 - please see the bug evaluation in 4089199.
Posted Date : 2006-01-19 20:51:16.0
Comments
  
  Include a link with my name & email   

Submitted On 06-OCT-1999
wrd02
Re your evaluation: I'm really surprised by that, because it's trivial! See the
code below: 
it generates a list of available drive letters without provoking any removable
drives. Tested
NT4 sp5, reported as working on everything from 95 upwards. See also
SetErrorMode()
for how to turn off critical errors.
int main(int argc, char* argv[])
{
	printf("Hello World!\n");
	char drvroot[10];
	for(char ch = 'A'; ch <= 'Z'; ch++) {
		sprintf(drvroot, "%c:\\", ch);
		UINT i = GetDriveType(drvroot);
		char *msg = NULL;
		switch(i) {
			case DRIVE_UNKNOWN: msg = "unknown"; break;
			case DRIVE_NO_ROOT_DIR: msg = "not mounted"; break;
			case DRIVE_REMOVABLE: msg = "removable"; break;
			case DRIVE_FIXED: msg = "fixed"; break;
			case DRIVE_REMOTE: msg = "remote"; break;
			case DRIVE_CDROM: msg = "cdrom"; break;
			case DRIVE_RAMDISK: msg = "ramdisk"; break;
			default: msg = "(unexpected return: wierdness)"; break;
		}
		printf("drive %s is %s\n", drvroot, msg);
	}
	return 0;
}


Submitted On 11-JUN-2000
marcoschmidt
Could someone from Sun please attempt to use the C code to 
avoid the annoying system dialog box pop up in Win32? It's 
eight months old! Would be nice if it could make it into 
1.3.1 (or whatever is next).


Submitted On 20-MAY-2001
rockhopper
This is ridiculous. Today is May, 2001 and this bug still 
exists in 1.3.

What is wrong with you guys?


Submitted On 25-APR-2002
douglasPollock
This bug makes it impossible to develop a professional quality GUI 
that includes a "file explorer" capability (for selecting files, 
etc.) without writing native code for Windows NT machines.  Does 
the Java team want people to develop complete applications in Java 
or not? 


Submitted On 17-MAR-2004
mrsteve
I'm just about to write a "dir a:" runtime command and 
parse the output to find out if a drive is ready to be 
accessed or not.  Crazy huh?
I DO NOT BELIEVE THERE IS NO WAY TO DO THIS IN 
THE VM.

All the people who want to know if a drive is removable 
or not.. who cares?  The question is, is it ready or not?  
Can you read files from it or do you need to prompt the 
user to make it ready?  Can't we do this ourselves or 
control it???? arghhh [klonk - sound of me dying of 
frustration]


Submitted On 20-OCT-2004
kilrath
I can't believe this STILL isn't supported. What in the hell do you people at Sun do all day? You've had almost a decade to do something about the file dialog bug and this feature request. Fix it NOW.


Submitted On 18-JAN-2006
This really needs to be fixed.  While it's probably technically an RFE, it's really just a plain bug.  And it's an enhancement that probably could have been added in Oct 1999 (ie just over 6 years ago) when wrd02 listed the code to fix it.  How about an isRemovable() call?  Is available would also be useful.  Seems like this would be easy.


Submitted On 19-JAN-2006
alan.bateman
This has been fixed and the dialog no longer pops up - see evaluation in bug 4089199.


Submitted On 15-FEB-2006
JSSAggie
This will solve all of your problems...
http://support.microsoft.com/default.aspx?scid=kb;en-us;281345



PLEASE NOTE: JDK6 is formerly known as Project Mustang