Duplicate :
|
###@###.### 2003-05-13 J2SE Version (please include all output from java -version flag): java version "1.4.1_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01) Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode) and java version "1.4.2-rc" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-rc-b22) Java HotSpot(TM) Client VM (build 1.4.2-rc-b22, mixed mode) Does this problem occur on J2SE 1.3, 1.4 or 1.4.1? Yes / No (pick one) Yes. Operating System Configuration Information (be specific): NT service pack 5(works fine with Win2K) Hardware Configuration Information (be specific): Compaq Deskpro Bug Description: File.length() does not reflect the actual length of the file. Steps to Reproduce (be specific): Compile and run FileLength.java file. On Win2K, it will print 3 but on WinNT, it will print 0. Test Program(FileLength.java): import java.io.*; public class FileLength { public static void main(String[] args) throws Exception { File f = new File("tmp.tmp"); Writer w = new FileWriter(f); w.write("abc"); w.flush(); System.out.println(f.length()); } }