[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Re: FYI: java/io/ java/io/FileOutp

From: Dalibor Topic
Subject: Re: [cp-patches] Re: FYI: java/io/ java/io/
Date: Wed, 09 Mar 2005 21:04:53 +0100
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.7.5) Gecko/20050105 Debian/1.7.5-1

Jeroen Frijters wrote:
Dalibor Topic wrote:

Yeah, i can understand the inefficient part, as the same code is duplicated in two classes. Could you elaborate some more on the racy part?

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

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.

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?

I can attach a patch, if you're interested.

dalibor topic

reply via email to

[Prev in Thread] Current Thread [Next in Thread]