logo       

bug-to-bug compatibility - another issue: msg#00926

java.harmony.devel

Subject: bug-to-bug compatibility - another issue

Following the discussion before, I have another issue about RI's "bug",

try this little test below:

import java.nio.charset.*;
public class DecoderTest{
public static void main(String[] args){
CharsetDecoder decoder = Charset.forName("utf-8").newDecoder();
decoder.reset();
decoder.flush(CharBuffer.allocate(10));
}
}

It quits quietly on Harmony, while on RI(JDK 5.0/1.4.2), it throws exception like below:
java.lang.IllegalStateException: Current state = RESET, new state = FLUSHED
at java.nio.charset.CharsetDecoder.throwIllegalStateException(Unknown Source)
at java.nio.charset.CharsetDecoder.flush(Unknown Source)
........

But the spec of CharsetDecoder.flush() says:

Throws:
IllegalStateException - If the previous step of the current decoding operation was an invocation neither of the reset method nor of the three-argument decode method with a value of true for the endOfInput parameter

It's so interesting that the spec emphasizes it SHOULD NOT throw IllegalStateException when flush() just after reset().

In fact, this is just one example of contradiction between spec and RI's CharsetDecoder/Encoder internal status implementation. These *bugs* are serious so that the RI's Decoder/Encoder must be used by experiment. Should Harmony be compatible with RI?



--
Paulex Yang
China Software Development Lab
IBM





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise