Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 52889 invoked from network); 12 Dec 2006 12:23:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2006 12:23:17 -0000 Received: (qmail 9531 invoked by uid 500); 12 Dec 2006 12:23:23 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 9509 invoked by uid 500); 12 Dec 2006 12:23:23 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 9500 invoked by uid 99); 12 Dec 2006 12:23:23 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Dec 2006 04:23:23 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Dec 2006 04:22:51 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 05E9B7141D1 for ; Tue, 12 Dec 2006 04:22:23 -0800 (PST) Message-ID: <12433344.1165926143021.JavaMail.jira@brutus> Date: Tue, 12 Dec 2006 04:22:23 -0800 (PST) From: "Alexei Zakharov (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-64) [classlib][nio charset] java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/HARMONY-64?page=all ] Alexei Zakharov updated HARMONY-64: ----------------------------------- Summary: [classlib][nio charset] java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-" (was: [classlib][nio] java.nio.charset.Charset.forName(String name) does not throw UnsupportedCharsetException if valid name starts with "x-") > [classlib][nio charset] 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 > Issue Type: Bug > Components: Classlib > Reporter: Svetlana Samoilenko > Assigned To: 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