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

File.get{Free,Usable,Total}Space throws NPE (win98)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 6
    • core-libs
    • x86
    • windows_98

      File.get{Free,Total,Usable}Space throws NullPointerException on Windows 98,
      if File Object is created as File("tmp"); where tmp is windows file

      C:\>uname -a
      Windows_98 JLAB408 4 10 586

      C:\>c:\jdk\win\bin\java -version
      java version "1.6.0-beta2"
      Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
      Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode)

      <Code>
      import java.io.File;
      public class TestDS {
        public static void main(String... args) throws Exception{
          
           File f = new File("tmp");
           if (!f.exists()) {
              f.createNewFile();
           }
           System.out.println(f.getFreeSpace());
           System.out.println(f.getUsableSpace());
           System.out.println(f.getTotalSpace());
           
           }
        }
      </Code>

      <Result>

      C:\>c:\jdk\win\bin\java TestDS
      Exception in thread "main" java.lang.NullPointerException
              at java.io.Win32FileSystem.getSpace0(Native Method)
              at java.io.Win32FileSystem.getSpace(Win32FileSystem.java:565)
              at java.io.File.getFreeSpace(File.java:1619)
              at TestDS.main(TestDS.java:9)

      </Result>

            alanb Alan Bateman
            rgutupalsunw Rajendra Gutupalli (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: