harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Ivanov (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-1111) [classlib][lang] unexpected IllegalArgumentException for String(byte[], int, int, String)
Date Wed, 09 Aug 2006 09:24:15 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-1111?page=all ]

Vladimir Ivanov updated HARMONY-1111:
-------------------------------------

    Attachment: CoderResult.patch

patch

> [classlib][lang] unexpected IllegalArgumentException for String(byte[], int, int, String)
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1111
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1111
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vladimir Ivanov
>         Attachments: CoderResult.patch
>
>
> The Harmony method java.lang.String(byte[] bytes, int offset, int length, String charsetName)
 throws IllegalArgumentException while RI creates object.
> ==================== test.java =======================
> import java.nio.charset.Charset;
> public class test  {    
>     public static void main (String [] args) throws Exception {
>         byte [] b = new byte[256];
>         for (int i = 0; i < b.length; i++) {
>             b[i] = (byte)i;
>         }
>         System.out.println("res = " + new String(b, 170, 30, Charset.forName("UTF-8").name()));
>     }
> }
> ==================================================
> Output:
> C:\tmp\tmp17>C:\jrockit-jdk1.5.0-windows-ia32\bin\java.exe -cp . -showversion test
> java version "1.5.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC: System
optimized over throughput (initial strategy singleparpar))
> res = ??????????????????????????????
> C:\tmp\tmp17>C:\harmony\classlib1.5\deploy\jdk\jre\bin\java.exe -cp . -showversion
test
> java version 1.5 (subset)
> (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> Exception in thread "main" 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 java.nio.charset.Charset.decode(Charset.java:690)
>         at java.lang.String.<init>(String.java:352)
>         at test.main(test.java:9)

-- 
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

        

Mime
View raw message