Print this page
rev 5696 : 6336885: RFE: Locale Data Deployment Enhancements
4609153: Provide locale data for Indic locales
5104387: Support for gl_ES locale (galician language)
6337471: desktop/system locale preferences support
7056139: (cal) SPI support for locale-dependent Calendar parameters
7058206: Provide CalendarData SPI for week params and display field value names
7073852: Support multiple scripts for digits and decimal symbols per locale
7079560: [Fmt-Da] Context dependent month names support in SimpleDateFormat
7171324: getAvailableLocales() of locale sensitive services should return the actual availability of locales
7151414: (cal) Support calendar type identification
7168528: LocaleServiceProvider needs to be aware of Locale extensions
7171372: (cal) locale's default Calendar should be created if unknown calendar is specified
Summary: JEP 127: Improve Locale Data Packaging and Adopt Unicode CLDR Data (part 1 w/o packaging changes. by Naoto Sato and Masayoshi Okutsu)

Split Close
Expand all
Collapse all
          --- old/src/share/classes/java/util/spi/CurrencyNameProvider.java
          +++ new/src/share/classes/java/util/spi/CurrencyNameProvider.java
↓ open down ↓ 21 lines elided ↑ open up ↑
  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 java.util.spi;
  27   27  
  28   28  import java.util.Arrays;
  29   29  import java.util.Currency;
  30   30  import java.util.List;
  31   31  import java.util.Locale;
       32 +import java.util.ResourceBundle.Control;
  32   33  
  33   34  /**
  34   35   * An abstract class for service providers that
  35   36   * provide localized currency symbols and display names for the
  36   37   * {@link java.util.Currency Currency} class.
  37   38   * Note that currency symbols are considered names when determining
  38   39   * behaviors described in the
  39   40   * {@link java.util.spi.LocaleServiceProvider LocaleServiceProvider}
  40   41   * specification.
  41   42   *
↓ open down ↓ 60 lines elided ↑ open up ↑
 102  103          if (charray.length != 3) {
 103  104              throw new IllegalArgumentException("The currencyCode is not in the form of three upper-case letters.");
 104  105          }
 105  106          for (char c : charray) {
 106  107              if (c < 'A' || c > 'Z') {
 107  108                  throw new IllegalArgumentException("The currencyCode is not in the form of three upper-case letters.");
 108  109              }
 109  110          }
 110  111  
 111  112          // Check whether the locale is valid
 112      -        List<Locale> avail = Arrays.asList(getAvailableLocales());
 113      -        if (!avail.contains(locale)) {
 114      -            throw new IllegalArgumentException("The locale is not available");
      113 +        Control c = Control.getNoFallbackControl(Control.FORMAT_DEFAULT);
      114 +        for (Locale l : getAvailableLocales()) {
      115 +            if (c.getCandidateLocales("", l).contains(locale)) {
      116 +                return null;
      117 +            }
 115  118          }
 116  119  
 117      -        return null;
      120 +        throw new IllegalArgumentException("The locale is not available");
 118  121      }
 119  122  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX