]> granicus.if.org Git - icu/commitdiff
ICU-8268 equals(Object o) methods assume that o is the correct type.
authorAbhinav Gupta <mail@abhinavg.net>
Wed, 28 Sep 2011 20:30:06 +0000 (20:30 +0000)
committerAbhinav Gupta <mail@abhinavg.net>
Wed, 28 Sep 2011 20:30:06 +0000 (20:30 +0000)
X-SVN-Rev: 30736

icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java
icu4j/main/classes/core/src/com/ibm/icu/text/DecimalFormatSymbols.java

index 11719a92cfed76eec1f9fbb2b82488c0102d833c..d90b05ac49150bbbbc62aa10a6d20fd8b1df6c72 100644 (file)
@@ -2055,7 +2055,9 @@ public class DateTimePatternGenerator implements Freezable<DateTimePatternGenera
         }
 
         public boolean equals(Object other) {
-            if (other == null) return false;
+            if (!(other instanceof DateTimeMatcher)) {
+                return false;
+            }
             DateTimeMatcher that = (DateTimeMatcher) other;
             for (int i = 0; i < original.length; ++i) {
                 if (!original[i].equals(that.original[i])) return false;
index b416bfa3eb50b225ff213cee6265b6aff50816ad..c17a93d76710b79fa201d9b660a9f0549ca168e1 100644 (file)
@@ -731,8 +731,12 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
      * @stable ICU 2.0
      */
     public boolean equals(Object obj) {
-        if (obj == null) return false;
-        if (this == obj) return true;
+        if (!(obj instanceof DecimalFormatSymbols)) {
+            return false;
+        }
+        if (this == obj) {
+            return true;
+        }
         DecimalFormatSymbols other = (DecimalFormatSymbols) obj;
         for (int i = 0; i <= CURRENCY_SPC_INSERT; i++) {
             if (!currencySpcBeforeSym[i].equals(other.currencySpcBeforeSym[i])) {