src/share/classes/sun/util/locale/provider/LocaleResources.java

Print this page

        

*** 52,61 **** --- 52,62 ---- import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import sun.util.calendar.ZoneInfo; import sun.util.resources.LocaleData; import sun.util.resources.OpenListResourceBundle; + import sun.util.resources.ParallelListResourceBundle; import sun.util.resources.TimeZoneNamesBundle; /** * Central accessor to locale-dependent resources for JRE/CLDR provider adapters. *
*** 329,338 **** --- 330,358 ---- } return names; } + String[] getJavaTimeNames(String key) { + String[] names = null; + String cacheKey = CALENDAR_NAMES + key; + + removeEmptyReferences(); + ResourceReference data = cache.get(cacheKey); + + if (data == null || ((names = (String[]) data.get()) == null)) { + ResourceBundle rb = getJavaTimeFormatData(); + if (rb.containsKey(key)) { + names = rb.getStringArray(key); + cache.put(cacheKey, + new ResourceReference(cacheKey, (Object) names, referenceQueue)); + } + } + + return names; + } + public String getDateTimePattern(int timeStyle, int dateStyle, Calendar cal) { if (cal == null) { cal = Calendar.getInstance(locale); } return getDateTimePattern(null, timeStyle, dateStyle, cal.getCalendarType());
*** 345,358 **** * @param dateStyle style of time; one of FULL, LONG, MEDIUM, SHORT in DateFormat, * or -1 if not required * @param calType the calendar type for the pattern * @return the pattern string */ ! public String getCldrDateTimePattern(int timeStyle, int dateStyle, String calType) { calType = CalendarDataUtility.normalizeCalendarType(calType); String pattern; ! pattern = getDateTimePattern("cldr.", timeStyle, dateStyle, calType); if (pattern == null) { pattern = getDateTimePattern(null, timeStyle, dateStyle, calType); } return pattern; } --- 365,378 ---- * @param dateStyle style of time; one of FULL, LONG, MEDIUM, SHORT in DateFormat, * or -1 if not required * @param calType the calendar type for the pattern * @return the pattern string */ ! public String getJavaTimeDateTimePattern(int timeStyle, int dateStyle, String calType) { calType = CalendarDataUtility.normalizeCalendarType(calType); String pattern; ! pattern = getDateTimePattern("java.time.", timeStyle, dateStyle, calType); if (pattern == null) { pattern = getDateTimePattern(null, timeStyle, dateStyle, calType); } return pattern; }
*** 428,439 **** /** * Returns the FormatData resource bundle of this LocaleResources. * The FormatData should be used only for accessing extra * resources required by JSR 310. */ ! public ResourceBundle getFormatData() { ! return localeData.getDateFormatData(locale); } private String getDateTimePattern(String prefix, String key, int styleIndex, String calendarType) { StringBuilder sb = new StringBuilder(); if (prefix != null) { --- 448,463 ---- /** * Returns the FormatData resource bundle of this LocaleResources. * The FormatData should be used only for accessing extra * resources required by JSR 310. */ ! public ResourceBundle getJavaTimeFormatData() { ! ResourceBundle rb = localeData.getDateFormatData(locale); ! if (rb instanceof ParallelListResourceBundle) { ! localeData.setSupplementary((ParallelListResourceBundle) rb); ! } ! return rb; } private String getDateTimePattern(String prefix, String key, int styleIndex, String calendarType) { StringBuilder sb = new StringBuilder(); if (prefix != null) {
*** 449,459 **** removeEmptyReferences(); ResourceReference data = cache.get(cacheKey); Object value = NULLOBJECT; if (data == null || ((value = data.get()) == null)) { ! ResourceBundle r = localeData.getDateFormatData(locale); if (r.containsKey(resourceKey)) { value = r.getStringArray(resourceKey); } else { assert !resourceKey.equals(key); if (r.containsKey(key)) { --- 473,483 ---- removeEmptyReferences(); ResourceReference data = cache.get(cacheKey); Object value = NULLOBJECT; if (data == null || ((value = data.get()) == null)) { ! ResourceBundle r = (prefix != null) ? getJavaTimeFormatData() : localeData.getDateFormatData(locale); if (r.containsKey(resourceKey)) { value = r.getStringArray(resourceKey); } else { assert !resourceKey.equals(key); if (r.containsKey(key)) {