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] Created: (HARMONY-663) [classlib][luni] compatibility: unexpected IllegalCharsetNameException for String.getBytes("illegal/name")
Date Mon, 26 Jun 2006 09:16:29 GMT
[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
 Attachments: 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


Mime
View raw message