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

File.get{Total,Free,Usable)Space() produces incorrect result (win)

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b63
    • CPU:
      generic
    • OS:
      windows_xp
    • Verification:
      Verified

      Description

      If I try to execute the following code:

             public static void main(String[] args) {
                 try {
                     File file = File.createTempFile("tmp", null,
                         new File(System.getProperty("user.dir")));
                     file.deleteOnExit();
                     System.out.println("File exists = " + file.exists());
                     System.out.println("Total space " + file.getTotalSpace());
                     System.out.println("Free space " + file.getFreeSpace());
                     System.out.println("Usable space " + file.getUsableSpace());
                 } catch (Exception e) {
                     System.out.println("Unexpected exception "+ e);
                 }
             }

      on SOLARIS platform, I get the output:
      File exists = true
      Total space 35833200640
      Free space 5932088320
      Usable space 5573756928

      on WINDOWS platform, I get the following:
      File exists = true
      Total space 0
      Free space 0
      Usable space 0

      File was physically created on disc in both cases, all needed permissions were granted. Such behaviour seems to be strange.
      ###@###.### 2005-06-16 14:38:37 GMT
      JCK tests fail on windows because of this issue:
      api/java_io/File/index.html#GetXXXSpace[getFreeSpace2005]
      api/java_io/File/index.html#GetXXXSpace[getTotalSpace2002]
      api/java_io/File/index.html#GetXXXSpace[getUsableSpace2009]

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              iris Iris Clark
              Reporter:
              ynovozhi Yulia Novozhilova (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: