Print this page
rev 5957 : imported patch 8000245.8000273.8000615

Split Close
Expand all
Collapse all
          --- old/src/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java
          +++ new/src/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java
↓ open down ↓ 19 lines elided ↑ open up ↑
  20   20   *
  21   21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22   22   * or visit www.oracle.com if you need additional information or have any
  23   23   * questions.
  24   24   */
  25   25  
  26   26  package sun.util.locale.provider;
  27   27  
  28   28  import java.util.Locale;
  29   29  import java.util.MissingResourceException;
       30 +import java.util.ResourceBundle;
  30   31  import java.util.Set;
  31   32  import java.util.TimeZone;
  32   33  import java.util.spi.TimeZoneNameProvider;
  33      -import sun.util.resources.OpenListResourceBundle;
  34   34  
  35   35  /**
  36   36   * Concrete implementation of the
  37   37   * {@link java.util.spi.TimeZoneNameProvider TimeZoneNameProvider} class
  38   38   * for the JRE LocaleProviderAdapter.
  39   39   *
  40   40   * @author Naoto Sato
  41   41   * @author Masayoshi Okutsu
  42   42   */
  43   43  public class TimeZoneNameProviderImpl extends TimeZoneNameProvider {
↓ open down ↓ 51 lines elided ↑ open up ↑
  95   95       *     is null
  96   96       * @see java.util.TimeZone#getDisplayName(boolean, int, java.util.Locale)
  97   97       */
  98   98      @Override
  99   99      public String getDisplayName(String id, boolean daylight, int style, Locale locale) {
 100  100          if (id == null || locale == null) {
 101  101              throw new NullPointerException();
 102  102          }
 103  103  
 104  104          LocaleProviderAdapter adapter = LocaleProviderAdapter.forType(type);
 105      -        OpenListResourceBundle rb = adapter.getLocaleResources(locale).getTimeZoneNames();
 106      -        LocaleServiceProviderPool pool =
 107      -                LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class);
      105 +        ResourceBundle rb = adapter.getLocaleResources(locale).getTimeZoneNames();
 108  106          try {
 109      -            if (!pool.hasProviders() ||
 110      -                (rb.getLocale().equals(locale) && rb.handleGetKeys().contains(id))) {
      107 +            if (rb.containsKey(id)) {
 111  108                  String[] names = rb.getStringArray(id);
 112  109                  int index = daylight ? 3 : 1;
 113  110                  if (style == TimeZone.SHORT) {
 114  111                      index++;
 115  112                  }
 116  113                  return names[index];
 117  114              }
 118  115          } catch (MissingResourceException mre) {
 119  116          }
 120  117  
 121  118          return null;
 122  119      }
 123  120  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX