Opened 12 years ago
#211 new defect
File size greater than 2 gig causes a failure to read size.
Reported by: | gap | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | Enhanced |
Component: | general | Version: | 1.6.0 Build 27 GA5 |
Severity: | medium | Keywords: | |
Cc: |
Description
The code below will show the failure.
Note that the config.sys file will need to be greater than 2 gig for the test.
package filetest;
public class FileSize {
public FileSize() {
super();
}
public static void main(String[] args) {
}
public void run() {
String fname = "c:
config.sys";
try {
java.io.File fl = new java.io.File(fname);
long flz = -1;
try {
flz = fl.length();
} catch (Exception e) {
System.out.println("File error getting length:" + e.toString());
}
System.out.println("File length:" + flz);
java.io.RandomAccessFile rf = new java.io.RandomAccessFile(fname, "r");
flz = -1;
try {
flz = rf.length();
} catch (Exception e) {
System.out.println("RandomAccessFile error getting length:" + e.toString());
}
System.out.println("RandomAccessFile length:" + flz);
rf.close();
} catch (Exception ee) {
System.out.println("error:" + ee);
}
}
}
source for file size test