< prev index next >
src/java.base/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java
Print this page
rev 49575 : imported patch 8181157
*** 1,7 ****
/*
! * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 160,172 ****
*
* @param shortID time zone short ID defined in LDML
* @return the tzdb's time zone ID
*/
public static Optional<String> convertLDMLShortID(String shortID) {
return ((CLDRLocaleProviderAdapter)LocaleProviderAdapter.forType(Type.CLDR))
! .getTimeZoneID(shortID)
! .map(id -> id.replaceAll("\\s.*", ""));
}
private static String[] retrieveDisplayNamesImpl(String id, Locale locale) {
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class);
--- 160,178 ----
*
* @param shortID time zone short ID defined in LDML
* @return the tzdb's time zone ID
*/
public static Optional<String> convertLDMLShortID(String shortID) {
+ return canonicalTZID(shortID);
+ }
+
+ /**
+ * Returns the canonical ID for the given ID
+ */
+ public static Optional<String> canonicalTZID(String id) {
return ((CLDRLocaleProviderAdapter)LocaleProviderAdapter.forType(Type.CLDR))
! .canonicalTZID(id);
}
private static String[] retrieveDisplayNamesImpl(String id, Locale locale) {
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class);
< prev index next >