-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
generic
-
generic
Name: mlR10151 Date: 06/04/2001
The description for the FileCacheImageOutputStream.close()
says nothing about EOFException, but it does throw EOFEx if
seeked beyond the end of stream previously.
Note, RandomAccessFile does not throw any exception in such a case.
To reproduce the bug run the following test:
===================== a.java =======================
import javax.imageio.stream.*;
import java.io.*;
public class a {
public static void main(String[] args) throws Exception {
RandomAccessFile raf = new RandomAccessFile(new File("a.java"), "r");
raf.seek(20000);
raf.close();
OutputStream ostream = new ByteArrayOutputStream();
FileCacheImageOutputStream fcios = new FileCacheImageOutputStream(ostream, null);
fcios.seek(20);
fcios.close();
}
}
===================== log =======================
% java -version
java version "1.4.0-beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta_refresh-b66)
Java HotSpot(TM) Client VM (build 1.4.0-beta_refresh-b66, mixed mode)
% java a
Exception in thread "main" java.io.EOFException
at java.io.RandomAccessFile.readFully(RandomAccessFile.java:300)
at javax.imageio.stream.FileCacheImageOutputStream.flushBefore(FileCacheImageOutputStream.java:202)
at javax.imageio.stream.FileCacheImageOutputStream.close(FileCacheImageOutputStream.java:183)
at a.main(a.java:13)
The bug causes failure of the following test:
api/javax/imageio/stream/FileCacheImageOutputStream/index.html#seekTests
======================================================================