[ http://issues.apache.org/jira/browse/HARMONY-28?page=all ] Tim Ellison closed HARMONY-28: ------------------------------
Verified by Tatyana. > java.text.RuleBasedCollator. getCollationKey (null) does not return null > ------------------------------------------------------------------------ > > Key: HARMONY-28 > URL: http://issues.apache.org/jira/browse/HARMONY-28 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: tatyana doubtsova > Assignee: Tim Ellison > > Problem details: > j2se1.4.2 specifies that CollationKey java.text. > RuleBasedCollator.getCollationKey(String source) returns a null CollationKey, > if the source String is null. > Code for reproducing Test.java: > import java.text.*; > public class Test { > public static void main(String[] args) { > String source = null; > RuleBasedCollator rbc = null; > String Simple = "< a< b< c< d"; > try { > rbc = new RuleBasedCollator(Simple); > } catch (ParseException e) { > } > CollationKey ck = rbc.getCollationKey(source); > System.out.println(ck == null ? "PASSED" : "FAILED"); > System.out > .println(ck instanceof CollationKey ? "the > instance of CollationKey" > : "not the instance of > CollationKey"); > } > } > Steps to Reproduce: > 1. Build Harmony-14 j2se subset as described in README.txt. > 2. Compile Test.java using BEA 1.4 javac > > javac -d . Test.java > 2. Run java using compatible VM (J9) > > java -showversion Test > Output: > java version 1.4.2 (subset) > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as > applicable. > FAILED > the instance of CollationKey > Output on BEA 1.4.2 to compare with: > PASSED > not the instance of CollationKey > The suggested junit test case: > package org.apache.harmony.tests.java.text; > import java.text.*; > > import junit.framework.TestCase; > public class RuleBasedCollatorTest extends TestCase { > public static void main(String[] args) { > junit.textui.TestRunner.run(RuleBasedCollatorTest.class); > } > public void test_getCollationKey() { > String source = null; > RuleBasedCollator rbc = null; > try { > String Simple = "< a< b< c< d"; > rbc = new RuleBasedCollator(Simple); > } catch (ParseException e) { > fail("Assert 0: Unexpected format exception " + e); > } > CollationKey ck = rbc.getCollationKey(source); > assertTrue("Assert 1: getCollationKey (null) does not return > null", ck == null ); } > } -- 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