diff options
author | Elliott Hughes <enh@google.com> | 2010-02-12 18:10:26 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2010-02-12 18:10:26 -0800 |
commit | deacd761e85ee4d75a6adbdd63225fc4a6d3088d (patch) | |
tree | 0bff6cdfc057a75ffaac0598f3d21c7baccdfc7a /icu/src/main | |
parent | b0e5963793d8980b349f8e553067c19fd31601c5 (diff) | |
download | libcore-deacd761e85ee4d75a6adbdd63225fc4a6d3088d.zip libcore-deacd761e85ee4d75a6adbdd63225fc4a6d3088d.tar.gz libcore-deacd761e85ee4d75a6adbdd63225fc4a6d3088d.tar.bz2 |
Fix a few of our FindBugs "high" warnings.
RuleBasedBreakIterator was breaking the equals/hashCode contract.
Various classes were calling toString on arrays, which isn't very useful.
GregorianCalendar was missing a null/instanceof check. (FindBugs complained about
the former, but the super.equals would actually take care of that. The lack of
the explicit "instanceof" did mean that we could throw ClassCastException if you
had a Calendar that wasn't a GregorianCalendar, though. [Not easily testable,
and I hope we'll replace our calendars with ICU4J's before we actually have
another Calendar subclass.])
Collator's cache was broken, but luckily never had anything inserted into it
anyway.
Diffstat (limited to 'icu/src/main')
-rw-r--r-- | icu/src/main/java/com/ibm/icu4jni/text/RuleBasedBreakIterator.java | 7 | ||||
-rw-r--r-- | icu/src/main/java/com/ibm/icu4jni/util/LocaleData.java | 13 |
2 files changed, 13 insertions, 7 deletions
diff --git a/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedBreakIterator.java b/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedBreakIterator.java index 4d38f2b..e532ac4 100644 --- a/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedBreakIterator.java +++ b/icu/src/main/java/com/ibm/icu4jni/text/RuleBasedBreakIterator.java @@ -58,7 +58,12 @@ public class RuleBasedBreakIterator extends BreakIterator { return result && iter.equals(this.charIter); } - + + @Override + public int hashCode() { + return 42; // No-one uses RuleBasedBreakIterator as a hash key. + } + @Override public int current() { return NativeBreakIterator.currentImpl(this.addr); diff --git a/icu/src/main/java/com/ibm/icu4jni/util/LocaleData.java b/icu/src/main/java/com/ibm/icu4jni/util/LocaleData.java index 24d3323..87f9bc2 100644 --- a/icu/src/main/java/com/ibm/icu4jni/util/LocaleData.java +++ b/icu/src/main/java/com/ibm/icu4jni/util/LocaleData.java @@ -17,6 +17,7 @@ package com.ibm.icu4jni.util; import java.text.DateFormat; +import java.util.Arrays; /** * Passes locale-specific from ICU native code to Java. @@ -66,12 +67,12 @@ public class LocaleData { return "LocaleData[" + "firstDayOfWeek=" + firstDayOfWeek + "," + "minimalDaysInFirstWeek=" + minimalDaysInFirstWeek + "," + - "amPm=" + amPm + "," + - "eras=" + eras + "," + - "longMonthNames=" + longMonthNames + "," + - "shortMonthNames=" + shortMonthNames + "," + - "longWeekdayNames=" + longWeekdayNames + "," + - "shortWeekdayNames=" + shortWeekdayNames + "," + + "amPm=" + Arrays.toString(amPm) + "," + + "eras=" + Arrays.toString(eras) + "," + + "longMonthNames=" + Arrays.toString(longMonthNames) + "," + + "shortMonthNames=" + Arrays.toString(shortMonthNames) + "," + + "longWeekdayNames=" + Arrays.toString(longWeekdayNames) + "," + + "shortWeekdayNames=" + Arrays.toString(shortWeekdayNames) + "," + "fullTimeFormat=" + fullTimeFormat + "," + "longTimeFormat=" + longTimeFormat + "," + "mediumTimeFormat=" + mediumTimeFormat + "," + |