-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
11, 17, 21
Found this issue as part of backporting JDK-8358095 to 21u.
As per Java doc of LocaleServiceProvider
It says,
/*
* The default order for looking up the preferred locale providers is "CLDR,COMPAT",
* so specifying "CLDR,COMPAT" is identical to the default behavior.
*/
Which means it has to look up in CLDR first, but in some cases it is not happening.
Example code:
TimeZone.getTimeZone("Europe/Saratov").getDisplayName(true,TimeZone.LONG,Locale.US);
Output for above code differs when -Djava.locale.providers=CLDR is used.
a) Without passing option "-Djava.locale.providers", this code returns output
"Saratov Standard Time"
b)If "-Djava.locale.providers=COMPAT" is passed, it is returning "Saratov Standard Time"
c) If "-Djava.locale.providers=CLDR" is passed, it is returning "Saratov Daylight Time"
-------------
In jdk25 case, without passing "-Djava.locale.providers” code is returning "Saratov Daylight Time”
Change in behavior of jdk 21u and 25u is due to removal of compat data provider as part of https://bugs.openjdk.org/browse/JDK-8174269
As per Java doc of LocaleServiceProvider
It says,
/*
* The default order for looking up the preferred locale providers is "CLDR,COMPAT",
* so specifying "CLDR,COMPAT" is identical to the default behavior.
*/
Which means it has to look up in CLDR first, but in some cases it is not happening.
Example code:
TimeZone.getTimeZone("Europe/Saratov").getDisplayName(true,TimeZone.LONG,Locale.US);
Output for above code differs when -Djava.locale.providers=CLDR is used.
a) Without passing option "-Djava.locale.providers", this code returns output
"Saratov Standard Time"
b)If "-Djava.locale.providers=COMPAT" is passed, it is returning "Saratov Standard Time"
c) If "-Djava.locale.providers=CLDR" is passed, it is returning "Saratov Daylight Time"
-------------
In jdk25 case, without passing "-Djava.locale.providers” code is returning "Saratov Daylight Time”
Change in behavior of jdk 21u and 25u is due to removal of compat data provider as part of https://bugs.openjdk.org/browse/JDK-8174269