Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8190918

Retrieve the region specific data regardless of language in locale

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 10
    • 8, 9, 10
    • core-libs
    • b36
    • Verified

    Description

      For the region specific data, we would get the data from CLDR only regards to the region settings in locale. In current implementation, if we use an "invalid" locale, e.g. "zh-ES", as this locale hasn't been handled correctly when need to search the region specific information, so we would get the data from root resource bundle.

      ===== Code
          public static void main(String[] args) {
              Locale normLocale = Locale.forLanguageTag("es-ES");
              Locale oddLocale = Locale.forLanguageTag("zh-ES");
              print(normLocale);
              print(oddLocale);
          }

          private static void print(Locale loc) {
              Calendar ca = Calendar.getInstance(loc);
              int minDayInFirstWeek = ca.getMinimalDaysInFirstWeek();
              int firstDayOfWeek = ca.getFirstDayOfWeek();
              System.out.println("minDay: "+minDayInFirstWeek +" firstDay: "+firstDayOfWeek);
          }
      ===== Output
      minDay: 4 firstDay: 2
      minDay: 1 firstDay: 1

      ===== Expected:
      minDay: 4 firstDay: 2
      minDay: 4 firstDay: 2

      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              ljiang Leo Jiang (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: