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

Retrieve the region specific data regardless of language in locale

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8, 9, 10
    • Fix Version/s: 10
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b36
    • Verification:
      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

              • Assignee:
                naoto Naoto Sato
                Reporter:
                ljiang Leo Jiang
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: