[jira] Commented: (HARMONY-64) java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-"
[ http://issues.apache.org/jira/browse/HARMONY-64?page=comments#action_12367029 ] Svetlana Samoilenko commented on HARMONY-64: Tim, I have no objection. Let's wait. > java.nio.charset.Charset.forName(String name) does not throw > UnsupportedCharsetException if valid name starts with "x-" > --- > > Key: HARMONY-64 > URL: http://issues.apache.org/jira/browse/HARMONY-64 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Svetlana Samoilenko > Assignee: Tim Ellison > Attachments: ICUInterface34.dll, libICUInterface34.so > > According to j2se 1.4.2 specification for Charset forName(String charsetName) > the method must throw UnsupportedCharsetException "if no support for the > named charset is available in this instance of the Java virtual machine". The > method does not throw exception if a unsupported name started with "x-". For > example, the method throws an exception for not supported name "xyz", but > does not for "x-yz". > Code to reproduce: > import java.nio.charset.*; > public class test2 { > public static void main (String[] args) { > try{ > Charset ch=Charset.forName("x-yz"); > System.out.println("***BAD. UnsupportedCharsetException must be > thrown instead of creating "+ch); > } catch (UnsupportedCharsetException e) { > System.out.println("***OK. Expected UnsupportedCharsetException " > + e); > } > } > } > Steps to Reproduce: > 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in > README.txt. > 2. Compile test2.java using BEA 1.4 javac > > javac -d . test2.java > 3. Run java using compatible VM (J9) > > java -showversion test2 > Output: > C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 > 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) > ***OK. Expected UnsupportedCharsetException > java.nio.charset.UnsupportedCharsetException: x-yz > C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as > applicable. > ***BAD. UnsupportedCharsetException must be thrown instead of creating > Charset[x-yz] > Suggested junit test case: > CharsetTest.java > - > import java.nio.charset.*; > import junit.framework.*; > public class CharsetTest extends TestCase { > public static void main(String[] args) { > junit.textui.TestRunner.run(CharsetTest.class); > } > public void test_forName() { > try { > Charset ch=Charset.forName("x-yz"); > fail("Assert 0: UnsupportedCharsetException must be thrown > instead of creating: " + ch); > } catch (UnsupportedCharsetException e) { > } >} > } -- 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] Commented: (HARMONY-64) java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-"
[ http://issues.apache.org/jira/browse/HARMONY-64?page=comments#action_12367024 ] Tim Ellison commented on HARMONY-64: Svetlana, We have decided to defer this fix until the next official release of ICU4JNI becomes available. Let us know if this is a problem. Thanks Tim > java.nio.charset.Charset.forName(String name) does not throw > UnsupportedCharsetException if valid name starts with "x-" > --- > > Key: HARMONY-64 > URL: http://issues.apache.org/jira/browse/HARMONY-64 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Svetlana Samoilenko > Assignee: Tim Ellison > Attachments: ICUInterface34.dll, libICUInterface34.so > > According to j2se 1.4.2 specification for Charset forName(String charsetName) > the method must throw UnsupportedCharsetException "if no support for the > named charset is available in this instance of the Java virtual machine". The > method does not throw exception if a unsupported name started with "x-". For > example, the method throws an exception for not supported name "xyz", but > does not for "x-yz". > Code to reproduce: > import java.nio.charset.*; > public class test2 { > public static void main (String[] args) { > try{ > Charset ch=Charset.forName("x-yz"); > System.out.println("***BAD. UnsupportedCharsetException must be > thrown instead of creating "+ch); > } catch (UnsupportedCharsetException e) { > System.out.println("***OK. Expected UnsupportedCharsetException " > + e); > } > } > } > Steps to Reproduce: > 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in > README.txt. > 2. Compile test2.java using BEA 1.4 javac > > javac -d . test2.java > 3. Run java using compatible VM (J9) > > java -showversion test2 > Output: > C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 > 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) > ***OK. Expected UnsupportedCharsetException > java.nio.charset.UnsupportedCharsetException: x-yz > C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as > applicable. > ***BAD. UnsupportedCharsetException must be thrown instead of creating > Charset[x-yz] > Suggested junit test case: > CharsetTest.java > - > import java.nio.charset.*; > import junit.framework.*; > public class CharsetTest extends TestCase { > public static void main(String[] args) { > junit.textui.TestRunner.run(CharsetTest.class); > } > public void test_forName() { > try { > Charset ch=Charset.forName("x-yz"); > fail("Assert 0: UnsupportedCharsetException must be thrown > instead of creating: " + ch); > } catch (UnsupportedCharsetException e) { > } >} > } -- 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
Re: [jira] Commented: (HARMONY-64) java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-"
Hello Tim, Agree. We can defer this issue to icu4jni's next release. And yes, I will have a look at icu4j 3.4.2. :-) Richard Liang China Software Development Lab, IBM Tim Ellison wrote: BTW: I see there is an ICU4J 3.4.2 available now -- we may want to grab that. Regards, Tim Richard Liang wrote: Hello Tim, Sorry for my carelessness :-) The "icu4jni's latest code" is the CVS HEAD checked out on Feb. 16, 2006. There is no new icu4jni release since version 3.4. Richard Liang China Software Development Lab, IBM Tim Ellison (JIRA) wrote: [ http://issues.apache.org/jira/browse/HARMONY-64?page=comments#action_12366796 ] Tim Ellison commented on HARMONY-64: Richard, When you say "icu4jni's latest code" can you be more specific? Was this HEAD or a release ... ? We need to know exactly what it contains before deciding whether to use it. Thanks, Tim java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-" --- Key: HARMONY-64 URL: http://issues.apache.org/jira/browse/HARMONY-64 Project: Harmony Type: Bug Components: Classlib Reporter: Svetlana Samoilenko Assignee: Tim Ellison Attachments: ICUInterface34.dll, libICUInterface34.so According to j2se 1.4.2 specification for Charset forName(String charsetName) the method must throw UnsupportedCharsetException "if no support for the named charset is available in this instance of the Java virtual machine". The method does not throw exception if a unsupported name started with "x-". For example, the method throws an exception for not supported name "xyz", but does not for "x-yz". Code to reproduce: import java.nio.charset.*; public class test2 { public static void main (String[] args) { try{ Charset ch=Charset.forName("x-yz"); System.out.println("***BAD. UnsupportedCharsetException must be thrown instead of creating "+ch); } catch (UnsupportedCharsetException e) { System.out.println("***OK. Expected UnsupportedCharsetException " + e); } } } Steps to Reproduce: 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 2. Compile test2.java using BEA 1.4 javac javac -d . test2.java 3. Run java using compatible VM (J9) java -showversion test2 Output: C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 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) ***OK. Expected UnsupportedCharsetException java.nio.charset.UnsupportedCharsetException: x-yz C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. ***BAD. UnsupportedCharsetException must be thrown instead of creating Charset[x-yz] Suggested junit test case: CharsetTest.java - import java.nio.charset.*; import junit.framework.*; public class CharsetTest extends TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(CharsetTest.class); } public void test_forName() { try { Charset ch=Charset.forName("x-yz"); fail("Assert 0: UnsupportedCharsetException must be thrown instead of creating: " + ch); } catch (UnsupportedCharsetException e) { } } }
Re: [jira] Commented: (HARMONY-64) java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-"
BTW: I see there is an ICU4J 3.4.2 available now -- we may want to grab that. Regards, Tim Richard Liang wrote: > Hello Tim, > > Sorry for my carelessness :-) The "icu4jni's latest code" is the CVS > HEAD checked out on Feb. 16, 2006. There is no new icu4jni release since > version 3.4. > > Richard Liang > China Software Development Lab, IBM > > > > Tim Ellison (JIRA) wrote: >> [ >> http://issues.apache.org/jira/browse/HARMONY-64?page=comments#action_12366796 >> ] >> Tim Ellison commented on HARMONY-64: >> >> >> Richard, >> >> When you say "icu4jni's latest code" can you be more specific? Was >> this HEAD or a release ... ? >> We need to know exactly what it contains before deciding whether to >> use it. >> >> Thanks, >> Tim >> >> >>> java.nio.charset.Charset.forName(String name) does not throw >>> UnsupportedCharsetException if valid name starts with "x-" >>> --- >>> >>> >>> Key: HARMONY-64 >>> URL: http://issues.apache.org/jira/browse/HARMONY-64 >>> Project: Harmony >>> Type: Bug >>> Components: Classlib >>> Reporter: Svetlana Samoilenko >>> Assignee: Tim Ellison >>> Attachments: ICUInterface34.dll, libICUInterface34.so >>> >>> According to j2se 1.4.2 specification for Charset forName(String >>> charsetName) the method must throw UnsupportedCharsetException "if >>> no support for the named charset is available in this instance of the >>> Java virtual machine". The method does not throw exception if a >>> unsupported name started with "x-". For example, the method throws an >>> exception for not supported name "xyz", but does not for "x-yz". >>> Code to reproduce: import java.nio.charset.*; public class test2 { >>> public static void main (String[] args) { >>> try{ >>> Charset ch=Charset.forName("x-yz"); >>> System.out.println("***BAD. UnsupportedCharsetException >>> must be thrown instead of creating "+ch); } catch >>> (UnsupportedCharsetException e) { >>> System.out.println("***OK. Expected UnsupportedCharsetException " + >>> e); } >>> } } >>> Steps to Reproduce: 1. Build Harmony (check-out on 2006-01-30) j2se >>> subset as described in README.txt. 2. Compile test2.java using BEA >>> 1.4 javac javac -d . test2.java >>> 3. Run java using compatible VM (J9) java -showversion test2 >>> Output: C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion >>> test2 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) ***OK. Expected UnsupportedCharsetException >>> java.nio.charset.UnsupportedCharsetException: x-yz >>> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 (c) >>> Copyright 1991, 2005 The Apache Software Foundation or its licensors, >>> as applicable. ***BAD. UnsupportedCharsetException must be thrown >>> instead of creating Charset[x-yz] >>> Suggested junit test case: >>> CharsetTest.java >>> - import >>> java.nio.charset.*; import junit.framework.*; public class >>> CharsetTest extends TestCase { public static void main(String[] >>> args) { junit.textui.TestRunner.run(CharsetTest.class); } >>> public void test_forName() { try { >>> Charset ch=Charset.forName("x-yz"); >>> fail("Assert 0: UnsupportedCharsetException must be >>> thrown instead of creating: " + ch); } catch >>> (UnsupportedCharsetException e) { >>> } >>>} } >>> >> >> > -- Tim Ellison ([EMAIL PROTECTED]) IBM Java technology centre, UK.
Re: [jira] Commented: (HARMONY-64) java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-"
Richard Liang wrote: > Hello Tim, > > Sorry for my carelessness :-) The "icu4jni's latest code" is the CVS > HEAD checked out on Feb. 16, 2006. There is no new icu4jni release since > version 3.4. Not a problem. So do people think we should take HEAD from ICU4JNI to fix this problem, or wait for the next ICU release? Unless this bug is hurting somebody I'm inclined to defer it, since I'm assuming HEAD is the code du jour, and we probably only want the stable stuff! (no slur on the good folk at ICU, obviously) Regards, Tim > Tim Ellison (JIRA) wrote: >> [ >> http://issues.apache.org/jira/browse/HARMONY-64?page=comments#action_12366796 >> ] >> Tim Ellison commented on HARMONY-64: >> >> >> Richard, >> >> When you say "icu4jni's latest code" can you be more specific? Was >> this HEAD or a release ... ? >> We need to know exactly what it contains before deciding whether to >> use it. >> >> Thanks, >> Tim >> >> >>> java.nio.charset.Charset.forName(String name) does not throw >>> UnsupportedCharsetException if valid name starts with "x-" >>> --- >>> >>> >>> Key: HARMONY-64 >>> URL: http://issues.apache.org/jira/browse/HARMONY-64 >>> Project: Harmony >>> Type: Bug >>> Components: Classlib >>> Reporter: Svetlana Samoilenko >>> Assignee: Tim Ellison >>> Attachments: ICUInterface34.dll, libICUInterface34.so >>> >>> According to j2se 1.4.2 specification for Charset forName(String >>> charsetName) the method must throw UnsupportedCharsetException "if >>> no support for the named charset is available in this instance of the >>> Java virtual machine". The method does not throw exception if a >>> unsupported name started with "x-". For example, the method throws an >>> exception for not supported name "xyz", but does not for "x-yz". >>> Code to reproduce: import java.nio.charset.*; public class test2 { >>> public static void main (String[] args) { >>> try{ >>> Charset ch=Charset.forName("x-yz"); >>> System.out.println("***BAD. UnsupportedCharsetException >>> must be thrown instead of creating "+ch); } catch >>> (UnsupportedCharsetException e) { >>> System.out.println("***OK. Expected UnsupportedCharsetException " + >>> e); } >>> } } >>> Steps to Reproduce: 1. Build Harmony (check-out on 2006-01-30) j2se >>> subset as described in README.txt. 2. Compile test2.java using BEA >>> 1.4 javac javac -d . test2.java >>> 3. Run java using compatible VM (J9) java -showversion test2 >>> Output: C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion >>> test2 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) ***OK. Expected UnsupportedCharsetException >>> java.nio.charset.UnsupportedCharsetException: x-yz >>> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 (c) >>> Copyright 1991, 2005 The Apache Software Foundation or its licensors, >>> as applicable. ***BAD. UnsupportedCharsetException must be thrown >>> instead of creating Charset[x-yz] >>> Suggested junit test case: >>> CharsetTest.java >>> - import >>> java.nio.charset.*; import junit.framework.*; public class >>> CharsetTest extends TestCase { public static void main(String[] >>> args) { junit.textui.TestRunner.run(CharsetTest.class); } >>> public void test_forName() { try { >>> Charset ch=Charset.forName("x-yz"); >>> fail("Assert 0: UnsupportedCharsetException must be >>> thrown instead of creating: " + ch); } catch >>> (UnsupportedCharsetException e) { >>> } >>>} } >>> >> >> > -- Tim Ellison ([EMAIL PROTECTED]) IBM Java technology centre, UK.
Re: [jira] Commented: (HARMONY-64) java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-"
Hello Tim, Sorry for my carelessness :-) The "icu4jni's latest code" is the CVS HEAD checked out on Feb. 16, 2006. There is no new icu4jni release since version 3.4. Richard Liang China Software Development Lab, IBM Tim Ellison (JIRA) wrote: [ http://issues.apache.org/jira/browse/HARMONY-64?page=comments#action_12366796 ] Tim Ellison commented on HARMONY-64: Richard, When you say "icu4jni's latest code" can you be more specific? Was this HEAD or a release ... ? We need to know exactly what it contains before deciding whether to use it. Thanks, Tim java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-" --- Key: HARMONY-64 URL: http://issues.apache.org/jira/browse/HARMONY-64 Project: Harmony Type: Bug Components: Classlib Reporter: Svetlana Samoilenko Assignee: Tim Ellison Attachments: ICUInterface34.dll, libICUInterface34.so According to j2se 1.4.2 specification for Charset forName(String charsetName) the method must throw UnsupportedCharsetException "if no support for the named charset is available in this instance of the Java virtual machine". The method does not throw exception if a unsupported name started with "x-". For example, the method throws an exception for not supported name "xyz", but does not for "x-yz". Code to reproduce: import java.nio.charset.*; public class test2 { public static void main (String[] args) { try{ Charset ch=Charset.forName("x-yz"); System.out.println("***BAD. UnsupportedCharsetException must be thrown instead of creating "+ch); } catch (UnsupportedCharsetException e) { System.out.println("***OK. Expected UnsupportedCharsetException " + e); } } } Steps to Reproduce: 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 2. Compile test2.java using BEA 1.4 javac javac -d . test2.java 3. Run java using compatible VM (J9) java -showversion test2 Output: C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 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) ***OK. Expected UnsupportedCharsetException java.nio.charset.UnsupportedCharsetException: x-yz C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. ***BAD. UnsupportedCharsetException must be thrown instead of creating Charset[x-yz] Suggested junit test case: CharsetTest.java - import java.nio.charset.*; import junit.framework.*; public class CharsetTest extends TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(CharsetTest.class); } public void test_forName() { try { Charset ch=Charset.forName("x-yz"); fail("Assert 0: UnsupportedCharsetException must be thrown instead of creating: " + ch); } catch (UnsupportedCharsetException e) { } } }
[jira] Commented: (HARMONY-64) java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-"
[ http://issues.apache.org/jira/browse/HARMONY-64?page=comments#action_12366796 ] Tim Ellison commented on HARMONY-64: Richard, When you say "icu4jni's latest code" can you be more specific? Was this HEAD or a release ... ? We need to know exactly what it contains before deciding whether to use it. Thanks, Tim > java.nio.charset.Charset.forName(String name) does not throw > UnsupportedCharsetException if valid name starts with "x-" > --- > > Key: HARMONY-64 > URL: http://issues.apache.org/jira/browse/HARMONY-64 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Svetlana Samoilenko > Assignee: Tim Ellison > Attachments: ICUInterface34.dll, libICUInterface34.so > > According to j2se 1.4.2 specification for Charset forName(String charsetName) > the method must throw UnsupportedCharsetException "if no support for the > named charset is available in this instance of the Java virtual machine". The > method does not throw exception if a unsupported name started with "x-". For > example, the method throws an exception for not supported name "xyz", but > does not for "x-yz". > Code to reproduce: > import java.nio.charset.*; > public class test2 { > public static void main (String[] args) { > try{ > Charset ch=Charset.forName("x-yz"); > System.out.println("***BAD. UnsupportedCharsetException must be > thrown instead of creating "+ch); > } catch (UnsupportedCharsetException e) { > System.out.println("***OK. Expected UnsupportedCharsetException " > + e); > } > } > } > Steps to Reproduce: > 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in > README.txt. > 2. Compile test2.java using BEA 1.4 javac > > javac -d . test2.java > 3. Run java using compatible VM (J9) > > java -showversion test2 > Output: > C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 > 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) > ***OK. Expected UnsupportedCharsetException > java.nio.charset.UnsupportedCharsetException: x-yz > C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as > applicable. > ***BAD. UnsupportedCharsetException must be thrown instead of creating > Charset[x-yz] > Suggested junit test case: > CharsetTest.java > - > import java.nio.charset.*; > import junit.framework.*; > public class CharsetTest extends TestCase { > public static void main(String[] args) { > junit.textui.TestRunner.run(CharsetTest.class); > } > public void test_forName() { > try { > Charset ch=Charset.forName("x-yz"); > fail("Assert 0: UnsupportedCharsetException must be thrown > instead of creating: " + ch); > } catch (UnsupportedCharsetException e) { > } >} > } -- 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] Commented: (HARMONY-64) java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-"
[ http://issues.apache.org/jira/browse/HARMONY-64?page=comments#action_12364882 ] Tim Ellison commented on HARMONY-64: This behaviour originates from the ICU provider code, I'll see what they say about it first: http://bugs.icu-project.org/cgi-bin/icu-bugs/incoming?findid=5027 > java.nio.charset.Charset.forName(String name) does not throw > UnsupportedCharsetException if valid name starts with "x-" > --- > > Key: HARMONY-64 > URL: http://issues.apache.org/jira/browse/HARMONY-64 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Svetlana Samoilenko > Assignee: Tim Ellison > > According to j2se 1.4.2 specification for Charset forName(String charsetName) > the method must throw UnsupportedCharsetException "if no support for the > named charset is available in this instance of the Java virtual machine". The > method does not throw exception if a unsupported name started with "x-". For > example, the method throws an exception for not supported name "xyz", but > does not for "x-yz". > Code to reproduce: > import java.nio.charset.*; > public class test2 { > public static void main (String[] args) { > try{ > Charset ch=Charset.forName("x-yz"); > System.out.println("***BAD. UnsupportedCharsetException must be > thrown instead of creating "+ch); > } catch (UnsupportedCharsetException e) { > System.out.println("***OK. Expected UnsupportedCharsetException " > + e); > } > } > } > Steps to Reproduce: > 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in > README.txt. > 2. Compile test2.java using BEA 1.4 javac > > javac -d . test2.java > 3. Run java using compatible VM (J9) > > java -showversion test2 > Output: > C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 > 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) > ***OK. Expected UnsupportedCharsetException > java.nio.charset.UnsupportedCharsetException: x-yz > C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as > applicable. > ***BAD. UnsupportedCharsetException must be thrown instead of creating > Charset[x-yz] > Suggested junit test case: > CharsetTest.java > - > import java.nio.charset.*; > import junit.framework.*; > public class CharsetTest extends TestCase { > public static void main(String[] args) { > junit.textui.TestRunner.run(CharsetTest.class); > } > public void test_forName() { > try { > Charset ch=Charset.forName("x-yz"); > fail("Assert 0: UnsupportedCharsetException must be thrown > instead of creating: " + ch); > } catch (UnsupportedCharsetException e) { > } >} > } -- 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