Duplicate :
|
Name: dbT83986 Date: 03/10/99 The process I am running using JRE is an RMI server. When attempting to access a path that is a removable drive (disk drive A:, or local JAZ drive) jre displays a modal dialog box saying "there is no disk in the drive, please insert a disk into drive DRIVE". This happens on any type of file IO (File.isDirectory(), new FileInputStream(), etc.) so I have not included specific code. If you click abort, you get the IOException. Maybe this is not a bug, but my RMI server blocks... what I need is for the exception to be thrown without displaying the modal dialog box, but I can't figure out how to eliminate this behavior. Thanks ====================================== REVIEW NOTE 3/10/99 - User responded with more information Below is a sample that easily re-creates it, and below that is my actual code. But after further searching, I found this bug was already reported: > bug id: 4089199 > location: http://developer.java.sun.com/developer/bugParade/bugs/4089199.html This really, really needs to be fixed or we need a workaround!!! It would be OK if it just stopped the executing thread, but I am seeing that it blocks my RMI server, rendering it useless (this happens if an automatic backup gets kicked off and the admin forgets to put in a jaz drive, for example). Help!!! Bill Walker Lucent Technologies ###@###.### 732-817-4609 --------------------------------< easy way to recreate it >----------------------------------------- import java.io.*; public class FileTest { public static void main(String[] args) { if( args.length != 1 ) { System.out.println("usage: jre FileTest path"); System.exit(1); } try { File path = new File(args[0]); System.out.println("checking directory"); if( path.isDirectory() ) { System.out.println("path is a directory"); } else { System.out.println("not a directory"); } } catch(Exception e) { System.out.println(e.toString()); } } } ----------------< actual code from my program >------------------------------------------------------------- trace.prn("making file copy"); try { CopyFile.copy(DbBackupImpl.this.dbName + ".odb", newName + ".odb"); CopyFile.copy(DbBackupImpl.this.dbName + ".odt", newName + ".odt"); CopyFile.copy(DbBackupImpl.this.dbName + ".odf", newName + ".odf"); } catch(IOException ioe) { throw new AdminException("file copy failed"); } finally { trace.prn("restarting db"); sc.startup(); DbBackupImpl.this.backupInProgress = false; } public class CopyFile { static final int BUFSIZE = 4028; /** * Make a copy of a disk file. * @param path1 the full or relative path to the file to copy * @param path2 the destination path * @exception IOException for any file exception. */ public static void copy(String path1, String path2) throws IOException { byte[] buf = new byte[BUFSIZE]; FileInputStream fin = new FileInputStream(path1); FileOutputStream fout = new FileOutputStream(path2); while( true ) { int bytesRead = fin.read(buf, 0, BUFSIZE-1); if( bytesRead == -1 ) break; fout.write(buf, 0, bytesRead); } fin.close(); fout.close(); return; } } (Review ID: 55191) ======================================================================