You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "tatyana doubtsova (JIRA)" <ji...@apache.org> on 2006/01/17 06:59:42 UTC
[jira] Created: (HARMONY-32)
java.text.Collator.setDecomposition(FULL_DECOMPOSITION) throws
IllegalArgumentException
java.text.Collator.setDecomposition(FULL_DECOMPOSITION) throws IllegalArgumentException
----------------------------------------------------------------------------------------
Key: HARMONY-32
URL: http://issues.apache.org/jira/browse/HARMONY-32
Project: Harmony
Type: Bug
Components: Classlib
Reporter: tatyana doubtsova
Assigned to: Geir Magnusson Jr
Code for reproducing Test.java:
import java.text.Collator;
import java.util.Locale;
public class Test {
public static void main (String[] args) {
Collator c = Collator.getInstance(Locale.US);
c.setDecomposition(Collator.FULL_DECOMPOSITION);
int decompositionMode = c.getDecomposition();
System.out.println("decomposition Mode is " + decompositionMode);
}
}
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.
Exception in thread "main" java.lang.IllegalArgumentException: Wrong decomposition mode.
at com.ibm.icu.text.Collator.setDecomposition(Collator.java:295)
at java.text.Collator.setDecomposition(Collator.java:277)
at Test.main(Test.java:7)
Output on BEA 1.4.2:
decomposition Mode is 2
Suggested junit test case:
package org.apache.harmony.tests.java.text;
import java.text.Collator;
import java.util.Locale;
import junit.framework.TestCase;
public class CollatorTest extends TestCase {
public static void main(String[] args) {
junit.textui.TestRunner.run(CollatorTest.class);
}
public void test_setDecomposition() {
Collator c = Collator.getInstance(Locale.US);
try {
c.setDecomposition(Collator.FULL_DECOMPOSITION);
} catch (Exception e) {
fail("Assert 0: Unexpected exception " + e);
}
int decompositionMode = c.getDecomposition();
assertTrue("Assert 1: next() returns incorrect value " + decompositionMode, decompositionMode == Collator.FULL_DECOMPOSITION );
}
}
--
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-32)
java.text.Collator.setDecomposition(FULL_DECOMPOSITION) throws
IllegalArgumentException
Posted by "Richard Liang (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-32?page=comments#action_12363208 ]
Richard Liang commented on HARMONY-32:
--------------------------------------
Having a looking at the javadoc of com.ibm.icu.text.Collator, I find that icu4j's collator officially supports only two decomposition mode: CANONICAL_DECOMPOSITION and NO_DECOMPOSITION. (FULL_DECOMPOSITION is in Deprecated status).
For this issue, throwing a more specific expcetion such as *NotYetImplementedException* may be a better solution.
Any comment?
Thanks a lot.
> java.text.Collator.setDecomposition(FULL_DECOMPOSITION) throws IllegalArgumentException
> ----------------------------------------------------------------------------------------
>
> Key: HARMONY-32
> URL: http://issues.apache.org/jira/browse/HARMONY-32
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: tatyana doubtsova
> Assignee: Geir Magnusson Jr
>
> Code for reproducing Test.java:
> import java.text.Collator;
> import java.util.Locale;
> public class Test {
> public static void main (String[] args) {
> Collator c = Collator.getInstance(Locale.US);
> c.setDecomposition(Collator.FULL_DECOMPOSITION);
> int decompositionMode = c.getDecomposition();
> System.out.println("decomposition Mode is " + decompositionMode);
> }
> }
> 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.
> Exception in thread "main" java.lang.IllegalArgumentException: Wrong decomposition mode.
> at com.ibm.icu.text.Collator.setDecomposition(Collator.java:295)
> at java.text.Collator.setDecomposition(Collator.java:277)
> at Test.main(Test.java:7)
> Output on BEA 1.4.2:
> decomposition Mode is 2
> Suggested junit test case:
> package org.apache.harmony.tests.java.text;
> import java.text.Collator;
> import java.util.Locale;
> import junit.framework.TestCase;
> public class CollatorTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(CollatorTest.class);
> }
>
> public void test_setDecomposition() {
> Collator c = Collator.getInstance(Locale.US);
> try {
> c.setDecomposition(Collator.FULL_DECOMPOSITION);
> } catch (Exception e) {
> fail("Assert 0: Unexpected exception " + e);
> }
> int decompositionMode = c.getDecomposition();
> assertTrue("Assert 1: next() returns incorrect value " + decompositionMode, decompositionMode == Collator.FULL_DECOMPOSITION );
> }
> }
--
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-32)
java.text.Collator.setDecomposition(FULL_DECOMPOSITION) throws
IllegalArgumentException
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-32?page=comments#action_12362993 ]
Tim Ellison commented on HARMONY-32:
------------------------------------
This is an easy one for somebody to pick-off.
As a hint, take a look at the table here:
http://java.sun.com/j2se/1.5.0/docs/api/constant-values.html#java.text.Collator.CANONICAL_DECOMPOSITION
compared to:
http://icu.sourceforge.net/apiref/icu4j/constant-values.html#com.ibm.icu.text.Collator.CANONICAL_DECOMPOSITION
> java.text.Collator.setDecomposition(FULL_DECOMPOSITION) throws IllegalArgumentException
> ----------------------------------------------------------------------------------------
>
> Key: HARMONY-32
> URL: http://issues.apache.org/jira/browse/HARMONY-32
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: tatyana doubtsova
> Assignee: Geir Magnusson Jr
>
> Code for reproducing Test.java:
> import java.text.Collator;
> import java.util.Locale;
> public class Test {
> public static void main (String[] args) {
> Collator c = Collator.getInstance(Locale.US);
> c.setDecomposition(Collator.FULL_DECOMPOSITION);
> int decompositionMode = c.getDecomposition();
> System.out.println("decomposition Mode is " + decompositionMode);
> }
> }
> 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.
> Exception in thread "main" java.lang.IllegalArgumentException: Wrong decomposition mode.
> at com.ibm.icu.text.Collator.setDecomposition(Collator.java:295)
> at java.text.Collator.setDecomposition(Collator.java:277)
> at Test.main(Test.java:7)
> Output on BEA 1.4.2:
> decomposition Mode is 2
> Suggested junit test case:
> package org.apache.harmony.tests.java.text;
> import java.text.Collator;
> import java.util.Locale;
> import junit.framework.TestCase;
> public class CollatorTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(CollatorTest.class);
> }
>
> public void test_setDecomposition() {
> Collator c = Collator.getInstance(Locale.US);
> try {
> c.setDecomposition(Collator.FULL_DECOMPOSITION);
> } catch (Exception e) {
> fail("Assert 0: Unexpected exception " + e);
> }
> int decompositionMode = c.getDecomposition();
> assertTrue("Assert 1: next() returns incorrect value " + decompositionMode, decompositionMode == Collator.FULL_DECOMPOSITION );
> }
> }
--
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-32)
java.text.Collator.setDecomposition(FULL_DECOMPOSITION) throws
IllegalArgumentException
Posted by "Richard Liang (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-32?page=comments#action_12363209 ]
Richard Liang commented on HARMONY-32:
--------------------------------------
Forgive my carping, but I think the proposed test method can be re-written more clean:
public void test_setDecomposition() {
Collator c = Collator.getInstance(Locale.US);
c.setDecomposition(Collator.FULL_DECOMPOSITION);
assertEquals(Collator.FULL_DECOMPOSITION, c.getDecomposition());
}
please refer to the article "JUnit best practices" http://www.javaworld.com/javaworld/jw-12-2000/jw-1221-junit_p.html
> java.text.Collator.setDecomposition(FULL_DECOMPOSITION) throws IllegalArgumentException
> ----------------------------------------------------------------------------------------
>
> Key: HARMONY-32
> URL: http://issues.apache.org/jira/browse/HARMONY-32
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: tatyana doubtsova
> Assignee: Geir Magnusson Jr
>
> Code for reproducing Test.java:
> import java.text.Collator;
> import java.util.Locale;
> public class Test {
> public static void main (String[] args) {
> Collator c = Collator.getInstance(Locale.US);
> c.setDecomposition(Collator.FULL_DECOMPOSITION);
> int decompositionMode = c.getDecomposition();
> System.out.println("decomposition Mode is " + decompositionMode);
> }
> }
> 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.
> Exception in thread "main" java.lang.IllegalArgumentException: Wrong decomposition mode.
> at com.ibm.icu.text.Collator.setDecomposition(Collator.java:295)
> at java.text.Collator.setDecomposition(Collator.java:277)
> at Test.main(Test.java:7)
> Output on BEA 1.4.2:
> decomposition Mode is 2
> Suggested junit test case:
> package org.apache.harmony.tests.java.text;
> import java.text.Collator;
> import java.util.Locale;
> import junit.framework.TestCase;
> public class CollatorTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(CollatorTest.class);
> }
>
> public void test_setDecomposition() {
> Collator c = Collator.getInstance(Locale.US);
> try {
> c.setDecomposition(Collator.FULL_DECOMPOSITION);
> } catch (Exception e) {
> fail("Assert 0: Unexpected exception " + e);
> }
> int decompositionMode = c.getDecomposition();
> assertTrue("Assert 1: next() returns incorrect value " + decompositionMode, decompositionMode == Collator.FULL_DECOMPOSITION );
> }
> }
--
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