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

Moses DeJong dejong at cs.umn.edu
Fri Feb 12 16:04:33 PST 1999


On Fri, 12 Feb 1999, Godmar Back wrote:

> > 
> > On Fri, 12 Feb 1999, Godmar Back wrote:
> > 
> > > > 
> > > > Ok, here is a quick shot at that.
> > > > 
> > > 
> > > This tests only one case, though.
> > 
> > The problem is that they throw a FileNotFoundException. The correct
> > thing to do in this case is to throw an IOException. Then in the case
> > where the file does not exist a FileNotFoundException can be thrown.
> > A FileNotFoundException is derived from IOException so there would
> > be no problem there. In the current JDK and Kaffe implementations
> > an IOException is rethrown as a FileNotFoundException which is
> > just plain wrong.
> > 

Well, if it is a bug then why not fix it? The FileOutputStream class
does not have this bug. If you look at the throws clause on the
FileOutputStream stream you will see that is throws an IOException
not a FileNotFoundException. This means you can implement a
FileOutputStream correctly on unix systems but there is no way
to implement a FileInputStream correctly. This change will not
stop you from implementing FileInputStream on a windows box but
is does stop a correct implementation on a unix system.

mo
 
> Oh I see.  So you just lamented the current state of affairs.
> While I agree that it would be beneficial to be able to distinguish
> between the cases when a file cannot be read because it's not there,
> or because it's not readable, I don't see the immediate need for it.
> Also, some systems (Win98) don't even have file permissions, so it
> would make even less sense there.
> Why do you need to distinguish these cases?
> 
> In Kaffe, we can of course implement whatever we want, but in practice
> I think we should pick a version of the JDK and be bug-compatible.
> 
> 	- Godmar




More information about the kaffe mailing list