JDK-8220037 : Inconsistencies of generated timezone files between Windows and Linux
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 11
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2019-03-04
  • Updated: 2019-10-04
  • Resolved: 2019-05-07
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 11 JDK 13
11.0.5-oracleFixed 13 b20Fixed
Related Reports
Relates :  
Relates :  
Description
There is an inconsistency between Windows and Linux timezone files generated 
during the JDK build. Some timezone files such as TimeZoneNames_en_CA.java, 
TimeZoneNames_en_BW.java,  TimeZoneNames_en_CM.java, etc. do not contain 
short names for particular timezone. 

It could be an intensional change by the fix of 
JDK-8181157: CLDR Timezone name fallback implementation. 

In this case, the timezone files for Windows may accidentally contain short 
names.  Moreover, some builds for Linux contain short names as well.  We
needs to make sure it was intensional or not. 

Taking 11.0.2+9 as an example, a source diff below shows a difference in 
TimeZoneNames_en_CA.java between Linux and Windows. The Windows version of 
TimeZoneNames_em_CA.java has a few extra short name aliases such as "ART" and 
"ARST" that are not generated for the Linux version. 

--- 
linux/tz/jdk-11.0.2+9_x64/jdk.localedata/sun/util/resources/cldr/ext/TimeZoneN 
ames_en_CA.java 
2019-01-18 14:16:26.000000000 +0900 
+++ 
windows/tz/jdk-11.0.2+9_x64/jdk.localedata/sun/util/resources/cldr/ext/TimeZon 
eNames_en_CA.java 

- protected final Object[][] getContents() { 
+ protected final Object[][] getContents() { 
final String[] Argentina = new String[] { 
"Argentina Standard Time", 
- "", 
+ "ART", 
"Argentina Summer Time", 
- "", 
+ "ARST", 
"Argentina Time", 
- "", 
+ "ART", 
}; 

Looking around other bundles including 11.0.1+13, 11.0.2+7, 11.0.2+9 
and 12.0.0+33 for Windows and Linux.  The timezone files in 11.0.1+13 and 
11.0.2+7 for Linux contain short name aliases, which is the same as all 
versions for Windows.  On the other hand, 11.0.0+28, 11.0.2+9 and 12-ea+33 
for Linux do not have short name aliases. 

Other TimeZoneNames_en_XX.java files have similar inconsistencies but how 
much files contain such inconsistency hasn't been examined yet. 

1. Create temporary directory 

$ mkdir tz 
$ ls 
jdk-11.0.0+28_x64 jdk-11.0.1+13_x64 jdk-11.0.2+7_x64 jdk-11.0.2+9_x64 
jdk-12-ea+33 tz 

2. Extract TimeZoneNames_en_CA.java from src.zip 

$ for in in `ls` 
for> do 
for> mkdir -n tz/$i 
for> unzip -d tz/$i lib/src.zip 
jdk.localedata/sun/util/resources/cldr/ext/TimeZoneNames_en_CA.java 
for> done 

3. Compare the Argentina timezone for all TimeZoneNames_en_CA.java 

$ for i in * 
do 
echo $i 
tail -n +66 
$i/jdk.localedata/sun/util/resources/cldr/ext/TimeZoneNames_en_CA.java | head 
-20 
done 

jdk-11.0.0+28_x64 
package sun.util.resources.cldr.ext; 

import sun.util.resources.TimeZoneNamesBundle; 

public class TimeZoneNames_en_CA extends TimeZoneNamesBundle { 
@Override 
protected final Object[][] getContents() { 
final String[] Argentina = new String[] { 
"Argentina Standard Time", 
"", 
"Argentina Summer Time", 
"", 
"Argentina Time", 
"", 
}; 
final String[] America_Eastern = new String[] { 
"", 
"EST", 
"", 
"EDT", 
jdk-11.0.1+13_x64 
package sun.util.resources.cldr.ext; 

import sun.util.resources.TimeZoneNamesBundle; 

public class TimeZoneNames_en_CA extends TimeZoneNamesBundle { 
@Override 
protected final Object[][] getContents() { 
final String[] Argentina = new String[] { 
"Argentina Standard Time", 
"ART", 
"Argentina Summer Time", 
"ARST", 
"Argentina Time", 
"ART", 
}; 
final String[] America_Eastern = new String[] { 
"", 
"EST", 
"", 
"EDT", 
jdk-11.0.2+7_x64 
package sun.util.resources.cldr.ext; 

import sun.util.resources.TimeZoneNamesBundle; 

public class TimeZoneNames_en_CA extends TimeZoneNamesBundle { 
@Override 
protected final Object[][] getContents() { 
final String[] Argentina = new String[] { 
"Argentina Standard Time", 
"ART", 
"Argentina Summer Time", 
"ARST", 
"Argentina Time", 
"ART", 
}; 
final String[] America_Eastern = new String[] { 
"", 
"EST", 
"", 
"EDT", 
jdk-11.0.2+9_x64 
package sun.util.resources.cldr.ext; 

import sun.util.resources.TimeZoneNamesBundle; 

public class TimeZoneNames_en_CA extends TimeZoneNamesBundle { 
@Override 
protected final Object[][] getContents() { 
final String[] Argentina = new String[] { 
"Argentina Standard Time", 
"", 
"Argentina Summer Time", 
"", 
"Argentina Time", 
"", 
}; 
final String[] America_Eastern = new String[] { 
"", 
"EST", 
"", 
"EDT", 
jdk-12-ea+33 
package sun.util.resources.cldr.ext; 

import sun.util.resources.TimeZoneNamesBundle; 

public class TimeZoneNames_en_CA extends TimeZoneNamesBundle { 
@Override 
protected final Object[][] getContents() { 
final String[] Argentina = new String[] { 
"Argentina Standard Time", 
"", 
"Argentina Summer Time", 
"", 
"Argentina Time", 
"", 
}; 
final String[] America_Eastern = new String[] { 
"", 
"EST", 
"", 
"EDT", 
Comments
Fix request (11u): Requesting backport for parity with Oracle 11.0.5. Patch applies cleanly after JDK-8217366 is applied. Will be tested at SAP.
04-07-2019

The inconsistency comes from the different order of the CLDR source files enumeration on each platform. Make sure that the parent bundles are processed before their child bundles. Sorting the bundles list by their names will be sufficient.
03-05-2019

$ cat Main.java import java.util.*; public class Main { public static void main(String[] args) { String s = "America/Argentina/La_Rioja"; TimeZone tz = TimeZone.getTimeZone(s); Locale locale = new Locale.Builder().setLanguage("en").setRegion("CA").build(); System.out.println(tz.getDisplayName(true, TimeZone.SHORT, locale)); } } [Linux] $ jdk-11.0.2+9_x64/bin/java -Djava.locale.providers=CLDR Main GMT-03:00 $ jdk-11.0.2+9_x64/bin/java -Djava.locale.providers=CLDR,JRE Main ARST [Windows] $ jdk-11.0.2+9_x64/bin/java -Djava.locale.providers=CLDR Main ARST $ jdk-11.0.2+9_x64/bin/java -Djava.locale.providers=CLDR,JRE Main ARST
12-03-2019