[automerger skipped] DO NOT MERGE Track tzdb 2023d update. [SC_V2 CTS] am: 9c14af3c90 -s ours am: 25d9d020f2 -s ours am: 684fd74c35 -s ours am: d43668518d -s ours
am skip reason: contains skip directive
Original change: https://android-review.googlesource.com/c/platform/external/icu/+/2985516
Change-Id: I60304852a76a8c2b80d37a3cd163181cd0ef7a11
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java b/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java
index 7c4d92e..db3af94 100644
--- a/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java
+++ b/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java
@@ -1312,18 +1312,22 @@
// fallback to locale ID parent
if(b == null){
+ OpenType localOpenType = openType;
+ if (openType == OpenType.LOCALE_DEFAULT_ROOT && localeName.equals(defaultID)) {
+ localOpenType = OpenType.LOCALE_ROOT;
+ }
int i = localeName.lastIndexOf('_');
if (i != -1) {
// Chop off the last underscore and the subtag after that.
String temp = localeName.substring(0, i);
- b = instantiateBundle(baseName, temp, defaultID, root, openType);
+ b = instantiateBundle(baseName, temp, defaultID, root, localOpenType);
}else{
// No underscore, only a base language subtag.
- if(openType == OpenType.LOCALE_DEFAULT_ROOT &&
+ if(localOpenType == OpenType.LOCALE_DEFAULT_ROOT &&
!localeIDStartsWithLangSubtag(defaultID, localeName)) {
// Go to the default locale before root.
- b = instantiateBundle(baseName, defaultID, defaultID, root, openType);
- } else if(openType != OpenType.LOCALE_ONLY && !rootLocale.isEmpty()) {
+ b = instantiateBundle(baseName, defaultID, defaultID, root, localOpenType);
+ } else if(localOpenType != OpenType.LOCALE_ONLY && !rootLocale.isEmpty()) {
// Ultimately go to root.
b = ICUResourceBundle.createBundle(baseName, rootLocale, root);
}
diff --git a/android_icu4j/src/main/tests/android/icu/dev/test/translit/TransliteratorTest.java b/android_icu4j/src/main/tests/android/icu/dev/test/translit/TransliteratorTest.java
index ffed90e..ac4ce90 100644
--- a/android_icu4j/src/main/tests/android/icu/dev/test/translit/TransliteratorTest.java
+++ b/android_icu4j/src/main/tests/android/icu/dev/test/translit/TransliteratorTest.java
@@ -2589,7 +2589,6 @@
}
}
-
static final String[][] registerRules = {
{"Any-Dev1", "x > X; y > Y;"},
{"Any-Dev2", "XY > Z"},
diff --git a/android_icu4j/src/main/tests/android/icu/dev/test/util/ICUResourceBundleTest.java b/android_icu4j/src/main/tests/android/icu/dev/test/util/ICUResourceBundleTest.java
index 64146ac..a48a58f 100644
--- a/android_icu4j/src/main/tests/android/icu/dev/test/util/ICUResourceBundleTest.java
+++ b/android_icu4j/src/main/tests/android/icu/dev/test/util/ICUResourceBundleTest.java
@@ -1146,4 +1146,20 @@
} catch (NoSuchElementException ex) {
}
}
+
+ @Test
+ public void TestResourceBundleCrash() {
+ final String[] TEST_LOCALE_IDS = new String[] { "nb", "nn", "ht", "hi-Latn" };
+
+ ULocale oldDefaultLocale = ULocale.getDefault();
+ for (String localeID : TEST_LOCALE_IDS) {
+ ULocale locale = ULocale.forLanguageTag(localeID);
+ ULocale.setDefault(locale);
+ UResourceBundle rb = UResourceBundle.getBundleInstance(ICUData.ICU_TRANSLIT_BASE_NAME, locale);
+ assertTrue("Failed to retrieve a resource bundle for " + localeID, rb != null);
+ // the test is to make sure we fell back to root (or otherwise returned SOMETHING)-- all we're really trying to
+ // enrure is that we don't crash with a StackOverflowError when trying to retrieve the bundle
+ }
+ ULocale.setDefault(oldDefaultLocale);
+ }
}
diff --git a/icu4c/source/data/region/ar_XB.txt b/icu4c/source/data/region/ar_XB.txt
index 20e2cd2..ab63137 100644
--- a/icu4c/source/data/region/ar_XB.txt
+++ b/icu4c/source/data/region/ar_XB.txt
@@ -267,7 +267,7 @@
TM{"Turkmenistan"}
TN{"Tunisia"}
TO{"Tonga"}
- TR{"Turkey"}
+ TR{"Türkiye"}
TT{"Trinidad & Tobago"}
TV{"Tuvalu"}
TW{"Taiwan"}
@@ -313,5 +313,6 @@
CZ{"Czech Republic"}
SZ{"Swaziland"}
TL{"East Timor"}
+ TR{"Turkey"}
}
}
diff --git a/icu4c/source/data/region/en.txt b/icu4c/source/data/region/en.txt
index c00c46d..8ccb46e 100644
--- a/icu4c/source/data/region/en.txt
+++ b/icu4c/source/data/region/en.txt
@@ -267,7 +267,7 @@
TM{"Turkmenistan"}
TN{"Tunisia"}
TO{"Tonga"}
- TR{"Turkey"}
+ TR{"Türkiye"}
TT{"Trinidad & Tobago"}
TV{"Tuvalu"}
TW{"Taiwan"}
@@ -313,5 +313,6 @@
CZ{"Czech Republic"}
SZ{"Swaziland"}
TL{"East Timor"}
+ TR{"Turkey"}
}
}
diff --git a/icu4c/source/data/region/en_XA.txt b/icu4c/source/data/region/en_XA.txt
index ae4630e..559a4fa 100644
--- a/icu4c/source/data/region/en_XA.txt
+++ b/icu4c/source/data/region/en_XA.txt
@@ -267,7 +267,7 @@
TM{"[Ţûŕķɱéñîšţåñ one two]"}
TN{"[Ţûñîšîå one two]"}
TO{"[Ţöñĝå one]"}
- TR{"[Ţûŕķéý one]"}
+ TR{"[Ţüŕķîýé one two]"}
TT{"[Ţŕîñîðåð ⅋ Ţöƀåĝö one two three]"}
TV{"[Ţûṽåļû one]"}
TW{"[Ţåîŵåñ one]"}
@@ -313,5 +313,6 @@
CZ{"[Çžéçĥ Ŕéþûƀļîç one two]"}
SZ{"[Šŵåžîļåñð one two]"}
TL{"[Éåšţ Ţîɱöŕ one two]"}
+ TR{"[Ţûŕķéý one]"}
}
}
diff --git a/icu4c/source/stubdata/icudt70l.dat b/icu4c/source/stubdata/icudt70l.dat
index 1ebf7e0..3c44127 100644
--- a/icu4c/source/stubdata/icudt70l.dat
+++ b/icu4c/source/stubdata/icudt70l.dat
Binary files differ
diff --git a/icu4c/source/test/intltest/tztest.cpp b/icu4c/source/test/intltest/tztest.cpp
index e765007..290182b 100644
--- a/icu4c/source/test/intltest/tztest.cpp
+++ b/icu4c/source/test/intltest/tztest.cpp
@@ -68,7 +68,9 @@
TESTCASE_AUTO(TestFractionalDST);
TESTCASE_AUTO(TestFebruary);
TESTCASE_AUTO(TestCanonicalIDAPI);
- TESTCASE_AUTO(TestCanonicalID);
+ // Android-changed: b/263438687 Prebuilts update cause this test failures. Ignoring
+ // it in the same way as we do in CTS branches.
+ // TESTCASE_AUTO(TestCanonicalID);
TESTCASE_AUTO(TestDisplayNamesMeta);
TESTCASE_AUTO(TestGetRegion);
TESTCASE_AUTO(TestGetAvailableIDsNew);
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUResourceBundle.java b/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUResourceBundle.java
index c1ff388..4679874 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUResourceBundle.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUResourceBundle.java
@@ -1304,18 +1304,22 @@
// fallback to locale ID parent
if(b == null){
+ OpenType localOpenType = openType;
+ if (openType == OpenType.LOCALE_DEFAULT_ROOT && localeName.equals(defaultID)) {
+ localOpenType = OpenType.LOCALE_ROOT;
+ }
int i = localeName.lastIndexOf('_');
if (i != -1) {
// Chop off the last underscore and the subtag after that.
String temp = localeName.substring(0, i);
- b = instantiateBundle(baseName, temp, defaultID, root, openType);
+ b = instantiateBundle(baseName, temp, defaultID, root, localOpenType);
}else{
// No underscore, only a base language subtag.
- if(openType == OpenType.LOCALE_DEFAULT_ROOT &&
+ if(localOpenType == OpenType.LOCALE_DEFAULT_ROOT &&
!localeIDStartsWithLangSubtag(defaultID, localeName)) {
// Go to the default locale before root.
- b = instantiateBundle(baseName, defaultID, defaultID, root, openType);
- } else if(openType != OpenType.LOCALE_ONLY && !rootLocale.isEmpty()) {
+ b = instantiateBundle(baseName, defaultID, defaultID, root, localOpenType);
+ } else if(localOpenType != OpenType.LOCALE_ONLY && !rootLocale.isEmpty()) {
// Ultimately go to root.
b = ICUResourceBundle.createBundle(baseName, rootLocale, root);
}
diff --git a/icu4j/main/shared/data/icudata.jar b/icu4j/main/shared/data/icudata.jar
index e63a08f..f80cfdf 100644
--- a/icu4j/main/shared/data/icudata.jar
+++ b/icu4j/main/shared/data/icudata.jar
Binary files differ
diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java
index a5c61f5..c945d21 100644
--- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java
+++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java
@@ -1143,4 +1143,20 @@
} catch (NoSuchElementException ex) {
}
}
+
+ @Test
+ public void TestResourceBundleCrash() {
+ final String[] TEST_LOCALE_IDS = new String[] { "nb", "nn", "ht", "hi-Latn" };
+
+ ULocale oldDefaultLocale = ULocale.getDefault();
+ for (String localeID : TEST_LOCALE_IDS) {
+ ULocale locale = ULocale.forLanguageTag(localeID);
+ ULocale.setDefault(locale);
+ UResourceBundle rb = UResourceBundle.getBundleInstance(ICUData.ICU_TRANSLIT_BASE_NAME, locale);
+ assertTrue("Failed to retrieve a resource bundle for " + localeID, rb != null);
+ // the test is to make sure we fell back to root (or otherwise returned SOMETHING)-- all we're really trying to
+ // enrure is that we don't crash with a StackOverflowError when trying to retrieve the bundle
+ }
+ ULocale.setDefault(oldDefaultLocale);
+ }
}
diff --git a/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/TransliteratorTest.java b/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/TransliteratorTest.java
index 2bc5388..f9f3a1a 100644
--- a/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/TransliteratorTest.java
+++ b/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/TransliteratorTest.java
@@ -2586,7 +2586,6 @@
}
}
-
static final String[][] registerRules = {
{"Any-Dev1", "x > X; y > Y;"},
{"Any-Dev2", "XY > Z"},