提交 76c2ef31 编写于 作者: M mullan

Merge

...@@ -186,3 +186,5 @@ cec8fa02f15634acd7d02d04b0b2d8c044cdbaaa jdk8-b60 ...@@ -186,3 +186,5 @@ cec8fa02f15634acd7d02d04b0b2d8c044cdbaaa jdk8-b60
50b8b17449d200c66bfd68fb4f3a9197432c9e2b jdk8-b62 50b8b17449d200c66bfd68fb4f3a9197432c9e2b jdk8-b62
f117a3e06f78a258074674ad17601f99bcb1ce0d jdk8-b63 f117a3e06f78a258074674ad17601f99bcb1ce0d jdk8-b63
26dbd73fb7662a29b3e47179fdc88a0bfa4e231e jdk8-b64 26dbd73fb7662a29b3e47179fdc88a0bfa4e231e jdk8-b64
130d3a54d28becaac0846137256c2684adb34c33 jdk8-b65
4d337fae2250135729ee9ed2bf8baf3c60da5d6d jdk8-b66
...@@ -35,7 +35,7 @@ SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true ...@@ -35,7 +35,7 @@ SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = auth SUBDIRS = auth
SUBDIRS_misc = jgss sasl auth/module SUBDIRS_misc = jgss sasl auth/module ntlm
include $(BUILDDIR)/common/Subdirs.gmk include $(BUILDDIR)/common/Subdirs.gmk
all build clean clobber:: all build clean clobber::
......
#
# Copyright (c) 2012, 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
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
BUILDDIR = ../../../..
PACKAGE = com.sun.security.ntlm
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
#
# Files
#
AUTO_FILES_JAVA_DIRS = com/sun/security/ntlm
#
# Rules
#
include $(BUILDDIR)/common/Classes.gmk
...@@ -69,6 +69,7 @@ FILES_java += \ ...@@ -69,6 +69,7 @@ FILES_java += \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \ sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\ \
sun/nio/fs/GnomeFileTypeDetector.java \ sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/MimeTypesFileTypeDetector.java \
sun/nio/fs/PollingWatchService.java \ sun/nio/fs/PollingWatchService.java \
sun/nio/fs/SolarisAclFileAttributeView.java \ sun/nio/fs/SolarisAclFileAttributeView.java \
sun/nio/fs/SolarisFileStore.java \ sun/nio/fs/SolarisFileStore.java \
...@@ -202,6 +203,8 @@ FILES_java += \ ...@@ -202,6 +203,8 @@ FILES_java += \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \ sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\ \
sun/nio/fs/GnomeFileTypeDetector.java \ sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/MagicFileTypeDetector.java \
sun/nio/fs/MimeTypesFileTypeDetector.java \
sun/nio/fs/LinuxDosFileAttributeView.java \ sun/nio/fs/LinuxDosFileAttributeView.java \
sun/nio/fs/LinuxFileStore.java \ sun/nio/fs/LinuxFileStore.java \
sun/nio/fs/LinuxFileSystem.java \ sun/nio/fs/LinuxFileSystem.java \
...@@ -239,6 +242,7 @@ FILES_c += \ ...@@ -239,6 +242,7 @@ FILES_c += \
UnixAsynchronousSocketChannelImpl.c \ UnixAsynchronousSocketChannelImpl.c \
\ \
GnomeFileTypeDetector.c \ GnomeFileTypeDetector.c \
MagicFileTypeDetector.c \
LinuxNativeDispatcher.c \ LinuxNativeDispatcher.c \
LinuxWatchService.c \ LinuxWatchService.c \
UnixCopyFile.c \ UnixCopyFile.c \
...@@ -254,6 +258,7 @@ FILES_export += \ ...@@ -254,6 +258,7 @@ FILES_export += \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \ sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\ \
sun/nio/fs/GnomeFileTypeDetector.java \ sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/MagicFileTypeDetector.java \
sun/nio/fs/LinuxNativeDispatcher.java \ sun/nio/fs/LinuxNativeDispatcher.java \
sun/nio/fs/LinuxWatchService.java \ sun/nio/fs/LinuxWatchService.java \
sun/nio/fs/UnixCopyFile.java \ sun/nio/fs/UnixCopyFile.java \
...@@ -277,6 +282,7 @@ FILES_java += \ ...@@ -277,6 +282,7 @@ FILES_java += \
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \ sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \ sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\ \
sun/nio/fs/MimeTypesFileTypeDetector.java \
sun/nio/fs/BsdFileStore.java \ sun/nio/fs/BsdFileStore.java \
sun/nio/fs/BsdFileSystem.java \ sun/nio/fs/BsdFileSystem.java \
sun/nio/fs/BsdFileSystemProvider.java \ sun/nio/fs/BsdFileSystemProvider.java \
......
...@@ -130,6 +130,8 @@ SUNWprivate_1.1 { ...@@ -130,6 +130,8 @@ SUNWprivate_1.1 {
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio; Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs; Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs; Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
Java_sun_nio_fs_MagicFileTypeDetector_initialize0;
Java_sun_nio_fs_MagicFileTypeDetector_probe0;
Java_sun_nio_fs_LinuxWatchService_eventSize; Java_sun_nio_fs_LinuxWatchService_eventSize;
Java_sun_nio_fs_LinuxWatchService_eventOffsets; Java_sun_nio_fs_LinuxWatchService_eventOffsets;
Java_sun_nio_fs_LinuxWatchService_inotifyInit; Java_sun_nio_fs_LinuxWatchService_inotifyInit;
......
...@@ -40,7 +40,8 @@ AUTO_FILES_JAVA_DIRS = java/security ...@@ -40,7 +40,8 @@ AUTO_FILES_JAVA_DIRS = java/security
# Directories # Directories
# #
PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security # The default security properties file is for linux
PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-linux
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-solaris PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-solaris
......
...@@ -86,7 +86,6 @@ jprt.make.rule.core.test.targets= \ ...@@ -86,7 +86,6 @@ jprt.make.rule.core.test.targets= \
${jprt.my.test.target.set:TESTNAME=jdk_jmx}, \ ${jprt.my.test.target.set:TESTNAME=jdk_jmx}, \
${jprt.my.test.target.set:TESTNAME=jdk_text}, \ ${jprt.my.test.target.set:TESTNAME=jdk_text}, \
${jprt.my.test.target.set:TESTNAME=jdk_tools}, \ ${jprt.my.test.target.set:TESTNAME=jdk_tools}, \
${jprt.my.test.target.set:TESTNAME=jdk_jdi}, \
${jprt.my.test.target.set:TESTNAME=jdk_jfr}, \ ${jprt.my.test.target.set:TESTNAME=jdk_jfr}, \
${jprt.my.test.target.set:TESTNAME=jdk_other} ${jprt.my.test.target.set:TESTNAME=jdk_other}
...@@ -103,6 +102,7 @@ jprt.make.rule.all.test.targets= \ ...@@ -103,6 +102,7 @@ jprt.make.rule.all.test.targets= \
${jprt.my.test.target.set:TESTNAME=jdk_beans1}, \ ${jprt.my.test.target.set:TESTNAME=jdk_beans1}, \
${jprt.my.test.target.set:TESTNAME=jdk_beans2}, \ ${jprt.my.test.target.set:TESTNAME=jdk_beans2}, \
${jprt.my.test.target.set:TESTNAME=jdk_beans3}, \ ${jprt.my.test.target.set:TESTNAME=jdk_beans3}, \
${jprt.my.test.target.set:TESTNAME=jdk_jdi}, \
${jprt.my.test.target.set:TESTNAME=jdk_sound}, \ ${jprt.my.test.target.set:TESTNAME=jdk_sound}, \
${jprt.my.test.target.set:TESTNAME=jdk_swing} ${jprt.my.test.target.set:TESTNAME=jdk_swing}
......
...@@ -29,6 +29,7 @@ import java.util.ArrayList; ...@@ -29,6 +29,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -86,7 +87,23 @@ class Bundle { ...@@ -86,7 +87,23 @@ class Bundle {
private final static String[] ERA_KEYS = { private final static String[] ERA_KEYS = {
"long.Eras", "long.Eras",
"Eras", "Eras",
"short.Eras" "narrow.Eras"
};
// Keys for individual time zone names
private final static String TZ_GEN_LONG_KEY = "timezone.displayname.generic.long";
private final static String TZ_GEN_SHORT_KEY = "timezone.displayname.generic.short";
private final static String TZ_STD_LONG_KEY = "timezone.displayname.standard.long";
private final static String TZ_STD_SHORT_KEY = "timezone.displayname.standard.short";
private final static String TZ_DST_LONG_KEY = "timezone.displayname.daylight.long";
private final static String TZ_DST_SHORT_KEY = "timezone.displayname.daylight.short";
private final static String[] ZONE_NAME_KEYS = {
TZ_STD_LONG_KEY,
TZ_STD_SHORT_KEY,
TZ_DST_LONG_KEY,
TZ_DST_SHORT_KEY,
TZ_GEN_LONG_KEY,
TZ_GEN_SHORT_KEY
}; };
private final String id; private final String id;
...@@ -98,6 +115,7 @@ class Bundle { ...@@ -98,6 +115,7 @@ class Bundle {
return bundles.get(id); return bundles.get(id);
} }
@SuppressWarnings("ConvertToStringSwitch")
Bundle(String id, String cldrPath, String bundles, String currencies) { Bundle(String id, String cldrPath, String bundles, String currencies) {
this.id = id; this.id = id;
this.cldrPath = cldrPath; this.cldrPath = cldrPath;
...@@ -242,9 +260,12 @@ class Bundle { ...@@ -242,9 +260,12 @@ class Bundle {
// handle multiple inheritance for month and day names // handle multiple inheritance for month and day names
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNames"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNames");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthAbbreviations"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthAbbreviations");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNarrows");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNames"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNames");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayAbbreviations"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayAbbreviations");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNarrows");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "AmPmMarkers"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "AmPmMarkers");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "narrow.AmPmMarkers");
adjustEraNames(myMap, calendarType); adjustEraNames(myMap, calendarType);
...@@ -253,6 +274,99 @@ class Bundle { ...@@ -253,6 +274,99 @@ class Bundle {
handleDateTimeFormatPatterns(DATETIME_PATTERN_KEYS, myMap, parentsMap, calendarType, "DateTimePatterns"); handleDateTimeFormatPatterns(DATETIME_PATTERN_KEYS, myMap, parentsMap, calendarType, "DateTimePatterns");
} }
// if myMap has any empty timezone or metazone names, weed out them.
// Fill in any missing abbreviations if locale is "en".
for (Iterator<String> it = myMap.keySet().iterator(); it.hasNext();) {
String key = it.next();
if (key.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX)
|| key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
@SuppressWarnings("unchecked")
Map<String, String> nameMap = (Map<String, String>) myMap.get(key);
if (nameMap.isEmpty()) {
// Some zones have only exemplarCity, which become empty.
// Remove those from the map.
it.remove();
continue;
}
if (id.startsWith("en")) {
fillInAbbrs(key, nameMap);
}
}
}
for (Iterator<String> it = myMap.keySet().iterator(); it.hasNext();) {
String key = it.next();
if (key.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX)
|| key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
@SuppressWarnings("unchecked")
Map<String, String> nameMap = (Map<String, String>) myMap.get(key);
// Convert key/value pairs to an array.
String[] names = new String[ZONE_NAME_KEYS.length];
int ix = 0;
for (String nameKey : ZONE_NAME_KEYS) {
String name = nameMap.get(nameKey);
if (name == null) {
@SuppressWarnings("unchecked")
Map<String, String> parentNames = (Map<String, String>) parentsMap.get(key);
if (parentNames != null) {
name = parentNames.get(nameKey);
}
}
names[ix++] = name;
}
if (hasNulls(names)) {
String metaKey = toMetaZoneKey(key);
if (metaKey != null) {
Object obj = myMap.get(metaKey);
if (obj instanceof String[]) {
String[] metaNames = (String[]) obj;
for (int i = 0; i < names.length; i++) {
if (names[i] == null) {
names[i] = metaNames[i];
}
}
} else if (obj instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, String> m = (Map<String, String>) obj;
for (int i = 0; i < names.length; i++) {
if (names[i] == null) {
names[i] = m.get(ZONE_NAME_KEYS[i]);
}
}
}
}
// If there are still any nulls, try filling in them from en data.
if (hasNulls(names) && !id.equals("en")) {
@SuppressWarnings("unchecked")
String[] enNames = (String[]) Bundle.getBundle("en").getTargetMap().get(key);
if (enNames == null) {
if (metaKey != null) {
@SuppressWarnings("unchecked")
String[] metaNames = (String[]) Bundle.getBundle("en").getTargetMap().get(metaKey);
enNames = metaNames;
}
}
if (enNames != null) {
for (int i = 0; i < names.length; i++) {
if (names[i] == null) {
names[i] = enNames[i];
}
}
}
// If there are still nulls, give up names.
if (hasNulls(names)) {
names = null;
}
}
}
// replace the Map with the array
if (names != null) {
myMap.put(key, names);
} else {
it.remove();
}
}
}
return myMap; return myMap;
} }
...@@ -352,20 +466,10 @@ class Bundle { ...@@ -352,20 +466,10 @@ class Bundle {
realKeys[index] = realKey; realKeys[index] = realKey;
eraNames[index++] = value; eraNames[index++] = value;
} }
if (eraNames[0] != null) { for (int i = 0; i < eraNames.length; i++) {
if (eraNames[1] != null) { if (eraNames[i] == null) {
if (eraNames[2] == null) { map.put(realKeys[i], null);
// Eras -> short.Eras
// long.Eras -> Eras
map.put(realKeys[2], map.get(realKeys[1]));
map.put(realKeys[1], map.get(realKeys[0]));
}
} else {
// long.Eras -> Eras
map.put(realKeys[1], map.get(realKeys[0]));
} }
// remove long.Eras
map.remove(realKeys[0]);
} }
} }
...@@ -473,6 +577,86 @@ class Bundle { ...@@ -473,6 +577,86 @@ class Bundle {
return jrePattern.toString(); return jrePattern.toString();
} }
private String toMetaZoneKey(String tzKey) {
if (tzKey.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX)) {
String tz = tzKey.substring(CLDRConverter.TIMEZONE_ID_PREFIX.length());
String meta = CLDRConverter.handlerMetaZones.get(tz);
if (meta != null) {
return CLDRConverter.METAZONE_ID_PREFIX + meta;
}
}
return null;
}
private void fillInAbbrs(String key, Map<String, String> map) {
fillInAbbrs(TZ_STD_LONG_KEY, TZ_STD_SHORT_KEY, map);
fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map);
fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map);
// If the standard std is "Standard Time" and daylight std is "Summer Time",
// replace the standard std with the generic std to avoid using
// the same abbrivation except for Australia time zone names.
String std = map.get(TZ_STD_SHORT_KEY);
String dst = map.get(TZ_DST_SHORT_KEY);
String gen = map.get(TZ_GEN_SHORT_KEY);
if (std != null) {
if (dst == null) {
// if dst is null, create long and short names from the standard
// std. ("Something Standard Time" to "Something Daylight Time",
// or "Something Time" to "Something Summer Time")
String name = map.get(TZ_STD_LONG_KEY);
if (name != null) {
if (name.contains("Standard Time")) {
name = name.replace("Standard Time", "Daylight Time");
} else if (name.endsWith("Mean Time")) {
name = name.replace("Mean Time", "Summer Time");
} else if (name.endsWith(" Time")) {
name = name.replace(" Time", " Summer Time");
}
map.put(TZ_DST_LONG_KEY, name);
fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map);
}
}
if (gen == null) {
String name = map.get(TZ_STD_LONG_KEY);
if (name != null) {
if (name.endsWith("Standard Time")) {
name = name.replace("Standard Time", "Time");
} else if (name.endsWith("Mean Time")) {
name = name.replace("Mean Time", "Time");
}
map.put(TZ_GEN_LONG_KEY, name);
fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map);
}
}
}
}
private void fillInAbbrs(String longKey, String shortKey, Map<String, String> map) {
String abbr = map.get(shortKey);
if (abbr == null) {
String name = map.get(longKey);
if (name != null) {
abbr = toAbbr(name);
if (abbr != null) {
map.put(shortKey, abbr);
}
}
}
}
private String toAbbr(String name) {
String[] substrs = name.split("\\s+");
StringBuilder sb = new StringBuilder();
for (String s : substrs) {
char c = s.charAt(0);
if (c >= 'A' && c <= 'Z') {
sb.append(c);
}
}
return sb.length() > 0 ? sb.toString() : null;
}
private void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) { private void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
switch (cldrLetter) { switch (cldrLetter) {
case 'G': case 'G':
...@@ -539,4 +723,13 @@ class Bundle { ...@@ -539,4 +723,13 @@ class Bundle {
sb.append(c); sb.append(c);
} }
} }
private static boolean hasNulls(Object[] array) {
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
return true;
}
}
return false;
}
} }
...@@ -30,8 +30,27 @@ import java.util.Map; ...@@ -30,8 +30,27 @@ import java.util.Map;
import java.util.SortedSet; import java.util.SortedSet;
public interface BundleGenerator { public interface BundleGenerator {
static enum BundleType {
PLAIN("java.util.ListResourceBundle"),
OPEN("sun.util.resources.OpenListResourceBundle"),
TIMEZONE("sun.util.resources.TimeZoneNamesBundle");
private final String pathName, className;
private BundleType(String name) {
pathName = name;
int x = name.lastIndexOf('.');
className = name.substring(x + 1);
}
String getPathName() {
return pathName;
}
String getClassName() {
return className;
}
};
public void generateBundle(String packageName, String baseName, String localeID, public void generateBundle(String packageName, String baseName, String localeID,
boolean useJava, Map<String, ?> map, boolean open) throws IOException; boolean useJava, Map<String, ?> map, BundleType type) throws IOException;
public void generateMetaInfo(Map<String, SortedSet<String>> metaInfo) throws IOException; public void generateMetaInfo(Map<String, SortedSet<String>> metaInfo) throws IOException;
} }
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
package build.tools.cldrconverter; package build.tools.cldrconverter;
import build.tools.cldrconverter.BundleGenerator.BundleType;
import java.io.File; import java.io.File;
import java.nio.file.DirectoryStream; import java.nio.file.DirectoryStream;
import java.nio.file.FileSystems; import java.nio.file.FileSystems;
...@@ -58,9 +59,8 @@ public class CLDRConverter { ...@@ -58,9 +59,8 @@ public class CLDRConverter {
static final String CURRENCY_SYMBOL_PREFIX = "currency.symbol."; static final String CURRENCY_SYMBOL_PREFIX = "currency.symbol.";
static final String CURRENCY_NAME_PREFIX = "currency.displayname."; static final String CURRENCY_NAME_PREFIX = "currency.displayname.";
static final String TIMEZONE_ID_PREFIX = "timezone.id."; static final String TIMEZONE_ID_PREFIX = "timezone.id.";
static final String TIMEZONE_NAME_PREFIX = "timezone.displayname."; static final String ZONE_NAME_PREFIX = "timezone.displayname.";
static final String METAZONE_ID_PREFIX = "metazone.id."; static final String METAZONE_ID_PREFIX = "metazone.id.";
static final String METAZONE_NAME_PREFIX = "metazone.displayname.";
private static SupplementDataParseHandler handlerSuppl; private static SupplementDataParseHandler handlerSuppl;
static NumberingSystemsParseHandler handlerNumbering; static NumberingSystemsParseHandler handlerNumbering;
...@@ -236,7 +236,14 @@ public class CLDRConverter { ...@@ -236,7 +236,14 @@ public class CLDRConverter {
if (sb.indexOf("root") == -1) { if (sb.indexOf("root") == -1) {
sb.append("root"); sb.append("root");
} }
retList.add(new Bundle(id, sb.toString(), null, null)); Bundle b = new Bundle(id, sb.toString(), null, null);
// Insert the bundle for en at the top so that it will get
// processed first.
if ("en".equals(id)) {
retList.add(0, b);
} else {
retList.add(b);
}
} }
} }
} }
...@@ -312,6 +319,7 @@ public class CLDRConverter { ...@@ -312,6 +319,7 @@ public class CLDRConverter {
Map<String, SortedSet<String>> metaInfo = new HashMap<>(); Map<String, SortedSet<String>> metaInfo = new HashMap<>();
metaInfo.put("LocaleNames", new TreeSet<String>()); metaInfo.put("LocaleNames", new TreeSet<String>());
metaInfo.put("CurrencyNames", new TreeSet<String>()); metaInfo.put("CurrencyNames", new TreeSet<String>());
metaInfo.put("TimeZoneNames", new TreeSet<String>());
metaInfo.put("CalendarData", new TreeSet<String>()); metaInfo.put("CalendarData", new TreeSet<String>());
metaInfo.put("FormatData", new TreeSet<String>()); metaInfo.put("FormatData", new TreeSet<String>());
...@@ -348,24 +356,28 @@ public class CLDRConverter { ...@@ -348,24 +356,28 @@ public class CLDRConverter {
Map<String, Object> localeNamesMap = extractLocaleNames(targetMap, bundle.getID()); Map<String, Object> localeNamesMap = extractLocaleNames(targetMap, bundle.getID());
if (!localeNamesMap.isEmpty() || bundle.isRoot()) { if (!localeNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("LocaleNames").add(toLanguageTag(bundle.getID())); metaInfo.get("LocaleNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "LocaleNames", bundle.getID(), true, localeNamesMap, true); bundleGenerator.generateBundle("util", "LocaleNames", bundle.getID(), true, localeNamesMap, BundleType.OPEN);
} }
} }
if (bundleTypes.contains(Bundle.Type.CURRENCYNAMES)) { if (bundleTypes.contains(Bundle.Type.CURRENCYNAMES)) {
Map<String, Object> currencyNamesMap = extractCurrencyNames(targetMap, bundle.getID(), bundle.getCurrencies()); Map<String, Object> currencyNamesMap = extractCurrencyNames(targetMap, bundle.getID(), bundle.getCurrencies());
if (!currencyNamesMap.isEmpty() || bundle.isRoot()) { if (!currencyNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CurrencyNames").add(toLanguageTag(bundle.getID())); metaInfo.get("CurrencyNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getID(), true, currencyNamesMap, true); bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getID(), true, currencyNamesMap, BundleType.OPEN);
} }
} }
if (bundleTypes.contains(Bundle.Type.TIMEZONENAMES)) { if (bundleTypes.contains(Bundle.Type.TIMEZONENAMES)) {
Map<String, Object> zoneNamesMap = extractZoneNames(targetMap, bundle.getID()); Map<String, Object> zoneNamesMap = extractZoneNames(targetMap, bundle.getID());
if (!zoneNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("TimeZoneNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "TimeZoneNames", bundle.getID(), true, zoneNamesMap, BundleType.TIMEZONE);
}
} }
if (bundleTypes.contains(Bundle.Type.CALENDARDATA)) { if (bundleTypes.contains(Bundle.Type.CALENDARDATA)) {
Map<String, Object> calendarDataMap = extractCalendarData(targetMap, bundle.getID()); Map<String, Object> calendarDataMap = extractCalendarData(targetMap, bundle.getID());
if (!calendarDataMap.isEmpty() || bundle.isRoot()) { if (!calendarDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CalendarData").add(toLanguageTag(bundle.getID())); metaInfo.get("CalendarData").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, false); bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, BundleType.PLAIN);
} }
} }
if (bundleTypes.contains(Bundle.Type.FORMATDATA)) { if (bundleTypes.contains(Bundle.Type.FORMATDATA)) {
...@@ -373,9 +385,10 @@ public class CLDRConverter { ...@@ -373,9 +385,10 @@ public class CLDRConverter {
// LocaleData.getAvailableLocales depends on having FormatData bundles around // LocaleData.getAvailableLocales depends on having FormatData bundles around
if (!formatDataMap.isEmpty() || bundle.isRoot()) { if (!formatDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("FormatData").add(toLanguageTag(bundle.getID())); metaInfo.get("FormatData").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, false); bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, BundleType.PLAIN);
} }
} }
// For testing // For testing
SortedSet<String> allLocales = new TreeSet<>(); SortedSet<String> allLocales = new TreeSet<>();
allLocales.addAll(metaInfo.get("CurrencyNames")); allLocales.addAll(metaInfo.get("CurrencyNames"));
...@@ -431,6 +444,7 @@ public class CLDRConverter { ...@@ -431,6 +444,7 @@ public class CLDRConverter {
private KeyComparator() { private KeyComparator() {
} }
@Override
public int compare(String o1, String o2) { public int compare(String o1, String o2) {
int len1 = o1.length(); int len1 = o1.length();
int len2 = o2.length(); int len2 = o2.length();
...@@ -476,7 +490,26 @@ public class CLDRConverter { ...@@ -476,7 +490,26 @@ public class CLDRConverter {
} }
private static Map<String, Object> extractZoneNames(Map<String, Object> map, String id) { private static Map<String, Object> extractZoneNames(Map<String, Object> map, String id) {
return null; Map<String, Object> names = new HashMap<>();
for (String tzid : handlerMetaZones.keySet()) {
String tzKey = TIMEZONE_ID_PREFIX + tzid;
Object data = map.get(tzKey);
if (data instanceof String[]) {
names.put(tzid, data);
} else {
String meta = handlerMetaZones.get(tzid);
if (meta != null) {
String metaKey = METAZONE_ID_PREFIX + meta;
data = map.get(metaKey);
if (data instanceof String[]) {
// Keep the metazone prefix here.
names.put(metaKey, data);
names.put(tzid, meta);
}
}
}
}
return names;
} }
private static Map<String, Object> extractCalendarData(Map<String, Object> map, String id) { private static Map<String, Object> extractCalendarData(Map<String, Object> map, String id) {
...@@ -494,11 +527,19 @@ public class CLDRConverter { ...@@ -494,11 +527,19 @@ public class CLDRConverter {
copyIfPresent(map, prefix + "standalone.MonthNames", formatData); copyIfPresent(map, prefix + "standalone.MonthNames", formatData);
copyIfPresent(map, prefix + "MonthAbbreviations", formatData); copyIfPresent(map, prefix + "MonthAbbreviations", formatData);
copyIfPresent(map, prefix + "standalone.MonthAbbreviations", formatData); copyIfPresent(map, prefix + "standalone.MonthAbbreviations", formatData);
copyIfPresent(map, prefix + "MonthNarrow", formatData);
copyIfPresent(map, prefix + "standalone.MonthNarrows", formatData);
copyIfPresent(map, prefix + "DayNames", formatData); copyIfPresent(map, prefix + "DayNames", formatData);
copyIfPresent(map, prefix + "standalone.DayNames", formatData);
copyIfPresent(map, prefix + "DayAbbreviations", formatData); copyIfPresent(map, prefix + "DayAbbreviations", formatData);
copyIfPresent(map, prefix + "standalone.DayAbbreviations", formatData);
copyIfPresent(map, prefix + "DayNarrows", formatData);
copyIfPresent(map, prefix + "standalone.DayNarrows", formatData);
copyIfPresent(map, prefix + "AmPmMarkers", formatData); copyIfPresent(map, prefix + "AmPmMarkers", formatData);
copyIfPresent(map, prefix + "narrow.AmPmMarkers", formatData);
copyIfPresent(map, prefix + "long.Eras", formatData);
copyIfPresent(map, prefix + "Eras", formatData); copyIfPresent(map, prefix + "Eras", formatData);
copyIfPresent(map, prefix + "short.Eras", formatData); copyIfPresent(map, prefix + "narrow.Eras", formatData);
copyIfPresent(map, prefix + "TimePatterns", formatData); copyIfPresent(map, prefix + "TimePatterns", formatData);
copyIfPresent(map, prefix + "DatePatterns", formatData); copyIfPresent(map, prefix + "DatePatterns", formatData);
copyIfPresent(map, prefix + "DateTimePatterns", formatData); copyIfPresent(map, prefix + "DateTimePatterns", formatData);
...@@ -560,7 +601,6 @@ public class CLDRConverter { ...@@ -560,7 +601,6 @@ public class CLDRConverter {
if (x == 0 || escapeSpace) { if (x == 0 || escapeSpace) {
outBuffer.append('\\'); outBuffer.append('\\');
} }
outBuffer.append(' '); outBuffer.append(' ');
break; break;
case '\\': case '\\':
...@@ -584,7 +624,7 @@ public class CLDRConverter { ...@@ -584,7 +624,7 @@ public class CLDRConverter {
outBuffer.append('f'); outBuffer.append('f');
break; break;
default: default:
if (!USE_UTF8 && ((aChar < 0x0020) || (aChar > 0x007e))) { if (aChar < 0x0020 || (!USE_UTF8 && aChar > 0x007e)) {
formatter.format("\\u%04x", (int)aChar); formatter.format("\\u%04x", (int)aChar);
} else { } else {
if (specialSaveChars.indexOf(aChar) != -1) { if (specialSaveChars.indexOf(aChar) != -1) {
......
...@@ -155,6 +155,9 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> { ...@@ -155,6 +155,9 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "abbreviated": case "abbreviated":
pushStringArrayEntry(qName, attributes, prefix + "MonthAbbreviations/" + getContainerKey(), 13); pushStringArrayEntry(qName, attributes, prefix + "MonthAbbreviations/" + getContainerKey(), 13);
break; break;
case "narrow":
pushStringArrayEntry(qName, attributes, prefix + "MonthNarrows/" + getContainerKey(), 13);
break;
default: default:
pushIgnoredContainer(qName); pushIgnoredContainer(qName);
break; break;
...@@ -191,6 +194,9 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> { ...@@ -191,6 +194,9 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "abbreviated": case "abbreviated":
pushStringArrayEntry(qName, attributes, prefix + "DayAbbreviations/" + getContainerKey(), 7); pushStringArrayEntry(qName, attributes, prefix + "DayAbbreviations/" + getContainerKey(), 7);
break; break;
case "narrow":
pushStringArrayEntry(qName, attributes, prefix + "DayNarrows/" + getContainerKey(), 7);
break;
default: default:
pushIgnoredContainer(qName); pushIgnoredContainer(qName);
break; break;
...@@ -219,25 +225,36 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> { ...@@ -219,25 +225,36 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "dayPeriodWidth": case "dayPeriodWidth":
// for FormatData // for FormatData
// create string array entry for am/pm. only keeping wide // create string array entry for am/pm. only keeping wide
if ("wide".equals(attributes.getValue("type"))) { switch (attributes.getValue("type")) {
case "wide":
pushStringArrayEntry(qName, attributes, "AmPmMarkers/" + getContainerKey(), 2); pushStringArrayEntry(qName, attributes, "AmPmMarkers/" + getContainerKey(), 2);
} else { break;
case "narrow":
pushStringArrayEntry(qName, attributes, "narrow.AmPmMarkers/" + getContainerKey(), 2);
break;
default:
pushIgnoredContainer(qName); pushIgnoredContainer(qName);
break;
} }
break; break;
case "dayPeriod": case "dayPeriod":
// for FormatData // for FormatData
// add to string array entry of AmPmMarkers element // add to string array entry of AmPmMarkers element
switch (attributes.getValue("type")) { if (attributes.getValue("alt") == null) {
case "am": switch (attributes.getValue("type")) {
pushStringArrayElement(qName, attributes, 0); case "am":
break; pushStringArrayElement(qName, attributes, 0);
case "pm": break;
pushStringArrayElement(qName, attributes, 1); case "pm":
break; pushStringArrayElement(qName, attributes, 1);
default: break;
default:
pushIgnoredContainer(qName);
break;
}
} else {
// discard alt values
pushIgnoredContainer(qName); pushIgnoredContainer(qName);
break;
} }
break; break;
case "eraNames": case "eraNames":
...@@ -269,7 +286,7 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> { ...@@ -269,7 +286,7 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
assert currentContainer instanceof IgnoredContainer; assert currentContainer instanceof IgnoredContainer;
pushIgnoredContainer(qName); pushIgnoredContainer(qName);
} else { } else {
String key = currentCalendarType.keyElementName() + "short.Eras"; String key = currentCalendarType.keyElementName() + "narrow.Eras";
pushStringArrayEntry(qName, attributes, key, currentCalendarType.getEraLength(qName)); pushStringArrayEntry(qName, attributes, key, currentCalendarType.getEraLength(qName));
} }
break; break;
...@@ -301,15 +318,15 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> { ...@@ -301,15 +318,15 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
break; break;
case "zone": case "zone":
{ {
String zone = attributes.getValue("type"); String tzid = attributes.getValue("type"); // Olson tz id
zonePrefix = CLDRConverter.TIMEZONE_ID_PREFIX; zonePrefix = CLDRConverter.TIMEZONE_ID_PREFIX;
put(zonePrefix + zone, new HashMap<String, String>()); put(zonePrefix + tzid, new HashMap<String, String>());
pushKeyContainer(qName, attributes, zone); pushKeyContainer(qName, attributes, tzid);
} }
break; break;
case "metazone": case "metazone":
{ {
String zone = attributes.getValue("type"); String zone = attributes.getValue("type"); // LDML meta zone id
zonePrefix = CLDRConverter.METAZONE_ID_PREFIX; zonePrefix = CLDRConverter.METAZONE_ID_PREFIX;
put(zonePrefix + zone, new HashMap<String, String>()); put(zonePrefix + zone, new HashMap<String, String>());
pushKeyContainer(qName, attributes, zone); pushKeyContainer(qName, attributes, zone);
...@@ -323,16 +340,12 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> { ...@@ -323,16 +340,12 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
zoneNameStyle = "short"; zoneNameStyle = "short";
pushContainer(qName, attributes); pushContainer(qName, attributes);
break; break;
case "generic": // not used in JDK case "generic": // generic name
pushIgnoredContainer(qName); case "standard": // standard time name
break; case "daylight": // daylight saving (summer) time name
case "standard": // standard time pushStringEntry(qName, attributes, CLDRConverter.ZONE_NAME_PREFIX + qName + "." + zoneNameStyle);
pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "standard." + zoneNameStyle);
break;
case "daylight":
pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "daylight." + zoneNameStyle);
break; break;
case "exemplarCity": case "exemplarCity": // not used in JDK
pushIgnoredContainer(qName); pushIgnoredContainer(qName);
break; break;
...@@ -530,6 +543,7 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> { ...@@ -530,6 +543,7 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "timeZoneNames": case "timeZoneNames":
zonePrefix = null; zonePrefix = null;
break; break;
case "generic":
case "standard": case "standard":
case "daylight": case "daylight":
if (zonePrefix != null && (currentContainer instanceof Entry)) { if (zonePrefix != null && (currentContainer instanceof Entry)) {
......
...@@ -46,8 +46,9 @@ class MetaZonesParseHandler extends AbstractLDMLHandler<String> { ...@@ -46,8 +46,9 @@ class MetaZonesParseHandler extends AbstractLDMLHandler<String> {
return null; return null;
} }
// metaZone: ID -> metazone
// per locale: ID -> names, metazone -> names
@Override @Override
@SuppressWarnings("fallthrough")
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
switch (qName) { switch (qName) {
case "timezone": case "timezone":
......
...@@ -28,14 +28,16 @@ package build.tools.cldrconverter; ...@@ -28,14 +28,16 @@ package build.tools.cldrconverter;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.Formatter;
import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
class ResourceBundleGenerator implements BundleGenerator { class ResourceBundleGenerator implements BundleGenerator {
@Override @Override
public void generateBundle(String packageName, String baseName, String localeID, boolean useJava, public void generateBundle(String packageName, String baseName, String localeID, boolean useJava,
Map<String, ?> map, boolean open) throws IOException { Map<String, ?> map, BundleType type) throws IOException {
String suffix = useJava ? ".java" : ".properties"; String suffix = useJava ? ".java" : ".properties";
String lang = CLDRConverter.getLanguageCode(localeID); String lang = CLDRConverter.getLanguageCode(localeID);
String dirName = CLDRConverter.DESTINATION_DIR + File.separator + "sun" + File.separator String dirName = CLDRConverter.DESTINATION_DIR + File.separator + "sun" + File.separator
...@@ -67,6 +69,28 @@ class ResourceBundleGenerator implements BundleGenerator { ...@@ -67,6 +69,28 @@ class ResourceBundleGenerator implements BundleGenerator {
encoding = "iso-8859-1"; encoding = "iso-8859-1";
} }
Formatter fmt = null;
if (type == BundleType.TIMEZONE) {
fmt = new Formatter();
Set<String> metaKeys = new HashSet<>();
for (String key : map.keySet()) {
if (key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
String meta = key.substring(CLDRConverter.METAZONE_ID_PREFIX.length());
String[] value;
value = (String[]) map.get(key);
fmt.format(" final String[] %s = new String[] {\n", meta);
for (String s : value) {
fmt.format(" \"%s\",\n", CLDRConverter.saveConvert(s, useJava));
}
fmt.format(" };\n");
metaKeys.add(key);
}
}
for (String key : metaKeys) {
map.remove(key);
}
}
try (PrintWriter out = new PrintWriter(file, encoding)) { try (PrintWriter out = new PrintWriter(file, encoding)) {
// Output copyright headers // Output copyright headers
out.println(CopyrightHeaders.getOpenJDKCopyright()); out.println(CopyrightHeaders.getOpenJDKCopyright());
...@@ -74,16 +98,15 @@ class ResourceBundleGenerator implements BundleGenerator { ...@@ -74,16 +98,15 @@ class ResourceBundleGenerator implements BundleGenerator {
if (useJava) { if (useJava) {
out.println("package sun." + packageName + ";\n"); out.println("package sun." + packageName + ";\n");
if (open) { out.printf("import %s;\n\n", type.getPathName());
out.println("import sun.util.resources.OpenListResourceBundle;\n"); out.printf("public class %s%s extends %s {\n", baseName, "root".equals(localeID) ? "" : "_" + localeID, type.getClassName());
out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends OpenListResourceBundle {");
} else {
out.println("import java.util.ListResourceBundle;\n");
out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends ListResourceBundle {");
}
out.println(" @Override\n" + out.println(" @Override\n" +
" protected final Object[][] getContents() {\n" + " protected final Object[][] getContents() {");
" final Object[][] data = new Object[][] {"); if (fmt != null) {
out.print(fmt.toString());
}
out.println(" final Object[][] data = new Object[][] {");
} }
for (String key : map.keySet()) { for (String key : map.keySet()) {
if (useJava) { if (useJava) {
...@@ -91,7 +114,11 @@ class ResourceBundleGenerator implements BundleGenerator { ...@@ -91,7 +114,11 @@ class ResourceBundleGenerator implements BundleGenerator {
if (value == null) { if (value == null) {
CLDRConverter.warning("null value for " + key); CLDRConverter.warning("null value for " + key);
} else if (value instanceof String) { } else if (value instanceof String) {
out.println(" { \"" + key + "\", \"" + CLDRConverter.saveConvert((String) value, useJava) + "\" },"); if (type == BundleType.TIMEZONE) {
out.printf(" { \"%s\", %s },\n", key, CLDRConverter.saveConvert((String) value, useJava));
} else {
out.printf(" { \"%s\", \"%s\" },\n", key, CLDRConverter.saveConvert((String) value, useJava));
}
} else if (value instanceof String[]) { } else if (value instanceof String[]) {
String[] values = (String[]) value; String[] values = (String[]) value;
out.println(" { \"" + key + "\",\n new String[] {"); out.println(" { \"" + key + "\",\n new String[] {");
......
...@@ -166,9 +166,9 @@ $(eval $(call SetupDemo,SampleTree,jfc,,SampleTree,,,README*)) ...@@ -166,9 +166,9 @@ $(eval $(call SetupDemo,SampleTree,jfc,,SampleTree,,,README*))
$(eval $(call SetupDemo,SwingApplet,jfc,,SwingApplet,,,README* *.html)) $(eval $(call SetupDemo,SwingApplet,jfc,,SwingApplet,,,README* *.html))
$(eval $(call SetupDemo,TableExample,jfc,,TableExample,,,README*)) $(eval $(call SetupDemo,TableExample,jfc,,TableExample,,,README*))
$(eval $(call SetupDemo,TransparentRuler,jfc,,transparentruler.Ruler,,,README*)) $(eval $(call SetupDemo,TransparentRuler,jfc,,transparentruler.Ruler,,,README*))
$(eval $(call SetupDemo,jconsole-plugin,scripting,-cp $(JDK_OUTPUTDIR)/lib/jconsole.jar,,,,*.xml *.txt,,,,Main-Class: \n)) $(eval $(call SetupDemo,jconsole-plugin,scripting,,,,,*.xml *.txt,,,,Main-Class: \n))
$(eval $(call SetupDemo,FullThreadDump,management,,FullThreadDump,,,README*)) $(eval $(call SetupDemo,FullThreadDump,management,,FullThreadDump,,,README*))
$(eval $(call SetupDemo,JTop,management,-cp $(JDK_OUTPUTDIR)/lib/jconsole.jar,JTop,,,README*)) $(eval $(call SetupDemo,JTop,management,,JTop,,,README*))
$(eval $(call SetupDemo,MemoryMonitor,management,,MemoryMonitor,,,README*)) $(eval $(call SetupDemo,MemoryMonitor,management,,MemoryMonitor,,,README*))
$(eval $(call SetupDemo,VerboseGC,management,,VerboseGC,,,README*)) $(eval $(call SetupDemo,VerboseGC,management,,VerboseGC,,,README*))
$(eval $(call SetupDemo,zipfs,nio,,,,,README* *.java,,,,Main-Class: \n)) $(eval $(call SetupDemo,zipfs,nio,,,,,README* *.java,,,,Main-Class: \n))
......
...@@ -121,6 +121,7 @@ ifneq ($(OPENJDK_TARGET_OS),linux) ...@@ -121,6 +121,7 @@ ifneq ($(OPENJDK_TARGET_OS),linux)
sun/nio/fs/LinuxFileStore.java \ sun/nio/fs/LinuxFileStore.java \
sun/nio/fs/LinuxFileSystem.java \ sun/nio/fs/LinuxFileSystem.java \
sun/nio/fs/LinuxFileSystemProvider.java \ sun/nio/fs/LinuxFileSystemProvider.java \
sun/nio/fs/MagicFileTypeDetector.java \
sun/nio/fs/LinuxNativeDispatcher.java \ sun/nio/fs/LinuxNativeDispatcher.java \
sun/nio/fs/LinuxUserDefinedFileAttributeView.java \ sun/nio/fs/LinuxUserDefinedFileAttributeView.java \
sun/nio/fs/LinuxWatchService.java sun/nio/fs/LinuxWatchService.java
......
...@@ -238,7 +238,7 @@ $(eval $(call SetupLauncher,jar,\ ...@@ -238,7 +238,7 @@ $(eval $(call SetupLauncher,jar,\
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }')) -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
$(eval $(call SetupLauncher,jarsigner,\ $(eval $(call SetupLauncher,jarsigner,\
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarSigner.Main"$(COMMA) }')) -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
$(eval $(call SetupLauncher,javac,\ $(eval $(call SetupLauncher,javac,\
-DEXPAND_CLASSPATH_WILDCARDS \ -DEXPAND_CLASSPATH_WILDCARDS \
......
...@@ -104,7 +104,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\ ...@@ -104,7 +104,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\
LANG:=C,\ LANG:=C,\
CFLAGS:=$(CFLAGS_JDKLIB) \ CFLAGS:=$(CFLAGS_JDKLIB) \
-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\ -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
LDFLAGS:=-nostdlib -r -arch i386 -arch x86_64,\ LDFLAGS:=-nostdlib -r -arch x86_64,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm)) OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
$(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) : $(BUILD_LIBFDLIBM) $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) : $(BUILD_LIBFDLIBM)
...@@ -240,7 +240,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA,\ ...@@ -240,7 +240,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA,\
LDFLAGS:=$(LDFLAGS_JDKLIB) \ LDFLAGS:=$(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \ $(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX_posix:=-ljvm -lverify, \ LDFLAGS_SUFFIX_posix:=-ljvm -lverify, \
LDFLAGS_SUFFIX_solaris:=-lnsl -lsocket -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc,\ LDFLAGS_SUFFIX_solaris:=-lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc,\
LDFLAGS_SUFFIX_linux:=$(LIBDL) $(BUILD_LIBFDLIBM),\ LDFLAGS_SUFFIX_linux:=$(LIBDL) $(BUILD_LIBFDLIBM),\
LDFLAGS_SUFFIX_macosx:=-L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \ LDFLAGS_SUFFIX_macosx:=-L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
-framework CoreFoundation \ -framework CoreFoundation \
...@@ -905,57 +905,34 @@ endif ...@@ -905,57 +905,34 @@ endif
########################################################################################## ##########################################################################################
BUILD_LIBZIP_FILES:=\ BUILD_LIBZIP_EXCLUDES :=
CRC32.c \
Adler32.c \
Deflater.c \
Inflater.c \
ZipFile.c \
zip_util.c
ifeq ($(USE_EXTERNAL_LIBZ),true) ifeq ($(USE_EXTERNAL_LIBZ),true)
LIBZ:=-lz LIBZ := -lz
LIBZIP_EXCLUDES += zlib-1.2.5
else else
BUILD_LIBZIP_FILES += \ ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
compress.c \ endif
deflate.c \
gzclose.c \ BUILD_LIBZIP_REORDER :=
gzlib.c \
gzread.c \
gzwrite.c \
infback.c \
inffast.c \
inflate.c \
inftrees.c \
trees.c \
uncompr.c \
zadler32.c \
zcrc32.c \
zutil.c
LIBZ_INCLUDE:=-I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
endif
BUILD_LIBZIP_REORDER:=
ifeq ($(OPENJDK_TARGET_OS), solaris) ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64) ifneq ($(OPENJDK_TARGET_CPU), x86_64)
BUILD_LIBZIP_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU) BUILD_LIBZIP_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
endif endif
endif endif
ifeq ($(LIBZIP_CAN_USE_MMAP), true) ifeq ($(LIBZIP_CAN_USE_MMAP), true)
BUILD_LIBZIP_MMAP:=-DUSE_MMAP BUILD_LIBZIP_MMAP := -DUSE_MMAP
endif endif
$(eval $(call SetupNativeCompilation,BUILD_LIBZIP,\ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP,\
LIBRARY:=zip,\ LIBRARY:=zip,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/share/native/java/util/zip \
$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5,\
INCLUDE_FILES:=$(BUILD_LIBZIP_FILES), \
LANG:=C,\ LANG:=C,\
OPTIMIZATION:=LOW, \ OPTIMIZATION:=LOW, \
SRC:=$(JDK_TOPDIR)/src/share/native/java/util/zip,\
EXCLUDES:=$(LIBZIP_EXCLUDES),\
CFLAGS:=$(CFLAGS_JDKLIB) \ CFLAGS:=$(CFLAGS_JDKLIB) \
$(LIBZ_INCLUDE) \ $(ZLIB_CPPFLAGS) \
-I$(JDK_TOPDIR)/src/share/native/java/io \ -I$(JDK_TOPDIR)/src/share/native/java/io \
-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io,\ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io,\
CFLAGS_posix:=$(BUILD_LIBZIP_MMAP) -UDEBUG,\ CFLAGS_posix:=$(BUILD_LIBZIP_MMAP) -UDEBUG,\
...@@ -1238,15 +1215,7 @@ ifdef OPENJDK ...@@ -1238,15 +1215,7 @@ ifdef OPENJDK
$(eval $(call SetupNativeCompilation,BUILD_LIBLCMS,\ $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS,\
LIBRARY:=lcms,\ LIBRARY:=lcms,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms \ SRC:=$(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms,\
$(JDK_TOPDIR)/src/share/native/sun/java2d/,\
INCLUDE_FILES:=cmscam02.c cmscgats.c cmscnvrt.c cmserr.c \
cmsgamma.c cmsgmt.c cmsintrp.c cmsio0.c \
cmsio1.c cmslut.c cmsmd5.c cmsmtrx.c \
cmsnamed.c cmsopt.c cmshalf.c cmspack.c cmspcs.c \
cmsplugin.c cmsps2.c cmssamp.c cmssm.c \
cmstypes.c cmsvirt.c cmswtpnt.c cmsxform.c \
LCMS.c,\
LANG:=C,\ LANG:=C,\
OPTIMIZATION:=LOW, \ OPTIMIZATION:=LOW, \
CFLAGS:=$(filter-out -xc99=%none,$(CFLAGS_JDKLIB)) \ CFLAGS:=$(filter-out -xc99=%none,$(CFLAGS_JDKLIB)) \
...@@ -1928,6 +1897,7 @@ ifeq ($(OPENJDK_TARGET_OS), linux) ...@@ -1928,6 +1897,7 @@ ifeq ($(OPENJDK_TARGET_OS), linux)
UnixAsynchronousServerSocketChannelImpl.c \ UnixAsynchronousServerSocketChannelImpl.c \
UnixAsynchronousSocketChannelImpl.c \ UnixAsynchronousSocketChannelImpl.c \
GnomeFileTypeDetector.c \ GnomeFileTypeDetector.c \
MagicFileTypeDetector.c \
LinuxNativeDispatcher.c \ LinuxNativeDispatcher.c \
LinuxWatchService.c \ LinuxWatchService.c \
UnixCopyFile.c \ UnixCopyFile.c \
...@@ -2006,7 +1976,7 @@ $(BUILD_LIBNIO) : $(BUILD_LIBNET) ...@@ -2006,7 +1976,7 @@ $(BUILD_LIBNIO) : $(BUILD_LIBNET)
########################################################################################## ##########################################################################################
ifeq ($(OPENJDK_TARGET_OS_API),posix) ifeq ($(OPENJDK_TARGET_OS_API),posix)
# TODO make this work on macosx
ifneq ($(OPENJDK_TARGET_OS),macosx) ifneq ($(OPENJDK_TARGET_OS),macosx)
SCTP_WERROR := -Werror SCTP_WERROR := -Werror
...@@ -2034,7 +2004,6 @@ ifeq ($(OPENJDK_TARGET_OS_API),posix) ...@@ -2034,7 +2004,6 @@ ifeq ($(OPENJDK_TARGET_OS_API),posix)
LDFLAGS_SUFFIX_posix:=-lnio -lnet,\ LDFLAGS_SUFFIX_posix:=-lnio -lnet,\
LDFLAGS_SUFFIX_solaris:=-lsocket -ljava -ljvm -lc,\ LDFLAGS_SUFFIX_solaris:=-lsocket -ljava -ljvm -lc,\
LDFLAGS_SUFFIX_macosx:=-ljava -ljvm,\ LDFLAGS_SUFFIX_macosx:=-ljava -ljvm,\
INCLUDE_FILES:=SctpNet.c SctpChannelImpl.c SctpServerChannelImpl.c,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsctp)) OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsctp))
BUILD_LIBRARIES += $(BUILD_LIBSCTP) BUILD_LIBRARIES += $(BUILD_LIBSCTP)
...@@ -2105,7 +2074,7 @@ endif ...@@ -2105,7 +2074,7 @@ endif
ifneq ($(USE_EXTERNAL_LIBZ),true) ifneq ($(USE_EXTERNAL_LIBZ),true)
BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5 BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
LIBJLI_CFLAGS += $(LIBZ_INCLUDE) LIBJLI_CFLAGS += $(ZLIB_CPPFLAGS)
BUILD_LIBJLI_FILES += \ BUILD_LIBJLI_FILES += \
inflate.c \ inflate.c \
inftrees.c \ inftrees.c \
...@@ -2416,8 +2385,14 @@ LIBSPLASHSCREEN_DIRS:=\ ...@@ -2416,8 +2385,14 @@ LIBSPLASHSCREEN_DIRS:=\
$(JDK_TOPDIR)/src/share/native/sun/awt/giflib \ $(JDK_TOPDIR)/src/share/native/sun/awt/giflib \
$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \ $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
$(JDK_TOPDIR)/src/share/native/sun/awt/libpng \ $(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
$(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen \ $(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
ifneq ($(OPENJDK_TARGET_OS), macosx)
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
else
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen
endif
LIBSPLASHSCREEN_CFLAGS:=-DSPLASHSCREEN -DPNG_NO_MMX_CODE \ LIBSPLASHSCREEN_CFLAGS:=-DSPLASHSCREEN -DPNG_NO_MMX_CODE \
$(foreach dir,$(LIBSPLASHSCREEN_DIRS),-I$(dir)) $(foreach dir,$(LIBSPLASHSCREEN_DIRS),-I$(dir))
...@@ -2443,104 +2418,11 @@ else ...@@ -2443,104 +2418,11 @@ else
LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32 LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32
endif endif
LIBSPLASHSCREEN_FILES:=\
java_awt_SplashScreen.c \
splashscreen_gfx_impl.c \
splashscreen_gif.c \
splashscreen_impl.c \
splashscreen_jpeg.c \
splashscreen_png.c \
png.c \
pngerror.c \
pngget.c \
pngmem.c \
pngpread.c \
pngread.c \
pngrio.c \
pngrtran.c \
pngrutil.c \
pngset.c \
pngtrans.c \
pngwio.c \
pngwrite.c \
pngwtran.c \
pngwutil.c \
dgif_lib.c \
gif_err.c \
gifalloc.c \
jcomapi.c \
jdapimin.c \
jdapistd.c \
jdcoefct.c \
jdcolor.c \
jddctmgr.c \
jdhuff.c \
jdinput.c \
jdmainct.c \
jdmarker.c \
jdmaster.c \
jdmerge.c \
jdphuff.c \
jdpostct.c \
jdsample.c \
jerror.c \
jidctflt.c \
jidctfst.c \
jidctint.c \
jidctred.c \
jmemmgr.c \
jmemnobs.c \
jquant1.c \
jquant2.c \
jutils.c \
jcapimin.c \
jcapistd.c \
jccoefct.c \
jccolor.c \
jcdctmgr.c \
jchuff.c \
jcinit.c \
jcmainct.c \
jcmarker.c \
jcmaster.c \
jcparam.c \
jcphuff.c \
jcprepct.c \
jcsample.c \
jctrans.c \
jdtrans.c \
jfdctflt.c \
jfdctfst.c \
jfdctint.c
ifneq ($(OPENJDK_TARGET_OS), macosx)
LIBSPLASHSCREEN_FILES += splashscreen_sys.c
else
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen
LIBSPLASHSCREEN_FILES += splashscreen_sys.m
endif
LIBSPLASHSCREEN_LDFLAGS_SUFFIX:= LIBSPLASHSCREEN_LDFLAGS_SUFFIX:=
ifneq ($(USE_EXTERNAL_LIBZ),true) ifneq ($(USE_EXTERNAL_LIBZ),true)
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5 LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
LIBSPLASHSCREEN_CFLAGS += $(LIBZ_INCLUDE) LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS)
LIBSPLASHSCREEN_FILES += \
compress.c \
deflate.c \
gzclose.c \
gzlib.c \
gzread.c \
gzwrite.c \
infback.c \
inffast.c \
inflate.c \
inftrees.c \
trees.c \
uncompr.c \
zadler32.c \
zcrc32.c \
zutil.c
endif endif
ifeq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
...@@ -2560,7 +2442,7 @@ $(eval $(call SetupNativeCompilation,LIBSPLASHSCREEN,\ ...@@ -2560,7 +2442,7 @@ $(eval $(call SetupNativeCompilation,LIBSPLASHSCREEN,\
LIBRARY:=splashscreen,\ LIBRARY:=splashscreen,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(LIBSPLASHSCREEN_DIRS),\ SRC:=$(LIBSPLASHSCREEN_DIRS),\
INCLUDE_FILES:=$(LIBSPLASHSCREEN_FILES),\ EXCLUDE_FILES:=imageioJPEG.c jpegdecoder.c pngtest.c,\
LANG:=C,\ LANG:=C,\
OPTIMIZATION:=LOW, \ OPTIMIZATION:=LOW, \
CFLAGS:=$(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB),\ CFLAGS:=$(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB),\
...@@ -2683,14 +2565,13 @@ endif ...@@ -2683,14 +2565,13 @@ endif
BUILD_LIBKRB5_NAME:= BUILD_LIBKRB5_NAME:=
ifeq ($(OPENJDK_TARGET_OS), windows) ifeq ($(OPENJDK_TARGET_OS), windows)
BUILD_LIBKRB5_NAME:=w2k_lsa_auth BUILD_LIBKRB5_NAME:=w2k_lsa_auth
BUILD_LIBKRB5_FILES:=NativeCreds.c WindowsDirectory.c
BUILD_LIBKRB5_SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5 BUILD_LIBKRB5_SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5
BUILD_LIBKRB5_LIBS:=advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \ BUILD_LIBKRB5_LIBS:=advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \ gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib
else ifeq ($(OPENJDK_TARGET_OS), macosx) else ifeq ($(OPENJDK_TARGET_OS), macosx)
BUILD_LIBKRB5_NAME:=osxkrb5 BUILD_LIBKRB5_NAME:=osxkrb5
BUILD_LIBKRB5_FILES:=nativeccache.c BUILD_LIBKRB5_SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/krb5
BUILD_LIBKRB5_LIBS:=-framework Kerberos BUILD_LIBKRB5_LIBS:=-framework Kerberos
endif endif
...@@ -2698,9 +2579,7 @@ ifneq ($(BUILD_LIBKRB5_NAME),) ...@@ -2698,9 +2579,7 @@ ifneq ($(BUILD_LIBKRB5_NAME),)
$(eval $(call SetupNativeCompilation,BUILD_LIBKRB5,\ $(eval $(call SetupNativeCompilation,BUILD_LIBKRB5,\
LIBRARY:=$(BUILD_LIBKRB5_NAME),\ LIBRARY:=$(BUILD_LIBKRB5_NAME),\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/krb5 \ SRC:=$(BUILD_LIBKRB5_SRC),\
$(BUILD_LIBKRB5_SRC) ,\
INCLUDE_FILES:=$(BUILD_LIBKRB5_FILES),\
LANG:=C,\ LANG:=C,\
OPTIMIZATION:=LOW, \ OPTIMIZATION:=LOW, \
CFLAGS:=$(CFLAGS_JDKLIB) \ CFLAGS:=$(CFLAGS_JDKLIB) \
...@@ -3071,18 +2950,11 @@ endif ...@@ -3071,18 +2950,11 @@ endif
ifeq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBAPPLESCRIPTENGINE_FILES:=\
AppleScriptEngine.m \
AppleScriptExecutionContext.m \
AS_NS_ConversionUtils.m \
NS_Java_ConversionUtils.m
$(eval $(call SetupNativeCompilation,BUILD_LIBAPPLESCRIPTENGINE,\ $(eval $(call SetupNativeCompilation,BUILD_LIBAPPLESCRIPTENGINE,\
LIBRARY:=AppleScriptEngine,\ LIBRARY:=AppleScriptEngine,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/macosx/native/apple/applescript,\ SRC:=$(JDK_TOPDIR)/src/macosx/native/apple/applescript,\
LANG:=C,\ LANG:=C,\
INCLUDE_FILES:=$(LIBAPPLESCRIPTENGINE_FILES),\
OPTIMIZATION:=LOW, \ OPTIMIZATION:=LOW, \
CFLAGS:=$(CFLAGS_JDKLIB) \ CFLAGS:=$(CFLAGS_JDKLIB) \
-I$(JDK_TOPDIR)/src/macosx/native/apple/applescript \ -I$(JDK_TOPDIR)/src/macosx/native/apple/applescript \
...@@ -3107,18 +2979,11 @@ endif ...@@ -3107,18 +2979,11 @@ endif
ifeq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBOSXAPP_FILES:=\
NSApplicationAWT.m \
QueuingApplicationDelegate.m \
PropertiesUtilities.m \
ThreadUtilities.m
$(eval $(call SetupNativeCompilation,BUILD_LIBOSXAPP,\ $(eval $(call SetupNativeCompilation,BUILD_LIBOSXAPP,\
LIBRARY:=osxapp,\ LIBRARY:=osxapp,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/macosx/native/sun/osxapp,\ SRC:=$(JDK_TOPDIR)/src/macosx/native/sun/osxapp,\
LANG:=C,\ LANG:=C,\
INCLUDE_FILES:=$(LIBOSXAPP_FILES),\
OPTIMIZATION:=LOW, \ OPTIMIZATION:=LOW, \
CFLAGS:=$(CFLAGS_JDKLIB) \ CFLAGS:=$(CFLAGS_JDKLIB) \
-I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \ -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
...@@ -3151,14 +3016,6 @@ endif ...@@ -3151,14 +3016,6 @@ endif
ifeq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBOSX_FILES:=\
Dispatch.m \
CFileManager.m \
KeystoreImpl.m \
JavaAppLauncher.m \
MacOSXPreferencesFile.m \
SCDynamicStoreConfig.m
LIBOSX_DIRS:=\ LIBOSX_DIRS:=\
$(JDK_TOPDIR)/src/macosx/native/com/apple/concurrent \ $(JDK_TOPDIR)/src/macosx/native/com/apple/concurrent \
$(JDK_TOPDIR)/src/macosx/native/java/util \ $(JDK_TOPDIR)/src/macosx/native/java/util \
...@@ -3171,7 +3028,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBOSX,\ ...@@ -3171,7 +3028,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBOSX,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(LIBOSX_DIRS),\ SRC:=$(LIBOSX_DIRS),\
LANG:=C,\ LANG:=C,\
INCLUDE_FILES:=$(LIBOSX_FILES),\
OPTIMIZATION:=LOW, \ OPTIMIZATION:=LOW, \
CFLAGS:=$(CFLAGS_JDKLIB) \ CFLAGS:=$(CFLAGS_JDKLIB) \
$(foreach dir,$(LIBOSX_DIRS),-I$(dir)) \ $(foreach dir,$(LIBOSX_DIRS),-I$(dir)) \
...@@ -3341,22 +3197,11 @@ endif ...@@ -3341,22 +3197,11 @@ endif
ifeq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBOSXUI_FILES:=\
AquaFileView.m \
AquaLookAndFeel.m \
AquaNativeResources.m \
JRSUIConstantSync.m \
JRSUIController.m \
JRSUIFocus.m \
ScreenPopupFactory.m \
ScreenMenu.m
$(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI,\ $(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI,\
LIBRARY:=osxui,\ LIBRARY:=osxui,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
SRC:=$(JDK_TOPDIR)/src/macosx/native/com/apple/laf,\ SRC:=$(JDK_TOPDIR)/src/macosx/native/com/apple/laf,\
LANG:=C,\ LANG:=C,\
INCLUDE_FILES:=$(LIBOSXUI_FILES),\
OPTIMIZATION:=LOW, \ OPTIMIZATION:=LOW, \
CFLAGS:=$(CFLAGS_JDKLIB) \ CFLAGS:=$(CFLAGS_JDKLIB) \
-I$(JDK_TOPDIR)/src/macosx/native/com/apple/laf \ -I$(JDK_TOPDIR)/src/macosx/native/com/apple/laf \
......
...@@ -356,21 +356,9 @@ COPY_FILES += $(JVMCFG) ...@@ -356,21 +356,9 @@ COPY_FILES += $(JVMCFG)
########################################################################################## ##########################################################################################
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-$(OPENJDK_TARGET_OS)
PROPS_DST := $(JDK_OUTPUTDIR)/lib/security/java.security PROPS_DST := $(JDK_OUTPUTDIR)/lib/security/java.security
ifeq ($(OPENJDK_TARGET_OS), solaris)
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-solaris
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-windows
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-macosx
endif
$(PROPS_DST): $(PROPS_SRC) $(PROPS_DST): $(PROPS_SRC)
$(MKDIR) -p $(@D) $(MKDIR) -p $(@D)
$(RM) $@ $(RM) $@
......
...@@ -419,6 +419,23 @@ $(eval $(call SetupArchive,BUILD_JSSE_JAR,,\ ...@@ -419,6 +419,23 @@ $(eval $(call SetupArchive,BUILD_JSSE_JAR,,\
JARS+=$(IMAGES_OUTPUTDIR)/lib/jsse.jar JARS+=$(IMAGES_OUTPUTDIR)/lib/jsse.jar
##########################################################################################
# Create manifest for security jars
#
# Include these extra attributes for now, should probably take out.
#
JCE_MANIFEST := $(IMAGES_OUTPUTDIR)/lib/_the.security.manifest.mf
$(JCE_MANIFEST): $(MAINMANIFEST)
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
$(SED) -e "s#@@RELEASE@@#$(JDK_VERSION)#" \
-e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
$(MAINMANIFEST) >> $@.tmp
$(ECHO) "Extension-Name: javax.crypto" >> $@.tmp
$(ECHO) "Implementation-Vendor-Id: com.sun" >> $@.tmp
$(MV) $@.tmp $@
########################################################################################## ##########################################################################################
SUNPKCS11_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunpkcs11.jar SUNPKCS11_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunpkcs11.jar
...@@ -440,8 +457,11 @@ else ...@@ -440,8 +457,11 @@ else
SUFFIXES:=.class,\ SUFFIXES:=.class,\
INCLUDES:=sun/security/pkcs11,\ INCLUDES:=sun/security/pkcs11,\
JAR:=$(SUNPKCS11_JAR_DST), \ JAR:=$(SUNPKCS11_JAR_DST), \
MANIFEST:=$(JCE_MANIFEST), \
SKIP_METAINF := true)) SKIP_METAINF := true))
$(SUNPKCS11_JAR_DST): $(JCE_MANIFEST)
endif endif
JARS += $(SUNPKCS11_JAR_DST) JARS += $(SUNPKCS11_JAR_DST)
...@@ -452,9 +472,9 @@ SUNEC_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunec.jar ...@@ -452,9 +472,9 @@ SUNEC_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunec.jar
ifndef OPENJDK ifndef OPENJDK
SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar
$(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC) $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..." @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
$(MKDIR) -p $(@D) $(MKDIR) -p $(@D)
$(RM) $@ $(RM) $@
...@@ -462,13 +482,16 @@ $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC) ...@@ -462,13 +482,16 @@ $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
else else
$(eval $(call SetupArchive,BUILD_SUNEC_JAR,,\ $(eval $(call SetupArchive,BUILD_SUNEC_JAR,,\
SRCS:=$(JDK_OUTPUTDIR)/classes, \ SRCS:=$(JDK_OUTPUTDIR)/classes, \
SUFFIXES:=.class,\ SUFFIXES:=.class,\
INCLUDES:=sun/security/ec,\ INCLUDES:=sun/security/ec,\
JAR:=$(SUNEC_JAR_DST), \ JAR:=$(SUNEC_JAR_DST), \
MANIFEST:=$(JCE_MANIFEST), \
SKIP_METAINF := true)) SKIP_METAINF := true))
$(SUNEC_JAR_DST): $(JCE_MANIFEST)
endif endif
JARS += $(SUNEC_JAR_DST) JARS += $(SUNEC_JAR_DST)
...@@ -505,9 +528,11 @@ else ...@@ -505,9 +528,11 @@ else
SUFFIXES:=.class,\ SUFFIXES:=.class,\
INCLUDES:= com/sun/crypto/provider,\ INCLUDES:= com/sun/crypto/provider,\
JAR:=$(SUNJCE_PROVIDER_JAR_DST), \ JAR:=$(SUNJCE_PROVIDER_JAR_DST), \
MANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf, \ MANIFEST:=$(JCE_MANIFEST), \
EXTRA_MANIFEST_ATTR := Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \
SKIP_METAINF := true)) SKIP_METAINF := true))
$(SUNJCE_PROVIDER_JAR_DST): $(JCE_MANIFEST)
endif endif
JARS += $(SUNJCE_PROVIDER_JAR_DST) JARS += $(SUNJCE_PROVIDER_JAR_DST)
...@@ -516,9 +541,9 @@ JCE_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/jce.jar ...@@ -516,9 +541,9 @@ JCE_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/jce.jar
ifndef OPENJDK ifndef OPENJDK
JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
$(JCE_JAR_DST) : $(JCE_JAR_SRC) $(JCE_JAR_DST) : $(JCE_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..." @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
$(MKDIR) -p $(@D) $(MKDIR) -p $(@D)
$(RM) $@ $(RM) $@
...@@ -526,14 +551,16 @@ $(JCE_JAR_DST) : $(JCE_JAR_SRC) ...@@ -526,14 +551,16 @@ $(JCE_JAR_DST) : $(JCE_JAR_SRC)
else else
$(eval $(call SetupArchive,BUILD_JCE_JAR,,\ $(eval $(call SetupArchive,BUILD_JCE_JAR,,\
SRCS:=$(JDK_OUTPUTDIR)/classes, \ SRCS:=$(JDK_OUTPUTDIR)/classes, \
SUFFIXES:=.class,\ SUFFIXES:=.class,\
INCLUDES:= javax/crypto sun/security/internal,\ INCLUDES:= javax/crypto sun/security/internal,\
JAR:=$(JCE_JAR_DST), \ JAR:=$(JCE_JAR_DST), \
MANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf, \ MANIFEST:=$(JCE_MANIFEST), \
EXTRA_MANIFEST_ATTR := Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \
SKIP_METAINF := true)) SKIP_METAINF := true))
$(JCE_JAR_DST): $(JCE_MANIFEST)
endif endif
JARS += $(JCE_JAR_DST) JARS += $(JCE_JAR_DST)
......
...@@ -130,6 +130,8 @@ SUNWprivate_1.1 { ...@@ -130,6 +130,8 @@ SUNWprivate_1.1 {
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio; Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs; Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs; Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
Java_sun_nio_fs_MagicFileTypeDetector_initialize0;
Java_sun_nio_fs_MagicFileTypeDetector_probe0;
Java_sun_nio_fs_LinuxWatchService_eventSize; Java_sun_nio_fs_LinuxWatchService_eventSize;
Java_sun_nio_fs_LinuxWatchService_eventOffsets; Java_sun_nio_fs_LinuxWatchService_eventOffsets;
Java_sun_nio_fs_LinuxWatchService_inotifyInit; Java_sun_nio_fs_LinuxWatchService_inotifyInit;
......
/* /*
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "debugLoop.h" #include "debugLoop.h"
#include "bag.h" #include "bag.h"
#include "invoker.h" #include "invoker.h"
#include "sys.h"
/* How the options get to OnLoad: */ /* How the options get to OnLoad: */
#define XDEBUG "-Xdebug" #define XDEBUG "-Xdebug"
...@@ -201,6 +202,8 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) ...@@ -201,6 +202,8 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
jint jvmtiCompileTimeMajorVersion; jint jvmtiCompileTimeMajorVersion;
jint jvmtiCompileTimeMinorVersion; jint jvmtiCompileTimeMinorVersion;
jint jvmtiCompileTimeMicroVersion; jint jvmtiCompileTimeMicroVersion;
char *boot_path = NULL;
char npt_lib[MAXPATHLEN];
/* See if it's already loaded */ /* See if it's already loaded */
if ( gdata!=NULL && gdata->isLoaded==JNI_TRUE ) { if ( gdata!=NULL && gdata->isLoaded==JNI_TRUE ) {
...@@ -227,18 +230,6 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) ...@@ -227,18 +230,6 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
vmInitialized = JNI_FALSE; vmInitialized = JNI_FALSE;
gdata->vmDead = JNI_FALSE; gdata->vmDead = JNI_FALSE;
/* Npt and Utf function init */
NPT_INITIALIZE(&(gdata->npt), NPT_VERSION, NULL);
if (gdata->npt == NULL) {
ERROR_MESSAGE(("JDWP: unable to initialize NPT library"));
return JNI_ERR;
}
gdata->npt->utf = (gdata->npt->utfInitialize)(NULL);
if (gdata->npt->utf == NULL) {
ERROR_MESSAGE(("JDWP: UTF function initialization failed"));
return JNI_ERR;
}
/* Get the JVMTI Env, IMPORTANT: Do this first! For jvmtiAllocate(). */ /* Get the JVMTI Env, IMPORTANT: Do this first! For jvmtiAllocate(). */
error = JVM_FUNC_PTR(vm,GetEnv) error = JVM_FUNC_PTR(vm,GetEnv)
(vm, (void **)&(gdata->jvmti), JVMTI_VERSION_1); (vm, (void **)&(gdata->jvmti), JVMTI_VERSION_1);
...@@ -277,6 +268,24 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) ...@@ -277,6 +268,24 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
forceExit(1); /* Kill entire process, no core dump wanted */ forceExit(1); /* Kill entire process, no core dump wanted */
} }
JVMTI_FUNC_PTR(gdata->jvmti, GetSystemProperty)
(gdata->jvmti, (const char *)"sun.boot.library.path",
&boot_path);
dbgsysBuildLibName(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME);
/* Npt and Utf function init */
NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL);
jvmtiDeallocate(boot_path);
if (gdata->npt == NULL) {
ERROR_MESSAGE(("JDWP: unable to initialize NPT library"));
return JNI_ERR;
}
gdata->npt->utf = (gdata->npt->utfInitialize)(NULL);
if (gdata->npt->utf == NULL) {
ERROR_MESSAGE(("JDWP: UTF function initialization failed"));
return JNI_ERR;
}
/* Parse input options */ /* Parse input options */
if (!parseOptions(options)) { if (!parseOptions(options)) {
/* No message necessary, should have been printed out already */ /* No message necessary, should have been printed out already */
......
/* /*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -70,8 +70,13 @@ vprint_message(FILE *fp, const char *prefix, const char *suffix, ...@@ -70,8 +70,13 @@ vprint_message(FILE *fp, const char *prefix, const char *suffix,
len = (int)strlen((char*)utf8buf); len = (int)strlen((char*)utf8buf);
/* Convert to platform encoding (ignore errors, dangerous area) */ /* Convert to platform encoding (ignore errors, dangerous area) */
(void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf, if (gdata->npt != NULL) {
utf8buf, len, pbuf, MAX_MESSAGE_LEN); (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf,
utf8buf, len, pbuf, MAX_MESSAGE_LEN);
} else {
/* May be called before NPT is initialized so don't fault */
strncpy(pbuf, (char*)utf8buf, len);
}
(void)fprintf(fp, "%s%s%s", prefix, pbuf, suffix); (void)fprintf(fp, "%s%s%s", prefix, pbuf, suffix);
} }
......
/* /*
* Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -144,7 +144,9 @@ loadTransport(char *name, jdwpTransportEnv **transportPtr) ...@@ -144,7 +144,9 @@ loadTransport(char *name, jdwpTransportEnv **transportPtr)
/* First, look in sun.boot.library.path. This should find the standard /* First, look in sun.boot.library.path. This should find the standard
* dt_socket and dt_shmem transport libraries, or any library * dt_socket and dt_shmem transport libraries, or any library
* that was delivered with the J2SE. * that was delivered with the J2SE.
* Note: Java property sun.boot.library.path contains a single directory. * Note: Since 6819213 fixed, Java property sun.boot.library.path can
* contain multiple paths. Dll_dir is the first entry and
* -Dsun.boot.library.path entries are appended.
*/ */
libdir = gdata->property_sun_boot_library_path; libdir = gdata->property_sun_boot_library_path;
if (libdir == NULL) { if (libdir == NULL) {
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
package com.sun.java.util.jar.pack; package com.sun.java.util.jar.pack;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.PrintStream; import java.io.PrintStream;
...@@ -42,40 +40,39 @@ import java.util.Set; ...@@ -42,40 +40,39 @@ import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.jar.Pack200; import java.util.jar.Pack200;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/** /**
* Control block for publishing Pack200 options to the other classes. * Control block for publishing Pack200 options to the other classes.
*/ */
final class PropMap implements SortedMap<String, String> { final class PropMap implements SortedMap<String, String> {
private final TreeMap<String, String> theMap = new TreeMap<>();; private final TreeMap<String, String> theMap = new TreeMap<>();;
private final List<PropertyChangeListener> listenerList = new ArrayList<>(1);
void addListener(PropertyChangeListener listener) { // type is erased, elements are of type java.beans.PropertyChangeListener
private final List<Object> listenerList = new ArrayList<>(1);
void addListener(Object listener) {
assert Beans.isPropertyChangeListener(listener);
listenerList.add(listener); listenerList.add(listener);
} }
void removeListener(PropertyChangeListener listener) { void removeListener(Object listener) {
assert Beans.isPropertyChangeListener(listener);
listenerList.remove(listener); listenerList.remove(listener);
} }
void addListeners(ArrayList<PropertyChangeListener> listeners) {
listenerList.addAll(listeners);
}
void removeListeners(ArrayList<PropertyChangeListener> listeners) {
listenerList.removeAll(listeners);
}
// Override: // Override:
public String put(String key, String value) { public String put(String key, String value) {
String oldValue = theMap.put(key, value); String oldValue = theMap.put(key, value);
if (value != oldValue && !listenerList.isEmpty()) { if (value != oldValue && !listenerList.isEmpty()) {
assert Beans.isBeansPresent();
// Post the property change event. // Post the property change event.
PropertyChangeEvent event = Object event = Beans.newPropertyChangeEvent(this, key, oldValue, value);
new PropertyChangeEvent(this, key, for (Object listener : listenerList) {
oldValue, value); Beans.invokePropertyChange(listener, event);
for (PropertyChangeListener listener : listenerList) {
listener.propertyChange(event);
} }
} }
return oldValue; return oldValue;
...@@ -339,4 +336,113 @@ final class PropMap implements SortedMap<String, String> { ...@@ -339,4 +336,113 @@ final class PropMap implements SortedMap<String, String> {
public String lastKey() { public String lastKey() {
return theMap.lastKey(); return theMap.lastKey();
} }
/**
* A class that provides access to the java.beans.PropertyChangeListener
* and java.beans.PropertyChangeEvent without creating a static dependency
* on java.beans. This class can be removed once the addPropertyChangeListener
* and removePropertyChangeListener methods are removed from Packer and
* Unpacker.
*/
private static class Beans {
private static final Class<?> propertyChangeListenerClass =
getClass("java.beans.PropertyChangeListener");
private static final Class<?> propertyChangeEventClass =
getClass("java.beans.PropertyChangeEvent");
private static final Method propertyChangeMethod =
getMethod(propertyChangeListenerClass,
"propertyChange",
propertyChangeEventClass);
private static final Constructor<?> propertyEventCtor =
getConstructor(propertyChangeEventClass,
Object.class,
String.class,
Object.class,
Object.class);
private static Class<?> getClass(String name) {
try {
return Class.forName(name, true, Beans.class.getClassLoader());
} catch (ClassNotFoundException e) {
return null;
}
}
private static Constructor<?> getConstructor(Class<?> c, Class<?>... types) {
try {
return (c == null) ? null : c.getDeclaredConstructor(types);
} catch (NoSuchMethodException x) {
throw new AssertionError(x);
}
}
private static Method getMethod(Class<?> c, String name, Class<?>... types) {
try {
return (c == null) ? null : c.getMethod(name, types);
} catch (NoSuchMethodException e) {
throw new AssertionError(e);
}
}
/**
* Returns {@code true} if java.beans is present.
*/
static boolean isBeansPresent() {
return propertyChangeListenerClass != null &&
propertyChangeEventClass != null;
}
/**
* Returns {@code true} if the given object is a PropertyChangeListener
*/
static boolean isPropertyChangeListener(Object obj) {
if (propertyChangeListenerClass == null) {
return false;
} else {
return propertyChangeListenerClass.isInstance(obj);
}
}
/**
* Returns a new PropertyChangeEvent with the given source, property
* name, old and new values.
*/
static Object newPropertyChangeEvent(Object source, String prop,
Object oldValue, Object newValue)
{
try {
return propertyEventCtor.newInstance(source, prop, oldValue, newValue);
} catch (InstantiationException | IllegalAccessException x) {
throw new AssertionError(x);
} catch (InvocationTargetException x) {
Throwable cause = x.getCause();
if (cause instanceof Error)
throw (Error)cause;
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(x);
}
}
/**
* Invokes the given PropertyChangeListener's propertyChange method
* with the given event.
*/
static void invokePropertyChange(Object listener, Object ev) {
try {
propertyChangeMethod.invoke(listener, ev);
} catch (IllegalAccessException x) {
throw new AssertionError(x);
} catch (InvocationTargetException x) {
Throwable cause = x.getCause();
if (cause instanceof Error)
throw (Error)cause;
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(x);
}
}
}
} }
...@@ -264,7 +264,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -264,7 +264,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
* <code>false</code> otherwise * <code>false</code> otherwise
*/ */
public boolean writeData(RowSetInternal caller) throws SQLException { public boolean writeData(RowSetInternal caller) throws SQLException {
boolean conflict = false; long conflicts = 0;
boolean showDel = false; boolean showDel = false;
PreparedStatement pstmtIns = null; PreparedStatement pstmtIns = null;
iChangedValsInDbAndCRS = 0; iChangedValsInDbAndCRS = 0;
...@@ -337,8 +337,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -337,8 +337,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
while (crs.next()) { while (crs.next()) {
if (crs.rowDeleted()) { if (crs.rowDeleted()) {
// The row has been deleted. // The row has been deleted.
if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) { if (deleteOriginalRow(crs, this.crsResolve)) {
status.add(rows, SyncResolver.DELETE_ROW_CONFLICT); status.add(rows, SyncResolver.DELETE_ROW_CONFLICT);
conflicts++;
} else { } else {
// delete happened without any occurrence of conflicts // delete happened without any occurrence of conflicts
// so update status accordingly // so update status accordingly
...@@ -349,8 +350,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -349,8 +350,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
// The row has been inserted. // The row has been inserted.
pstmtIns = con.prepareStatement(insertCmd); pstmtIns = con.prepareStatement(insertCmd);
if ( (conflict = insertNewRow(crs, pstmtIns, this.crsResolve)) == true) { if (insertNewRow(crs, pstmtIns, this.crsResolve)) {
status.add(rows, SyncResolver.INSERT_ROW_CONFLICT); status.add(rows, SyncResolver.INSERT_ROW_CONFLICT);
conflicts++;
} else { } else {
// insert happened without any occurrence of conflicts // insert happened without any occurrence of conflicts
// so update status accordingly // so update status accordingly
...@@ -358,8 +360,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -358,8 +360,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
} }
} else if (crs.rowUpdated()) { } else if (crs.rowUpdated()) {
// The row has been updated. // The row has been updated.
if ( conflict = (updateOriginalRow(crs)) == true) { if (updateOriginalRow(crs)) {
status.add(rows, SyncResolver.UPDATE_ROW_CONFLICT); status.add(rows, SyncResolver.UPDATE_ROW_CONFLICT);
conflicts++;
} else { } else {
// update happened without any occurrence of conflicts // update happened without any occurrence of conflicts
// so update status accordingly // so update status accordingly
...@@ -395,21 +398,12 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { ...@@ -395,21 +398,12 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
// reset // reset
crs.setShowDeleted(showDel); crs.setShowDeleted(showDel);
boolean boolConf = false;
for (int j=1;j<status.size();j++){
// ignore status for index = 0 which is set to null
if(! ((status.get(j)).equals(SyncResolver.NO_ROW_CONFLICT))) {
// there is at least one conflict which needs to be resolved
boolConf = true;
break;
}
}
crs.beforeFirst(); crs.beforeFirst();
this.crsResolve.beforeFirst(); this.crsResolve.beforeFirst();
if(boolConf) { if(conflicts != 0) {
SyncProviderException spe = new SyncProviderException(status.size() - 1+resBundle.handleGetObject("crswriter.conflictsno").toString()); SyncProviderException spe = new SyncProviderException(conflicts + " " +
resBundle.handleGetObject("crswriter.conflictsno").toString());
//SyncResolver syncRes = spe.getSyncResolver(); //SyncResolver syncRes = spe.getSyncResolver();
SyncResolverImpl syncResImpl = (SyncResolverImpl) spe.getSyncResolver(); SyncResolverImpl syncResImpl = (SyncResolverImpl) spe.getSyncResolver();
......
...@@ -1067,10 +1067,6 @@ public class Krb5LoginModule implements LoginModule { ...@@ -1067,10 +1067,6 @@ public class Krb5LoginModule implements LoginModule {
if (ktab != null) { if (ktab != null) {
if (!privCredSet.contains(ktab)) { if (!privCredSet.contains(ktab)) {
privCredSet.add(ktab); privCredSet.add(ktab);
// Compatibility; also add keys to privCredSet
for (KerberosKey key: ktab.getKeys(kerbClientPrinc)) {
privCredSet.add(new Krb5Util.KeysFromKeyTab(key));
}
} }
} else { } else {
succeeded = false; succeeded = false;
......
...@@ -177,11 +177,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { ...@@ -177,11 +177,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
ensureCapacityInternal(newLength); ensureCapacityInternal(newLength);
if (count < newLength) { if (count < newLength) {
for (; count < newLength; count++) Arrays.fill(value, count, newLength, '\0');
value[count] = '\0';
} else {
count = newLength;
} }
count = newLength;
} }
/** /**
...@@ -1308,8 +1307,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { ...@@ -1308,8 +1307,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* {@code null}. * {@code null}.
*/ */
public int indexOf(String str, int fromIndex) { public int indexOf(String str, int fromIndex) {
return String.indexOf(value, 0, count, return String.indexOf(value, 0, count, str, fromIndex);
str.toCharArray(), 0, str.length(), fromIndex);
} }
/** /**
...@@ -1352,8 +1350,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { ...@@ -1352,8 +1350,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* {@code null}. * {@code null}.
*/ */
public int lastIndexOf(String str, int fromIndex) { public int lastIndexOf(String str, int fromIndex) {
return String.lastIndexOf(value, 0, count, return String.lastIndexOf(value, 0, count, str, fromIndex);
str.toCharArray(), 0, str.length(), fromIndex);
} }
/** /**
......
...@@ -1705,6 +1705,24 @@ public final class String ...@@ -1705,6 +1705,24 @@ public final class String
str.value, 0, str.value.length, fromIndex); str.value, 0, str.value.length, fromIndex);
} }
/**
* Code shared by String and AbstractStringBuilder to do searches. The
* source is the character array being searched, and the target
* is the string being searched for.
*
* @param source the characters being searched.
* @param sourceOffset offset of the source string.
* @param sourceCount count of the source string.
* @param target the characters being searched for.
* @param fromIndex the index to begin searching from.
*/
static int indexOf(char[] source, int sourceOffset, int sourceCount,
String target, int fromIndex) {
return indexOf(source, sourceOffset, sourceCount,
target.value, 0, target.value.length,
fromIndex);
}
/** /**
* Code shared by String and StringBuffer to do searches. The * Code shared by String and StringBuffer to do searches. The
* source is the character array being searched, and the target * source is the character array being searched, and the target
...@@ -1796,6 +1814,24 @@ public final class String ...@@ -1796,6 +1814,24 @@ public final class String
str.value, 0, str.value.length, fromIndex); str.value, 0, str.value.length, fromIndex);
} }
/**
* Code shared by String and AbstractStringBuilder to do searches. The
* source is the character array being searched, and the target
* is the string being searched for.
*
* @param source the characters being searched.
* @param sourceOffset offset of the source string.
* @param sourceCount count of the source string.
* @param target the characters being searched for.
* @param fromIndex the index to begin searching from.
*/
static int lastIndexOf(char[] source, int sourceOffset, int sourceCount,
String target, int fromIndex) {
return lastIndexOf(source, sourceOffset, sourceCount,
target.value, 0, target.value.length,
fromIndex);
}
/** /**
* Code shared by String and StringBuffer to do searches. The * Code shared by String and StringBuffer to do searches. The
* source is the character array being searched, and the target * source is the character array being searched, and the target
......
...@@ -25,19 +25,21 @@ ...@@ -25,19 +25,21 @@
package java.lang; package java.lang;
import java.lang.ref.*; import java.lang.ref.*;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;
/** /**
* This class provides thread-local variables. These variables differ from * This class provides thread-local variables. These variables differ from
* their normal counterparts in that each thread that accesses one (via its * their normal counterparts in that each thread that accesses one (via its
* <tt>get</tt> or <tt>set</tt> method) has its own, independently initialized * {@code get} or {@code set} method) has its own, independently initialized
* copy of the variable. <tt>ThreadLocal</tt> instances are typically private * copy of the variable. {@code ThreadLocal} instances are typically private
* static fields in classes that wish to associate state with a thread (e.g., * static fields in classes that wish to associate state with a thread (e.g.,
* a user ID or Transaction ID). * a user ID or Transaction ID).
* *
* <p>For example, the class below generates unique identifiers local to each * <p>For example, the class below generates unique identifiers local to each
* thread. * thread.
* A thread's id is assigned the first time it invokes <tt>ThreadId.get()</tt> * A thread's id is assigned the first time it invokes {@code ThreadId.get()}
* and remains unchanged on subsequent calls. * and remains unchanged on subsequent calls.
* <pre> * <pre>
* import java.util.concurrent.atomic.AtomicInteger; * import java.util.concurrent.atomic.AtomicInteger;
...@@ -61,7 +63,7 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -61,7 +63,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* } * }
* </pre> * </pre>
* <p>Each thread holds an implicit reference to its copy of a thread-local * <p>Each thread holds an implicit reference to its copy of a thread-local
* variable as long as the thread is alive and the <tt>ThreadLocal</tt> * variable as long as the thread is alive and the {@code ThreadLocal}
* instance is accessible; after a thread goes away, all of its copies of * instance is accessible; after a thread goes away, all of its copies of
* thread-local instances are subject to garbage collection (unless other * thread-local instances are subject to garbage collection (unless other
* references to these copies exist). * references to these copies exist).
...@@ -108,14 +110,14 @@ public class ThreadLocal<T> { ...@@ -108,14 +110,14 @@ public class ThreadLocal<T> {
* thread-local variable. This method will be invoked the first * thread-local variable. This method will be invoked the first
* time a thread accesses the variable with the {@link #get} * time a thread accesses the variable with the {@link #get}
* method, unless the thread previously invoked the {@link #set} * method, unless the thread previously invoked the {@link #set}
* method, in which case the <tt>initialValue</tt> method will not * method, in which case the {@code initialValue} method will not
* be invoked for the thread. Normally, this method is invoked at * be invoked for the thread. Normally, this method is invoked at
* most once per thread, but it may be invoked again in case of * most once per thread, but it may be invoked again in case of
* subsequent invocations of {@link #remove} followed by {@link #get}. * subsequent invocations of {@link #remove} followed by {@link #get}.
* *
* <p>This implementation simply returns <tt>null</tt>; if the * <p>This implementation simply returns {@code null}; if the
* programmer desires thread-local variables to have an initial * programmer desires thread-local variables to have an initial
* value other than <tt>null</tt>, <tt>ThreadLocal</tt> must be * value other than {@code null}, {@code ThreadLocal} must be
* subclassed, and this method overridden. Typically, an * subclassed, and this method overridden. Typically, an
* anonymous inner class will be used. * anonymous inner class will be used.
* *
...@@ -125,8 +127,22 @@ public class ThreadLocal<T> { ...@@ -125,8 +127,22 @@ public class ThreadLocal<T> {
return null; return null;
} }
/**
* Creates a thread local variable. The initial value of the variable is
* determined by invoking the {@code get} method on the {@code Supplier}.
*
* @param supplier the supplier to be used to determine the initial value
* @return a new thread local variable
* @throws NullPointerException if the specified supplier is null
* @since 1.8
*/
public static <T> ThreadLocal<T> withInitial(Supplier<? extends T> supplier) {
return new SuppliedThreadLocal<>(supplier);
}
/** /**
* Creates a thread local variable. * Creates a thread local variable.
* @see #withInitial(java.util.function.Supplier)
*/ */
public ThreadLocal() { public ThreadLocal() {
} }
...@@ -195,7 +211,7 @@ public class ThreadLocal<T> { ...@@ -195,7 +211,7 @@ public class ThreadLocal<T> {
* reinitialized by invoking its {@link #initialValue} method, * reinitialized by invoking its {@link #initialValue} method,
* unless its value is {@linkplain #set set} by the current thread * unless its value is {@linkplain #set set} by the current thread
* in the interim. This may result in multiple invocations of the * in the interim. This may result in multiple invocations of the
* <tt>initialValue</tt> method in the current thread. * {@code initialValue} method in the current thread.
* *
* @since 1.5 * @since 1.5
*/ */
...@@ -250,6 +266,24 @@ public class ThreadLocal<T> { ...@@ -250,6 +266,24 @@ public class ThreadLocal<T> {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
/**
* An extension of ThreadLocal that obtains its initial value from
* the specified {@code Supplier}.
*/
static final class SuppliedThreadLocal<T> extends ThreadLocal<T> {
private final Supplier<? extends T> supplier;
SuppliedThreadLocal(Supplier<? extends T> supplier) {
this.supplier = Objects.requireNonNull(supplier);
}
@Override
protected T initialValue() {
return supplier.get();
}
}
/** /**
* ThreadLocalMap is a customized hash map suitable only for * ThreadLocalMap is a customized hash map suitable only for
* maintaining thread local values. No operations are exported * maintaining thread local values. No operations are exported
...@@ -599,9 +633,9 @@ public class ThreadLocal<T> { ...@@ -599,9 +633,9 @@ public class ThreadLocal<T> {
* @param i a position known NOT to hold a stale entry. The * @param i a position known NOT to hold a stale entry. The
* scan starts at the element after i. * scan starts at the element after i.
* *
* @param n scan control: <tt>log2(n)</tt> cells are scanned, * @param n scan control: {@code log2(n)} cells are scanned,
* unless a stale entry is found, in which case * unless a stale entry is found, in which case
* <tt>log2(table.length)-1</tt> additional cells are scanned. * {@code log2(table.length)-1} additional cells are scanned.
* When called from insertions, this parameter is the number * When called from insertions, this parameter is the number
* of elements, but when from replaceStaleEntry, it is the * of elements, but when from replaceStaleEntry, it is the
* table length. (Note: all this could be changed to be either * table length. (Note: all this could be changed to be either
......
...@@ -25,15 +25,15 @@ ...@@ -25,15 +25,15 @@
package java.lang.invoke; package java.lang.invoke;
import java.io.FileOutputStream; import java.lang.reflect.Constructor;
import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import sun.util.logging.PlatformLogger;
import jdk.internal.org.objectweb.asm.*; import jdk.internal.org.objectweb.asm.*;
import static jdk.internal.org.objectweb.asm.Opcodes.*; import static jdk.internal.org.objectweb.asm.Opcodes.*;
import sun.misc.Unsafe; import sun.misc.Unsafe;
import java.security.AccessController;
import java.security.PrivilegedAction;
/** /**
* InnerClassLambdaMetafactory * InnerClassLambdaMetafactory
...@@ -120,13 +120,34 @@ import sun.misc.Unsafe; ...@@ -120,13 +120,34 @@ import sun.misc.Unsafe;
* *
* @return a CallSite, which, when invoked, will return an instance of the * @return a CallSite, which, when invoked, will return an instance of the
* functional interface * functional interface
* @throws ReflectiveOperationException * @throws ReflectiveOperationException, LambdaConversionException
*/ */
@Override @Override
CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException { CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException {
final Class<?> innerClass = spinInnerClass(); final Class<?> innerClass = spinInnerClass();
if (invokedType.parameterCount() == 0) { if (invokedType.parameterCount() == 0) {
return new ConstantCallSite(MethodHandles.constant(samBase, innerClass.newInstance())); final Constructor[] ctrs = AccessController.doPrivileged(
new PrivilegedAction<Constructor[]>() {
@Override
public Constructor[] run() {
return innerClass.getDeclaredConstructors();
}
});
if (ctrs.length != 1) {
throw new ReflectiveOperationException("Expected one lambda constructor for "
+ innerClass.getCanonicalName() + ", got " + ctrs.length);
}
// The lambda implementing inner class constructor is private, set
// it accessible (by us) before creating the constant sole instance
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
ctrs[0].setAccessible(true);
return null;
}
});
Object inst = ctrs[0].newInstance();
return new ConstantCallSite(MethodHandles.constant(samBase, inst));
} else { } else {
return new ConstantCallSite( return new ConstantCallSite(
MethodHandles.Lookup.IMPL_LOOKUP MethodHandles.Lookup.IMPL_LOOKUP
...@@ -144,7 +165,7 @@ import sun.misc.Unsafe; ...@@ -144,7 +165,7 @@ import sun.misc.Unsafe;
private <T> Class<? extends T> spinInnerClass() throws LambdaConversionException { private <T> Class<? extends T> spinInnerClass() throws LambdaConversionException {
String samName = samBase.getName().replace('.', '/'); String samName = samBase.getName().replace('.', '/');
cw.visit(CLASSFILE_VERSION, ACC_PUBLIC + ACC_SUPER, lambdaClassName, null, NAME_MAGIC_ACCESSOR_IMPL, cw.visit(CLASSFILE_VERSION, ACC_SUPER, lambdaClassName, null, NAME_MAGIC_ACCESSOR_IMPL,
isSerializable ? new String[]{samName, NAME_SERIALIZABLE} : new String[]{samName}); isSerializable ? new String[]{samName, NAME_SERIALIZABLE} : new String[]{samName});
// Generate final fields to be filled in by constructor // Generate final fields to be filled in by constructor
...@@ -186,17 +207,27 @@ import sun.misc.Unsafe; ...@@ -186,17 +207,27 @@ import sun.misc.Unsafe;
final byte[] classBytes = cw.toByteArray(); final byte[] classBytes = cw.toByteArray();
if (System.getProperty("debug.dump.generated") != null) { /*** Uncomment to dump the generated file
System.out.printf("Loaded: %s (%d bytes) %n", lambdaClassName, classBytes.length); System.out.printf("Loaded: %s (%d bytes) %n", lambdaClassName, classBytes.length);
try (FileOutputStream fos = new FileOutputStream(lambdaClassName.replace('/', '.') + ".class")) { try (FileOutputStream fos = new FileOutputStream(lambdaClassName.replace('/', '.') + ".class")) {
fos.write(classBytes); fos.write(classBytes);
} catch (IOException ex) { } catch (IOException ex) {
PlatformLogger.getLogger(InnerClassLambdaMetafactory.class.getName()).severe(ex.getMessage(), ex); Logger.getLogger(InnerClassLambdaMetafactory.class.getName()).log(Level.SEVERE, null, ex);
} }
} ***/
ClassLoader loader = targetClass.getClassLoader(); ClassLoader loader = targetClass.getClassLoader();
ProtectionDomain pd = (loader == null) ? null : targetClass.getProtectionDomain(); ProtectionDomain pd = (loader == null)
? null
: AccessController.doPrivileged(
new PrivilegedAction<ProtectionDomain>() {
@Override
public ProtectionDomain run() {
return targetClass.getProtectionDomain();
}
}
);
return (Class<? extends T>) Unsafe.getUnsafe().defineClass(lambdaClassName, classBytes, 0, classBytes.length, loader, pd); return (Class<? extends T>) Unsafe.getUnsafe().defineClass(lambdaClassName, classBytes, 0, classBytes.length, loader, pd);
} }
...@@ -205,7 +236,7 @@ import sun.misc.Unsafe; ...@@ -205,7 +236,7 @@ import sun.misc.Unsafe;
*/ */
private void generateConstructor() { private void generateConstructor() {
// Generate constructor // Generate constructor
MethodVisitor ctor = cw.visitMethod(ACC_PUBLIC, NAME_CTOR, constructorDesc, null, null); MethodVisitor ctor = cw.visitMethod(ACC_PRIVATE, NAME_CTOR, constructorDesc, null, null);
ctor.visitCode(); ctor.visitCode();
ctor.visitVarInsn(ALOAD, 0); ctor.visitVarInsn(ALOAD, 0);
ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR, METHOD_DESCRIPTOR_VOID); ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR, METHOD_DESCRIPTOR_VOID);
......
...@@ -688,7 +688,16 @@ public class DateFormatSymbols implements Serializable, Cloneable { ...@@ -688,7 +688,16 @@ public class DateFormatSymbols implements Serializable, Cloneable {
} }
ResourceBundle resource = adapter.getLocaleData().getDateFormatData(locale); ResourceBundle resource = adapter.getLocaleData().getDateFormatData(locale);
eras = resource.getStringArray("Eras"); // JRE and CLDR use different keys
// JRE: Eras, short.Eras and narrow.Eras
// CLDR: long.Eras, Eras and narrow.Eras
if (resource.containsKey("Eras")) {
eras = resource.getStringArray("Eras");
} else if (resource.containsKey("long.Eras")) {
eras = resource.getStringArray("long.Eras");
} else if (resource.containsKey("short.Eras")) {
eras = resource.getStringArray("short.Eras");
}
months = resource.getStringArray("MonthNames"); months = resource.getStringArray("MonthNames");
shortMonths = resource.getStringArray("MonthAbbreviations"); shortMonths = resource.getStringArray("MonthAbbreviations");
ampms = resource.getStringArray("AmPmMarkers"); ampms = resource.getStringArray("AmPmMarkers");
......
...@@ -48,12 +48,13 @@ import java.util.GregorianCalendar; ...@@ -48,12 +48,13 @@ import java.util.GregorianCalendar;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.SimpleTimeZone; import java.util.SimpleTimeZone;
import java.util.SortedMap;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.calendar.CalendarUtils; import sun.util.calendar.CalendarUtils;
import sun.util.calendar.ZoneInfoFile; import sun.util.calendar.ZoneInfoFile;
import sun.util.locale.provider.LocaleProviderAdapter;
/** /**
* <code>SimpleDateFormat</code> is a concrete class for formatting and * <code>SimpleDateFormat</code> is a concrete class for formatting and
...@@ -1593,6 +1594,17 @@ public class SimpleDateFormat extends DateFormat { ...@@ -1593,6 +1594,17 @@ public class SimpleDateFormat extends DateFormat {
private int matchString(String text, int start, int field, private int matchString(String text, int start, int field,
Map<String,Integer> data, CalendarBuilder calb) { Map<String,Integer> data, CalendarBuilder calb) {
if (data != null) { if (data != null) {
// TODO: make this default when it's in the spec.
if (data instanceof SortedMap) {
for (String name : data.keySet()) {
if (text.regionMatches(true, start, name, 0, name.length())) {
calb.set(field, data.get(name));
return start + name.length();
}
}
return -start;
}
String bestMatch = null; String bestMatch = null;
for (String name : data.keySet()) { for (String name : data.keySet()) {
...@@ -1803,7 +1815,7 @@ public class SimpleDateFormat extends DateFormat { ...@@ -1803,7 +1815,7 @@ public class SimpleDateFormat extends DateFormat {
boolean obeyCount, boolean[] ambiguousYear, boolean obeyCount, boolean[] ambiguousYear,
ParsePosition origPos, ParsePosition origPos,
boolean useFollowingMinusSignAsDelimiter, CalendarBuilder calb) { boolean useFollowingMinusSignAsDelimiter, CalendarBuilder calb) {
Number number = null; Number number;
int value = 0; int value = 0;
ParsePosition pos = new ParsePosition(0); ParsePosition pos = new ParsePosition(0);
pos.index = start; pos.index = start;
...@@ -1876,9 +1888,7 @@ public class SimpleDateFormat extends DateFormat { ...@@ -1876,9 +1888,7 @@ public class SimpleDateFormat extends DateFormat {
return index; return index;
} }
} else { } else {
Map<String, Integer> map = calendar.getDisplayNames(field, Map<String, Integer> map = getDisplayNamesMap(field, locale);
Calendar.ALL_STYLES,
locale);
if ((index = matchString(text, start, field, map, calb)) > 0) { if ((index = matchString(text, start, field, map, calb)) > 0) {
return index; return index;
} }
...@@ -1940,7 +1950,7 @@ public class SimpleDateFormat extends DateFormat { ...@@ -1940,7 +1950,7 @@ public class SimpleDateFormat extends DateFormat {
// count >= 3 // i.e., MMM or MMMM // count >= 3 // i.e., MMM or MMMM
// Want to be able to parse both short and long forms. // Want to be able to parse both short and long forms.
// Try count == 4 first: // Try count == 4 first:
int newStart = 0; int newStart;
if ((newStart = matchString(text, start, Calendar.MONTH, if ((newStart = matchString(text, start, Calendar.MONTH,
formatData.getMonths(), calb)) > 0) { formatData.getMonths(), calb)) > 0) {
return newStart; return newStart;
...@@ -1951,9 +1961,7 @@ public class SimpleDateFormat extends DateFormat { ...@@ -1951,9 +1961,7 @@ public class SimpleDateFormat extends DateFormat {
return index; return index;
} }
} else { } else {
Map<String, Integer> map = calendar.getDisplayNames(field, Map<String, Integer> map = getDisplayNamesMap(field, locale);
Calendar.ALL_STYLES,
locale);
if ((index = matchString(text, start, field, map, calb)) > 0) { if ((index = matchString(text, start, field, map, calb)) > 0) {
return index; return index;
} }
...@@ -1979,7 +1987,7 @@ public class SimpleDateFormat extends DateFormat { ...@@ -1979,7 +1987,7 @@ public class SimpleDateFormat extends DateFormat {
if (useDateFormatSymbols) { if (useDateFormatSymbols) {
// Want to be able to parse both short and long forms. // Want to be able to parse both short and long forms.
// Try count == 4 (DDDD) first: // Try count == 4 (DDDD) first:
int newStart = 0; int newStart;
if ((newStart=matchString(text, start, Calendar.DAY_OF_WEEK, if ((newStart=matchString(text, start, Calendar.DAY_OF_WEEK,
formatData.getWeekdays(), calb)) > 0) { formatData.getWeekdays(), calb)) > 0) {
return newStart; return newStart;
...@@ -2008,7 +2016,7 @@ public class SimpleDateFormat extends DateFormat { ...@@ -2008,7 +2016,7 @@ public class SimpleDateFormat extends DateFormat {
return index; return index;
} }
} else { } else {
Map<String,Integer> map = calendar.getDisplayNames(field, Calendar.ALL_STYLES, locale); Map<String,Integer> map = getDisplayNamesMap(field, locale);
if ((index = matchString(text, start, field, map, calb)) > 0) { if ((index = matchString(text, start, field, map, calb)) > 0) {
return index; return index;
} }
...@@ -2098,7 +2106,7 @@ public class SimpleDateFormat extends DateFormat { ...@@ -2098,7 +2106,7 @@ public class SimpleDateFormat extends DateFormat {
break parsing; break parsing;
} }
int sign = 0; int sign;
char c = text.charAt(pos.index); char c = text.charAt(pos.index);
if (c == 'Z') { if (c == 'Z') {
calb.set(Calendar.ZONE_OFFSET, 0).set(Calendar.DST_OFFSET, 0); calb.set(Calendar.ZONE_OFFSET, 0).set(Calendar.DST_OFFSET, 0);
...@@ -2340,6 +2348,21 @@ public class SimpleDateFormat extends DateFormat { ...@@ -2340,6 +2348,21 @@ public class SimpleDateFormat extends DateFormat {
&& formatData.equals(that.formatData)); && formatData.equals(that.formatData));
} }
private static final int[] REST_OF_STYLES = {
Calendar.SHORT_STANDALONE, Calendar.LONG_FORMAT, Calendar.LONG_STANDALONE,
};
private Map<String, Integer> getDisplayNamesMap(int field, Locale locale) {
Map<String, Integer> map = calendar.getDisplayNames(field, Calendar.SHORT_FORMAT, locale);
// Get all SHORT and LONG styles (avoid NARROW styles).
for (int style : REST_OF_STYLES) {
Map<String, Integer> m = calendar.getDisplayNames(field, style, locale);
if (m != null) {
map.putAll(m);
}
}
return map;
}
/** /**
* After reading an object from the input stream, the format * After reading an object from the input stream, the format
* pattern in the object is verified. * pattern in the object is verified.
......
...@@ -289,8 +289,8 @@ public class Base64 { ...@@ -289,8 +289,8 @@ public class Base64 {
* *
* <p> This method first encodes all input bytes into a base64 encoded * <p> This method first encodes all input bytes into a base64 encoded
* byte array and then constructs a new String by using the encoded byte * byte array and then constructs a new String by using the encoded byte
* array and the {@link java.nio.charset.StandardCharsets.ISO_8859_1 ISO-8859-1} * array and the {@link java.nio.charset.StandardCharsets#ISO_8859_1
* charset. * ISO-8859-1} charset.
* *
* <p> In other words, an invocation of this method has exactly the same * <p> In other words, an invocation of this method has exactly the same
* effect as invoking * effect as invoking
...@@ -358,9 +358,9 @@ public class Base64 { ...@@ -358,9 +358,9 @@ public class Base64 {
* to encode any more input bytes. The encoding operation can be * to encode any more input bytes. The encoding operation can be
* continued, if there is more bytes in input buffer to be encoded, * continued, if there is more bytes in input buffer to be encoded,
* by invoking this method again with an output buffer that has more * by invoking this method again with an output buffer that has more
* {@linkplain Buffer#remaining remaining} bytes. This is typically * {@linkplain java.nio.Buffer#remaining remaining} bytes. This is
* done by draining any encoded bytes from the output buffer. The * typically done by draining any encoded bytes from the output buffer.
* value returned from last invocation needs to be passed in as the * The value returned from last invocation needs to be passed in as the
* third parameter {@code bytesOut} if it is to continue an unfinished * third parameter {@code bytesOut} if it is to continue an unfinished
* encoding, 0 otherwise. * encoding, 0 otherwise.
* *
...@@ -806,9 +806,9 @@ public class Base64 { ...@@ -806,9 +806,9 @@ public class Base64 {
* buffer has insufficient space to decode any more input bytes. * buffer has insufficient space to decode any more input bytes.
* The decoding operation can be continued, if there is more bytes * The decoding operation can be continued, if there is more bytes
* in input buffer to be decoded, by invoking this method again with * in input buffer to be decoded, by invoking this method again with
* an output buffer that has more {@linkplain Buffer#remaining remaining} * an output buffer that has more {@linkplain java.nio.Buffer#remaining
* bytes.This is typically done by draining any decoded bytes from the * remaining} bytes. This is typically done by draining any decoded
* output buffer. * bytes from the output buffer.
* *
* <p><b>Recommended Usage Example</b> * <p><b>Recommended Usage Example</b>
* <pre> * <pre>
...@@ -901,7 +901,7 @@ public class Base64 { ...@@ -901,7 +901,7 @@ public class Base64 {
shiftto -= 6; shiftto -= 6;
if (shiftto < 0) { if (shiftto < 0) {
if (dl < dp + 3) if (dl < dp + 3)
return dp; return dp - dp0;
da[dp++] = (byte)(bits >> 16); da[dp++] = (byte)(bits >> 16);
da[dp++] = (byte)(bits >> 8); da[dp++] = (byte)(bits >> 8);
da[dp++] = (byte)(bits); da[dp++] = (byte)(bits);
...@@ -912,7 +912,7 @@ public class Base64 { ...@@ -912,7 +912,7 @@ public class Base64 {
} }
if (shiftto == 6) { if (shiftto == 6) {
if (dl - dp < 1) if (dl - dp < 1)
return dp; return dp - dp0;
if (padding && (sp + 1 != sl || sa[sp++] != '=')) if (padding && (sp + 1 != sl || sa[sp++] != '='))
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Input buffer has wrong 4-byte ending unit"); "Input buffer has wrong 4-byte ending unit");
...@@ -920,7 +920,7 @@ public class Base64 { ...@@ -920,7 +920,7 @@ public class Base64 {
mark = sp; mark = sp;
} else if (shiftto == 0) { } else if (shiftto == 0) {
if (dl - dp < 2) if (dl - dp < 2)
return dp; return dp - dp0;
if (padding && sp != sl) if (padding && sp != sl)
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Input buffer has wrong 4-byte ending unit"); "Input buffer has wrong 4-byte ending unit");
...@@ -969,7 +969,7 @@ public class Base64 { ...@@ -969,7 +969,7 @@ public class Base64 {
shiftto -= 6; shiftto -= 6;
if (shiftto < 0) { if (shiftto < 0) {
if (dl < dp + 3) if (dl < dp + 3)
return dp; return dp - dp0;
dst.put(dp++, (byte)(bits >> 16)); dst.put(dp++, (byte)(bits >> 16));
dst.put(dp++, (byte)(bits >> 8)); dst.put(dp++, (byte)(bits >> 8));
dst.put(dp++, (byte)(bits)); dst.put(dp++, (byte)(bits));
...@@ -980,7 +980,7 @@ public class Base64 { ...@@ -980,7 +980,7 @@ public class Base64 {
} }
if (shiftto == 6) { if (shiftto == 6) {
if (dl - dp < 1) if (dl - dp < 1)
return dp; return dp - dp0;
if (padding && (sp + 1 != sl || src.get(sp++) != '=')) if (padding && (sp + 1 != sl || src.get(sp++) != '='))
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Input buffer has wrong 4-byte ending unit"); "Input buffer has wrong 4-byte ending unit");
...@@ -988,7 +988,7 @@ public class Base64 { ...@@ -988,7 +988,7 @@ public class Base64 {
mark = sp; mark = sp;
} else if (shiftto == 0) { } else if (shiftto == 0) {
if (dl - dp < 2) if (dl - dp < 2)
return dp; return dp - dp0;
if (padding && sp != sl) if (padding && sp != sl)
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Input buffer has wrong 4-byte ending unit"); "Input buffer has wrong 4-byte ending unit");
......
...@@ -53,9 +53,7 @@ import java.text.DateFormat; ...@@ -53,9 +53,7 @@ import java.text.DateFormat;
import java.text.DateFormatSymbols; import java.text.DateFormatSymbols;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.spi.CalendarDataProvider;
import sun.util.BuddhistCalendar; import sun.util.BuddhistCalendar;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.calendar.ZoneInfo; import sun.util.calendar.ZoneInfo;
import sun.util.locale.provider.CalendarDataUtility; import sun.util.locale.provider.CalendarDataUtility;
...@@ -743,6 +741,32 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca ...@@ -743,6 +741,32 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
*/ */
public static final int LONG = 2; public static final int LONG = 2;
/**
* A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale)
* getDisplayNames} indicating a narrow name used for format. Narrow names
* are typically single character strings, such as "M" for Monday.
*
* @see #NARROW_STANDALONE
* @see #SHORT_FORMAT
* @see #LONG_FOTMAT
* @since 1.8
*/
public static final int NARROW_FORMAT = 4;
/**
* A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale)
* getDisplayNames} indicating a narrow name independently. Narrow names
* are typically single character strings, such as "M" for Monday.
*
* @see #NARROW_FORMAT
* @see #SHORT_STANDALONE
* @see #LONG_STANDALONE
* @since 1.8
*/
public static final int NARROW_STANDALONE = NARROW_FORMAT | STANDALONE_MASK;
/** /**
* A style specifier for {@link #getDisplayName(int, int, Locale) * A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale) * getDisplayName} and {@link #getDisplayNames(int, int, Locale)
...@@ -1472,30 +1496,31 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca ...@@ -1472,30 +1496,31 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @param style * @param style
* the style applied to the string representation; one of {@link * the style applied to the string representation; one of {@link
* #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE}, * #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE},
* {@link #LONG_FORMAT} ({@link #LONG}) or {@link #LONG_STANDALONE}. * {@link #LONG_FORMAT} ({@link #LONG}), {@link #LONG_STANDALONE},
* {@link #NARROW_FORMAT}, or {@link #NARROW_STANDALONE}.
* @param locale * @param locale
* the locale for the string representation * the locale for the string representation
* (any calendar types specified by {@code locale} are ignored) * (any calendar types specified by {@code locale} are ignored)
* @return the string representation of the given * @return the string representation of the given
* <code>field</code> in the given <code>style</code>, or * {@code field} in the given {@code style}, or
* <code>null</code> if no string representation is * {@code null} if no string representation is
* applicable. * applicable.
* @exception IllegalArgumentException * @exception IllegalArgumentException
* if <code>field</code> or <code>style</code> is invalid, * if {@code field} or {@code style} is invalid,
* or if this <code>Calendar</code> is non-lenient and any * or if this {@code Calendar} is non-lenient and any
* of the calendar fields have invalid values * of the calendar fields have invalid values
* @exception NullPointerException * @exception NullPointerException
* if <code>locale</code> is null * if {@code locale} is null
* @since 1.6 * @since 1.6
*/ */
public String getDisplayName(int field, int style, Locale locale) { public String getDisplayName(int field, int style, Locale locale) {
if (!checkDisplayNameParams(field, style, SHORT, LONG, locale, if (!checkDisplayNameParams(field, style, SHORT, NARROW_FORMAT, locale,
ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null; return null;
} }
// the standalone styles are supported only through CalendarDataProviders. // the standalone and narrow styles are supported only through CalendarDataProviders.
if (isStandaloneStyle(style)) { if (isStandaloneStyle(style) || isNarrowStyle(style)) {
return CalendarDataUtility.retrieveFieldValueName(getCalendarType(), return CalendarDataUtility.retrieveFieldValueName(getCalendarType(),
field, get(field), field, get(field),
style, locale); style, locale);
...@@ -1513,26 +1538,30 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca ...@@ -1513,26 +1538,30 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
} }
/** /**
* Returns a <code>Map</code> containing all names of the calendar * Returns a {@code Map} containing all names of the calendar
* <code>field</code> in the given <code>style</code> and * {@code field} in the given {@code style} and
* <code>locale</code> and their corresponding field values. For * {@code locale} and their corresponding field values. For
* example, if this <code>Calendar</code> is a {@link * example, if this {@code Calendar} is a {@link
* GregorianCalendar}, the returned map would contain "Jan" to * GregorianCalendar}, the returned map would contain "Jan" to
* {@link #JANUARY}, "Feb" to {@link #FEBRUARY}, and so on, in the * {@link #JANUARY}, "Feb" to {@link #FEBRUARY}, and so on, in the
* {@linkplain #SHORT short} style in an English locale. * {@linkplain #SHORT short} style in an English locale.
* *
* <p>Narrow names may not be unique due to use of single characters,
* such as "S" for Sunday and Saturday. In that case narrow names are not
* included in the returned {@code Map}.
*
* <p>The values of other calendar fields may be taken into * <p>The values of other calendar fields may be taken into
* account to determine a set of display names. For example, if * account to determine a set of display names. For example, if
* this <code>Calendar</code> is a lunisolar calendar system and * this {@code Calendar} is a lunisolar calendar system and
* the year value given by the {@link #YEAR} field has a leap * the year value given by the {@link #YEAR} field has a leap
* month, this method would return month names containing the leap * month, this method would return month names containing the leap
* month name, and month names are mapped to their values specific * month name, and month names are mapped to their values specific
* for the year. * for the year.
* *
* <p>The default implementation supports display names contained in * <p>The default implementation supports display names contained in
* a {@link DateFormatSymbols}. For example, if <code>field</code> * a {@link DateFormatSymbols}. For example, if {@code field}
* is {@link #MONTH} and <code>style</code> is {@link * is {@link #MONTH} and {@code style} is {@link
* #ALL_STYLES}, this method returns a <code>Map</code> containing * #ALL_STYLES}, this method returns a {@code Map} containing
* all strings returned by {@link DateFormatSymbols#getShortMonths()} * all strings returned by {@link DateFormatSymbols#getShortMonths()}
* and {@link DateFormatSymbols#getMonths()}. * and {@link DateFormatSymbols#getMonths()}.
* *
...@@ -1541,30 +1570,31 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca ...@@ -1541,30 +1570,31 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @param style * @param style
* the style applied to the string representation; one of {@link * the style applied to the string representation; one of {@link
* #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE}, * #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE},
* {@link #LONG_FORMAT} ({@link #LONG}) or {@link #LONG_STANDALONE}. * {@link #LONG_FORMAT} ({@link #LONG}), {@link #LONG_STANDALONE},
* {@link #NARROW_FORMAT}, or {@link #NARROW_STANDALONE}
* @param locale * @param locale
* the locale for the display names * the locale for the display names
* @return a <code>Map</code> containing all display names in * @return a {@code Map} containing all display names in
* <code>style</code> and <code>locale</code> and their * {@code style} and {@code locale} and their
* field values, or <code>null</code> if no display names * field values, or {@code null} if no display names
* are defined for <code>field</code> * are defined for {@code field}
* @exception IllegalArgumentException * @exception IllegalArgumentException
* if <code>field</code> or <code>style</code> is invalid, * if {@code field} or {@code style} is invalid,
* or if this <code>Calendar</code> is non-lenient and any * or if this {@code Calendar} is non-lenient and any
* of the calendar fields have invalid values * of the calendar fields have invalid values
* @exception NullPointerException * @exception NullPointerException
* if <code>locale</code> is null * if {@code locale} is null
* @since 1.6 * @since 1.6
*/ */
public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) { public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) {
if (!checkDisplayNameParams(field, style, ALL_STYLES, LONG, locale, if (!checkDisplayNameParams(field, style, ALL_STYLES, NARROW_FORMAT, locale,
ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null; return null;
} }
if (style == ALL_STYLES || isStandaloneStyle(style)) { if (style == ALL_STYLES || isStandaloneStyle(style)) {
return CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale); return CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale);
} }
// SHORT or LONG // SHORT, LONG, or NARROW
return getDisplayNamesImpl(field, style, locale); return getDisplayNamesImpl(field, style, locale);
} }
...@@ -1599,6 +1629,12 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca ...@@ -1599,6 +1629,12 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) { private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
int baseStyle = getBaseStyle(style); // ignore the standalone mask int baseStyle = getBaseStyle(style); // ignore the standalone mask
// DateFormatSymbols doesn't support any narrow names.
if (baseStyle == NARROW_FORMAT) {
return null;
}
String[] strings = null; String[] strings = null;
switch (field) { switch (field) {
case ERA: case ERA:
...@@ -1948,6 +1984,10 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca ...@@ -1948,6 +1984,10 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
return (style & STANDALONE_MASK) != 0; return (style & STANDALONE_MASK) != 0;
} }
boolean isNarrowStyle(int style) {
return style == NARROW_FORMAT || style == NARROW_STANDALONE;
}
/** /**
* Returns the pseudo-time-stamp for two fields, given their * Returns the pseudo-time-stamp for two fields, given their
* individual pseudo-time-stamps. If either of the fields * individual pseudo-time-stamps. If either of the fields
......
...@@ -56,12 +56,13 @@ import sun.util.logging.PlatformLogger; ...@@ -56,12 +56,13 @@ import sun.util.logging.PlatformLogger;
* no public constructor. You obtain a <code>Currency</code> instance using * no public constructor. You obtain a <code>Currency</code> instance using
* the <code>getInstance</code> methods. * the <code>getInstance</code> methods.
* <p> * <p>
* Users can supersede the Java runtime currency data by creating a properties * Users can supersede the Java runtime currency data by means of the system
* file named <code>&lt;JAVA_HOME&gt;/lib/currency.properties</code>. The contents * property {@code java.util.currency.data}. If this system property is
* of the properties file are key/value pairs of the ISO 3166 country codes * defined then its value is the location of a properties file, the contents of
* and the ISO 4217 currency data respectively. The value part consists of * which are key/value pairs of the ISO 3166 country codes and the ISO 4217
* three ISO 4217 values of a currency, i.e., an alphabetic code, a numeric * currency data respectively. The value part consists of three ISO 4217 values
* code, and a minor unit. Those three ISO 4217 values are separated by commas. * of a currency, i.e., an alphabetic code, a numeric code, and a minor unit.
* Those three ISO 4217 values are separated by commas.
* The lines which start with '#'s are considered comment lines. An optional UTC * The lines which start with '#'s are considered comment lines. An optional UTC
* timestamp may be specified per currency entry if users need to specify a * timestamp may be specified per currency entry if users need to specify a
* cutover date indicating when the new data comes into effect. The timestamp is * cutover date indicating when the new data comes into effect. The timestamp is
...@@ -246,10 +247,13 @@ public final class Currency implements Serializable { ...@@ -246,10 +247,13 @@ public final class Currency implements Serializable {
} }
// look for the properties file for overrides // look for the properties file for overrides
String propsFile = System.getProperty("java.util.currency.data");
if (propsFile == null) {
propsFile = homeDir + File.separator + "lib" +
File.separator + "currency.properties";
}
try { try {
File propFile = new File(homeDir + File.separator + File propFile = new File(propsFile);
"lib" + File.separator +
"currency.properties");
if (propFile.exists()) { if (propFile.exists()) {
Properties props = new Properties(); Properties props = new Properties();
try (FileReader fr = new FileReader(propFile)) { try (FileReader fr = new FileReader(propFile)) {
......
...@@ -946,8 +946,9 @@ class JapaneseImperialCalendar extends Calendar { ...@@ -946,8 +946,9 @@ class JapaneseImperialCalendar extends Calendar {
set(field, getRolledValue(internalGet(field), amount, min, max)); set(field, getRolledValue(internalGet(field), amount, min, max));
} }
@Override
public String getDisplayName(int field, int style, Locale locale) { public String getDisplayName(int field, int style, Locale locale) {
if (!checkDisplayNameParams(field, style, SHORT, LONG, locale, if (!checkDisplayNameParams(field, style, SHORT, NARROW_FORMAT, locale,
ERA_MASK|YEAR_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { ERA_MASK|YEAR_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null; return null;
} }
...@@ -956,11 +957,12 @@ class JapaneseImperialCalendar extends Calendar { ...@@ -956,11 +957,12 @@ class JapaneseImperialCalendar extends Calendar {
// "GanNen" is supported only in the LONG style. // "GanNen" is supported only in the LONG style.
if (field == YEAR if (field == YEAR
&& (getBaseStyle(style) == SHORT || fieldValue != 1 || get(ERA) == 0)) { && (getBaseStyle(style) != LONG || fieldValue != 1 || get(ERA) == 0)) {
return null; return null;
} }
String name = CalendarDataUtility.retrieveFieldValueName("japanese", field, fieldValue, style, locale); String name = CalendarDataUtility.retrieveFieldValueName(getCalendarType(), field,
fieldValue, style, locale);
// If the ERA value is null, then // If the ERA value is null, then
// try to get its name or abbreviation from the Era instance. // try to get its name or abbreviation from the Era instance.
if (name == null && field == ERA && fieldValue < eras.length) { if (name == null && field == ERA && fieldValue < eras.length) {
...@@ -970,27 +972,37 @@ class JapaneseImperialCalendar extends Calendar { ...@@ -970,27 +972,37 @@ class JapaneseImperialCalendar extends Calendar {
return name; return name;
} }
@Override
public Map<String,Integer> getDisplayNames(int field, int style, Locale locale) { public Map<String,Integer> getDisplayNames(int field, int style, Locale locale) {
if (!checkDisplayNameParams(field, style, ALL_STYLES, LONG, locale, if (!checkDisplayNameParams(field, style, ALL_STYLES, NARROW_FORMAT, locale,
ERA_MASK|YEAR_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { ERA_MASK|YEAR_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null; return null;
} }
Map<String, Integer> names = CalendarDataUtility.retrieveFieldValueNames("japanese", field, style, locale); Map<String, Integer> names;
names = CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale);
// If strings[] has fewer than eras[], get more names from eras[]. // If strings[] has fewer than eras[], get more names from eras[].
if (field == ERA) { if (names != null) {
int size = names.size(); if (field == ERA) {
if (style == ALL_STYLES) { int size = names.size();
size /= 2; // SHORT and LONG if (style == ALL_STYLES) {
} Set<Integer> values = new HashSet<>();
if (size < eras.length) { // count unique era values
int baseStyle = getBaseStyle(style); for (String key : names.keySet()) {
for (int i = size; i < eras.length; i++) { values.add(names.get(key));
Era era = eras[i];
if (baseStyle == ALL_STYLES || baseStyle == SHORT) {
names.put(era.getAbbreviation(), i);
} }
if (baseStyle == ALL_STYLES || baseStyle == LONG) { size = values.size();
names.put(era.getName(), i); }
if (size < eras.length) {
int baseStyle = getBaseStyle(style);
for (int i = size; i < eras.length; i++) {
Era era = eras[i];
if (baseStyle == ALL_STYLES || baseStyle == SHORT
|| baseStyle == NARROW_FORMAT) {
names.put(era.getAbbreviation(), i);
}
if (baseStyle == ALL_STYLES || baseStyle == LONG) {
names.put(era.getName(), i);
}
} }
} }
} }
......
...@@ -43,12 +43,12 @@ import java.lang.ref.SoftReference; ...@@ -43,12 +43,12 @@ import java.lang.ref.SoftReference;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import sun.misc.SharedSecrets;
import sun.misc.JavaAWTAccess; import sun.misc.JavaAWTAccess;
import sun.misc.SharedSecrets;
import sun.security.action.GetPropertyAction; import sun.security.action.GetPropertyAction;
import sun.util.locale.provider.TimeZoneNameUtility;
import sun.util.calendar.ZoneInfo; import sun.util.calendar.ZoneInfo;
import sun.util.calendar.ZoneInfoFile; import sun.util.calendar.ZoneInfoFile;
import sun.util.locale.provider.TimeZoneNameUtility;
/** /**
* <code>TimeZone</code> represents a time zone offset, and also figures out daylight * <code>TimeZone</code> represents a time zone offset, and also figures out daylight
...@@ -399,28 +399,23 @@ abstract public class TimeZone implements Serializable, Cloneable { ...@@ -399,28 +399,23 @@ abstract public class TimeZone implements Serializable, Cloneable {
if (style != SHORT && style != LONG) { if (style != SHORT && style != LONG) {
throw new IllegalArgumentException("Illegal style: " + style); throw new IllegalArgumentException("Illegal style: " + style);
} }
String id = getID(); String id = getID();
String[] names = getDisplayNames(id, locale); String name = TimeZoneNameUtility.retrieveDisplayName(id, daylight, style, locale);
if (names == null) { if (name != null) {
if (id.startsWith("GMT") && id.length() > 3) { return name;
char sign = id.charAt(3);
if (sign == '+' || sign == '-') {
return id;
}
}
int offset = getRawOffset();
if (daylight) {
offset += getDSTSavings();
}
return ZoneInfoFile.toCustomID(offset);
} }
int index = daylight ? 3 : 1; if (id.startsWith("GMT") && id.length() > 3) {
if (style == SHORT) { char sign = id.charAt(3);
index++; if (sign == '+' || sign == '-') {
return id;
}
} }
return names[index]; int offset = getRawOffset();
if (daylight) {
offset += getDSTSavings();
}
return ZoneInfoFile.toCustomID(offset);
} }
private static class DisplayNames { private static class DisplayNames {
...@@ -429,9 +424,12 @@ abstract public class TimeZone implements Serializable, Cloneable { ...@@ -429,9 +424,12 @@ abstract public class TimeZone implements Serializable, Cloneable {
// Map(key=id, value=SoftReference(Map(key=locale, value=displaynames))) // Map(key=id, value=SoftReference(Map(key=locale, value=displaynames)))
private static final Map<String, SoftReference<Map<Locale, String[]>>> CACHE = private static final Map<String, SoftReference<Map<Locale, String[]>>> CACHE =
new ConcurrentHashMap<>(); new ConcurrentHashMap<>();
private DisplayNames() {
}
} }
private static final String[] getDisplayNames(String id, Locale locale) { private static String[] getDisplayNames(String id, Locale locale) {
Map<String, SoftReference<Map<Locale, String[]>>> displayNames = DisplayNames.CACHE; Map<String, SoftReference<Map<Locale, String[]>>> displayNames = DisplayNames.CACHE;
SoftReference<Map<Locale, String[]>> ref = displayNames.get(id); SoftReference<Map<Locale, String[]>> ref = displayNames.get(id);
...@@ -631,14 +629,14 @@ abstract public class TimeZone implements Serializable, Cloneable { ...@@ -631,14 +629,14 @@ abstract public class TimeZone implements Serializable, Cloneable {
} }
private static synchronized TimeZone setDefaultZone() { private static synchronized TimeZone setDefaultZone() {
TimeZone tz = null; TimeZone tz;
// get the time zone ID from the system properties // get the time zone ID from the system properties
String zoneID = AccessController.doPrivileged( String zoneID = AccessController.doPrivileged(
new GetPropertyAction("user.timezone")); new GetPropertyAction("user.timezone"));
// if the time zone ID is not set (yet), perform the // if the time zone ID is not set (yet), perform the
// platform to Java time zone ID mapping. // platform to Java time zone ID mapping.
if (zoneID == null || zoneID.equals("")) { if (zoneID == null || zoneID.isEmpty()) {
String country = AccessController.doPrivileged( String country = AccessController.doPrivileged(
new GetPropertyAction("user.country")); new GetPropertyAction("user.country"));
String javaHome = AccessController.doPrivileged( String javaHome = AccessController.doPrivileged(
...@@ -670,8 +668,9 @@ abstract public class TimeZone implements Serializable, Cloneable { ...@@ -670,8 +668,9 @@ abstract public class TimeZone implements Serializable, Cloneable {
assert tz != null; assert tz != null;
final String id = zoneID; final String id = zoneID;
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Object run() { @Override
public Void run() {
System.setProperty("user.timezone", id); System.setProperty("user.timezone", id);
return null; return null;
} }
......
...@@ -1759,7 +1759,7 @@ public class TreeMap<K,V> ...@@ -1759,7 +1759,7 @@ public class TreeMap<K,V>
public Set<Map.Entry<K,V>> entrySet() { public Set<Map.Entry<K,V>> entrySet() {
EntrySetView es = entrySetView; EntrySetView es = entrySetView;
return (es != null) ? es : new AscendingEntrySetView(); return (es != null) ? es : (entrySetView = new AscendingEntrySetView());
} }
TreeMap.Entry<K,V> subLowest() { return absLowest(); } TreeMap.Entry<K,V> subLowest() { return absLowest(); }
...@@ -1840,7 +1840,7 @@ public class TreeMap<K,V> ...@@ -1840,7 +1840,7 @@ public class TreeMap<K,V>
public Set<Map.Entry<K,V>> entrySet() { public Set<Map.Entry<K,V>> entrySet() {
EntrySetView es = entrySetView; EntrySetView es = entrySetView;
return (es != null) ? es : new DescendingEntrySetView(); return (es != null) ? es : (entrySetView = new DescendingEntrySetView());
} }
TreeMap.Entry<K,V> subLowest() { return absHighest(); } TreeMap.Entry<K,V> subLowest() { return absHighest(); }
......
...@@ -31,10 +31,10 @@ import java.util.*; ...@@ -31,10 +31,10 @@ import java.util.*;
import java.security.*; import java.security.*;
import java.lang.ref.ReferenceQueue; import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.net.URL;
import sun.security.action.GetPropertyAction;
/** /**
* There is a single global LogManager object that is used to * There is a single global LogManager object that is used to
...@@ -56,20 +56,14 @@ import sun.security.action.GetPropertyAction; ...@@ -56,20 +56,14 @@ import sun.security.action.GetPropertyAction;
* At startup the LogManager class is located using the * At startup the LogManager class is located using the
* java.util.logging.manager system property. * java.util.logging.manager system property.
* <p> * <p>
* By default, the LogManager reads its initial configuration from * The LogManager defines two optional system properties that allow control over
* a properties file "lib/logging.properties" in the JRE directory. * the initial configuration:
* If you edit that property file you can change the default logging
* configuration for all uses of that JRE.
* <p>
* In addition, the LogManager uses two optional system properties that
* allow more control over reading the initial configuration:
* <ul> * <ul>
* <li>"java.util.logging.config.class" * <li>"java.util.logging.config.class"
* <li>"java.util.logging.config.file" * <li>"java.util.logging.config.file"
* </ul> * </ul>
* These two properties may be set via the Preferences API, or as * These two properties may be specified on the command line to the "java"
* command line property definitions to the "java" command, or as * command, or as system property definitions passed to JNI_CreateJavaVM.
* system property definitions passed to JNI_CreateJavaVM.
* <p> * <p>
* If the "java.util.logging.config.class" property is set, then the * If the "java.util.logging.config.class" property is set, then the
* property value is treated as a class name. The given class will be * property value is treated as a class name. The given class will be
...@@ -84,9 +78,10 @@ import sun.security.action.GetPropertyAction; ...@@ -84,9 +78,10 @@ import sun.security.action.GetPropertyAction;
* to specify a properties file (in java.util.Properties format). The * to specify a properties file (in java.util.Properties format). The
* initial logging configuration will be read from this file. * initial logging configuration will be read from this file.
* <p> * <p>
* If neither of these properties is defined then, as described * If neither of these properties is defined then the LogManager uses its
* above, the LogManager will read its initial configuration from * default configuration. The default configuration is typically loaded from the
* a properties file "lib/logging.properties" in the JRE directory. * properties file "{@code lib/logging.properties}" in the Java installation
* directory.
* <p> * <p>
* The properties for loggers and Handlers will have names starting * The properties for loggers and Handlers will have names starting
* with the dot-separated name for the handler or logger. * with the dot-separated name for the handler or logger.
...@@ -155,7 +150,7 @@ public class LogManager { ...@@ -155,7 +150,7 @@ public class LogManager {
// The map of the registered listeners. The map value is the registration // The map of the registered listeners. The map value is the registration
// count to allow for cases where the same listener is registered many times. // count to allow for cases where the same listener is registered many times.
private final Map<PropertyChangeListener,Integer> listenerMap = new HashMap<>(); private final Map<Object,Integer> listenerMap = new HashMap<>();
// Table of named Loggers that maps names to Loggers. // Table of named Loggers that maps names to Loggers.
private Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<>(); private Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<>();
...@@ -248,7 +243,7 @@ public class LogManager { ...@@ -248,7 +243,7 @@ public class LogManager {
* Protected constructor. This is protected so that container applications * Protected constructor. This is protected so that container applications
* (such as J2EE containers) can subclass the object. It is non-public as * (such as J2EE containers) can subclass the object. It is non-public as
* it is intended that there only be one LogManager object, whose value is * it is intended that there only be one LogManager object, whose value is
* retrieved by calling Logmanager.getLogManager. * retrieved by calling LogManager.getLogManager.
*/ */
protected LogManager() { protected LogManager() {
// Add a shutdown hook to close the global handlers. // Add a shutdown hook to close the global handlers.
...@@ -976,22 +971,24 @@ public class LogManager { ...@@ -976,22 +971,24 @@ public class LogManager {
// Notify any interested parties that our properties have changed. // Notify any interested parties that our properties have changed.
// We first take a copy of the listener map so that we aren't holding any // We first take a copy of the listener map so that we aren't holding any
// locks when calling the listeners. // locks when calling the listeners.
Map<PropertyChangeListener,Integer> listeners = null; Map<Object,Integer> listeners = null;
synchronized (listenerMap) { synchronized (listenerMap) {
if (!listenerMap.isEmpty()) if (!listenerMap.isEmpty())
listeners = new HashMap<>(listenerMap); listeners = new HashMap<>(listenerMap);
} }
if (listeners != null) { if (listeners != null) {
PropertyChangeEvent ev = new PropertyChangeEvent(LogManager.class, null, null, null); assert Beans.isBeansPresent();
for (Map.Entry<PropertyChangeListener,Integer> entry : listeners.entrySet()) { Object ev = Beans.newPropertyChangeEvent(LogManager.class, null, null, null);
PropertyChangeListener listener = entry.getKey(); for (Map.Entry<Object,Integer> entry : listeners.entrySet()) {
Object listener = entry.getKey();
int count = entry.getValue().intValue(); int count = entry.getValue().intValue();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
listener.propertyChange(ev); Beans.invokePropertyChange(listener, ev);
} }
} }
} }
// Note that we need to reinitialize global handles when // Note that we need to reinitialize global handles when
// they are first referenced. // they are first referenced.
synchronized (this) { synchronized (this) {
...@@ -1274,4 +1271,100 @@ public class LogManager { ...@@ -1274,4 +1271,100 @@ public class LogManager {
return loggingMXBean; return loggingMXBean;
} }
/**
* A class that provides access to the java.beans.PropertyChangeListener
* and java.beans.PropertyChangeEvent without creating a static dependency
* on java.beans. This class can be removed once the addPropertyChangeListener
* and removePropertyChangeListener methods are removed.
*/
private static class Beans {
private static final Class<?> propertyChangeListenerClass =
getClass("java.beans.PropertyChangeListener");
private static final Class<?> propertyChangeEventClass =
getClass("java.beans.PropertyChangeEvent");
private static final Method propertyChangeMethod =
getMethod(propertyChangeListenerClass,
"propertyChange",
propertyChangeEventClass);
private static final Constructor<?> propertyEventCtor =
getConstructor(propertyChangeEventClass,
Object.class,
String.class,
Object.class,
Object.class);
private static Class<?> getClass(String name) {
try {
return Class.forName(name, true, Beans.class.getClassLoader());
} catch (ClassNotFoundException e) {
return null;
}
}
private static Constructor<?> getConstructor(Class<?> c, Class<?>... types) {
try {
return (c == null) ? null : c.getDeclaredConstructor(types);
} catch (NoSuchMethodException x) {
throw new AssertionError(x);
}
}
private static Method getMethod(Class<?> c, String name, Class<?>... types) {
try {
return (c == null) ? null : c.getMethod(name, types);
} catch (NoSuchMethodException e) {
throw new AssertionError(e);
}
}
/**
* Returns {@code true} if java.beans is present.
*/
static boolean isBeansPresent() {
return propertyChangeListenerClass != null &&
propertyChangeEventClass != null;
}
/**
* Returns a new PropertyChangeEvent with the given source, property
* name, old and new values.
*/
static Object newPropertyChangeEvent(Object source, String prop,
Object oldValue, Object newValue)
{
try {
return propertyEventCtor.newInstance(source, prop, oldValue, newValue);
} catch (InstantiationException | IllegalAccessException x) {
throw new AssertionError(x);
} catch (InvocationTargetException x) {
Throwable cause = x.getCause();
if (cause instanceof Error)
throw (Error)cause;
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(x);
}
}
/**
* Invokes the given PropertyChangeListener's propertyChange method
* with the given event.
*/
static void invokePropertyChange(Object listener, Object ev) {
try {
propertyChangeMethod.invoke(listener, ev);
} catch (IllegalAccessException x) {
throw new AssertionError(x);
} catch (InvocationTargetException x) {
Throwable cause = x.getCause();
if (cause instanceof Error)
throw (Error)cause;
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(x);
}
}
}
} }
...@@ -174,7 +174,8 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider { ...@@ -174,7 +174,8 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider {
* <p>{@code style} gives the style of the string representation. It is one * <p>{@code style} gives the style of the string representation. It is one
* of {@link Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}), * of {@link Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}),
* {@link Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT} * {@link Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT}
* ({@link Calendar#LONG LONG}), or {@link Calendar#LONG_STANDALONE}. * ({@link Calendar#LONG LONG}), {@link Calendar#LONG_STANDALONE},
* {@link Calendar#NARROW_FORMAT}, or {@link Calendar#NARROW_STANDALONE}.
* *
* <p>For example, the following call will return {@code "Sunday"}. * <p>For example, the following call will return {@code "Sunday"}.
* <pre> * <pre>
...@@ -195,8 +196,10 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider { ...@@ -195,8 +196,10 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider {
* the string representation style: one of {@link * the string representation style: one of {@link
* Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}), * Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}),
* {@link Calendar#SHORT_STANDALONE}, {@link * {@link Calendar#SHORT_STANDALONE}, {@link
* Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or * Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}),
* {@link Calendar#LONG_STANDALONE} * {@link Calendar#LONG_STANDALONE},
* {@link Calendar#NARROW_FORMAT},
* or {@link Calendar#NARROW_STANDALONE}
* @param locale * @param locale
* the desired locale * the desired locale
* @return the string representation of the {@code field value}, or {@code * @return the string representation of the {@code field value}, or {@code
...@@ -226,8 +229,11 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider { ...@@ -226,8 +229,11 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider {
* <p>{@code style} gives the style of the string representation. It must be * <p>{@code style} gives the style of the string representation. It must be
* one of {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT} ({@link * one of {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT} ({@link
* Calendar#SHORT SHORT}), {@link Calendar#SHORT_STANDALONE}, {@link * Calendar#SHORT SHORT}), {@link Calendar#SHORT_STANDALONE}, {@link
* Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or {@link * Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), {@link
* Calendar#LONG_STANDALONE}. * Calendar#LONG_STANDALONE}, {@link Calendar#NARROW_FORMAT}, or
* {@link Calendar#NARROW_STANDALONE}. Note that narrow names may
* not be unique due to use of single characters, such as "S" for Sunday
* and Saturday, and that no narrow names are included in that case.
* *
* <p>For example, the following call will return a {@code Map} containing * <p>For example, the following call will return a {@code Map} containing
* {@code "January"} to {@link Calendar#JANUARY}, {@code "Jan"} to {@link * {@code "January"} to {@link Calendar#JANUARY}, {@code "Jan"} to {@link
...@@ -247,8 +253,9 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider { ...@@ -247,8 +253,9 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider {
* {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT} * {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT}
* ({@link Calendar#SHORT SHORT}), {@link * ({@link Calendar#SHORT SHORT}), {@link
* Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT} * Calendar#SHORT_STANDALONE}, {@link Calendar#LONG_FORMAT}
* ({@link Calendar#LONG LONG}), or {@link * ({@link Calendar#LONG LONG}), {@link Calendar#LONG_STANDALONE},
* Calendar#LONG_STANDALONE}. * {@link Calendar#NARROW_FORMAT},
* or {@link Calendar#NARROW_STANDALONE}
* @param locale * @param locale
* the desired locale * the desired locale
* @return a {@code Map} containing all display names of {@code field} in * @return a {@code Map} containing all display names of {@code field} in
......
/* /*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -77,4 +77,34 @@ public abstract class TimeZoneNameProvider extends LocaleServiceProvider { ...@@ -77,4 +77,34 @@ public abstract class TimeZoneNameProvider extends LocaleServiceProvider {
* @see java.util.TimeZone#getDisplayName(boolean, int, java.util.Locale) * @see java.util.TimeZone#getDisplayName(boolean, int, java.util.Locale)
*/ */
public abstract String getDisplayName(String ID, boolean daylight, int style, Locale locale); public abstract String getDisplayName(String ID, boolean daylight, int style, Locale locale);
/**
* Returns a generic name for the given time zone {@code ID} that's suitable
* for presentation to the user in the specified {@code locale}. Generic
* time zone names are neutral from standard time and daylight saving
* time. For example, "PT" is the short generic name of time zone ID {@code
* America/Los_Angeles}, while its short standard time and daylight saving
* time names are "PST" and "PDT", respectively. Refer to
* {@link #getDisplayName(String, boolean, int, Locale) getDisplayName}
* for valid time zone IDs.
*
* <p>The default implementation of this method returns {@code null}.
*
* @param ID a time zone ID string
* @param style either {@link java.util.TimeZone#LONG TimeZone.LONG} or
* {@link java.util.TimeZone#SHORT TimeZone.SHORT}
* @param locale the desired locale
* @return the human-readable generic name of the given time zone in the
* given locale, or {@code null} if it's not available.
* @exception IllegalArgumentException if <code>style</code> is invalid,
* or <code>locale</code> isn't one of the locales returned from
* {@link LocaleServiceProvider#getAvailableLocales()
* getAvailableLocales()}.
* @exception NullPointerException if <code>ID</code> or <code>locale</code>
* is {@code null}
* @since 1.8
*/
public String getGenericDisplayName(String ID, int style, Locale locale) {
return null;
}
} }
/* /*
* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -786,7 +786,7 @@ public class InputContext extends java.awt.im.InputContext ...@@ -786,7 +786,7 @@ public class InputContext extends java.awt.im.InputContext
public void disableNativeIM() { public void disableNativeIM() {
InputMethod inputMethod = getInputMethod(); InputMethod inputMethod = getInputMethod();
if (inputMethod != null && inputMethod instanceof InputMethodAdapter) { if (inputMethod != null && inputMethod instanceof InputMethodAdapter) {
((InputMethodAdapter)inputMethod).disableInputMethod(); ((InputMethodAdapter)inputMethod).stopListening();
} }
} }
......
/* /*
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -79,7 +79,6 @@ public abstract class InputMethodAdapter implements InputMethod { ...@@ -79,7 +79,6 @@ public abstract class InputMethodAdapter implements InputMethod {
/** /**
* Informs the input method adapter not to listen to the native events. * Informs the input method adapter not to listen to the native events.
* This method is called when a Java input method is active.
*/ */
protected void stopListening() { protected void stopListening() {
// ignore - adapters can override if needed // ignore - adapters can override if needed
......
...@@ -137,6 +137,43 @@ class MessageHeader { ...@@ -137,6 +137,43 @@ class MessageHeader {
return null; return null;
} }
/**
* Removes bare Negotiate and Kerberos headers when an "NTLM ..."
* appears. All Performed on headers with key being k.
* @return true if there is a change
*/
public boolean filterNTLMResponses(String k) {
boolean found = false;
for (int i=0; i<nkeys; i++) {
if (k.equalsIgnoreCase(keys[i])
&& values[i] != null && values[i].length() > 5
&& values[i].substring(0, 5).equalsIgnoreCase("NTLM ")) {
found = true;
break;
}
}
if (found) {
int j = 0;
for (int i=0; i<nkeys; i++) {
if (k.equalsIgnoreCase(keys[i]) && (
"Negotiate".equalsIgnoreCase(values[i]) ||
"Kerberos".equalsIgnoreCase(values[i]))) {
continue;
}
if (i != j) {
keys[j] = keys[i];
values[j] = values[i];
}
j++;
}
if (j != nkeys) {
nkeys = j;
return true;
}
}
return false;
}
class HeaderIterator implements Iterator<String> { class HeaderIterator implements Iterator<String> {
int index = 0; int index = 0;
int next = -1; int next = -1;
......
...@@ -1326,6 +1326,16 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -1326,6 +1326,16 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
if (logger.isLoggable(PlatformLogger.FINE)) { if (logger.isLoggable(PlatformLogger.FINE)) {
logger.fine(responses.toString()); logger.fine(responses.toString());
} }
boolean b1 = responses.filterNTLMResponses("WWW-Authenticate");
boolean b2 = responses.filterNTLMResponses("Proxy-Authenticate");
if (b1 || b2) {
if (logger.isLoggable(PlatformLogger.FINE)) {
logger.fine(">>>> Headers are filtered");
logger.fine(responses.toString());
}
}
inputStream = http.getInputStream(); inputStream = http.getInputStream();
respCode = getResponseCode(); respCode = getResponseCode();
...@@ -1784,6 +1794,13 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -1784,6 +1794,13 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
logger.fine(responses.toString()); logger.fine(responses.toString());
} }
if (responses.filterNTLMResponses("Proxy-Authenticate")) {
if (logger.isLoggable(PlatformLogger.FINE)) {
logger.fine(">>>> Headers are filtered");
logger.fine(responses.toString());
}
}
statusLine = responses.getValue(0); statusLine = responses.getValue(0);
StringTokenizer st = new StringTokenizer(statusLine); StringTokenizer st = new StringTokenizer(statusLine);
st.nextToken(); st.nextToken();
......
...@@ -102,11 +102,7 @@ public class ThreadPool { ...@@ -102,11 +102,7 @@ public class ThreadPool {
if (threadFactory == null) if (threadFactory == null)
threadFactory = defaultThreadFactory; threadFactory = defaultThreadFactory;
// create thread pool // create thread pool
ExecutorService executor = ExecutorService executor = Executors.newCachedThreadPool(threadFactory);
new ThreadPoolExecutor(0, Integer.MAX_VALUE,
Long.MAX_VALUE, TimeUnit.MILLISECONDS,
new SynchronousQueue<Runnable>(),
threadFactory);
return new ThreadPool(executor, false, initialSize); return new ThreadPool(executor, false, initialSize);
} }
......
...@@ -37,7 +37,7 @@ import sun.reflect.Reflection; ...@@ -37,7 +37,7 @@ import sun.reflect.Reflection;
import sun.misc.JavaLangAccess; import sun.misc.JavaLangAccess;
public final class AnnotationSupport { public final class AnnotationSupport {
private static JavaLangAccess javaLangAccess = sun.misc.SharedSecrets.getJavaLangAccess(); private static final JavaLangAccess javaLangAccess = sun.misc.SharedSecrets.getJavaLangAccess();
/** /**
* Finds and returns _one_ annotation of the type indicated by * Finds and returns _one_ annotation of the type indicated by
...@@ -104,7 +104,7 @@ public final class AnnotationSupport { ...@@ -104,7 +104,7 @@ public final class AnnotationSupport {
/** /**
* Unpacks the {@code annotationMap} parameter into an array of * Unpacks the {@code annotationMap} parameter into an array of
* {@code Annotation}s. This method will unpack all repeating * {@code Annotation}s. This method will unpack all repeating
* annotaions containers (once). An annotation type is marked as a * annotations containers (once). An annotation type is marked as a
* container by meta-annotating it the with the {@code * container by meta-annotating it the with the {@code
* ContainerFor} annotation. * ContainerFor} annotation.
* *
...@@ -175,7 +175,6 @@ public final class AnnotationSupport { ...@@ -175,7 +175,6 @@ public final class AnnotationSupport {
IllegalArgumentException | // parameters doesn't match IllegalArgumentException | // parameters doesn't match
InvocationTargetException | // the value method threw an exception InvocationTargetException | // the value method threw an exception
ClassCastException e) { // well, a cast failed ... ClassCastException e) { // well, a cast failed ...
e.getCause().printStackTrace();
throw new InvalidContainerAnnotationError(containerInstance + " is an invalid container for repeating annotations", throw new InvalidContainerAnnotationError(containerInstance + " is an invalid container for repeating annotations",
e, e,
containerInstance, containerInstance,
......
...@@ -40,10 +40,7 @@ import sun.security.krb5.EncryptionKey; ...@@ -40,10 +40,7 @@ import sun.security.krb5.EncryptionKey;
import sun.security.krb5.KrbException; import sun.security.krb5.KrbException;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Set;
import sun.security.krb5.KerberosSecrets; import sun.security.krb5.KerberosSecrets;
import sun.security.krb5.PrincipalName; import sun.security.krb5.PrincipalName;
/** /**
...@@ -189,18 +186,6 @@ public class Krb5Util { ...@@ -189,18 +186,6 @@ public class Krb5Util {
return subject; return subject;
} }
// A special KerberosKey, used as keys read from a KeyTab object.
// Each time new keys are read from KeyTab objects in the private
// credentials set, old ones are removed and new ones added.
public static class KeysFromKeyTab extends KerberosKey {
private static final long serialVersionUID = 8238092170252746927L;
public KeysFromKeyTab(KerberosKey key) {
super(key.getPrincipal(), key.getEncoded(),
key.getKeyType(), key.getVersionNumber());
}
}
/** /**
* Credentials of a service, the private secret to authenticate its * Credentials of a service, the private secret to authenticate its
* identity, which can be: * identity, which can be:
...@@ -239,7 +224,7 @@ public class Krb5Util { ...@@ -239,7 +224,7 @@ public class Krb5Util {
// Compatibility with old behavior: even when there is no // Compatibility with old behavior: even when there is no
// KerberosPrincipal, we can find one from KerberosKeys // KerberosPrincipal, we can find one from KerberosKeys
List<KerberosKey> keys = SubjectComber.findMany( List<KerberosKey> keys = SubjectComber.findMany(
subj, null, null, KerberosKey.class); subj, serverPrincipal, null, KerberosKey.class);
if (!keys.isEmpty()) { if (!keys.isEmpty()) {
sc.kp = keys.get(0).getPrincipal(); sc.kp = keys.get(0).getPrincipal();
serverPrincipal = sc.kp.getName(); serverPrincipal = sc.kp.getName();
...@@ -255,9 +240,9 @@ public class Krb5Util { ...@@ -255,9 +240,9 @@ public class Krb5Util {
subj, null, null, KeyTab.class); subj, null, null, KeyTab.class);
sc.kk = SubjectComber.findMany( sc.kk = SubjectComber.findMany(
subj, serverPrincipal, null, KerberosKey.class); subj, serverPrincipal, null, KerberosKey.class);
sc.tgt = SubjectComber.find(subj, null, null, KerberosTicket.class); sc.tgt = SubjectComber.find(
subj, null, serverPrincipal, KerberosTicket.class);
if (sc.ktabs.isEmpty() && sc.kk.isEmpty()) { if (sc.ktabs.isEmpty() && sc.kk.isEmpty() && sc.tgt == null) {
return null; return null;
} }
return sc; return sc;
...@@ -268,37 +253,16 @@ public class Krb5Util { ...@@ -268,37 +253,16 @@ public class Krb5Util {
} }
public KerberosKey[] getKKeys() { public KerberosKey[] getKKeys() {
if (ktabs.isEmpty()) { List<KerberosKey> keys = new ArrayList<>();
return kk.toArray(new KerberosKey[kk.size()]); for (KerberosKey k: kk) {
} else { keys.add(k);
List<KerberosKey> keys = new ArrayList<>(); }
for (KeyTab ktab: ktabs) { for (KeyTab ktab: ktabs) {
for (KerberosKey k: ktab.getKeys(kp)) { for (KerberosKey k: ktab.getKeys(kp)) {
keys.add(k); keys.add(k);
}
}
// Compatibility: also add keys to privCredSet. Remove old
// ones first, only remove those from keytab.
if (!subj.isReadOnly()) {
Set<Object> pcs = subj.getPrivateCredentials();
synchronized (pcs) {
Iterator<Object> iterator = pcs.iterator();
while (iterator.hasNext()) {
Object obj = iterator.next();
if (obj instanceof KeysFromKeyTab) {
KerberosKey key = (KerberosKey)obj;
if (Objects.equals(key.getPrincipal(), kp)) {
iterator.remove();
}
}
}
}
for (KerberosKey key: keys) {
subj.getPrivateCredentials().add(new KeysFromKeyTab(key));
}
} }
return keys.toArray(new KerberosKey[keys.size()]);
} }
return keys.toArray(new KerberosKey[keys.size()]);
} }
public EncryptionKey[] getEKeys() { public EncryptionKey[] getEKeys() {
......
...@@ -43,6 +43,7 @@ import java.util.List; ...@@ -43,6 +43,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static sun.security.provider.certpath.OCSPResponse.*; import static sun.security.provider.certpath.OCSPResponse.*;
import sun.security.action.GetIntegerAction;
import sun.security.util.Debug; import sun.security.util.Debug;
import sun.security.util.ObjectIdentifier; import sun.security.util.ObjectIdentifier;
import sun.security.x509.AccessDescription; import sun.security.x509.AccessDescription;
...@@ -69,7 +70,31 @@ public final class OCSP { ...@@ -69,7 +70,31 @@ public final class OCSP {
private static final Debug debug = Debug.getInstance("certpath"); private static final Debug debug = Debug.getInstance("certpath");
private static final int CONNECT_TIMEOUT = 15000; // 15 seconds private static final int DEFAULT_CONNECT_TIMEOUT = 15000;
/**
* Integer value indicating the timeout length, in seconds, to be
* used for the OCSP check. A timeout of zero is interpreted as
* an infinite timeout.
*/
private static final int CONNECT_TIMEOUT = initializeTimeout();
/**
* Initialize the timeout length by getting the OCSP timeout
* system property. If the property has not been set, or if its
* value is negative, set the timeout length to the default.
*/
private static int initializeTimeout() {
int tmp = java.security.AccessController.doPrivileged(
new GetIntegerAction("com.sun.security.ocsp.timeout",
DEFAULT_CONNECT_TIMEOUT));
if (tmp < 0) {
tmp = DEFAULT_CONNECT_TIMEOUT;
}
// Convert to milliseconds, as the system property will be
// specified in seconds
return tmp * 1000;
}
private OCSP() {} private OCSP() {}
......
...@@ -50,6 +50,20 @@ public class FormatData extends ListResourceBundle { ...@@ -50,6 +50,20 @@ public class FormatData extends ListResourceBundle {
* Overrides ListResourceBundle * Overrides ListResourceBundle
*/ */
protected final Object[][] getContents() { protected final Object[][] getContents() {
final String[] buddhistEras = new String[] { // Thai Buddhist calendar era strings
"BC", // BC
"B.E." // Buddhist Era
};
// Japanese imperial calendar era abbreviations
final String[] japaneseEraAbbrs = new String[] {
"",
"M",
"T",
"S",
"H",
};
return new Object[][] { return new Object[][] {
{ "MonthNames", { "MonthNames",
new String[] { new String[] {
...@@ -107,29 +121,49 @@ public class FormatData extends ListResourceBundle { ...@@ -107,29 +121,49 @@ public class FormatData extends ListResourceBundle {
"Sat" // abb Saturday "Sat" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"S",
"M",
"T",
"W",
"T",
"F",
"S",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"AM", // am marker "AM", // am marker
"PM" // pm marker "PM" // pm marker
} }
}, },
{ "narrow.AmPmMarkers",
new String[] {
"a", // am marker
"p" // pm marker
}
},
{ "Eras", { "Eras",
new String[] { // era strings for GregorianCalendar new String[] { // era strings for GregorianCalendar
"BC", "BC",
"AD" "AD"
} }
}, },
{ "buddhist.Eras", { "narrow.Eras",
new String[] { // Thai Buddhist calendar era strings new String[] {
"BC", // BC "B",
"B.E." // Buddhist Era "A",
} }
}, },
{ "buddhist.Eras",
buddhistEras
},
{ "buddhist.short.Eras", { "buddhist.short.Eras",
new String[] { // Thai Buddhist calendar era strings buddhistEras
"BC", // BC },
"B.E." // Buddhist Era { "buddhist.narrow.Eras",
} buddhistEras
}, },
{ "japanese.Eras", { "japanese.Eras",
new String[] { // Japanese imperial calendar era strings new String[] { // Japanese imperial calendar era strings
...@@ -141,13 +175,10 @@ public class FormatData extends ListResourceBundle { ...@@ -141,13 +175,10 @@ public class FormatData extends ListResourceBundle {
} }
}, },
{ "japanese.short.Eras", { "japanese.short.Eras",
new String[] { // Japanese imperial calendar era abbreviations japaneseEraAbbrs
"", },
"M", { "japanese.narrow.Eras",
"T", japaneseEraAbbrs
"S",
"H",
}
}, },
{ "japanese.FirstYear", { "japanese.FirstYear",
new String[] { // Japanese imperial calendar year name new String[] { // Japanese imperial calendar year name
......
...@@ -107,6 +107,17 @@ public class FormatData_ar extends ListResourceBundle { ...@@ -107,6 +107,17 @@ public class FormatData_ar extends ListResourceBundle {
"\u0633" // abb Saturday "\u0633" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u062d",
"\u0646",
"\u062b",
"\u0631",
"\u062e",
"\u062c",
"\u0633",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"\u0635", // am marker "\u0635", // am marker
......
...@@ -85,6 +85,23 @@ public class FormatData_be extends ListResourceBundle { ...@@ -85,6 +85,23 @@ public class FormatData_be extends ListResourceBundle {
"" // abb month 13 if applicable "" // abb month 13 if applicable
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"\u0441",
"\u043b",
"\u0441",
"\u043a",
"\u043c",
"\u0447",
"\u043b",
"\u0436",
"\u0432",
"\u043a",
"\u043b",
"\u0441",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"\u043d\u044f\u0434\u0437\u0435\u043b\u044f", // Sunday "\u043d\u044f\u0434\u0437\u0435\u043b\u044f", // Sunday
...@@ -107,6 +124,17 @@ public class FormatData_be extends ListResourceBundle { ...@@ -107,6 +124,17 @@ public class FormatData_be extends ListResourceBundle {
"\u0441\u0431" // abb Saturday "\u0441\u0431" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u043d",
"\u043f",
"\u0430",
"\u0441",
"\u0447",
"\u043f",
"\u0441",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"\u0434\u0430 \u043d.\u0435.", "\u0434\u0430 \u043d.\u0435.",
......
...@@ -107,6 +107,17 @@ public class FormatData_bg extends ListResourceBundle { ...@@ -107,6 +107,17 @@ public class FormatData_bg extends ListResourceBundle {
"\u0421\u0431" // abb Saturday "\u0421\u0431" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u043d",
"\u043f",
"\u0432",
"\u0441",
"\u0447",
"\u043f",
"\u0441",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"\u043f\u0440.\u043d.\u0435.", "\u043f\u0440.\u043d.\u0435.",
......
...@@ -119,6 +119,23 @@ public class FormatData_ca extends ListResourceBundle { ...@@ -119,6 +119,23 @@ public class FormatData_ca extends ListResourceBundle {
"" // abb month 13 if applicable "" // abb month 13 if applicable
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"g",
"f",
"m",
"a",
"m",
"j",
"j",
"a",
"s",
"o",
"n",
"d",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"diumenge", // Sunday "diumenge", // Sunday
...@@ -141,6 +158,28 @@ public class FormatData_ca extends ListResourceBundle { ...@@ -141,6 +158,28 @@ public class FormatData_ca extends ListResourceBundle {
"ds." // abb Saturday "ds." // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"G",
"L", // Note: contributed item in CDLR
"T",
"C",
"J",
"V",
"S",
}
},
{ "standalone.DayNarrows",
new String[] {
"g",
"l",
"t",
"c",
"j",
"v",
"s",
}
},
{ "NumberElements", { "NumberElements",
new String[] { new String[] {
",", // decimal separator ",", // decimal separator
......
...@@ -141,6 +141,17 @@ public class FormatData_cs extends ListResourceBundle { ...@@ -141,6 +141,17 @@ public class FormatData_cs extends ListResourceBundle {
"So" // abb Saturday "So" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"N",
"P",
"\u00da",
"S",
"\u010c",
"P",
"S",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"dop.", // am marker "dop.", // am marker
......
...@@ -124,6 +124,17 @@ public class FormatData_da extends ListResourceBundle { ...@@ -124,6 +124,17 @@ public class FormatData_da extends ListResourceBundle {
"l\u00f8" // abb Saturday "l\u00f8" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"S",
"M",
"T",
"O",
"T",
"F",
"L",
}
},
{ "NumberElements", { "NumberElements",
new String[] { new String[] {
",", // decimal separator ",", // decimal separator
......
...@@ -124,6 +124,17 @@ public class FormatData_de extends ListResourceBundle { ...@@ -124,6 +124,17 @@ public class FormatData_de extends ListResourceBundle {
"Sa" // abb Saturday "Sa" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"S",
"M",
"D",
"M",
"D",
"F",
"S",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"v. Chr.", "v. Chr.",
......
...@@ -124,6 +124,17 @@ public class FormatData_el extends ListResourceBundle { ...@@ -124,6 +124,17 @@ public class FormatData_el extends ListResourceBundle {
"\u03a3\u03b1\u03b2" // abb Saturday "\u03a3\u03b1\u03b2" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u039a",
"\u0394",
"\u03a4",
"\u03a4",
"\u03a0",
"\u03a0",
"\u03a3",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"\u03c0\u03bc", // am marker "\u03c0\u03bc", // am marker
......
...@@ -104,6 +104,17 @@ public class FormatData_es extends ListResourceBundle { ...@@ -104,6 +104,17 @@ public class FormatData_es extends ListResourceBundle {
"s\u00e1b" // abb Saturday "s\u00e1b" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"D",
"L",
"M",
"X",
"J",
"V",
"S",
}
},
{ "NumberPatterns", { "NumberPatterns",
new String[] { new String[] {
"#,##0.###;-#,##0.###", // decimal pattern "#,##0.###;-#,##0.###", // decimal pattern
......
...@@ -104,6 +104,17 @@ public class FormatData_et extends ListResourceBundle { ...@@ -104,6 +104,17 @@ public class FormatData_et extends ListResourceBundle {
"L" // abb Saturday "L" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"P",
"E",
"T",
"K",
"N",
"R",
"L",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"e.m.a.", "e.m.a.",
......
...@@ -116,6 +116,23 @@ public class FormatData_fi extends ListResourceBundle { ...@@ -116,6 +116,23 @@ public class FormatData_fi extends ListResourceBundle {
"" // abb month 13 if applicable "" // abb month 13 if applicable
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"T",
"H",
"M",
"H",
"T",
"K",
"H",
"E",
"S",
"L",
"M",
"J",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"sunnuntai", // Sunday "sunnuntai", // Sunday
...@@ -138,6 +155,28 @@ public class FormatData_fi extends ListResourceBundle { ...@@ -138,6 +155,28 @@ public class FormatData_fi extends ListResourceBundle {
"la" // abb Saturday "la" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"S",
"M",
"T",
"K",
"T",
"P",
"L",
}
},
{ "standalone.DayNarrows",
new String[] {
"S",
"M",
"T",
"K",
"T",
"P",
"L",
}
},
{ "NumberElements", { "NumberElements",
new String[] { new String[] {
",", // decimal separator ",", // decimal separator
...@@ -181,6 +220,12 @@ public class FormatData_fi extends ListResourceBundle { ...@@ -181,6 +220,12 @@ public class FormatData_fi extends ListResourceBundle {
"ip." // pm marker "ip." // pm marker
} }
}, },
{ "narrow.AmPmMarkers",
new String[] {
"ap.",
"ip.",
}
},
}; };
} }
} }
...@@ -104,6 +104,17 @@ public class FormatData_fr extends ListResourceBundle { ...@@ -104,6 +104,17 @@ public class FormatData_fr extends ListResourceBundle {
"sam." // abb Saturday "sam." // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"D",
"L",
"M",
"M",
"J",
"V",
"S",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"BC", "BC",
......
...@@ -99,6 +99,17 @@ public class FormatData_hi_IN extends ListResourceBundle { ...@@ -99,6 +99,17 @@ public class FormatData_hi_IN extends ListResourceBundle {
"\u0936\u0928\u093f" // abb Saturday "\u0936\u0928\u093f" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u0930",
"\u0938\u094b",
"\u092e\u0902",
"\u092c\u0941",
"\u0917\u0941",
"\u0936\u0941",
"\u0936",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"\u092a\u0942\u0930\u094d\u0935\u093e\u0939\u094d\u0928", // am marker "\u092a\u0942\u0930\u094d\u0935\u093e\u0939\u094d\u0928", // am marker
......
...@@ -116,6 +116,23 @@ public class FormatData_hr extends ListResourceBundle { ...@@ -116,6 +116,23 @@ public class FormatData_hr extends ListResourceBundle {
"" // abb month 13 if applicable "" // abb month 13 if applicable
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"1.",
"2.",
"3.",
"4.",
"5.",
"6.",
"7.",
"8.",
"9.",
"10.",
"11.",
"12.",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"nedjelja", // Sunday "nedjelja", // Sunday
...@@ -138,6 +155,28 @@ public class FormatData_hr extends ListResourceBundle { ...@@ -138,6 +155,28 @@ public class FormatData_hr extends ListResourceBundle {
"sub" // abb Saturday "sub" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"N",
"P",
"U",
"S",
"\u010c",
"P",
"S",
}
},
{ "standalone.DayNarrows",
new String[] {
"n",
"p",
"u",
"s",
"\u010d",
"p",
"s",
}
},
{ "NumberElements", { "NumberElements",
new String[] { new String[] {
",", // decimal separator ",", // decimal separator
......
...@@ -104,6 +104,17 @@ public class FormatData_hu extends ListResourceBundle { ...@@ -104,6 +104,17 @@ public class FormatData_hu extends ListResourceBundle {
"Szo" // abb Saturday "Szo" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"V",
"H",
"K",
"Sz",
"Cs",
"P",
"Sz",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"DE", // am marker "DE", // am marker
......
...@@ -82,6 +82,23 @@ public class FormatData_is extends ListResourceBundle { ...@@ -82,6 +82,23 @@ public class FormatData_is extends ListResourceBundle {
"" // abb month 13 if applicable "" // abb month 13 if applicable
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"j",
"f",
"m",
"a",
"m",
"j",
"j",
"\u00e1",
"s",
"o",
"n",
"d",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"sunnudagur", // Sunday "sunnudagur", // Sunday
...@@ -104,6 +121,28 @@ public class FormatData_is extends ListResourceBundle { ...@@ -104,6 +121,28 @@ public class FormatData_is extends ListResourceBundle {
"lau." // abb Saturday "lau." // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"S",
"M",
"\u00de",
"M",
"F",
"F",
"L",
}
},
{ "standalone.DayNarrows",
new String[] {
"s",
"m",
"\u00fe",
"m",
"f",
"f",
"l",
}
},
{ "NumberElements", { "NumberElements",
new String[] { new String[] {
",", // decimal separator ",", // decimal separator
......
...@@ -121,6 +121,17 @@ public class FormatData_it extends ListResourceBundle { ...@@ -121,6 +121,17 @@ public class FormatData_it extends ListResourceBundle {
"sab" // abb Saturday "sab" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"D",
"L",
"M",
"M",
"G",
"V",
"S",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"BC", "BC",
......
...@@ -121,6 +121,28 @@ public class FormatData_iw extends ListResourceBundle { ...@@ -121,6 +121,28 @@ public class FormatData_iw extends ListResourceBundle {
"\u05e9" // abb Saturday "\u05e9" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u05d0",
"\u05d1",
"\u05d2",
"\u05d3",
"\u05d4",
"\u05d5",
"\u05e9",
}
},
{ "standalone.DayNarrows",
new String[] {
"\u05d0",
"\u05d1",
"\u05d2",
"\u05d3",
"\u05d4",
"\u05d5",
"\u05e9",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"\u05dc\u05e1\u05d4\"\u05e0", "\u05dc\u05e1\u05d4\"\u05e0",
......
...@@ -104,6 +104,17 @@ public class FormatData_ja extends ListResourceBundle { ...@@ -104,6 +104,17 @@ public class FormatData_ja extends ListResourceBundle {
"\u571f" // abb Saturday "\u571f" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u65e5",
"\u6708",
"\u706b",
"\u6c34",
"\u6728",
"\u91d1",
"\u571f",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"\u5348\u524d", // am marker "\u5348\u524d", // am marker
......
...@@ -104,6 +104,17 @@ public class FormatData_ko extends ListResourceBundle { ...@@ -104,6 +104,17 @@ public class FormatData_ko extends ListResourceBundle {
"\ud1a0" // abb Saturday "\ud1a0" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\uc77c",
"\uc6d4",
"\ud654",
"\uc218",
"\ubaa9",
"\uae08",
"\ud1a0",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"\uc624\uc804", // am marker "\uc624\uc804", // am marker
......
...@@ -99,6 +99,23 @@ public class FormatData_lt extends ListResourceBundle { ...@@ -99,6 +99,23 @@ public class FormatData_lt extends ListResourceBundle {
"" // abb month 13 if applicable "" // abb month 13 if applicable
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"S",
"V",
"K",
"B",
"G",
"B",
"L",
"R",
"R",
"S",
"L",
"G",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"Sekmadienis", // Sunday "Sekmadienis", // Sunday
...@@ -121,6 +138,28 @@ public class FormatData_lt extends ListResourceBundle { ...@@ -121,6 +138,28 @@ public class FormatData_lt extends ListResourceBundle {
"\u0160t" // abb Saturday "\u0160t" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"S",
"P",
"A",
"T",
"K",
"P",
"\u0160",
}
},
{ "standalone.DayNarrows",
new String[] {
"S",
"P",
"A",
"T",
"K",
"P",
"\u0160",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"pr.Kr.", "pr.Kr.",
......
...@@ -121,6 +121,17 @@ public class FormatData_lv extends ListResourceBundle { ...@@ -121,6 +121,17 @@ public class FormatData_lv extends ListResourceBundle {
"S" // abb Saturday "S" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"S",
"P",
"O",
"T",
"C",
"P",
"S",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"pm\u0113", "pm\u0113",
......
...@@ -104,6 +104,17 @@ public class FormatData_mk extends ListResourceBundle { ...@@ -104,6 +104,17 @@ public class FormatData_mk extends ListResourceBundle {
"\u0441\u0430\u0431." // abb Saturday "\u0441\u0430\u0431." // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u043d",
"\u043f",
"\u0432",
"\u0441",
"\u0447",
"\u043f",
"\u0441",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"\u043f\u0440.\u043d.\u0435.", "\u043f\u0440.\u043d.\u0435.",
......
...@@ -81,6 +81,23 @@ public class FormatData_ms extends ListResourceBundle { ...@@ -81,6 +81,23 @@ public class FormatData_ms extends ListResourceBundle {
"", "",
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"O",
"S",
"O",
"N",
"D",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"Ahad", "Ahad",
...@@ -103,6 +120,28 @@ public class FormatData_ms extends ListResourceBundle { ...@@ -103,6 +120,28 @@ public class FormatData_ms extends ListResourceBundle {
"Sab", "Sab",
} }
}, },
{ "DayNarrows",
new String[] {
"A",
"I",
"S",
"R",
"K",
"J",
"S",
}
},
{ "standalone.DayNarrows",
new String[] {
"A",
"I",
"S",
"R",
"K",
"J",
"S",
}
},
{ "Eras", { "Eras",
new String[] { new String[] {
"BCE", "BCE",
......
...@@ -103,6 +103,17 @@ public class FormatData_mt extends ListResourceBundle { ...@@ -103,6 +103,17 @@ public class FormatData_mt extends ListResourceBundle {
"Sib", "Sib",
} }
}, },
{ "DayNarrows",
new String[] {
"\u0126",
"T",
"T",
"E",
"\u0126",
"\u0120",
"S",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"QN", "QN",
......
...@@ -104,6 +104,17 @@ public class FormatData_nl extends ListResourceBundle { ...@@ -104,6 +104,17 @@ public class FormatData_nl extends ListResourceBundle {
"za" // abb Saturday "za" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"Z",
"M",
"D",
"W",
"D",
"V",
"Z",
}
},
{ "Eras", { "Eras",
new String[] { // era strings for GregorianCalendar new String[] { // era strings for GregorianCalendar
"v. Chr.", "v. Chr.",
......
...@@ -121,6 +121,17 @@ public class FormatData_pl extends ListResourceBundle { ...@@ -121,6 +121,17 @@ public class FormatData_pl extends ListResourceBundle {
"So" // abb Saturday "So" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"N",
"P",
"W",
"\u015a",
"C",
"P",
"S",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"p.n.e.", "p.n.e.",
......
...@@ -104,6 +104,17 @@ public class FormatData_pt extends ListResourceBundle { ...@@ -104,6 +104,17 @@ public class FormatData_pt extends ListResourceBundle {
"S\u00e1b" // abb Saturday "S\u00e1b" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"D",
"S",
"T",
"Q",
"Q",
"S",
"S",
}
},
{ "NumberElements", { "NumberElements",
new String[] { new String[] {
",", // decimal al separator ",", // decimal al separator
......
...@@ -82,6 +82,23 @@ public class FormatData_ro extends ListResourceBundle { ...@@ -82,6 +82,23 @@ public class FormatData_ro extends ListResourceBundle {
"" // abb month 13 if applicable "" // abb month 13 if applicable
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"I",
"F",
"M",
"A",
"M",
"I",
"I",
"A",
"S",
"O",
"N",
"D",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"duminic\u0103", // Sunday "duminic\u0103", // Sunday
...@@ -104,6 +121,29 @@ public class FormatData_ro extends ListResourceBundle { ...@@ -104,6 +121,29 @@ public class FormatData_ro extends ListResourceBundle {
"S" // abb Saturday "S" // abb Saturday
} }
}, },
// commented out DayNarrows because most names are contributed.
// { "DayNarrows",
// new String[] {
// "D",
// "",
// "",
// "",
// "",
// "",
// "",
// }
// },
{ "standalone.DayNarrows",
new String[] {
"D",
"L",
"M",
"M",
"J",
"V",
"S",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"d.C.", "d.C.",
......
...@@ -138,6 +138,28 @@ public class FormatData_ru extends ListResourceBundle { ...@@ -138,6 +138,28 @@ public class FormatData_ru extends ListResourceBundle {
"\u0421\u0431" // abb Saturday "\u0421\u0431" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u0412",
"\u041f\u043d",
"\u0412\u0442",
"\u0421",
"\u0427",
"\u041f",
"\u0421", // contributed item in CLDR
}
},
{ "standalone.DayNarrows",
new String[] {
"\u0412",
"\u041f",
"\u0412",
"\u0421",
"\u0427",
"\u041f",
"\u0421",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"\u0434\u043e \u043d.\u044d.", "\u0434\u043e \u043d.\u044d.",
......
...@@ -138,6 +138,17 @@ public class FormatData_sk extends ListResourceBundle { ...@@ -138,6 +138,17 @@ public class FormatData_sk extends ListResourceBundle {
"So" // abb Saturday "So" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"N",
"P",
"U",
"S",
"\u0160",
"P",
"S",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"pred n.l.", "pred n.l.",
......
...@@ -121,6 +121,17 @@ public class FormatData_sl extends ListResourceBundle { ...@@ -121,6 +121,17 @@ public class FormatData_sl extends ListResourceBundle {
"Sob" // abb Saturday "Sob" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"n",
"p",
"t",
"s",
"\u010d",
"p",
"s",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"pr.n.\u0161.", "pr.n.\u0161.",
......
...@@ -104,6 +104,17 @@ public class FormatData_sq extends ListResourceBundle { ...@@ -104,6 +104,17 @@ public class FormatData_sq extends ListResourceBundle {
"Sht" // abb Saturday "Sht" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"D",
"H",
"M",
"M",
"E",
"P",
"S",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"PD", // am marker "PD", // am marker
......
...@@ -103,12 +103,35 @@ public class FormatData_sr extends ListResourceBundle { ...@@ -103,12 +103,35 @@ public class FormatData_sr extends ListResourceBundle {
"\u0441\u0443\u0431", "\u0441\u0443\u0431",
} }
}, },
{ "DayNarrows",
new String[] {
"\u043d",
"\u043f",
"\u0443",
"\u0441",
"\u0447",
"\u043f",
"\u0441",
}
},
{ "Eras", { "Eras",
new String[] { new String[] {
"\u043f. \u043d. \u0435.", "\u043f. \u043d. \u0435.",
"\u043d. \u0435", "\u043d. \u0435",
} }
}, },
{ "short.Eras",
new String[] {
"\u043f. \u043d. \u0435.",
"\u043d. \u0435.",
}
},
{ "narrow.Eras",
new String[] {
"\u043f.\u043d.\u0435.",
"\u043d.\u0435.",
}
},
{ "NumberPatterns", { "NumberPatterns",
new String[] { new String[] {
"#,##0.###", "#,##0.###",
......
...@@ -82,6 +82,23 @@ public class FormatData_sv extends ListResourceBundle { ...@@ -82,6 +82,23 @@ public class FormatData_sv extends ListResourceBundle {
"" // abb month 13 if applicable "" // abb month 13 if applicable
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"s\u00f6ndag", // Sunday "s\u00f6ndag", // Sunday
...@@ -104,12 +121,46 @@ public class FormatData_sv extends ListResourceBundle { ...@@ -104,12 +121,46 @@ public class FormatData_sv extends ListResourceBundle {
"l\u00f6" // abb Saturday "l\u00f6" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"S",
"M",
"T",
"O",
"T",
"F",
"L",
}
},
{ "standalone.DayNarrows",
new String[] {
"S",
"M",
"T",
"O",
"T",
"F",
"L",
}
},
{ "narrow.Eras",
new String[] {
"f.Kr.",
"e.Kr.",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"fm", // am marker "fm", // am marker
"em" // pm marker "em" // pm marker
} }
}, },
{ "narrow.AmPmMarkers",
new String[] {
"f",
"e",
}
},
{ "NumberElements", { "NumberElements",
new String[] { new String[] {
",", // decimal separator ",", // decimal separator
......
...@@ -99,6 +99,23 @@ public class FormatData_th extends ListResourceBundle { ...@@ -99,6 +99,23 @@ public class FormatData_th extends ListResourceBundle {
"" // abb month 13 if applicable "" // abb month 13 if applicable
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"\u0e21.\u0e04.",
"\u0e01.\u0e1e.",
"\u0e21\u0e35.\u0e04.",
"\u0e40\u0e21.\u0e22.",
"\u0e1e.\u0e04.",
"\u0e21\u0e34.\u0e22.",
"\u0e01.\u0e04.",
"\u0e2a.\u0e04.",
"\u0e01.\u0e22.",
"\u0e15.\u0e04.",
"\u0e1e.\u0e22.",
"\u0e18.\u0e04.",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"\u0e27\u0e31\u0e19\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c", // Sunday "\u0e27\u0e31\u0e19\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c", // Sunday
...@@ -121,6 +138,17 @@ public class FormatData_th extends ListResourceBundle { ...@@ -121,6 +138,17 @@ public class FormatData_th extends ListResourceBundle {
"\u0e2a." // abb Saturday "\u0e2a." // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u0e2d",
"\u0e08",
"\u0e2d",
"\u0e1e",
"\u0e1e",
"\u0e28",
"\u0e2a",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"\u0e01\u0e48\u0e2d\u0e19\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07", // am marker "\u0e01\u0e48\u0e2d\u0e19\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07", // am marker
...@@ -145,6 +173,12 @@ public class FormatData_th extends ListResourceBundle { ...@@ -145,6 +173,12 @@ public class FormatData_th extends ListResourceBundle {
"\u0e04.\u0e28." "\u0e04.\u0e28."
} }
}, },
{ "narrow.Eras",
new String[] {
"\u0e01\u0e48\u0e2d\u0e19 \u0e04.\u0e28.",
"\u0e04.\u0e28.",
}
},
{ "buddhist.TimePatterns", { "buddhist.TimePatterns",
timePatterns timePatterns
}, },
......
...@@ -82,6 +82,23 @@ public class FormatData_tr extends ListResourceBundle { ...@@ -82,6 +82,23 @@ public class FormatData_tr extends ListResourceBundle {
"" // abb month 13 if applicable "" // abb month 13 if applicable
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"O",
"\u015e",
"M",
"N",
"M",
"H",
"T",
"A",
"E",
"E",
"K",
"A",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"Pazar", // Sunday "Pazar", // Sunday
...@@ -104,6 +121,17 @@ public class FormatData_tr extends ListResourceBundle { ...@@ -104,6 +121,17 @@ public class FormatData_tr extends ListResourceBundle {
"Cmt" // abb Saturday "Cmt" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"P",
"P",
"S",
"\u00c7",
"P",
"C",
"C",
}
},
{ "NumberPatterns", { "NumberPatterns",
new String[] { new String[] {
"#,##0.###;-#,##0.###", // decimal pattern "#,##0.###;-#,##0.###", // decimal pattern
......
...@@ -138,6 +138,17 @@ public class FormatData_uk extends ListResourceBundle { ...@@ -138,6 +138,17 @@ public class FormatData_uk extends ListResourceBundle {
"\u0441\u0431" // abb Saturday "\u0441\u0431" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u041d",
"\u041f",
"\u0412",
"\u0421",
"\u0427",
"\u041f",
"\u0421",
}
},
{ "Eras", { "Eras",
new String[] { // era strings new String[] { // era strings
"\u0434\u043e \u043d.\u0435.", "\u0434\u043e \u043d.\u0435.",
......
...@@ -106,6 +106,17 @@ public class FormatData_vi extends ListResourceBundle { ...@@ -106,6 +106,17 @@ public class FormatData_vi extends ListResourceBundle {
"Th 7" // abb Saturday "Th 7" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"CN",
"T2",
"T3",
"T4",
"T5",
"T6",
"T7",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"SA", // am marker "SA", // am marker
......
...@@ -82,6 +82,23 @@ public class FormatData_zh extends ListResourceBundle { ...@@ -82,6 +82,23 @@ public class FormatData_zh extends ListResourceBundle {
"" // abb month 13 if applicable "" // abb month 13 if applicable
} }
}, },
{ "standalone.MonthNarrows",
new String[] {
"1\u6708",
"2\u6708",
"3\u6708",
"4\u6708",
"5\u6708",
"6\u6708",
"7\u6708",
"8\u6708",
"9\u6708",
"10\u6708",
"11\u6708",
"12\u6708",
"",
}
},
{ "DayNames", { "DayNames",
new String[] { new String[] {
"\u661f\u671f\u65e5", // Sunday "\u661f\u671f\u65e5", // Sunday
...@@ -104,6 +121,17 @@ public class FormatData_zh extends ListResourceBundle { ...@@ -104,6 +121,17 @@ public class FormatData_zh extends ListResourceBundle {
"\u661f\u671f\u516d" // abb Saturday "\u661f\u671f\u516d" // abb Saturday
} }
}, },
{ "DayNarrows",
new String[] {
"\u65e5",
"\u4e00",
"\u4e8c",
"\u4e09",
"\u56db",
"\u4e94",
"\u516d",
}
},
{ "AmPmMarkers", { "AmPmMarkers",
new String[] { new String[] {
"\u4e0a\u5348", // am marker "\u4e0a\u5348", // am marker
......
...@@ -88,11 +88,6 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter { ...@@ -88,11 +88,6 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
return null; return null;
} }
@Override
public TimeZoneNameProvider getTimeZoneNameProvider() {
return null;
}
@Override @Override
public Locale[] getAvailableLocales() { public Locale[] getAvailableLocales() {
Set<String> all = createLanguageTagSet("All"); Set<String> all = createLanguageTagSet("All");
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
package sun.util.locale.provider; package sun.util.locale.provider;
import java.util.Calendar;
import static java.util.Calendar.*; import static java.util.Calendar.*;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
......
...@@ -52,7 +52,7 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av ...@@ -52,7 +52,7 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av
@Override @Override
public String getDisplayName(String calendarType, int field, int value, int style, Locale locale) { public String getDisplayName(String calendarType, int field, int value, int style, Locale locale) {
String name = null; String name = null;
String key = getKey(calendarType, field, style); String key = getResourceKey(calendarType, field, style);
if (key != null) { if (key != null) {
ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getDateFormatData(locale); ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getDateFormatData(locale);
if (rb.containsKey(key)) { if (rb.containsKey(key)) {
...@@ -64,9 +64,10 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av ...@@ -64,9 +64,10 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av
name = strings[value]; name = strings[value];
// If name is empty in standalone, try its `format' style. // If name is empty in standalone, try its `format' style.
if (name.length() == 0 if (name.length() == 0
&& (style == SHORT_STANDALONE || style == LONG_STANDALONE)) { && (style == SHORT_STANDALONE || style == LONG_STANDALONE
|| style == NARROW_STANDALONE)) {
name = getDisplayName(calendarType, field, value, name = getDisplayName(calendarType, field, value,
style == SHORT_STANDALONE ? SHORT_FORMAT : LONG_FORMAT, getBaseStyle(style),
locale); locale);
} }
} }
...@@ -75,15 +76,17 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av ...@@ -75,15 +76,17 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av
return name; return name;
} }
private static int[] REST_OF_STYLES = {
SHORT_STANDALONE, LONG_FORMAT, LONG_STANDALONE,
NARROW_FORMAT, NARROW_STANDALONE
};
@Override @Override
public Map<String, Integer> getDisplayNames(String calendarType, int field, int style, Locale locale) { public Map<String, Integer> getDisplayNames(String calendarType, int field, int style, Locale locale) {
Map<String, Integer> names; Map<String, Integer> names;
if (style == ALL_STYLES) { if (style == ALL_STYLES) {
names = getDisplayNamesImpl(calendarType, field, SHORT_FORMAT, locale); names = getDisplayNamesImpl(calendarType, field, SHORT_FORMAT, locale);
if (field != AM_PM) { for (int st : REST_OF_STYLES) {
for (int st : new int[] { SHORT_STANDALONE, LONG_FORMAT, LONG_STANDALONE }) { names.putAll(getDisplayNamesImpl(calendarType, field, st, locale));
names.putAll(getDisplayNamesImpl(calendarType, field, st, locale));
}
} }
} else { } else {
// specific style // specific style
...@@ -94,26 +97,28 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av ...@@ -94,26 +97,28 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av
private Map<String, Integer> getDisplayNamesImpl(String calendarType, int field, private Map<String, Integer> getDisplayNamesImpl(String calendarType, int field,
int style, Locale locale) { int style, Locale locale) {
String key = getKey(calendarType, field, style); String key = getResourceKey(calendarType, field, style);
Map<String, Integer> map = new TreeMap<>(LengthBasedComparator.INSTANCE); Map<String, Integer> map = new TreeMap<>(LengthBasedComparator.INSTANCE);
if (key != null) { if (key != null) {
ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getDateFormatData(locale); ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getDateFormatData(locale);
if (rb.containsKey(key)) { if (rb.containsKey(key)) {
String[] strings = rb.getStringArray(key); String[] strings = rb.getStringArray(key);
if (field == YEAR) { if (!hasDuplicates(strings)) {
if (strings.length > 0) { if (field == YEAR) {
map.put(strings[0], 1); if (strings.length > 0) {
} map.put(strings[0], 1);
} else { }
int base = (field == DAY_OF_WEEK) ? 1 : 0; } else {
for (int i = 0; i < strings.length; i++) { int base = (field == DAY_OF_WEEK) ? 1 : 0;
String name = strings[i]; for (int i = 0; i < strings.length; i++) {
// Ignore any empty string (some standalone month names String name = strings[i];
// are not defined) // Ignore any empty string (some standalone month names
if (name.length() == 0) { // are not defined)
continue; if (name.length() == 0) {
continue;
}
map.put(name, base + i);
} }
map.put(name, base + i);
} }
} }
} }
...@@ -121,6 +126,10 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av ...@@ -121,6 +126,10 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av
return map; return map;
} }
private int getBaseStyle(int style) {
return style & ~(SHORT_STANDALONE - SHORT_FORMAT);
}
/** /**
* Comparator implementation for TreeMap which iterates keys from longest * Comparator implementation for TreeMap which iterates keys from longest
* to shortest. * to shortest.
...@@ -180,55 +189,92 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av ...@@ -180,55 +189,92 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av
return langtags; return langtags;
} }
private int getIntData(String key, Locale locale) { private boolean hasDuplicates(String[] strings) {
ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getCalendarData(locale); int len = strings.length;
if (rb.containsKey(key)) { for (int i = 0; i < len - 1; i++) {
String firstday = rb.getString(key); String a = strings[i];
return Integer.parseInt(firstday); if (a != null) {
for (int j = i + 1; j < len; j++) {
if (a.equals(strings[j])) {
return true;
}
}
}
} }
// Note that the base bundle of CLDR doesn't have the Calendar week parameters. return false;
return 0;
} }
private String getKey(String type, int field, int style) { private String getResourceKey(String type, int field, int style) {
boolean standalone = (style & 0x8000) != 0; int baseStyle = getBaseStyle(style);
style &= ~0x8000; boolean isStandalone = (style != baseStyle);
if ("gregory".equals(type)) { if ("gregory".equals(type)) {
type = null; type = null;
} }
boolean isNarrow = (baseStyle == NARROW_FORMAT);
StringBuilder key = new StringBuilder(); StringBuilder key = new StringBuilder();
switch (field) { switch (field) {
case ERA: case ERA:
if (type != null) { if (type != null) {
key.append(type).append('.'); key.append(type).append('.');
} }
if (style == SHORT) { if (isNarrow) {
key.append("short."); key.append("narrow.");
} else {
// JRE and CLDR use different resource key conventions
// due to historical reasons. (JRE DateFormatSymbols.getEras returns
// abbreviations while other getShort*() return abbreviations.)
if (this.type == LocaleProviderAdapter.Type.JRE) {
if (baseStyle == SHORT) {
key.append("short.");
}
} else { // CLDR
if (baseStyle == LONG) {
key.append("long.");
}
}
} }
key.append("Eras"); key.append("Eras");
break; break;
case YEAR: case YEAR:
key.append(type).append(".FirstYear"); if (!isNarrow) {
key.append(type).append(".FirstYear");
}
break; break;
case MONTH: case MONTH:
if (standalone) { if (isStandalone) {
key.append("standalone."); key.append("standalone.");
} }
key.append(style == SHORT ? "MonthAbbreviations" : "MonthNames"); key.append("Month").append(toStyleName(baseStyle));
break; break;
case DAY_OF_WEEK: case DAY_OF_WEEK:
key.append(style == SHORT ? "DayAbbreviations" : "DayNames"); // support standalone narrow day names
if (isStandalone && isNarrow) {
key.append("standalone.");
}
key.append("Day").append(toStyleName(baseStyle));
break; break;
case AM_PM: case AM_PM:
if (isNarrow) {
key.append("narrow.");
}
key.append("AmPmMarkers"); key.append("AmPmMarkers");
break; break;
} }
return key.length() > 0 ? key.toString() : null; return key.length() > 0 ? key.toString() : null;
} }
private String toStyleName(int baseStyle) {
switch (baseStyle) {
case SHORT:
return "Abbreviations";
case NARROW_FORMAT:
return "Narrows";
}
return "Names";
}
} }
...@@ -46,7 +46,7 @@ import java.util.Locale; ...@@ -46,7 +46,7 @@ import java.util.Locale;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import sun.util.resources.OpenListResourceBundle; import sun.util.resources.TimeZoneNamesBundle;
/** /**
* Central accessor to locale-dependent resources. * Central accessor to locale-dependent resources.
...@@ -67,13 +67,13 @@ public class LocaleResources { ...@@ -67,13 +67,13 @@ public class LocaleResources {
this.locale = locale; this.locale = locale;
} }
public OpenListResourceBundle getTimeZoneNames() { public TimeZoneNamesBundle getTimeZoneNames() {
OpenListResourceBundle tznames = (OpenListResourceBundle) cache.get("TimeZoneNames"); TimeZoneNamesBundle tznames = (TimeZoneNamesBundle) cache.get("TimeZoneNames");
if (tznames == null) { if (tznames == null) {
tznames = adapter.getLocaleData().getTimeZoneNames(locale); tznames = adapter.getLocaleData().getTimeZoneNames(locale);
OpenListResourceBundle olrb = (OpenListResourceBundle) cache.putIfAbsent("TimeZoneNames", tznames); TimeZoneNamesBundle tznb = (TimeZoneNamesBundle) cache.putIfAbsent("TimeZoneNames", tznames);
if (olrb != null) { if (tznb != null) {
tznames = olrb; tznames = tznb;
} }
} }
return tznames; return tznames;
......
...@@ -604,5 +604,12 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter { ...@@ -604,5 +604,12 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
assert tznp != null; assert tznp != null;
return tznp.getDisplayName(ID, daylight, style, locale); return tznp.getDisplayName(ID, daylight, style, locale);
} }
@Override
public String getGenericDisplayName(String ID, int style, Locale locale) {
TimeZoneNameProvider tznp = getImpl(locale);
assert tznp != null;
return tznp.getGenericDisplayName(ID, style, locale);
}
} }
} }
...@@ -25,11 +25,14 @@ ...@@ -25,11 +25,14 @@
package sun.util.locale.provider; package sun.util.locale.provider;
import java.util.LinkedHashSet;
import java.util.Locale; import java.util.Locale;
import java.util.ResourceBundle; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.spi.TimeZoneNameProvider; import java.util.spi.TimeZoneNameProvider;
import sun.util.calendar.ZoneInfo;
import sun.util.resources.TimeZoneNamesBundle;
/** /**
* Concrete implementation of the * Concrete implementation of the
...@@ -96,21 +99,67 @@ public class TimeZoneNameProviderImpl extends TimeZoneNameProvider { ...@@ -96,21 +99,67 @@ public class TimeZoneNameProviderImpl extends TimeZoneNameProvider {
*/ */
@Override @Override
public String getDisplayName(String id, boolean daylight, int style, Locale locale) { public String getDisplayName(String id, boolean daylight, int style, Locale locale) {
String[] names = getDisplayNameArray(id, 5, locale);
if (names != null) {
int index = daylight ? 3 : 1;
if (style == TimeZone.SHORT) {
index++;
}
return names[index];
}
return null;
}
@Override
public String getGenericDisplayName(String id, int style, Locale locale) {
String[] names = getDisplayNameArray(id, 7, locale);
if (names != null && names.length >= 7) {
return names[(style == TimeZone.LONG) ? 5 : 6];
}
return null;
}
private String[] getDisplayNameArray(String id, int n, Locale locale) {
if (id == null || locale == null) { if (id == null || locale == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
LocaleProviderAdapter adapter = LocaleProviderAdapter.forType(type);
TimeZoneNamesBundle rb = adapter.getLocaleResources(locale).getTimeZoneNames();
return rb.containsKey(id) ? rb.getStringArray(id, n) : null;
}
/**
* Returns a String[][] as the DateFormatSymbols.getZoneStrings() value for
* the given locale. This method is package private.
*
* @param locale a Locale for time zone names
* @return an array of time zone names arrays
*/
String[][] getZoneStrings(Locale locale) {
LocaleProviderAdapter adapter = LocaleProviderAdapter.forType(type); LocaleProviderAdapter adapter = LocaleProviderAdapter.forType(type);
ResourceBundle rb = adapter.getLocaleResources(locale).getTimeZoneNames(); TimeZoneNamesBundle rb = adapter.getLocaleResources(locale).getTimeZoneNames();
if (rb.containsKey(id)) { Set<String> keyset = rb.keySet();
String[] names = rb.getStringArray(id); // Use a LinkedHashSet to preseve the order
int index = daylight ? 3 : 1; Set<String[]> value = new LinkedHashSet<>();
if (style == TimeZone.SHORT) { for (String key : keyset) {
index++; value.add(rb.getStringArray(key));
}
// Add aliases data for CLDR
if (type == LocaleProviderAdapter.Type.CLDR) {
// Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
Map<String, String> aliases = ZoneInfo.getAliasTable();
for (String alias : aliases.keySet()) {
if (!keyset.contains(alias)) {
String tzid = aliases.get(alias);
if (keyset.contains(tzid)) {
String[] val = rb.getStringArray(tzid);
val[0] = alias;
value.add(val);
}
} }
return names[index];
} }
}
return null; return value.toArray(new String[0][]);
} }
} }
...@@ -26,28 +26,28 @@ ...@@ -26,28 +26,28 @@
package sun.util.locale.provider; package sun.util.locale.provider;
import java.lang.ref.SoftReference; import java.lang.ref.SoftReference;
import java.util.Enumeration;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.spi.TimeZoneNameProvider; import java.util.spi.TimeZoneNameProvider;
import sun.util.calendar.ZoneInfo; import sun.util.calendar.ZoneInfo;
import sun.util.resources.OpenListResourceBundle; import sun.util.resources.OpenListResourceBundle;
import sun.util.resources.TimeZoneNamesBundle;
/** /**
* Utility class that deals with the localized time zone names * Utility class that deals with the localized time zone names
* *
* @author Naoto Sato * @author Naoto Sato
* @author Masayoshi Okutsu
*/ */
public final class TimeZoneNameUtility { public final class TimeZoneNameUtility {
/** /**
* cache to hold time zone resource bundles. Keyed by Locale * cache to hold time zone resource bundles. Keyed by Locale
*/ */
private static ConcurrentHashMap<Locale, SoftReference<OpenListResourceBundle>> cachedBundles = private static ConcurrentHashMap<Locale, SoftReference<TimeZoneNamesBundle>> cachedBundles =
new ConcurrentHashMap<>(); new ConcurrentHashMap<>();
/** /**
...@@ -73,15 +73,19 @@ public final class TimeZoneNameUtility { ...@@ -73,15 +73,19 @@ public final class TimeZoneNameUtility {
} }
private static String[][] loadZoneStrings(Locale locale) { private static String[][] loadZoneStrings(Locale locale) {
// If the provider is a TimeZoneNameProviderImpl, call its getZoneStrings
// in order to avoid per-ID retrieval.
LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(TimeZoneNameProvider.class, locale);
TimeZoneNameProvider provider = adapter.getTimeZoneNameProvider();
if (provider instanceof TimeZoneNameProviderImpl) {
return ((TimeZoneNameProviderImpl)provider).getZoneStrings(locale);
}
// Performs per-ID retrieval.
List<String[]> zones = new LinkedList<>(); List<String[]> zones = new LinkedList<>();
OpenListResourceBundle rb = getBundle(locale); OpenListResourceBundle rb = getBundle(locale);
Enumeration<String> keys = rb.getKeys(); for (String key : rb.keySet()) {
String[] names; String[] names = retrieveDisplayNamesImpl(key, locale);
while(keys.hasMoreElements()) {
String key = keys.nextElement();
names = retrieveDisplayNames(rb, key, locale);
if (names != null) { if (names != null) {
zones.add(names); zones.add(names);
} }
...@@ -95,24 +99,50 @@ public final class TimeZoneNameUtility { ...@@ -95,24 +99,50 @@ public final class TimeZoneNameUtility {
* Retrieve display names for a time zone ID. * Retrieve display names for a time zone ID.
*/ */
public static String[] retrieveDisplayNames(String id, Locale locale) { public static String[] retrieveDisplayNames(String id, Locale locale) {
OpenListResourceBundle rb = getBundle(locale);
return retrieveDisplayNames(rb, id, locale);
}
private static String[] retrieveDisplayNames(OpenListResourceBundle rb,
String id, Locale locale) {
if (id == null || locale == null) { if (id == null || locale == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
return retrieveDisplayNamesImpl(id, locale);
}
/**
* Retrieves a generic time zone display name for a time zone ID.
*
* @param id time zone ID
* @param style TimeZone.LONG or TimeZone.SHORT
* @param locale desired Locale
* @return the requested generic time zone display name, or null if not found.
*/
public static String retrieveGenericDisplayName(String id, int style, Locale locale) {
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class);
return pool.getLocalizedObject(TimeZoneNameGetter.INSTANCE, locale, "generic", style, id);
}
/**
* Retrieves a standard or daylight-saving time name for the given time zone ID.
*
* @param id time zone ID
* @param daylight true for a daylight saving time name, or false for a standard time name
* @param style TimeZone.LONG or TimeZone.SHORT
* @param locale desired Locale
* @return the requested time zone name, or null if not found.
*/
public static String retrieveDisplayName(String id, boolean daylight, int style, Locale locale) {
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class);
return pool.getLocalizedObject(TimeZoneNameGetter.INSTANCE, locale, daylight ? "dst" : "std", style, id);
}
private static String[] retrieveDisplayNamesImpl(String id, Locale locale) {
LocaleServiceProviderPool pool = LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class); LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class);
return pool.getLocalizedObject(TimeZoneNameGetter.INSTANCE, locale, id); return pool.getLocalizedObject(TimeZoneNameArrayGetter.INSTANCE, locale, id);
} }
private static OpenListResourceBundle getBundle(Locale locale) { private static TimeZoneNamesBundle getBundle(Locale locale) {
OpenListResourceBundle rb; TimeZoneNamesBundle rb;
SoftReference<OpenListResourceBundle> data = cachedBundles.get(locale); SoftReference<TimeZoneNamesBundle> data = cachedBundles.get(locale);
if (data == null || ((rb = data.get()) == null)) { if (data == null || ((rb = data.get()) == null)) {
rb = LocaleProviderAdapter.forJRE().getLocaleData().getTimeZoneNames(locale); rb = LocaleProviderAdapter.forJRE().getLocaleData().getTimeZoneNames(locale);
...@@ -127,19 +157,18 @@ public final class TimeZoneNameUtility { ...@@ -127,19 +157,18 @@ public final class TimeZoneNameUtility {
* Obtains a localized time zone strings from a TimeZoneNameProvider * Obtains a localized time zone strings from a TimeZoneNameProvider
* implementation. * implementation.
*/ */
private static class TimeZoneNameGetter private static class TimeZoneNameArrayGetter
implements LocaleServiceProviderPool.LocalizedObjectGetter<TimeZoneNameProvider, implements LocaleServiceProviderPool.LocalizedObjectGetter<TimeZoneNameProvider,
String[]>{ String[]>{
private static final TimeZoneNameGetter INSTANCE = private static final TimeZoneNameArrayGetter INSTANCE =
new TimeZoneNameGetter(); new TimeZoneNameArrayGetter();
@Override @Override
public String[] getObject(TimeZoneNameProvider timeZoneNameProvider, public String[] getObject(TimeZoneNameProvider timeZoneNameProvider,
Locale locale, Locale locale,
String requestID, String requestID,
Object... params) { Object... params) {
assert params.length == 0; assert params.length == 0;
String queryID = requestID;
// First, try to get names with the request ID // First, try to get names with the request ID
String[] names = buildZoneStrings(timeZoneNameProvider, locale, requestID); String[] names = buildZoneStrings(timeZoneNameProvider, locale, requestID);
...@@ -150,21 +179,15 @@ public final class TimeZoneNameUtility { ...@@ -150,21 +179,15 @@ public final class TimeZoneNameUtility {
if (aliases != null) { if (aliases != null) {
// Check whether this id is an alias, if so, // Check whether this id is an alias, if so,
// look for the standard id. // look for the standard id.
if (aliases.containsKey(queryID)) { String canonicalID = aliases.get(requestID);
String prevID = queryID; if (canonicalID != null) {
while ((queryID = aliases.get(queryID)) != null) { names = buildZoneStrings(timeZoneNameProvider, locale, canonicalID);
prevID = queryID;
}
queryID = prevID;
} }
names = buildZoneStrings(timeZoneNameProvider, locale, queryID);
if (names == null) { if (names == null) {
// There may be a case that a standard id has become an // There may be a case that a standard id has become an
// alias. so, check the aliases backward. // alias. so, check the aliases backward.
names = examineAliases(timeZoneNameProvider, locale, names = examineAliases(timeZoneNameProvider, locale,
queryID, aliases, aliases.entrySet()); canonicalID == null ? requestID : canonicalID, aliases);
} }
} }
} }
...@@ -178,20 +201,18 @@ public final class TimeZoneNameUtility { ...@@ -178,20 +201,18 @@ public final class TimeZoneNameUtility {
private static String[] examineAliases(TimeZoneNameProvider tznp, Locale locale, private static String[] examineAliases(TimeZoneNameProvider tznp, Locale locale,
String id, String id,
Map<String, String> aliases, Map<String, String> aliases) {
Set<Map.Entry<String, String>> aliasesSet) {
if (aliases.containsValue(id)) { if (aliases.containsValue(id)) {
for (Map.Entry<String, String> entry : aliasesSet) { for (Map.Entry<String, String> entry : aliases.entrySet()) {
if (entry.getValue().equals(id)) { if (entry.getValue().equals(id)) {
String alias = entry.getKey(); String alias = entry.getKey();
String[] names = buildZoneStrings(tznp, locale, alias); String[] names = buildZoneStrings(tznp, locale, alias);
if (names != null) { if (names != null) {
return names; return names;
} else { }
names = examineAliases(tznp, locale, alias, aliases, aliasesSet); names = examineAliases(tznp, locale, alias, aliases);
if (names != null) { if (names != null) {
return names; return names;
}
} }
} }
} }
...@@ -201,7 +222,7 @@ public final class TimeZoneNameUtility { ...@@ -201,7 +222,7 @@ public final class TimeZoneNameUtility {
} }
private static String[] buildZoneStrings(TimeZoneNameProvider tznp, private static String[] buildZoneStrings(TimeZoneNameProvider tznp,
Locale locale, String id) { Locale locale, String id) {
String[] names = new String[5]; String[] names = new String[5];
for (int i = 1; i <= 4; i ++) { for (int i = 1; i <= 4; i ++) {
...@@ -220,6 +241,77 @@ public final class TimeZoneNameUtility { ...@@ -220,6 +241,77 @@ public final class TimeZoneNameUtility {
} }
} }
private static class TimeZoneNameGetter
implements LocaleServiceProviderPool.LocalizedObjectGetter<TimeZoneNameProvider,
String> {
private static final TimeZoneNameGetter INSTANCE =
new TimeZoneNameGetter();
@Override
public String getObject(TimeZoneNameProvider timeZoneNameProvider,
Locale locale,
String requestID,
Object... params) {
assert params.length == 2;
int style = (int) params[0];
String tzid = (String) params[1];
String value = getName(timeZoneNameProvider, locale, requestID, style, tzid);
if (value == null) {
Map<String, String> aliases = ZoneInfo.getAliasTable();
if (aliases != null) {
String canonicalID = aliases.get(tzid);
if (canonicalID != null) {
value = getName(timeZoneNameProvider, locale, requestID, style, canonicalID);
}
if (value == null) {
value = examineAliases(timeZoneNameProvider, locale, requestID,
canonicalID != null ? canonicalID : tzid, style, aliases);
}
}
}
return value;
}
private static String examineAliases(TimeZoneNameProvider tznp, Locale locale,
String requestID, String tzid, int style,
Map<String, String> aliases) {
if (aliases.containsValue(tzid)) {
for (Map.Entry<String, String> entry : aliases.entrySet()) {
if (entry.getValue().equals(tzid)) {
String alias = entry.getKey();
String name = getName(tznp, locale, requestID, style, alias);
if (name != null) {
return name;
}
name = examineAliases(tznp, locale, requestID, alias, style, aliases);
if (name != null) {
return name;
}
}
}
}
return null;
}
private static String getName(TimeZoneNameProvider timeZoneNameProvider,
Locale locale, String requestID, int style, String tzid) {
String value = null;
switch (requestID) {
case "std":
value = timeZoneNameProvider.getDisplayName(tzid, false, style, locale);
break;
case "dst":
value = timeZoneNameProvider.getDisplayName(tzid, true, style, locale);
break;
case "generic":
value = timeZoneNameProvider.getGenericDisplayName(tzid, style, locale);
break;
}
return value;
}
}
// No instantiation // No instantiation
private TimeZoneNameUtility() { private TimeZoneNameUtility() {
} }
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册