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

Print this page
rev 6434 : 8007038: ArrayIndexOutOfBoundsException on calling localizedDateTime().print() with JapaneseChrono


 296 
 297         // Add aliases data for CLDR
 298         if (type == LocaleProviderAdapter.Type.CLDR) {
 299             // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
 300             Map<String, String> aliases = ZoneInfo.getAliasTable();
 301             for (String alias : aliases.keySet()) {
 302                 if (!keyset.contains(alias)) {
 303                     String tzid = aliases.get(alias);
 304                     if (keyset.contains(tzid)) {
 305                         String[] val = rb.getStringArray(tzid);
 306                         val[0] = alias;
 307                         value.add(val);
 308                     }
 309                 }
 310             }
 311         }
 312         return value.toArray(new String[0][]);
 313     }
 314 
 315     String[] getCalendarNames(String key) {












 316         String[] names = null;
 317         String cacheKey = CALENDAR_NAMES + key;
 318 
 319         removeEmptyReferences();
 320         ResourceReference data = cache.get(cacheKey);
 321 
 322         if (data == null || ((names = (String[]) data.get()) == null)) {
 323             ResourceBundle rb = localeData.getDateFormatData(locale);
 324             if (rb.containsKey(key)) {
 325                 names = rb.getStringArray(key);
 326                 cache.put(cacheKey,
 327                           new ResourceReference(cacheKey, (Object) names, referenceQueue));
 328             }
 329         }
 330 
 331         return names;
 332     }
 333 
 334     public String getDateTimePattern(int timeStyle, int dateStyle, Calendar cal) {
 335         String pattern;




 296 
 297         // Add aliases data for CLDR
 298         if (type == LocaleProviderAdapter.Type.CLDR) {
 299             // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
 300             Map<String, String> aliases = ZoneInfo.getAliasTable();
 301             for (String alias : aliases.keySet()) {
 302                 if (!keyset.contains(alias)) {
 303                     String tzid = aliases.get(alias);
 304                     if (keyset.contains(tzid)) {
 305                         String[] val = rb.getStringArray(tzid);
 306                         val[0] = alias;
 307                         value.add(val);
 308                     }
 309                 }
 310             }
 311         }
 312         return value.toArray(new String[0][]);
 313     }
 314 
 315     String[] getCalendarNames(String key) {
 316         String cal = locale.getUnicodeLocaleType("ca");
 317         if (cal != null) {
 318             String[] names = getCalendarNamesImpl(cal + "." + key);
 319             if (names != null) {
 320                 return names;
 321             }
 322         }
 323 
 324         return getCalendarNamesImpl(key);
 325     }
 326 
 327     private String[] getCalendarNamesImpl(String key) {
 328         String[] names = null;
 329         String cacheKey = CALENDAR_NAMES + key;
 330 
 331         removeEmptyReferences();
 332         ResourceReference data = cache.get(cacheKey);
 333 
 334         if (data == null || ((names = (String[]) data.get()) == null)) {
 335             ResourceBundle rb = localeData.getDateFormatData(locale);
 336             if (rb.containsKey(key)) {
 337                 names = rb.getStringArray(key);
 338                 cache.put(cacheKey,
 339                           new ResourceReference(cacheKey, (Object) names, referenceQueue));
 340             }
 341         }
 342 
 343         return names;
 344     }
 345 
 346     public String getDateTimePattern(int timeStyle, int dateStyle, Calendar cal) {
 347         String pattern;