Spark Shen wrote:
Hi All:

When login as 'root' under Linux, the following test case fails on Harmony while passes on RI.
public void test_canWrite() throws IOException{
File f = File.createTempFile("test", null);
f.setReadOnly();
assertTrue(f.canWrite());
f.deleteOnExit();
}
I think RI's behavior is more reasonable since the 'root' account does have read/write privilege for temp files. However, Harmony only treats 'root' as ordinary other users.
It seems that similar problem happens on java.io.File.canRead().
I agree that RI's behavior is reasonable, although a little different with spec[1], Harmony should fix the implementation.

[1]public boolean *setReadOnly* ()
Marks the file or directory named by this abstract pathname so that only read operations are allowed. After invoking this method the file or directory is guaranteed not to change until it is either deleted or marked to allow write access. Whether or not a read-only file or directory may be deleted depends upon the underlying system.

As we all know, File class deals with many different file object on many different file system, would any one test File behavior on other file systems.
I didn't follow, what you mean here?

Best regards



--
Paulex Yang
China Software Development Lab
IBM

Reply via email to