Opened 11 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) {

FileSize? f = new FileSize?();
f.run();

}
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);

}

}
}

Attachments (1)

FileSize.java (1.2 KB) - added by gap 11 years ago.
source for file size test

Download all attachments as: .zip

Change History (1)

Changed 11 years ago by gap

Attachment: FileSize.java added

source for file size test

Note: See TracTickets for help on using tickets.