JDK-4881631 : File("A:").exists() and isDirectory() can cause a dialog box to appear (win)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-06-20
  • Updated: 2013-04-02
  • Resolved: 2005-09-02
Related Reports
Duplicate :  
Description
Name: aaR10208			Date: 06/20/2003


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.5.0-b09
Platform[s]    : Windows 2000 Pro
switch/Mode    : Plugin + NS7.0

File.exists() and File.isDirectory() calls for "A:" drive can cause a dialog box
"There is no disk in the drive. Please insert a disk into drive A:" to appear.
File.listRoots() works fine in this build.

Please, see bugid#4850616 for more details.


How to reproduce:
=================
1. Install j2sdk1.5.0-b09 on Win2000 box with Netscape 7.0 installed.
2. Place into your home directory .java.policy file with all permissions enabled.
3. Copy the following applet and html files on the local disk.
4. Compile applet and open test.html. NOTE: Use desktop link to start Netscape.
You will see message
"Netscp.exe - No disk
There is no disk in the drive. Please insert a disk into drive A:.
[Cancel] [Try again] [Continue]"

----- test.java -----
import java.applet.*;
import java.io.File;

public class test  extends Applet
{
      public void start() {
	System.out.println("is A: a directory ?: "+(new File("A:")).isDirectory());
	System.out.println("does A: exist() ?: "+(new File("A:")).exists());
      };
      public static void main( String[] args ) {
	System.setSecurityManager( new sun.applet.AppletSecurity() );
	(new test()).start();
      };
}
----- end of test.java -----

----- test.html -----
<html>
<body bgcolor=#CCCCCC>

<center>
<APPLET CODE=test WIDTH="90%" HEIGHT="400"></APPLET>
</center>
<p>
</body>
</html>
----- end of test.html -----


Specific machine info:
======================
Hostname: linux-2
OS: Windows 2000 Pro

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

Comments
EVALUATION As per the original evaluation it is possible to disable the critical error dialog on a per-process basis. We are investigating the best place to do this, and investigating possible side effects via 4089199.
02-09-2005

EVALUATION Setting the per process error mode could prevent the dialogs but setting this could cause other problems. Users may be depending upon the mode they are running in. See also bug 4089199. ###@###.### 2003-11-18
18-11-2003