harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Deakin (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6527) [classlib][text] CollationElementIterator tests fail
Date Thu, 30 Sep 2010 15:25:33 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12916511#action_12916511

Oliver Deakin commented on HARMONY-6527:

This failure basically has the same cause as HARMONY-6524. The test essentially does the following:

 RuleBasedCollator rbColl = (RuleBasedCollator) Collator.getInstance(new Locale("es", "",
 String text = "cha";
 CollationElementIterator iterator = rbColl.getCollationElementIterator(text);
 assertEquals(1, iterator.getOffset());

However the spec for setOffset() says:
"Sets the iterator to point to the collation element corresponding to the specified character
(the parameter is a CHARACTER offset in the original string, not an offset into its corresponding
sequence of collation elements). The value returned by the next call to next() will be the
collation element corresponding to the specified position in the text. If that position is
in the middle of a contracting character sequence, the result of the next call to next() is
the collation element for that sequence. This means that getOffset() is not guaranteed to
return the same value as was passed to a preceding call to setOffset()."

The key here is that "ch" in the chosen locale should be treated as a single collation element
according to the example in the spec of CollationElementIterator. Because of this, I believe
setOffset(1) should actually set the offset to 0 i.e. the 'c' in "ch", not the 'h'. The RI
does not exhibit this behaviour but ICU does. I believe the RI's behaviour here is not correct
to the spec but ICU's is, so the right thing to do is change these tests to expect an offset
of 0 and file this as a non-bug difference.

> [classlib][text] CollationElementIterator tests fail
> ----------------------------------------------------
>                 Key: HARMONY-6527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Mark Hindess
>            Assignee: Oliver Deakin
> I see three failures on windows and linux:
> CollationElementIteratorTest testSetOffset Failure expected:<1> but was:<0>
>  junit.framework.AssertionFailedError: expected:<1> but was:<0>
>  at
>  org.apache.harmony.text.tests.java.text.CollationElementIteratorTest.testSetOffset
>  (CollationElementIteratorTest.java:170)
>  at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> CollationElementIteratorTest testSetTextString Failure expected:<1> but was:<0>
>  junit.framework.AssertionFailedError: expected:<1> but was:<0>
>  at
>  org.apache.harmony.text.tests.java.text.CollationElementIteratorTest.testSetTextString
>  (CollationElementIteratorTest.java:186)
>  at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> CollationElementIteratorTest testSetTextCharacterIterator Failure expected:<1>
but was:<0>
>  junit.framework.AssertionFailedError: expected:<1> but was:<0>
>  at
>  org.apache.harmony.text.tests.java.text.CollationElementIteratorTest.testSetTextCharacterIterator
>  (CollationElementIteratorTest.java:202)
>  at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message