]> granicus.if.org Git - icu/commitdiff
ICU-8268 fixed problems found in code review.
authorAbhinav Gupta <mail@abhinavg.net>
Fri, 30 Sep 2011 19:01:29 +0000 (19:01 +0000)
committerAbhinav Gupta <mail@abhinavg.net>
Fri, 30 Sep 2011 19:01:29 +0000 (19:01 +0000)
X-SVN-Rev: 30759

icu4j/main/classes/core/src/com/ibm/icu/impl/ICUResourceBundleImpl.java
icu4j/main/classes/core/src/com/ibm/icu/impl/Utility.java
icu4j/main/classes/currdata/src/com/ibm/icu/impl/ICUCurrencyDisplayInfoProvider.java
icu4j/main/tests/collate/src/com/ibm/icu/dev/test/collator/CollationMiscTest.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/lang/UCharacterTest.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/normalizer/UTS46Test.java
icu4j/tools/misc/src/com/ibm/icu/dev/tool/ime/translit/TransliteratorInputMethod.java

index d968e948bcf1ab6de9527e09075c8135d98e4097..e7ff03266448b5474a727772f7f2fbd18e32ee5d 100644 (file)
@@ -7,7 +7,6 @@
 package com.ibm.icu.impl;
 
 import java.nio.ByteBuffer;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Set;
 import java.util.TreeSet;
@@ -151,7 +150,7 @@ class ICUResourceBundleImpl extends ICUResourceBundle {
                 index[0] = i;
             }
             if (i < 0) {
-                throw new UResourceTypeMismatchException("Could not get the correct value for index: "+ Arrays.toString(index));
+                throw new UResourceTypeMismatchException("Could not get the correct value for index: "+ indexStr);
             }
             return createBundleObject(i, indexStr, table, requested, isAlias);
         }
index a6b72d2c8d03e7bc3a697b423d5d4380ba00f4bf..2a9d5876bd401b1f5f084d063c918b8ba1d8deda 100644 (file)
@@ -77,13 +77,8 @@ public final class Utility {
             return(arrayEquals((Object[]) source,target));
         if (source instanceof int[])
             return(arrayEquals((int[]) source,target));
-        if (source instanceof double[]) {
-            double[] oldSource = (double[]) source;
-            int[] newSource = new int[oldSource.length];
-            for (int i = 0; i < oldSource.length; i++)
-                newSource[i] = (int)oldSource[i];
-            return arrayEquals(newSource, target);
-        }
+        if (source instanceof double[])
+            return(arrayEquals((double[]) source, target));
         if (source instanceof byte[])
             return(arrayEquals((byte[]) source,target));
         return source.equals(target);
index a825f980fca363a56bf8cf8690bd813ebb8e909d..3df21e2f275f3bb5763372c4d2bc2c1f9af91825 100644 (file)
@@ -185,7 +185,7 @@ public class ICUCurrencyDisplayInfoProvider implements CurrencyDisplayInfoProvid
             if (srb != null) {
                 ICUResourceBundle brb = srb.findWithFallback("beforeCurrency");
                 ICUResourceBundle arb = srb.findWithFallback("afterCurrency");
-                if (brb != null) {
+                if (arb != null && brb != null) {
                     String beforeCurrencyMatch = brb.findWithFallback("currencyMatch").getString();
                     String beforeContextMatch = brb.findWithFallback("surroundingMatch").getString();
                     String beforeInsert = brb.findWithFallback("insertBetween").getString();
index 3e1e7d6bb7edabb2682dbfe867fd727512312973..bd08413c37e9cc1d46f3ce41c0c49e0e143f65fa 100644 (file)
@@ -1875,6 +1875,7 @@ public class CollationMiscTest extends TestFmwk {
             if (rule.equals("")) {
                 errln("UCA rule string should not be empty");
             }
+            coll = new RuleBasedCollator(rule);
         } catch (Exception e) {
             warnln(e.getMessage());
         }
index 3f3a8cdcdd6a07f54c17e49738b1380fe9c2b211..c49c7e67a1d39991be3cd9ce23538feb87aeab5e 100644 (file)
@@ -2996,7 +2996,7 @@ public final class UCharacterTest extends TestFmwk
                 UCharacter.codePointAt(reg_text, 100, limitCases[i]);
                 errln("UCharacter.codePointAt was suppose to return an exception " +
                         "but got " + UCharacter.codePointAt(reg_text, 100, limitCases[i]) +
-                        ". The following passed parameters were Text: " + Arrays.toString(reg_text) + ", Start: " +
+                        ". The following passed parameters were Text: " + String.valueOf(reg_text) + ", Start: " +
                         100 + ", Limit: " + limitCases[i] + ".");
             } catch(Exception e){
             }
@@ -3008,7 +3008,7 @@ public final class UCharacterTest extends TestFmwk
                 UCharacter.codePointAt(empty_text, 0, limitCases[i]);
                 errln("UCharacter.codePointAt was suppose to return an exception " +
                         "but got " + UCharacter.codePointAt(empty_text, 0, limitCases[i]) +
-                        ". The following passed parameters were Text: " + Arrays.toString(empty_text) + ", Start: " +
+                        ". The following passed parameters were Text: " + String.valueOf(empty_text) + ", Start: " +
                         0 + ", Limit: " + limitCases[i] + ".");
             } catch(Exception e){
             }
@@ -3017,7 +3017,7 @@ public final class UCharacterTest extends TestFmwk
                 UCharacter.codePointCount(one_char_text, 0, limitCases[i]);
                 errln("UCharacter.codePointCount was suppose to return an exception " +
                         "but got " + UCharacter.codePointCount(one_char_text, 0, limitCases[i]) +
-                        ". The following passed parameters were Text: " + Arrays.toString(one_char_text) + ", Start: " +
+                        ". The following passed parameters were Text: " + String.valueOf(one_char_text) + ", Start: " +
                         0 + ", Limit: " + limitCases[i] + ".");
             } catch(Exception e){
             }
@@ -3181,7 +3181,7 @@ public final class UCharacterTest extends TestFmwk
                 UCharacter.codePointCount(reg_text, 100, limitCases[i]);
                 errln("UCharacter.codePointCount was suppose to return an exception " +
                         "but got " + UCharacter.codePointCount(reg_text, 100, limitCases[i]) +
-                        ". The following passed parameters were Text: " + Arrays.toString(reg_text) + ", Start: " +
+                        ". The following passed parameters were Text: " + String.valueOf(reg_text) + ", Start: " +
                         100 + ", Limit: " + limitCases[i] + ".");
             } catch(Exception e){
             }
@@ -3193,7 +3193,7 @@ public final class UCharacterTest extends TestFmwk
                 UCharacter.codePointCount(empty_text, 0, limitCases[i]);
                 errln("UCharacter.codePointCount was suppose to return an exception " +
                         "but got " + UCharacter.codePointCount(empty_text, 0, limitCases[i]) +
-                        ". The following passed parameters were Text: " + Arrays.toString(empty_text) + ", Start: " +
+                        ". The following passed parameters were Text: " + String.valueOf(empty_text) + ", Start: " +
                         0 + ", Limit: " + limitCases[i] + ".");
             } catch(Exception e){
             }
@@ -3202,7 +3202,7 @@ public final class UCharacterTest extends TestFmwk
                 UCharacter.codePointCount(one_char_text, 0, limitCases[i]);
                 errln("UCharacter.codePointCount was suppose to return an exception " +
                         "but got " + UCharacter.codePointCount(one_char_text, 0, limitCases[i]) +
-                        ". The following passed parameters were Text: " + Arrays.toString(one_char_text) + ", Start: " +
+                        ". The following passed parameters were Text: " + String.valueOf(one_char_text) + ", Start: " +
                         0 + ", Limit: " + limitCases[i] + ".");
             } catch(Exception e){
             }
index 563d8963052c3026720b4a94e4ae40618f182f9d..146aba429f288c3f014f1c89ecffb18b60a5e06a 100644 (file)
@@ -89,8 +89,8 @@ public class UTS46Test extends TestFmwk {
         input="a\u2260b\u226Ec\u226Fd";
         not3.nameToUnicode(input, result, info);
         if(!UTF16Plus.equal(result, input) || info.hasErrors()) {
-            errln(String.format("notSTD3.nameToUnicode(equiv to non-LDH ASCII) unexpected errors %04x string %s",
-                                info.getErrors(), prettify(result.toString())));
+            errln(String.format("notSTD3.nameToUnicode(equiv to non-LDH ASCII) unexpected errors %s string %s",
+                                info.getErrors().toString(), prettify(result.toString())));
         }
     }
 
@@ -602,8 +602,8 @@ public class UTS46Test extends TestFmwk {
             if(aN.indexOf(".")<0) {
                 if(!UTF16Plus.equal(aN, aNL) || !sameErrors(aNInfo, aNLInfo)) {
                     errln(String.format("N.nameToASCII([%d] %s)!=N.labelToASCII() "+
-                                        "(errors %s vs %04x) %s vs. %s",
-                                        i, testCase.s, aNInfo.getErrors(), aNLInfo.getErrors(),
+                                        "(errors %s vs %s) %s vs. %s",
+                                        i, testCase.s, aNInfo.getErrors().toString(), aNLInfo.getErrors().toString(),
                                         prettify(aN.toString()), prettify(aNL.toString())));
                     continue;
                 }
@@ -617,8 +617,8 @@ public class UTS46Test extends TestFmwk {
             if(aT.indexOf(".")<0) {
                 if(!UTF16Plus.equal(aT, aTL) || !sameErrors(aTInfo, aTLInfo)) {
                     errln(String.format("T.nameToASCII([%d] %s)!=T.labelToASCII() "+
-                                        "(errors %s vs %04x) %s vs. %s",
-                                        i, testCase.s, aTInfo.getErrors(), aTLInfo.getErrors(),
+                                        "(errors %s vs %s) %s vs. %s",
+                                        i, testCase.s, aTInfo.getErrors().toString(), aTLInfo.getErrors().toString(),
                                         prettify(aT.toString()), prettify(aTL.toString())));
                     continue;
                 }
@@ -632,8 +632,8 @@ public class UTS46Test extends TestFmwk {
             if(uN.indexOf(".")<0) {
                 if(!UTF16Plus.equal(uN, uNL) || !sameErrors(uNInfo, uNLInfo)) {
                     errln(String.format("N.nameToUnicode([%d] %s)!=N.labelToUnicode() "+
-                                        "(errors %s vs %04x) %s vs. %s",
-                                        i, testCase.s, uNInfo.getErrors(), uNLInfo.getErrors(),
+                                        "(errors %s vs %s) %s vs. %s",
+                                        i, testCase.s, uNInfo.getErrors().toString(), uNLInfo.getErrors().toString(),
                                         prettify(uN.toString()), prettify(uNL.toString())));
                     continue;
                 }
@@ -647,8 +647,8 @@ public class UTS46Test extends TestFmwk {
             if(uT.indexOf(".")<0) {
                 if(!UTF16Plus.equal(uT, uTL) || !sameErrors(uTInfo, uTLInfo)) {
                     errln(String.format("T.nameToUnicode([%d] %s)!=T.labelToUnicode() "+
-                                        "(errors %s vs %04x) %s vs. %s",
-                                        i, testCase.s, uTInfo.getErrors(), uTLInfo.getErrors(),
+                                        "(errors %s vs %s) %s vs. %s",
+                                        i, testCase.s, uTInfo.getErrors().toString(), uTLInfo.getErrors().toString(),
                                         prettify(uT.toString()), prettify(uTL.toString())));
                     continue;
                 }
index ada9d4940649007f88b7fe46d216a00a9957f05f..ee15e502ce74489dea74f721f3e8b66a387cf5fd 100644 (file)
@@ -713,6 +713,6 @@ class LabelComparator implements Comparator {
     }
 
     public boolean equals(Object obj1) {
-        return false;
+        return obj1 instanceof LabelComparator;
     }
 }