106 // "parentLocales" map |
106 // "parentLocales" map |
107 private static final Map<String, SortedSet<String>> parentLocalesMap = new HashMap<>(); |
107 private static final Map<String, SortedSet<String>> parentLocalesMap = new HashMap<>(); |
108 private static final ResourceBundle.Control defCon = |
108 private static final ResourceBundle.Control defCon = |
109 ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT); |
109 ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT); |
110 |
110 |
111 private static final String[] AVAILABLE_TZIDS = TimeZone.getAvailableIDs(); |
111 private static Set<String> AVAILABLE_TZIDS; |
112 private static String zoneNameTempFile; |
112 private static String zoneNameTempFile; |
113 private static String tzDataDir; |
113 private static String tzDataDir; |
114 private static final Map<String, String> canonicalTZMap = new HashMap<>(); |
114 private static final Map<String, String> canonicalTZMap = new HashMap<>(); |
115 |
115 |
116 static enum DraftType { |
116 static enum DraftType { |
728 }); |
728 }); |
729 } |
729 } |
730 }); |
730 }); |
731 } |
731 } |
732 |
732 |
733 Arrays.stream(AVAILABLE_TZIDS).forEach(tzid -> { |
733 getAvailableZoneIds().stream().forEach(tzid -> { |
734 // If the tzid is deprecated, get the data for the replacement id |
734 // If the tzid is deprecated, get the data for the replacement id |
735 String tzKey = Optional.ofNullable((String)handlerSupplMeta.get(tzid)) |
735 String tzKey = Optional.ofNullable((String)handlerSupplMeta.get(tzid)) |
736 .orElse(tzid); |
736 .orElse(tzid); |
737 Object data = map.get(TIMEZONE_ID_PREFIX + tzKey); |
737 Object data = map.get(TIMEZONE_ID_PREFIX + tzKey); |
738 |
738 |
1072 }) |
1072 }) |
1073 .collect(Collectors.toList()), |
1073 .collect(Collectors.toList()), |
1074 StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); |
1074 StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); |
1075 } |
1075 } |
1076 |
1076 |
|
1077 // This method assumes handlerMetaZones is already initialized |
|
1078 private static Set<String> getAvailableZoneIds() { |
|
1079 assert handlerMetaZones != null; |
|
1080 if (AVAILABLE_TZIDS == null) { |
|
1081 AVAILABLE_TZIDS = new HashSet<>(ZoneId.getAvailableZoneIds()); |
|
1082 AVAILABLE_TZIDS.addAll(handlerMetaZones.keySet()); |
|
1083 AVAILABLE_TZIDS.remove(MetaZonesParseHandler.NO_METAZONE_KEY); |
|
1084 } |
|
1085 |
|
1086 return AVAILABLE_TZIDS; |
|
1087 } |
|
1088 |
1077 private static Stream<String> zidMapEntry() { |
1089 private static Stream<String> zidMapEntry() { |
1078 return ZoneId.getAvailableZoneIds().stream() |
1090 return getAvailableZoneIds().stream() |
1079 .map(id -> { |
1091 .map(id -> { |
1080 String canonId = canonicalTZMap.getOrDefault(id, id); |
1092 String canonId = canonicalTZMap.getOrDefault(id, id); |
1081 String meta = handlerMetaZones.get(canonId); |
1093 String meta = handlerMetaZones.get(canonId); |
1082 String zone001 = handlerMetaZones.zidMap().get(meta); |
1094 String zone001 = handlerMetaZones.zidMap().get(meta); |
1083 return zone001 == null ? "" : |
1095 return zone001 == null ? "" : |