[Kaffe] java.io.File(Input|Output)Stream question.

Moses DeJong dejong at cs.umn.edu
Fri Feb 12 14:31:50 PST 1999


On Thu, 11 Feb 1999, Tony Kimball wrote:

> Quoth Moses DeJong on Thu, 11 February:
> : Is there some other kind of IOException
> : that could happen while opening a file for writing that would not
> : happen while opening a file for reading.
> 
> Paying strict attention to your 'could' and 'would' semantics,
> you could get EPERM in one case while you would not in the other.
> But, vice versa contrariwise, on the other hand.  

Oh, I get it now, you are saying that a file writer could hit a unix
file that does not have write permission. If that was the case then the
reader could also run into a file without read permission. So I guess
the problem is that there would be no way to tell if a file existed but
was not readable when a FileNotFoundException is thrown by a reader.
So, this does seem like a bug in the Sun spec after all. Does this
mean we should change the implementation of Kaffe's FileInputStream to
throw an IOException instead of a FileNotFoundException. I took a look
the Kaffe's impl of FileInputStream and it does throw an IOException
but it then catches the IOException and rethrows it as a
FileNotFoundException.  A less specific exception like an IOException
should not be rethrown as a more specific exception like a
FileNotFoundException. It seems like this is a bug in the Sun JDK docs
and implementation. Does anyone agree with me?

Mo DeJong
dejong at cs.umn.edu
 
> I *do* think the FileReader should throw IOException, for this reason,
> if no other.  But frankly, I know of no guarantees that any exception
> type in the standard class library interface is maximally specific, so
> it's not a patent bug.



More information about the kaffe mailing list