mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 09:21:03 +00:00
ICU-8268 fixed problems found in code review.
X-SVN-Rev: 30759
This commit is contained in:
parent
e14fa4e630
commit
2dde8091b2
7 changed files with 22 additions and 27 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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){
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -713,6 +713,6 @@ class LabelComparator implements Comparator {
|
|||
}
|
||||
|
||||
public boolean equals(Object obj1) {
|
||||
return false;
|
||||
return obj1 instanceof LabelComparator;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue