-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta3
-
generic
-
generic
Name: ipR10067 Date: 09/03/2001
The method ImageOutputStreamImpl.writeBit() throws IndexOutOfBoundsException
after setBitOffset() method invocation with non-zero bit offset.
Whet bit offset is zero it works fine.
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) {
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
MemoryCacheImageOutputStream iosI = new MemoryCacheImageOutputStream(ostream);
try {
/* work around
iosI.setBitOffset(0);
iosI.writeBit(0);
*/
iosI.setBitOffset(2);
iosI.writeBit(1);
System.out.println("third bit has been set successfully!");
} catch (IOException e) {
System.out.println("Failed: unxepected Exception: " + e);
}
}
}
-----------------------------------------
% javac test.java
% java -version
novo50% java -version
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b78)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b78, mixed mode)
% java test
Exception in thread "main" java.lang.IndexOutOfBoundsException: pos < flushedPos!
at javax.imageio.stream.ImageInputStreamImpl.seek(ImageInputStreamImpl.java:732)
at javax.imageio.stream.ImageOutputStreamImpl.writeBits(ImageOutputStreamImpl.java:389)
at javax.imageio.stream.ImageOutputStreamImpl.writeBit(ImageOutputStreamImpl.java:372)
at test.main(test.java:14)
======================================================================
- relates to
-
JDK-4465683 method flushBits() works incorrectly after setBitOffset(int)
- Closed