harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Liang (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1497) [classlib][luni] java.io.File.length could not reflect the latest file attribute
Date Wed, 20 Sep 2006 01:38:22 GMT
[classlib][luni] java.io.File.length could not reflect the latest file attribute
--------------------------------------------------------------------------------

                 Key: HARMONY-1497
                 URL: http://issues.apache.org/jira/browse/HARMONY-1497
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Richard Liang
            Priority: Minor


Hello,

java.io.File.length has some delay when uses try to get the information about file length.
The following test case will demonstrate this issue.

public void testFile() {
       File derbyLog = new File("d:\\", "derby1.log");

       try {
           FileOutputStream fos = new FileOutputStream(derbyLog);
           fos.write(0x41);
           assertEquals(1, derbyLog.length());
       } catch (Exception e) {
           e.printStackTrace();
       }
   }

   public void testFileChannel() {
       File derbyLog = new File("d:\\", "derby2.log");

       try {
           FileOutputStream fos = new FileOutputStream(derbyLog);
           FileChannel fc = fos.getChannel();
           fc.write(ByteBuffer.wrap(new byte[]{0x41, 0x42}));
           assertEquals(2, derbyLog.length());
       } catch (Exception e) {
           e.printStackTrace();
       }
   } 

Best regards,
Richard

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message