diff --git a/icu4j/main/classes/core/src/com/ibm/icu/impl/ZoneMeta.java b/icu4j/main/classes/core/src/com/ibm/icu/impl/ZoneMeta.java index dc3fd3ce65..e261d49887 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/impl/ZoneMeta.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/impl/ZoneMeta.java @@ -865,19 +865,19 @@ public final class ZoneMeta { } /* - * Create olson tzid to metazone mappings from metazoneInfo.res (3.8.1 or later) + * Create olson tzid to metazone mappings from metaZones.res */ private static Map> createOlsonToMetaMap() { // Create olson id to metazone mapping table Map> olsonToMeta = null; - UResourceBundle metazoneMappingsBundle = null; + UResourceBundle metazoneInfoBundle = null; try { - UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "metazoneInfo"); - metazoneMappingsBundle = bundle.get("metazoneMappings"); + UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "metaZones"); + metazoneInfoBundle = bundle.get("metazoneInfo"); } catch (MissingResourceException mre) { // do nothing } - if (metazoneMappingsBundle != null) { + if (metazoneInfoBundle != null) { String[] tzids = getAvailableIDs(); for (int i = 0; i < tzids.length; i++) { // Skip aliases @@ -887,28 +887,28 @@ public final class ZoneMeta { } String tzkey = tzids[i].replace('/', ':'); try { - UResourceBundle zoneBundle = metazoneMappingsBundle.get(tzkey); + UResourceBundle zoneBundle = metazoneInfoBundle.get(tzkey); LinkedList mzMappings = new LinkedList(); - for (int idx = 0; ; idx++) { + for (int idx = 0; idx < zoneBundle.getSize(); idx++) { + UResourceBundle mz = zoneBundle.get(idx); + String mzid = mz.getString(0); + String from = "1970-01-01 00:00"; + String to = "9999-12-31 23:59"; + if (mz.getSize() == 3) { + from = mz.getString(1); + to = mz.getString(2); + } + OlsonToMetaMappingEntry mzmap = new OlsonToMetaMappingEntry(); + mzmap.mzid = mzid.intern(); try { - UResourceBundle mz = zoneBundle.get("mz" + idx); - String[] mzstr = mz.getStringArray(); - if (mzstr == null || mzstr.length != 3) { - continue; - } - OlsonToMetaMappingEntry mzmap = new OlsonToMetaMappingEntry(); - mzmap.mzid = mzstr[0].intern(); - mzmap.from = parseDate(mzstr[1]); - mzmap.to = parseDate(mzstr[2]); - - // Add this mapping to the list - mzMappings.add(mzmap); - } catch (MissingResourceException nomz) { - // we're done - break; + mzmap.from = parseDate(from); + mzmap.to = parseDate(to); } catch (IllegalArgumentException baddate) { // skip this + continue; } + // Add this mapping to the list + mzMappings.add(mzmap); } if (mzMappings.size() != 0) { // Add to the olson-to-meta map @@ -959,43 +959,43 @@ public final class ZoneMeta { } if (metaToOlson == null) { metaToOlson = new HashMap>(); - UResourceBundle metazonesBundle = null; + UResourceBundle mapTimezonesBundle = null; try { UResourceBundle supplementalBundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, - "metazoneInfo"); - UResourceBundle mapTimezonesBundle = supplementalBundle.get("mapTimezones"); - metazonesBundle = mapTimezonesBundle.get("metazones"); + "metaZones"); + mapTimezonesBundle = supplementalBundle.get("mapTimezones"); } catch (MissingResourceException mre) { // do nothing } - if (metazonesBundle != null) { - Enumeration mzenum = metazonesBundle.getKeys(); + if (mapTimezonesBundle != null) { + Enumeration mzenum = mapTimezonesBundle.getKeys(); while (mzenum.hasMoreElements()) { String mzkey = mzenum.nextElement(); - if (!mzkey.startsWith("meta:")) { - continue; - } String tzid = null; try { - tzid = metazonesBundle.getString(mzkey); + tzid = mapTimezonesBundle.getString(mzkey); } catch (MissingResourceException mre) { // It should not happen.. } if (tzid != null) { - int territoryIdx = mzkey.lastIndexOf('_'); + String mzid = mzkey; + String territory = "001"; // default to "001" + + int territoryIdx = mzkey.lastIndexOf(':'); if (territoryIdx > 0) { - String mzid = mzkey.substring(5 /* "meta:".length() */, territoryIdx); - String territory = mzkey.substring(territoryIdx + 1); - List mappings = metaToOlson.get(mzid); - if (mappings == null) { - mappings = new LinkedList(); - metaToOlson.put(mzid, mappings); - } - MetaToOlsonMappingEntry olsonmap = new MetaToOlsonMappingEntry(); - olsonmap.id = tzid; - olsonmap.territory = territory; - mappings.add(olsonmap); + mzid = mzkey.substring(0, territoryIdx); + territory = mzkey.substring(territoryIdx + 1); } + + List mappings = metaToOlson.get(mzid); + if (mappings == null) { + mappings = new LinkedList(); + metaToOlson.put(mzid, mappings); + } + MetaToOlsonMappingEntry olsonmap = new MetaToOlsonMappingEntry(); + olsonmap.id = tzid; + olsonmap.territory = territory; + mappings.add(olsonmap); } } } diff --git a/icu4j/main/shared/data/icudata.jar b/icu4j/main/shared/data/icudata.jar index a54df43624..3f156c45ff 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:5672f8f68d999b54d3bddaecf6d7d50f7d15102d3858d04aef78bc08c76d9c31 -size 6864531 +oid sha256:b9cff44109b84b2c242dd191d08dd5a2f635c85a489c5ee21c04098182efc257 +size 6860428 diff --git a/icu4j/main/shared/data/testdata.jar b/icu4j/main/shared/data/testdata.jar index 9f29fdc8d9..cfa41165cc 100755 --- a/icu4j/main/shared/data/testdata.jar +++ b/icu4j/main/shared/data/testdata.jar @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:07c50edb652f0dd85c0e660cc790995939cbdb8bb8d46645b676ea989788ce14 -size 720048 +oid sha256:fc135016749cbefe90c0df5259ff59b0ecbc40580ef3f46f67e77ffd271b13cf +size 719423