< prev index next >

src/java.base/share/classes/java/text/DateFormatSymbols.java

Print this page
rev 47480 : [mq]: 8176841

*** 1,7 **** /* ! * Copyright (c) 1996, 2016, 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) 1996, 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
*** 47,56 **** --- 47,57 ---- import java.util.Locale; import java.util.Objects; import java.util.ResourceBundle; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; + import sun.util.locale.provider.CalendarDataUtility; import sun.util.locale.provider.LocaleProviderAdapter; import sun.util.locale.provider.LocaleServiceProviderPool; import sun.util.locale.provider.ResourceBundleBasedAdapter; import sun.util.locale.provider.TimeZoneNameUtility;
*** 80,89 **** --- 81,94 ---- * <pre> * new SimpleDateFormat(aPattern, DateFormatSymbols.getInstance(aLocale)). * </pre> * </blockquote> * + * <p>If the locale contains "rg" (region override) + * <a href="../util/Locale.html#def_locale_extension">Unicode extension</a>, + * the symbols are overriden for the designated region. + * * <p> * <code>DateFormatSymbols</code> objects are cloneable. When you obtain * a <code>DateFormatSymbols</code> object, feel free to modify the * date-time formatting data. For instance, you can replace the localized * date-time format pattern characters with the ones that you feel easy
*** 714,732 **** // Remove the empty SoftReference cachedInstances.remove(locale, ref); } dfs = new DateFormatSymbols(false); // Initialize the fields from the ResourceBundle for locale. LocaleProviderAdapter adapter ! = LocaleProviderAdapter.getAdapter(DateFormatSymbolsProvider.class, locale); // Avoid any potential recursions if (!(adapter instanceof ResourceBundleBasedAdapter)) { adapter = LocaleProviderAdapter.getResourceBundleBased(); } ResourceBundle resource ! = ((ResourceBundleBasedAdapter)adapter).getLocaleData().getDateFormatData(locale); dfs.locale = locale; // JRE and CLDR use different keys // JRE: Eras, short.Eras and narrow.Eras // CLDR: long.Eras, Eras and narrow.Eras --- 719,740 ---- // Remove the empty SoftReference cachedInstances.remove(locale, ref); } dfs = new DateFormatSymbols(false); + // check for region override + Locale override = CalendarDataUtility.findRegionOverride(locale).orElse(locale); + // Initialize the fields from the ResourceBundle for locale. LocaleProviderAdapter adapter ! = LocaleProviderAdapter.getAdapter(DateFormatSymbolsProvider.class, override); // Avoid any potential recursions if (!(adapter instanceof ResourceBundleBasedAdapter)) { adapter = LocaleProviderAdapter.getResourceBundleBased(); } ResourceBundle resource ! = ((ResourceBundleBasedAdapter)adapter).getLocaleData().getDateFormatData(override); dfs.locale = locale; // JRE and CLDR use different keys // JRE: Eras, short.Eras and narrow.Eras // CLDR: long.Eras, Eras and narrow.Eras
< prev index next >