ICU-5683 Merging the fix for Chinese alias bundle resolution issue reproduced in 3.6 stream and its test code into trunk, although the issue is not reproduced in 3.8 stream.
X-SVN-Rev: 21419
This commit is contained in:
parent
1ddd297ae2
commit
17717d9c7f
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2007, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -961,4 +961,40 @@ public class DateFormatRegressionTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ticket#5683
|
||||
// Some ICU4J 3.6 data files contain garbage data which prevent the code to resolve another
|
||||
// bundle as an alias. zh_TW should be equivalent to zh_Hant_TW
|
||||
public void TestT5683() {
|
||||
Locale[] aliasLocales = {
|
||||
new Locale("zh", "CN"),
|
||||
new Locale("zh", "TW"),
|
||||
new Locale("zh", "HK"),
|
||||
new Locale("zh", "SG"),
|
||||
new Locale("zh", "MO")
|
||||
};
|
||||
|
||||
ULocale[] canonicalLocales = {
|
||||
new ULocale("zh_Hans_CN"),
|
||||
new ULocale("zh_Hant_TW"),
|
||||
new ULocale("zh_Hant_HK"),
|
||||
new ULocale("zh_Hans_SG"),
|
||||
new ULocale("zh_Hant_MO")
|
||||
};
|
||||
|
||||
Date d = new Date(0);
|
||||
|
||||
for (int i = 0; i < aliasLocales.length; i++) {
|
||||
DateFormat dfAlias = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, aliasLocales[i]);
|
||||
DateFormat dfCanonical = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, canonicalLocales[i]);
|
||||
|
||||
String sAlias = dfAlias.format(d);
|
||||
String sCanonical = dfCanonical.format(d);
|
||||
|
||||
if (!sAlias.equals(sCanonical)) {
|
||||
errln("Fail: The format result for locale " + aliasLocales[i] + " is different from the result for locale " + canonicalLocales[i]
|
||||
+ ": " + sAlias + "[" + aliasLocales[i] + "] / " + sCanonical + "[" + canonicalLocales[i] + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ public class ICUResourceBundle extends UResourceBundle {
|
||||
int type = RES_GET_TYPE(rootResource);
|
||||
if (type == TABLE) {
|
||||
ICUResourceBundleImpl.ResourceTable table = new ICUResourceBundleImpl.ResourceTable(reader, baseName, localeID, loader);
|
||||
if(table.getSize()==1){
|
||||
if(table.getSize()>=1){ // ticket#5683 ICU4J 3.6 data for zh_xx contains an entry other than %%ALIAS
|
||||
UResourceBundle b = table.handleGet(0, null, table);
|
||||
String itemKey = b.getKey();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user