Have you tested it on windows, for example, signing in as admin, and the file which is set read only is still writable?:)
It is always good to follow RI or else we might encounter odd problems in real applications. Furthermore, "root" is the concept of OS, so I do not think the role should be treated specially in the layer of java. We can delegate it to OS service naturally if possible. I guess RI uses another implementation, for example, the system call which itself deals with the user account. On 10/20/06, Spark Shen <[EMAIL PROTECTED]> wrote:
Tony Wu 写道: > you mean it fails when f.setReadOnly();? Hi Tony: No, setReadOnly is used to change the access privilege. After this change harmony and RI behaves differently. Best regards > > On 10/20/06, Spark Shen <[EMAIL PROTECTED]> 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(). >> >> 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. >> >> Best regards >> >> -- >> Spark Shen >> China Software Development Lab, IBM >> >> >> --------------------------------------------------------------------- >> Terms of use : http://incubator.apache.org/harmony/mailing.html >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- Spark Shen China Software Development Lab, IBM --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Leo Li China Software Development Lab, IBM