summaryrefslogtreecommitdiffstats
path: root/icu/src/main
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-04-22 13:38:42 -0700
committerElliott Hughes <enh@google.com>2010-04-22 14:00:53 -0700
commita7d4139bed693bf6037bf5f7f49a24b077102adc (patch)
treedb9d78c4a6cc9478a88996acd08f7b19be0cba48 /icu/src/main
parent5779f05dd67ea322017c4ceb45270f5c6969d6b5 (diff)
downloadlibcore-a7d4139bed693bf6037bf5f7f49a24b077102adc.zip
libcore-a7d4139bed693bf6037bf5f7f49a24b077102adc.tar.gz
libcore-a7d4139bed693bf6037bf5f7f49a24b077102adc.tar.bz2
java.text.RuleBasedCollator fixes.
Add expectations for broken harmony tests, add our own equivalent (but correct) tets, and fix the bug turned up by the correct tests: the icu4jni RuleBasedCollator was using toString to convert a CharacterIterator to a String, resulting in iteration over the result of Object.toString (the class name and identity hash code) rather than the characters of interest. Also shut javac up about non-ASCII characters in Locale.java. Bug: 2608742 Bug: 2608750 Change-Id: I2171789058c8116eacd7e5815bd483f0bc07c69b
Diffstat (limited to 'icu/src/main')
-rw-r--r--icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java b/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java
index a87c978..3135daa 100644
--- a/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java
+++ b/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedCollator.java
@@ -516,8 +516,17 @@ public final class RuleBasedCollator extends Collator {
return result;
}
- public CollationElementIterator getCollationElementIterator(CharacterIterator source) {
- return getCollationElementIterator(source.toString());
+ public CollationElementIterator getCollationElementIterator(CharacterIterator it) {
+ // We only implement the String-based API, so build a string from the iterator.
+ return getCollationElementIterator(characterIteratorToString(it));
+ }
+
+ private String characterIteratorToString(CharacterIterator it) {
+ StringBuilder result = new StringBuilder();
+ for (char ch = it.current(); ch != CharacterIterator.DONE; ch = it.next()) {
+ result.append(ch);
+ }
+ return result.toString();
}
/**