JDK-8190918 : Retrieve the region specific data regardless of language in locale
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 8,9,10
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2017-11-08
  • Updated: 2021-08-07
  • Resolved: 2017-12-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10 b36Fixed
Related Reports
Relates :  
Relates :  
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