Java Code Examples for sun.util.calendar.ZoneInfo#getAliasTable()

The following examples show how to use sun.util.calendar.ZoneInfo#getAliasTable() . 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: UTCAliasTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Map<String,String> map = ZoneInfo.getAliasTable();
    String alias = map.get("UTC");
    if (!alias.equals("Etc/UTC")) {
        throw new RuntimeException("got " + alias + ", expected Etc/UTC");
    }
    TimeZone GMT = TimeZone.getTimeZone("GMT");
    TimeZone UTC = TimeZone.getTimeZone("UTC");
    if (!GMT.hasSameRules(UTC)) {
        throw new RuntimeException("GMT and UTC have different rules");
    }
    TimeZone EtcUTC = TimeZone.getTimeZone("Etc/UTC");
    if (!UTC.hasSameRules(EtcUTC)) {
        throw new RuntimeException("UTC and Etc/UTC have different rules");
    }
}
 
Example 2
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 3
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 4
Source File: UTCAliasTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Map<String,String> map = ZoneInfo.getAliasTable();
    String alias = map.get("UTC");
    if (!alias.equals("Etc/UTC")) {
        throw new RuntimeException("got " + alias + ", expected Etc/UTC");
    }
    TimeZone GMT = TimeZone.getTimeZone("GMT");
    TimeZone UTC = TimeZone.getTimeZone("UTC");
    if (!GMT.hasSameRules(UTC)) {
        throw new RuntimeException("GMT and UTC have different rules");
    }
    TimeZone EtcUTC = TimeZone.getTimeZone("Etc/UTC");
    if (!UTC.hasSameRules(EtcUTC)) {
        throw new RuntimeException("UTC and Etc/UTC have different rules");
    }
}
 
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 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 7
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 8
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 9
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 10
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 11
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 12
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 13
Source File: UTCAliasTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Map<String,String> map = ZoneInfo.getAliasTable();
    String alias = map.get("UTC");
    if (!alias.equals("Etc/UTC")) {
        throw new RuntimeException("got " + alias + ", expected Etc/UTC");
    }
    TimeZone GMT = TimeZone.getTimeZone("GMT");
    TimeZone UTC = TimeZone.getTimeZone("UTC");
    if (!GMT.hasSameRules(UTC)) {
        throw new RuntimeException("GMT and UTC have different rules");
    }
    TimeZone EtcUTC = TimeZone.getTimeZone("Etc/UTC");
    if (!UTC.hasSameRules(EtcUTC)) {
        throw new RuntimeException("UTC and Etc/UTC have different rules");
    }
}
 
Example 14
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 15
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 16
Source File: UTCAliasTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Map<String,String> map = ZoneInfo.getAliasTable();
    String alias = map.get("UTC");
    if (!alias.equals("Etc/UTC")) {
        throw new RuntimeException("got " + alias + ", expected Etc/UTC");
    }
    TimeZone GMT = TimeZone.getTimeZone("GMT");
    TimeZone UTC = TimeZone.getTimeZone("UTC");
    if (!GMT.hasSameRules(UTC)) {
        throw new RuntimeException("GMT and UTC have different rules");
    }
    TimeZone EtcUTC = TimeZone.getTimeZone("Etc/UTC");
    if (!UTC.hasSameRules(EtcUTC)) {
        throw new RuntimeException("UTC and Etc/UTC have different rules");
    }
}
 
Example 17
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 18
Source File: UTCAliasTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Map<String,String> map = ZoneInfo.getAliasTable();
    String alias = map.get("UTC");
    if (!alias.equals("Etc/UTC")) {
        throw new RuntimeException("got " + alias + ", expected Etc/UTC");
    }
    TimeZone GMT = TimeZone.getTimeZone("GMT");
    TimeZone UTC = TimeZone.getTimeZone("UTC");
    if (!GMT.hasSameRules(UTC)) {
        throw new RuntimeException("GMT and UTC have different rules");
    }
    TimeZone EtcUTC = TimeZone.getTimeZone("Etc/UTC");
    if (!UTC.hasSameRules(EtcUTC)) {
        throw new RuntimeException("UTC and Etc/UTC have different rules");
    }
}