You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Vladimir Strigun <vs...@gmail.com> on 2006/12/14 14:25:21 UTC
Re: svn commit: r487184 - in /harmony/enhanced/classlib/trunk/modules/nio_char/src: main/java/java/nio/charset/CharsetDecoder.java test/java/tests/api/java/nio/charset/CharsetDecoderTest.java
Hi Richard,
Could you please clarify why the position should be incremented in
case of malformed input. According the spec the position could be
incremented:
"The malformed bytes begin at the input buffer's (possibly
incremented) position; the number of malformed bytes may be determined
by invoking the result object's length method"
But with your commit 3 tests failed on RI:
testDecodeByteBufferException
testDecodeCharBufferByteBufferbooleanExceptionTrue
testDecodeCharBufferByteBufferbooleanExceptionFalse
Of course the tests passes with J9 and DRLVM.
Thanks,
Vladimir.
On 12/14/06, liangyx@apache.org <li...@apache.org> wrote:
> Author: liangyx
> Date: Thu Dec 14 04:02:41 2006
> New Revision: 487184
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=487184
> Log:
> When ICU repports a malformed-input result, the input buffer's position is incremented
>
> Modified:
> harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java
> harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java
>
> Modified: harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java?view=diff&rev=487184&r1=487183&r2=487184
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java (original)
> +++ harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java Thu Dec 14 04:02:41 2006
> @@ -388,6 +388,7 @@
> int remaining = in.remaining();
> if (endOfInput && remaining > 0) {
> result = CoderResult.malformedForLength(remaining);
> + in.position(in.position() + result.length());
> } else {
> status = endOfInput ? END : ONGOING;
> return result;
> @@ -411,7 +412,9 @@
> if (action != CodingErrorAction.IGNORE)
> return result;
> }
> - in.position(in.position() + result.length());
> + if (!result.isMalformed()) {
> + in.position(in.position() + result.length());
> + }
> }
> }
>
>
> Modified: harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java?view=diff&rev=487184&r1=487183&r2=487184
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java (original)
> +++ harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java Thu Dec 14 04:02:41 2006
> @@ -717,7 +717,7 @@
> String result = new String(input);
> if (result.startsWith("malform")) {
> // reset the cursor to the error position
> - in.position(inPosition);
> + in.position(inPosition + "malform".length());
> // set the error length
> return CoderResult.malformedForLength("malform".length());
> } else if (result.startsWith("unmap")) {
>
>
>