Re: [jira] Commented: (HARMONY-33) java.nio.BufferOverflow exception while decoding ByteBuffer with UTF-16 charset
Andrew, thanks for your comments. Looks like the bug in ICU is very simple and I hope it will be fixed in the next ICU release. I just like to reopen harmony-33 to correctly track issue status. At the moment it reproduced with icu4jni3.4 , that's why I asked to reopen. As soon as we get new version of ICU bug should be closed. Thanks. Vladimir. On 5/5/06, Andrew Zhang [EMAIL PROTECTED] wrote: Hi, Vladimir The bug has been raised in ICU bug tracking system serveral months ago[1]. ICU has noticed this bug and will fix the bug in next release version. Thanks. [1] (http://bugs.icu-project.org/cgi-bin/icu-bugs/conversion?id=5074) On 5/4/06, Vladimir Strigun (JIRA) [EMAIL PROTECTED] wrote: [ http://issues.apache.org/jira/browse/HARMONY-33?page=comments#action_12377817] Vladimir Strigun commented on HARMONY-33: - Unfortunately the bug should be reopened. I have the next output with Harmony33 class: java.lang.IllegalArgumentException: The length must be positive. at java.nio.charset.CoderResult.malformedForLength(CoderResult.java :152) at com.ibm.icu4jni.charset.CharsetDecoderICU.implFlush(Unknown Source) at java.nio.charset.CharsetDecoder.flush(CharsetDecoder.java:571) at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:254) at Harmony33.main(Harmony33.java:11) It's not a regression, the problem here is inside implFlush method of CharsetDecoderICU . Corresponding bug was submitted to ICU already: http://bugs.icu-project.org/cgi-bin/icu-bugs?findid=5074 So, we just need to wait until we get new version of ICU library. java.nio.BufferOverflow exception while decoding ByteBuffer with UTF-16 charset --- Key: HARMONY-33 URL: http://issues.apache.org/jira/browse/HARMONY-33 Project: Harmony Type: Bug Components: Classlib Reporter: Vladimir Strigun Assignee: Tim Ellison Priority: Minor If I try to decode ByteBuffer with lengh 1 using UTF-16 decoder unexpected java.nio.BufferOverflow exception occured. Please see testcase below. import java.nio.*; import java.nio.charset.*; import junit.framework.TestCase; public class TestDecoder extends TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(TestDecoder.class); } public static void testDecoder(){ try{ ByteBuffer bb = ByteBuffer.allocate(1); bb.put(0,(byte)77); CharsetDecoder utf16D = Charset.forName (UTF-16).newDecoder(); CharBuffer cb = utf16D.onMalformedInput( CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE ).decode(bb); }catch(Exception e){ fail(Exception occured: +e); } } } Output on RI: . Time: 0,03 OK (1 test) Output with Harmony: .F Time: 0,01 There was 1 failure: 1) testDecoder(TestDecoder)junit.framework.AssertionFailedError: Exception occured: java.nio.BufferOverflowException at TestDecoder.testDecoder(TestDecoder.java:20) at java.lang.reflect.AccessibleObject.invokeV( AccessibleObject.java:211) at TestDecoder.main(TestDecoder.java:10) FAILURES!!! Tests run: 1, Failures: 1, Errors: 0 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira -- Andrew Zhang China Software Development Lab, IBM - Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [jira] Commented: (HARMONY-33) java.nio.BufferOverflow exception while decoding ByteBuffer with UTF-16 charset
Hi, Vladimir The bug has been raised in ICU bug tracking system serveral months ago[1]. ICU has noticed this bug and will fix the bug in next release version. Thanks. [1] (http://bugs.icu-project.org/cgi-bin/icu-bugs/conversion?id=5074) On 5/4/06, Vladimir Strigun (JIRA) [EMAIL PROTECTED] wrote: [ http://issues.apache.org/jira/browse/HARMONY-33?page=comments#action_12377817] Vladimir Strigun commented on HARMONY-33: - Unfortunately the bug should be reopened. I have the next output with Harmony33 class: java.lang.IllegalArgumentException: The length must be positive. at java.nio.charset.CoderResult.malformedForLength(CoderResult.java :152) at com.ibm.icu4jni.charset.CharsetDecoderICU.implFlush(Unknown Source) at java.nio.charset.CharsetDecoder.flush(CharsetDecoder.java:571) at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:254) at Harmony33.main(Harmony33.java:11) It's not a regression, the problem here is inside implFlush method of CharsetDecoderICU . Corresponding bug was submitted to ICU already: http://bugs.icu-project.org/cgi-bin/icu-bugs?findid=5074 So, we just need to wait until we get new version of ICU library. java.nio.BufferOverflow exception while decoding ByteBuffer with UTF-16 charset --- Key: HARMONY-33 URL: http://issues.apache.org/jira/browse/HARMONY-33 Project: Harmony Type: Bug Components: Classlib Reporter: Vladimir Strigun Assignee: Tim Ellison Priority: Minor If I try to decode ByteBuffer with lengh 1 using UTF-16 decoder unexpected java.nio.BufferOverflow exception occured. Please see testcase below. import java.nio.*; import java.nio.charset.*; import junit.framework.TestCase; public class TestDecoder extends TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(TestDecoder.class); } public static void testDecoder(){ try{ ByteBuffer bb = ByteBuffer.allocate(1); bb.put(0,(byte)77); CharsetDecoder utf16D = Charset.forName (UTF-16).newDecoder(); CharBuffer cb = utf16D.onMalformedInput( CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE ).decode(bb); }catch(Exception e){ fail(Exception occured: +e); } } } Output on RI: . Time: 0,03 OK (1 test) Output with Harmony: .F Time: 0,01 There was 1 failure: 1) testDecoder(TestDecoder)junit.framework.AssertionFailedError: Exception occured: java.nio.BufferOverflowException at TestDecoder.testDecoder(TestDecoder.java:20) at java.lang.reflect.AccessibleObject.invokeV( AccessibleObject.java:211) at TestDecoder.main(TestDecoder.java:10) FAILURES!!! Tests run: 1, Failures: 1, Errors: 0 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira -- Andrew Zhang China Software Development Lab, IBM
[jira] Commented: (HARMONY-33) java.nio.BufferOverflow exception while decoding ByteBuffer with UTF-16 charset
[ http://issues.apache.org/jira/browse/HARMONY-33?page=comments#action_12363005 ] Vladimir Strigun commented on HARMONY-33: - The reason of the issue is invocation of put(replacement) method for CharBuffer with zero capacity. First, during decoding byte buffer, char buffer should be created with initial capacity equals to remaining bytes in byte buffer multiplied by average chars per byte value. For the current testcase initial capacity for char buffer is 0 ( int length = (int) (in.remaining() * averChars) ). And when CodingErrorAction = CodingErrorAction.REPLACE decoder try to put replacement string to zero-sized char buffer. Please review fix for the issue (diff for revision 367369 of /incubator/harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java): 405a406,408 if(out.remaining() replace.length() ) { return CoderResult.OVERFLOW; } 407d409 continue; java.nio.BufferOverflow exception while decoding ByteBuffer with UTF-16 charset --- Key: HARMONY-33 URL: http://issues.apache.org/jira/browse/HARMONY-33 Project: Harmony Type: Bug Components: Classlib Reporter: Vladimir Strigun Assignee: Geir Magnusson Jr Priority: Minor If I try to decode ByteBuffer with lengh 1 using UTF-16 decoder unexpected java.nio.BufferOverflow exception occured. Please see testcase below. import java.nio.*; import java.nio.charset.*; import junit.framework.TestCase; public class TestDecoder extends TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(TestDecoder.class); } public static void testDecoder(){ try{ ByteBuffer bb = ByteBuffer.allocate(1); bb.put(0,(byte)77); CharsetDecoder utf16D = Charset.forName(UTF-16).newDecoder(); CharBuffer cb = utf16D.onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE).decode(bb); }catch(Exception e){ fail(Exception occured: +e); } } } Output on RI: . Time: 0,03 OK (1 test) Output with Harmony: .F Time: 0,01 There was 1 failure: 1) testDecoder(TestDecoder)junit.framework.AssertionFailedError: Exception occured: java.nio.BufferOverflowException at TestDecoder.testDecoder(TestDecoder.java:20) at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:211) at TestDecoder.main(TestDecoder.java:10) FAILURES!!! Tests run: 1, Failures: 1, Errors: 0 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira