< prev index next >
src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java
Print this page
rev 54003 : [mq]: 8218948
*** 1,7 ****
/*
! * Copyright (c) 2012, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 54,64 ****
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import sun.security.action.GetPropertyAction;
- import sun.util.calendar.ZoneInfo;
import sun.util.resources.LocaleData;
import sun.util.resources.OpenListResourceBundle;
import sun.util.resources.ParallelListResourceBundle;
import sun.util.resources.TimeZoneNamesBundle;
--- 54,63 ----
*** 269,289 ****
removeEmptyReferences();
ResourceReference data = cache.get(cacheKey);
if (Objects.isNull(data) || Objects.isNull(val = data.get())) {
TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
- if (tznb.containsKey(key)) {
if (key.startsWith(TZNB_EXCITY_PREFIX)) {
val = tznb.getString(key);
assert val instanceof String;
trace("tznb: %s key: %s, val: %s\n", tznb, key, val);
} else {
! String[] names = tznb.getStringArray(key);
trace("tznb: %s key: %s, names: %s, %s, %s, %s, %s, %s, %s\n", tznb, key,
names[0], names[1], names[2], names[3], names[4], names[5], names[6]);
val = names;
}
cache.put(cacheKey,
new ResourceReference(cacheKey, val, referenceQueue));
}
}
--- 268,302 ----
removeEmptyReferences();
ResourceReference data = cache.get(cacheKey);
if (Objects.isNull(data) || Objects.isNull(val = data.get())) {
TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
if (key.startsWith(TZNB_EXCITY_PREFIX)) {
+ if (tznb.containsKey(key)) {
val = tznb.getString(key);
assert val instanceof String;
trace("tznb: %s key: %s, val: %s\n", tznb, key, val);
+ }
+ } else {
+ String[] names = null;
+ if (tznb.containsKey(key)) {
+ names = tznb.getStringArray(key);
} else {
! var tz = TimeZoneNameUtility.canonicalTZID(key).orElse(key);
! if (tznb.containsKey(tz)) {
! names = tznb.getStringArray(tz);
! }
! }
!
! if (names != null) {
! names[0] = key;
trace("tznb: %s key: %s, names: %s, %s, %s, %s, %s, %s, %s\n", tznb, key,
names[0], names[1], names[2], names[3], names[4], names[5], names[6]);
val = names;
}
+ }
+ if (val != null) {
cache.put(cacheKey,
new ResourceReference(cacheKey, val, referenceQueue));
}
}
*** 319,330 ****
tzIds.remove(key);
}
}
if (type == LocaleProviderAdapter.Type.CLDR) {
- // Add aliases data for CLDR
- Map<String, String> aliases = ZoneInfo.getAliasTable();
// Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
// Add timezones which are not present in this keyset,
// so that their fallback names will be generated at runtime.
tzIds.stream().filter(i -> (!i.startsWith("Etc/GMT")
--- 332,341 ----
*** 333,345 ****
.forEach(tzid -> {
String[] val = new String[7];
if (keyset.contains(tzid)) {
val = rb.getStringArray(tzid);
} else {
! String tz = aliases.get(tzid);
! if (keyset.contains(tz)) {
! val = rb.getStringArray(tz);
}
}
val[0] = tzid;
value.add(val);
});
--- 344,357 ----
.forEach(tzid -> {
String[] val = new String[7];
if (keyset.contains(tzid)) {
val = rb.getStringArray(tzid);
} else {
! var canonID = TimeZoneNameUtility.canonicalTZID(tzid)
! .orElse(tzid);
! if (keyset.contains(canonID)) {
! val = rb.getStringArray(canonID);
}
}
val[0] = tzid;
value.add(val);
});
< prev index next >