-
Bug
-
Resolution: Fixed
-
P4
-
1.0.2, 1.1, 1.1.4
-
1.2fcs
-
generic, x86, sparc
-
generic, solaris_2.5, solaris_2.6
-
Not verified
This method does not throw an IOException if argument is greater than the length
of the file.
==== Java Language Specification v1.0 says (22.23.5) ====
public void seek(long pos) throws IOException
... An IOException is thrown if pos is less than zero or greater than the length of file ...
==== Here is the minimized test ====
import java.io.*;
public class java_io_RandomAccessFile_seek {
public static void main( String argv[] ) {
try {
RandomAccessFile f=new RandomAccessFile("f","rw");
System.out.println("file length is: "+f.length());
f.seek(1000);
f.write(1);
System.out.println("file length is: "+f.length());
f.close();
}
catch (IOException e) {
}
}
}
==== Here is the output of the test ====
file length is: 0
file length is: 1001
of the file.
==== Java Language Specification v1.0 says (22.23.5) ====
public void seek(long pos) throws IOException
... An IOException is thrown if pos is less than zero or greater than the length of file ...
==== Here is the minimized test ====
import java.io.*;
public class java_io_RandomAccessFile_seek {
public static void main( String argv[] ) {
try {
RandomAccessFile f=new RandomAccessFile("f","rw");
System.out.println("file length is: "+f.length());
f.seek(1000);
f.write(1);
System.out.println("file length is: "+f.length());
f.close();
}
catch (IOException e) {
}
}
}
==== Here is the output of the test ====
file length is: 0
file length is: 1001
- duplicates
-
JDK-4097291 (spec) java.io.RandomAccessFile.seek: Specify behavior when seeking past EOF
- Closed
- relates to
-
JDK-4017703 java.io.RandomAccessFile.seek method works wrong with Long.MIN_VALUE and Long.MA
- Closed
-
JDK-4032907 java.io.RandomAccessFile.seek doc deficiency
- Closed