-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
generic
-
generic
-
Not verified
Name: vpR10011 Date: 04/19/2001
Specifications of the following methods from the class
javax.imageio.stream.ImageInputStreamImpl:
readBoolean()
readByte()
readUnsignedByte()
say nothing about throwing EOFException.
But these methods throw EOFException if the stream reaches the end
before reading all the bytes.
To reproduce this bug run the following test:
---------------------test.java--------------
import java.io.*;
import javax.imageio.stream.*;
public class test {
public static void main(String[] argv) {
byte [] bar = new byte[0];
InputStream is = (InputStream) new ByteArrayInputStream(bar);
ImageInputStreamImpl iisI = (ImageInputStreamImpl) new MemoryCacheImageInputStream(is);
System.out.println("readBoolean");
try {
boolean b = iisI.readBoolean();
System.out.println("Passed");
} catch (Exception e) {
System.out.println("Failed: unexpected exception " + e);
}
System.out.println("readByte");
try {
byte b = iisI.readByte();
System.out.println("Passed");
} catch (Exception e) {
System.out.println("Failed: unexpected exception " + e);
}
System.out.println("readUnsignedByte");
try {
int b = iisI.readUnsignedByte();
System.out.println("Passed");
} catch (Exception e) {
System.out.println("Failed: unexpected exception " + e);
}
}
}
-------------------log----------------------
% java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b60)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b60, mixed mode)
% java test
readBoolean
Failed: unexpected exception java.io.EOFException
readByte
Failed: unexpected exception java.io.EOFException
readUnsignedByte
Failed: unexpected exception java.io.EOFException
This bug causes failure of the new JCK tests
api/javax_imageio/stream/ImageInputStreamImpl/index.html#readBoolean
api/javax_imageio/stream/ImageInputStreamImpl/index.html#readByte
api/javax_imageio/stream/ImageInputStreamImpl/index.html#readUnsignedByte
======================================================================