|
Duplicate :
|
|
|
Duplicate :
|
|
|
Duplicate :
|
|
|
Relates :
|
|
|
Relates :
|
Name: tb29552 Date: 09/15/97
Trying to write to a write-protected file yields
a FileNotFound exception. Looking at the source
code, we see that an IOException is being caught
and re-thrown as a FileNotFoundException.
Therefore, we are losing the actual error (file
can't be read) and gaining a bogus error (file can't
be found). Since the original exception is lost,
we don't know (without further work) whether the
file doesn't exist or is just not writable.
excerpting out of FileOutputStream.java <colon>
public FileInputStream(String name) throws FileNotFoundException {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(name);
}
try {
fd = new FileDescriptor();
open(name);
} catch (IOException e) {
throw new FileNotFoundException(name);
}
}
company - Integrated Measurement Systems , email - ###@###.###
======================================================================
|