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/08/31 11:42:22 UTC
[jira] Created: (HARMONY-1360) [classlib][nio charset]
Charset.forName() returns different value vs Charset.availableCharsets()
[classlib][nio charset] Charset.forName() returns different value vs Charset.availableCharsets()
-------------------------------------------------------------------------------------------------
Key: HARMONY-1360
URL: http://issues.apache.org/jira/browse/HARMONY-1360
Project: Harmony
Issue Type: Bug
Components: Classlib
Reporter: Vladimir Ivanov
The spec says for the method Charset.availableCharsets(): "In the absence of such changes (dynamically load of new charset providers), the charsets returned by this method are exactly those that can be retrieved via the forName method.
It works on RI but fails on Harmony.
================= test.java =======================
import java.util.SortedMap;
import java.nio.charset.Charset;
public class test {
public static void main(String args[]) {
SortedMap allCharsets = Charset.availableCharsets();
Object[] names = allCharsets.keySet().toArray();
for (int i = 0; i < names.length; ++i){
Charset _chset = (Charset) allCharsets.get(names[i]);
Charset chset = Charset.forName((String) names[i]);
if (!chset.name().equals(_chset.name())){
System.out.println("forName(" + names[i] + ") returned '" +
chset + "', instead of '" + _chset + "'");
}
}
System.out.println("END");
}
}
===============================================
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))
END
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.
forName(KSC_5601) returned 'Charset[EUC-KR]', instead of 'Charset[KSC_5601]'
END
--
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
[jira] Updated: (HARMONY-1360) [classlib][nio charset]
Charset.forName() returns different value vs Charset.availableCharsets()
Posted by "Vladimir Ivanov (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1360?page=all ]
Vladimir Ivanov updated HARMONY-1360:
-------------------------------------
Attachment: CharsetTest.patch
unit test
> [classlib][nio charset] Charset.forName() returns different value vs Charset.availableCharsets()
> -------------------------------------------------------------------------------------------------
>
> Key: HARMONY-1360
> URL: http://issues.apache.org/jira/browse/HARMONY-1360
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Vladimir Ivanov
> Attachments: CharsetTest.patch
>
>
> The spec says for the method Charset.availableCharsets(): "In the absence of such changes (dynamically load of new charset providers), the charsets returned by this method are exactly those that can be retrieved via the forName method.
> It works on RI but fails on Harmony.
> ================= test.java =======================
> import java.util.SortedMap;
> import java.nio.charset.Charset;
> public class test {
> public static void main(String args[]) {
> SortedMap allCharsets = Charset.availableCharsets();
> Object[] names = allCharsets.keySet().toArray();
> for (int i = 0; i < names.length; ++i){
> Charset _chset = (Charset) allCharsets.get(names[i]);
> Charset chset = Charset.forName((String) names[i]);
> if (!chset.name().equals(_chset.name())){
> System.out.println("forName(" + names[i] + ") returned '" +
> chset + "', instead of '" + _chset + "'");
> }
> }
> System.out.println("END");
> }
> }
> ===============================================
> 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))
> END
> 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.
> forName(KSC_5601) returned 'Charset[EUC-KR]', instead of 'Charset[KSC_5601]'
> END
--
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