8220037: Inconsistencies of generated timezone files between Windows and Linux
Reviewed-by: rriggs
This commit is contained in:
parent
68ae1e7965
commit
c797bc008e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -346,17 +346,26 @@ public class CLDRConverter {
|
||||
if (sb.indexOf("root") == -1) {
|
||||
sb.append("root");
|
||||
}
|
||||
Bundle b = new Bundle(id, sb.toString(), null, null);
|
||||
// Insert the bundle for root at the top so that it will get
|
||||
// processed first.
|
||||
if ("root".equals(id)) {
|
||||
retList.add(0, b);
|
||||
} else {
|
||||
retList.add(b);
|
||||
}
|
||||
retList.add(new Bundle(id, sb.toString(), null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the bundles based on id. This will make sure all the parent bundles are
|
||||
// processed first, e.g., for en_GB bundle, en_001, and "root" comes before
|
||||
// en_GB. In order for "root" to come at the beginning, "root" is replaced with
|
||||
// empty string on comparison.
|
||||
retList.sort((o1, o2) -> {
|
||||
String id1 = o1.getID();
|
||||
String id2 = o2.getID();
|
||||
if(id1.equals("root")) {
|
||||
id1 = "";
|
||||
}
|
||||
if(id2.equals("root")) {
|
||||
id2 = "";
|
||||
}
|
||||
return id1.compareTo(id2);
|
||||
});
|
||||
return retList;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8005471 8008577 8129881 8130845 8136518 8181157 8210490
|
||||
* @bug 8005471 8008577 8129881 8130845 8136518 8181157 8210490 8220037
|
||||
* @modules jdk.localedata
|
||||
* @run main/othervm -Djava.locale.providers=CLDR CLDRDisplayNamesTest
|
||||
* @summary Make sure that localized time zone names of CLDR are used
|
||||
@ -130,13 +130,10 @@ public class CLDRDisplayNamesTest {
|
||||
System.err.printf("Wrong display name for timezone Etc/GMT-5 : expected GMT+05:00, Actual " + displayName);
|
||||
errors++;
|
||||
}
|
||||
if (errors > 0) {
|
||||
throw new RuntimeException("test failed");
|
||||
}
|
||||
|
||||
// 8217366: No "no inheritance marker" should be left in the returned array
|
||||
// from DateFormatSymbols.getZoneStrings()
|
||||
List.of(Locale.ROOT,
|
||||
errors += List.of(Locale.ROOT,
|
||||
Locale.CHINA,
|
||||
Locale.GERMANY,
|
||||
Locale.JAPAN,
|
||||
@ -149,11 +146,26 @@ public class CLDRDisplayNamesTest {
|
||||
.flatMap(zoneStrings -> Arrays.stream(zoneStrings))
|
||||
.filter(namesArray -> Arrays.stream(namesArray)
|
||||
.anyMatch(aName -> aName.equals(NO_INHERITANCE_MARKER)))
|
||||
.findAny()
|
||||
.ifPresentOrElse(marker -> {
|
||||
throw new RuntimeException("No inheritance marker detected with tzid: "
|
||||
.peek(marker -> {
|
||||
System.err.println("No-inheritance-marker is detected with tzid: "
|
||||
+ marker[0]);
|
||||
},
|
||||
() -> System.out.println("Success: No \"no inheritance marker\" detected."));
|
||||
})
|
||||
.count();
|
||||
|
||||
// 8220037: Make sure CLDRConverter uniquely produces bundles, regardless of the
|
||||
// source file enumeration order.
|
||||
tz = TimeZone.getTimeZone("America/Argentina/La_Rioja");
|
||||
if (!"ARST".equals(tz.getDisplayName(true, TimeZone.SHORT,
|
||||
new Locale.Builder()
|
||||
.setLanguage("en")
|
||||
.setRegion("CA")
|
||||
.build()))) {
|
||||
System.err.println("Short display name of \"" + tz.getID() + "\" was not \"ARST\"");
|
||||
errors++;
|
||||
}
|
||||
|
||||
if (errors > 0) {
|
||||
throw new RuntimeException("test failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user