sun.util.resources.TimeZoneNamesBundle Java Examples

The following examples show how to use sun.util.resources.TimeZoneNamesBundle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocaleResources.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key, int size) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + size + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (data == null || ((names = (String[]) data.get()) == null)) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key, size);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #2
Source File: LocaleResources.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (Objects.isNull(data) || Objects.isNull((names = (String[]) data.get()))) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #3
Source File: LocaleResources.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #4
Source File: LocaleResources.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (Objects.isNull(data) || Objects.isNull((names = (String[]) data.get()))) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #5
Source File: LocaleResources.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #6
Source File: LocaleResources.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (Objects.isNull(data) || Objects.isNull((names = (String[]) data.get()))) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #7
Source File: LocaleResources.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #8
Source File: LocaleResources.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key, int size) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + size + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (data == null || ((names = (String[]) data.get()) == null)) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key, size);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #9
Source File: LocaleResources.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #10
Source File: LocaleResources.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (Objects.isNull(data) || Objects.isNull((names = (String[]) data.get()))) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #11
Source File: LocaleResources.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #12
Source File: LocaleResources.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (Objects.isNull(data) || Objects.isNull((names = (String[]) data.get()))) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #13
Source File: LocaleResources.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #14
Source File: LocaleResources.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key, int size) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + size + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (data == null || ((names = (String[]) data.get()) == null)) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key, size);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #15
Source File: LocaleResources.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #16
Source File: LocaleResources.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key, int size) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + size + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (data == null || ((names = (String[]) data.get()) == null)) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key, size);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #17
Source File: LocaleResources.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #18
Source File: LocaleResources.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #19
Source File: LocaleResources.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #20
Source File: LocaleResources.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (Objects.isNull(data) || Objects.isNull((names = (String[]) data.get()))) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #21
Source File: LocaleResources.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (Objects.isNull(data) || Objects.isNull((names = (String[]) data.get()))) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #22
Source File: LocaleResources.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #23
Source File: LocaleResources.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #24
Source File: LocaleResources.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (Objects.isNull(data) || Objects.isNull((names = (String[]) data.get()))) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #25
Source File: LocaleResources.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
Example #26
Source File: LocaleResources.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
String[] getTimeZoneNames(String key) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (Objects.isNull(data) || Objects.isNull((names = (String[]) data.get()))) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
Example #27
Source File: LocaleResources.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
Set<String> getZoneIDs() {
    Set<String> zoneIDs = null;

    removeEmptyReferences();
    ResourceReference data = cache.get(ZONE_IDS_CACHEKEY);
    if (data == null || ((zoneIDs = (Set<String>) data.get()) == null)) {
        TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
        zoneIDs = rb.keySet();
        cache.put(ZONE_IDS_CACHEKEY,
                  new ResourceReference(ZONE_IDS_CACHEKEY, (Object) zoneIDs, referenceQueue));
    }

    return zoneIDs;
}
 
Example #28
Source File: LocaleResources.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    Set<String> tzIds = new HashSet<>(Arrays.asList(TimeZone.getAvailableIDs()));
    for (String key : keyset) {
        if (!key.startsWith(TZNB_EXCITY_PREFIX)) {
            value.add(rb.getStringArray(key));
            tzIds.remove(key);
        }
    }

    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.

        // Add timezones which are not present in this keyset,
        // so that their fallback names will be generated at runtime.
        tzIds.stream().filter(i -> (!i.startsWith("Etc/GMT")
                && !i.startsWith("GMT")
                && !i.startsWith("SystemV")))
                .forEach(tzid -> {
                    String[] val = new String[7];
                    if (keyset.contains(tzid)) {
                        val = rb.getStringArray(tzid);
                    } else {
                        var canonID = TimeZoneNameUtility.canonicalTZID(tzid)
                                        .orElse(tzid);
                        if (keyset.contains(canonID)) {
                            val = rb.getStringArray(canonID);
                        }
                    }
                    val[0] = tzid;
                    value.add(val);
                });
    }
    return value.toArray(new String[0][]);
}
 
Example #29
Source File: LocaleResources.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
Set<String> getZoneIDs() {
    Set<String> zoneIDs = null;

    removeEmptyReferences();
    ResourceReference data = cache.get(ZONE_IDS_CACHEKEY);
    if (data == null || ((zoneIDs = (Set<String>) data.get()) == null)) {
        TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
        zoneIDs = rb.keySet();
        cache.put(ZONE_IDS_CACHEKEY,
                  new ResourceReference(ZONE_IDS_CACHEKEY, (Object) zoneIDs, referenceQueue));
    }

    return zoneIDs;
}
 
Example #30
Source File: LocaleResources.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
Set<String> getZoneIDs() {
    Set<String> zoneIDs = null;

    removeEmptyReferences();
    ResourceReference data = cache.get(ZONE_IDS_CACHEKEY);
    if (data == null || ((zoneIDs = (Set<String>) data.get()) == null)) {
        TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
        zoneIDs = rb.keySet();
        cache.put(ZONE_IDS_CACHEKEY,
                  new ResourceReference(ZONE_IDS_CACHEKEY, (Object) zoneIDs, referenceQueue));
    }

    return zoneIDs;
}