Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4863147

(NT only) File.length() returns incorrect length

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2
    • core-libs
    • x86
    • windows_nt


      ###@###.### 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());
          }
      }

            mmcclosksunw Michael Mccloskey (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: