[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cp-patches] Re: FYI: java/io/FileInputStream.java& java/io/FileOutp
From: |
Jeroen Frijters |
Subject: |
RE: [cp-patches] Re: FYI: java/io/FileInputStream.java& java/io/FileOutputStream.java |
Date: |
Wed, 9 Mar 2005 22:48:34 +0100 |
Dalibor Topic wrote:
> Jeroen Frijters wrote:
> > If another application creates a directory after the check,
> but before
> > the file is created, an incorrect error is thrown. So
> ideally the native
> > code that calls the platform file open API needs to handle
> this error
> > case.
>
> Isn't that the case in any way, independently of the implementation
> strategy used? Unless a platform has an atomic 'check if dir
> and open' function call, there is always a time slice where some
> other application can do stuff that invalidates what we know.
Yeah, but some platforms do have that atomic call ;-)
> Another strategy to implement this in the FileChannelImpl constructor
> would be to call open() first, and then to check whether what we have
> opened is a directory, and if it is one to call close() + throw
> FileNotFoundException in that case. Does that sound OK?
That sounds like a good approach to me. I would think it would be pretty
efficient too.
Regards,
Jeroen