< prev index next >
make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java
Print this page
@@ -106,11 +106,11 @@
// "parentLocales" map
private static final Map<String, SortedSet<String>> parentLocalesMap = new HashMap<>();
private static final ResourceBundle.Control defCon =
ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT);
- private static final String[] AVAILABLE_TZIDS = TimeZone.getAvailableIDs();
+ private static Set<String> AVAILABLE_TZIDS;
private static String zoneNameTempFile;
private static String tzDataDir;
private static final Map<String, String> canonicalTZMap = new HashMap<>();
static enum DraftType {
@@ -728,11 +728,11 @@
});
}
});
}
- Arrays.stream(AVAILABLE_TZIDS).forEach(tzid -> {
+ getAvailableZoneIds().stream().forEach(tzid -> {
// If the tzid is deprecated, get the data for the replacement id
String tzKey = Optional.ofNullable((String)handlerSupplMeta.get(tzid))
.orElse(tzid);
Object data = map.get(TIMEZONE_ID_PREFIX + tzKey);
@@ -1072,12 +1072,24 @@
})
.collect(Collectors.toList()),
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
}
+ // This method assumes handlerMetaZones is already initialized
+ private static Set<String> getAvailableZoneIds() {
+ assert handlerMetaZones != null;
+ if (AVAILABLE_TZIDS == null) {
+ AVAILABLE_TZIDS = new HashSet(ZoneId.getAvailableZoneIds());
+ AVAILABLE_TZIDS.addAll(handlerMetaZones.keySet());
+ AVAILABLE_TZIDS.remove(MetaZonesParseHandler.NO_METAZONE_KEY);
+ }
+
+ return AVAILABLE_TZIDS;
+ }
+
private static Stream<String> zidMapEntry() {
- return ZoneId.getAvailableZoneIds().stream()
+ return getAvailableZoneIds().stream()
.map(id -> {
String canonId = canonicalTZMap.getOrDefault(id, id);
String meta = handlerMetaZones.get(canonId);
String zone001 = handlerMetaZones.zidMap().get(meta);
return zone001 == null ? "" :
< prev index next >