You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vladimir Ivanov (JIRA)" <ji...@apache.org> on 2006/06/30 08:08:30 UTC

[jira] Commented: (HARMONY-663) [classlib][luni] compatibility: unexpected IllegalCharsetNameException for String.getBytes("illegal/name")

    [ http://issues.apache.org/jira/browse/HARMONY-663?page=comments#action_12418575 ] 

Vladimir Ivanov commented on HARMONY-663:
-----------------------------------------

verified, thanks

> [classlib][luni] compatibility: unexpected IllegalCharsetNameException for String.getBytes("illegal/name")
> ----------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-663
>          URL: http://issues.apache.org/jira/browse/HARMONY-663
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Vladimir Ivanov
>     Assignee: Mikhail Loenko
>  Attachments: String.patch, StringTest.patch
>
> The Harmony method String.getBytes("illegal/name") throws IllegalCharsetNameException while RI throws UnsupportedEncodingException  and the j2se spec says for the getBytes(String charsetName):
> "Throws: UnsupportedEncodingException - If the named charset is not supported"
> No notes about IllegalCharsetNameException.
> ======================= test.java ============================
> import java.io.*;
> public class test {
>     public static void main (String[] args) { 
>         try {
>             "any".getBytes("?Q?D??_??_6ffa?+vG?_?????");
>         } catch (Exception e) { 
> 	    e.printStackTrace();
>             System.out.println("Result: " + e);
>         }    
>    }   
> }
> ==========================================================
> Output:
> C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM  (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> java.io.UnsupportedEncodingException: ?Q?D??_??_6ffa?+vG?_?????§
>         at sun.io.Converters.getConverterClass(ILjava.lang.String;)Ljava.lang.Class;(Converters.java:215)
>         at sun.io.Converters.newConverter(ILjava.lang.String;)Ljava.lang.Object;(Converters.java:248)
>         at sun.io.CharToByteConverter.getConverter(Ljava.lang.String;)Lsun.io.CharToByteConverter;(CharToByteConverter.java:64)
>         at java.lang.StringCoding.getEncoder(Ljava.lang.String;Z)Ljava.lang.StringCoding$StringEncoder;(Unknown Source)
>         at java.lang.StringCoding.encode(Ljava.lang.String;[CII)[B(Unknown Source)
>         at java.lang.String.getBytes(Ljava.lang.String;)[B(Unknown Source)
>         at test.main([Ljava.lang.String;)V(test.java:6)
> Result: java.io.UnsupportedEncodingException: ?Q?D??_??_6ffa?+vG?_?????§
> C:\tmp\tmp17>C:\harmony\trunk_0427\deploy\jdk\jre\bin\java.exe -showversion test
> java version 1.5 (subset)
> (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java.nio.charset.IllegalCharsetNameException: The illegal charset name is "?Q?D??_??_6ffa?+vG?_?????§".
>         at java.nio.charset.Charset.checkCharsetName(Charset.java:242)
>         at java.nio.charset.Charset.forNameInternal(Charset.java:442)
>         at java.nio.charset.Charset.forName(Charset.java:513)
>         at java.lang.String.getCharset(String.java:850)
>         at java.lang.String.getBytes(String.java:838)
>         at test.main(test.java:6)
> Result: java.nio.charset.IllegalCharsetNameException: The illegal charset name is "?Q?D??_??_6ffa?+vG?_?????§".
> C:\tmp\tmp17>

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