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>
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>
- relates to
-
JDK-6364377 api/java_io/File/index.html#GetXXXSpace fails
-
- Closed
-
-
JDK-6402669 File.get{Total,Free,Usable}Space() throws NullPointerException
-
- Closed
-