harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulex Yang (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-173) java.nio.charset.CharsetEncoder.encode method does not reserve remaining bytes for next invocation.
Date Wed, 08 Mar 2006 06:04:49 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-173?page=all ]

Paulex Yang updated HARMONY-173:

    Attachment: CharsetEncoder_patch_173.txt

pls. try the patches, thx.

> java.nio.charset.CharsetEncoder.encode method does not reserve remaining bytes for next
> ---------------------------------------------------------------------------------------------------
>          Key: HARMONY-173
>          URL: http://issues.apache.org/jira/browse/HARMONY-173
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Richard Liang
>  Attachments: CharsetEncoderTest_patch_173.txt, CharsetEncoder_patch_173.txt
> Method 
> public final CoderResult encode(CharBuffer in,
>                                 ByteBuffer out,
>                                 boolean endOfInput)
> Considering that there is a supplemental character which represents by 4 bytes like "\ud800\udc00",
and it was divided into two input buffers. e.g. "\ud800" is at the end of input1 and the "\udc00"
is at the begining of input2. when invoking the method encode(input1,out,false), it deals
with "\ud800" as a malformed charactor and I think it should be reversed for next invocation
like encode(input2,out,true).
> And it aslo must be handled correspondingly in method public final ByteBuffer encode(CharBuffer
> ===Test segment to reproduce the bug (fail on RI 5.0 and Harmony. I think it's also a
bug for RI 5.0)
> 		CharsetEncoder encoder = Charset.forName("utf-8").newEncoder();
> 		CharBuffer in1 = CharBuffer.wrap("\ud800");
> 		CharBuffer in2 = CharBuffer.wrap("\udc00");
> 		ByteBuffer out = ByteBuffer.allocate(4);
> 		encoder.reset();
> 		CoderResult result = encoder.encode(in1, out, false);
> 		assertEquals(4, out.remaining());
> 		assertTrue(result.isUnderflow());
> 		result = encoder.encode(in2, out, true);
> 		assertEquals(0, out.remaining());
> 		assertTrue(result.isUnderflow());

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message