diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java b/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java index c3fdf7d1589..b9c5c01538f 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java @@ -3714,6 +3714,10 @@ public final class ULocale implements Serializable, Comparable { String bcpKey = null; try { bcpKey = keyMap.getString(key); + if (bcpKey.length() == 0) { + // empty value indicates the BCP47 key is same with the legacy key + bcpKey = key; + } } catch (MissingResourceException mre) { // fall through } @@ -3739,7 +3743,12 @@ public final class ULocale implements Serializable, Comparable { String key = null; for (int i = 0; i < keyMap.getSize(); i++) { UResourceBundle mapData = keyMap.get(i); - if (bcpKey.equals(mapData.getString())) { + String tmpBcpKey = mapData.getString(); + if (tmpBcpKey.length() == 0) { + // empty value indicates the BCP47 key is same with the legacy key + tmpBcpKey = mapData.getKey(); + } + if (bcpKey.equals(tmpBcpKey)) { key = mapData.getKey(); break; } @@ -3758,6 +3767,7 @@ public final class ULocale implements Serializable, Comparable { UResourceBundle typeMap = keyTypeData.get("typeMap"); // keys are case-insensitive, while types are case-sensitive + // TODO: make types case insensitive key = AsciiUtil.toLowerString(key); UResourceBundle typeMapForKey = null; String bcpType = null; @@ -3765,6 +3775,10 @@ public final class ULocale implements Serializable, Comparable { try { typeMapForKey = typeMap.get(key); bcpType = typeMapForKey.getString(typeResKey); + if (bcpType.length() == 0) { + // empty value indicates the BCP47 type is same with the legacy type + bcpType = type; + } } catch (MissingResourceException mre) { // fall through } @@ -3776,6 +3790,10 @@ public final class ULocale implements Serializable, Comparable { UResourceBundle typeAliasForKey = typeAlias.get(key); typeResKey = typeAliasForKey.getString(typeResKey); bcpType = typeMapForKey.getString(typeResKey.replace('/', ':')); + if (bcpType.length() == 0) { + // empty value indicates the BCP47 type is same with the legacy type + bcpType = typeResKey; + } } catch (MissingResourceException mre) { // fall through } @@ -3813,7 +3831,12 @@ public final class ULocale implements Serializable, Comparable { for (int i = 0; i < typeMapForKey.getSize(); i++) { UResourceBundle mapData = typeMapForKey.get(i); - if (bcpType.equals(mapData.getString())) { + String tmpBcpType = mapData.getString(); + if (tmpBcpType.length() == 0) { + // empty value indicates the BCP47 type is same with the legacy type + tmpBcpType = mapData.getKey(); + } + if (bcpType.equals(tmpBcpType)) { type = mapData.getKey(); if (key.equals("timezone")) { type = type.replace(':', '/'); diff --git a/icu4j/main/shared/data/icudata.jar b/icu4j/main/shared/data/icudata.jar index d0f615bb1ed..d62ef3847f7 100755 --- a/icu4j/main/shared/data/icudata.jar +++ b/icu4j/main/shared/data/icudata.jar @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01b1bf99d68a3849729b5af75db65bec86496bb43d46f54f6561d63a714de9c1 -size 10505773 +oid sha256:11004912c7ce72161feb732fdd36dad4d12914d8bfb378eec90eeab91951aef0 +size 10507681 diff --git a/icu4j/main/shared/data/icutzdata.jar b/icu4j/main/shared/data/icutzdata.jar index 51a35e20315..77b8ee3accb 100755 --- a/icu4j/main/shared/data/icutzdata.jar +++ b/icu4j/main/shared/data/icutzdata.jar @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7a225ee1ed42c0dab0082b046e3be1b2f81d49d866bacd3115aa0b7627b7e4d -size 90848 +oid sha256:241db710283f77944c73a1e3061b3adb43195ecb8c8194fea596923cc6f3878b +size 90909