Name: wl91122 Date: 09/02/99
This is a problem that's been around since the inception of java.io
and needs addressing.
The problem is that the interaction between java.io.File methods
canWrite() and delete() is unclear.
On some platforms, delete() will fail if canWrite() is false,(e.g. WinNT),
even if there is write access to the parent directory.
I suggest that EITHER the spec is changed to specify that delete()
always fails if canWrite() is false (which will probably impact existing
code running on Solaris), OR to specify that on some platforms,
canWrite() may imply that delete() will fail.
The latter solution, despite the obviously platform dependence, is
probably necessary to avoid breaking existing java.io code. Then
again, existing java.io code is already non-portable because of this
Either way, this portability issue should be brought to the attention
of developers in the documentation.
(Review ID: 94768)
Name: boT120536 Date: 11/15/2000
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
I want a method that says if I can write to a File.
File.canWrite() is not what I want.
It tells me if I can write to an existing file,
but gives no useful information if the file does
not exist. If the file does not exist, I want to
know if I can create it. I feel this is what
File.canWrite() should have done, but it is too
late to change the API. So we need a new method.
Maybe call it "File.canCreateOrWrite()".
(Review ID: 110002)