2357 }
2358
2359 private static final int[] REST_OF_STYLES = {
2360 Calendar.SHORT_STANDALONE, Calendar.LONG_FORMAT, Calendar.LONG_STANDALONE,
2361 };
2362 private Map<String, Integer> getDisplayNamesMap(int field, Locale locale) {
2363 Map<String, Integer> map = calendar.getDisplayNames(field, Calendar.SHORT_FORMAT, locale);
2364 // Get all SHORT and LONG styles (avoid NARROW styles).
2365 for (int style : REST_OF_STYLES) {
2366 Map<String, Integer> m = calendar.getDisplayNames(field, style, locale);
2367 if (m != null) {
2368 map.putAll(m);
2369 }
2370 }
2371 return map;
2372 }
2373
2374 /**
2375 * After reading an object from the input stream, the format
2376 * pattern in the object is verified.
2377 * <p>
2378 * @exception InvalidObjectException if the pattern is invalid
2379 */
2380 private void readObject(ObjectInputStream stream)
2381 throws IOException, ClassNotFoundException {
2382 stream.defaultReadObject();
2383
2384 try {
2385 compiledPattern = compile(pattern);
2386 } catch (Exception e) {
2387 throw new InvalidObjectException("invalid pattern");
2388 }
2389
2390 if (serialVersionOnStream < 1) {
2391 // didn't have defaultCenturyStart field
2392 initializeDefaultCentury();
2393 }
2394 else {
2395 // fill in dependent transient field
2396 parseAmbiguousDatesAsAfter(defaultCenturyStart);
2397 }
|
2357 }
2358
2359 private static final int[] REST_OF_STYLES = {
2360 Calendar.SHORT_STANDALONE, Calendar.LONG_FORMAT, Calendar.LONG_STANDALONE,
2361 };
2362 private Map<String, Integer> getDisplayNamesMap(int field, Locale locale) {
2363 Map<String, Integer> map = calendar.getDisplayNames(field, Calendar.SHORT_FORMAT, locale);
2364 // Get all SHORT and LONG styles (avoid NARROW styles).
2365 for (int style : REST_OF_STYLES) {
2366 Map<String, Integer> m = calendar.getDisplayNames(field, style, locale);
2367 if (m != null) {
2368 map.putAll(m);
2369 }
2370 }
2371 return map;
2372 }
2373
2374 /**
2375 * After reading an object from the input stream, the format
2376 * pattern in the object is verified.
2377 *
2378 * @exception InvalidObjectException if the pattern is invalid
2379 */
2380 private void readObject(ObjectInputStream stream)
2381 throws IOException, ClassNotFoundException {
2382 stream.defaultReadObject();
2383
2384 try {
2385 compiledPattern = compile(pattern);
2386 } catch (Exception e) {
2387 throw new InvalidObjectException("invalid pattern");
2388 }
2389
2390 if (serialVersionOnStream < 1) {
2391 // didn't have defaultCenturyStart field
2392 initializeDefaultCentury();
2393 }
2394 else {
2395 // fill in dependent transient field
2396 parseAmbiguousDatesAsAfter(defaultCenturyStart);
2397 }
|