diff --git a/.hgtags b/.hgtags index 4171aeb8e83cfe8504b55dfbe6998c7bb7df5518..0181b2d733a0905203d7d0cc60d729e6ebdf4ec4 100644 --- a/.hgtags +++ b/.hgtags @@ -186,3 +186,5 @@ cec8fa02f15634acd7d02d04b0b2d8c044cdbaaa jdk8-b60 50b8b17449d200c66bfd68fb4f3a9197432c9e2b jdk8-b62 f117a3e06f78a258074674ad17601f99bcb1ce0d jdk8-b63 26dbd73fb7662a29b3e47179fdc88a0bfa4e231e jdk8-b64 +130d3a54d28becaac0846137256c2684adb34c33 jdk8-b65 +4d337fae2250135729ee9ed2bf8baf3c60da5d6d jdk8-b66 diff --git a/make/com/sun/security/Makefile b/make/com/sun/security/Makefile index 3a6ae4386e200c9573cea6478c0f243665bd73bc..85a919b1824def2688976ceb49cdeeef8ff1cf76 100644 --- a/make/com/sun/security/Makefile +++ b/make/com/sun/security/Makefile @@ -35,7 +35,7 @@ SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true include $(BUILDDIR)/common/Defs.gmk SUBDIRS = auth -SUBDIRS_misc = jgss sasl auth/module +SUBDIRS_misc = jgss sasl auth/module ntlm include $(BUILDDIR)/common/Subdirs.gmk all build clean clobber:: diff --git a/make/com/sun/security/ntlm/Makefile b/make/com/sun/security/ntlm/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..547092b7a6161851e4158fc88872853ada85e8dd --- /dev/null +++ b/make/com/sun/security/ntlm/Makefile @@ -0,0 +1,39 @@ +# +# 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 diff --git a/make/java/nio/Makefile b/make/java/nio/Makefile index 94a50dc4bcb3506f30e8d630cb08cfe9ed7040bf..9eebd5cc4ea578f7907a789bad4ba822f40d184b 100644 --- a/make/java/nio/Makefile +++ b/make/java/nio/Makefile @@ -69,6 +69,7 @@ FILES_java += \ sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \ \ sun/nio/fs/GnomeFileTypeDetector.java \ + sun/nio/fs/MimeTypesFileTypeDetector.java \ sun/nio/fs/PollingWatchService.java \ sun/nio/fs/SolarisAclFileAttributeView.java \ sun/nio/fs/SolarisFileStore.java \ @@ -202,6 +203,8 @@ FILES_java += \ sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \ \ sun/nio/fs/GnomeFileTypeDetector.java \ + sun/nio/fs/MagicFileTypeDetector.java \ + sun/nio/fs/MimeTypesFileTypeDetector.java \ sun/nio/fs/LinuxDosFileAttributeView.java \ sun/nio/fs/LinuxFileStore.java \ sun/nio/fs/LinuxFileSystem.java \ @@ -239,6 +242,7 @@ FILES_c += \ UnixAsynchronousSocketChannelImpl.c \ \ GnomeFileTypeDetector.c \ + MagicFileTypeDetector.c \ LinuxNativeDispatcher.c \ LinuxWatchService.c \ UnixCopyFile.c \ @@ -254,6 +258,7 @@ FILES_export += \ sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \ \ sun/nio/fs/GnomeFileTypeDetector.java \ + sun/nio/fs/MagicFileTypeDetector.java \ sun/nio/fs/LinuxNativeDispatcher.java \ sun/nio/fs/LinuxWatchService.java \ sun/nio/fs/UnixCopyFile.java \ @@ -277,6 +282,7 @@ FILES_java += \ sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \ sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \ \ + sun/nio/fs/MimeTypesFileTypeDetector.java \ sun/nio/fs/BsdFileStore.java \ sun/nio/fs/BsdFileSystem.java \ sun/nio/fs/BsdFileSystemProvider.java \ diff --git a/make/java/nio/mapfile-linux b/make/java/nio/mapfile-linux index d78a74400b3ce821b01aa870357422a5d8f7c68d..92c7d318894ded0b9951a7c69f7253ca4d8eb9aa 100644 --- a/make/java/nio/mapfile-linux +++ b/make/java/nio/mapfile-linux @@ -130,6 +130,8 @@ SUNWprivate_1.1 { Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio; Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs; 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_eventOffsets; Java_sun_nio_fs_LinuxWatchService_inotifyInit; diff --git a/make/java/security/Makefile b/make/java/security/Makefile index d68d0a0351010a61cc87801fcdcf34c12a9f13a2..bbb0ca4f757fe13d8a6149c9ed9e250d6b7c8aa8 100644 --- a/make/java/security/Makefile +++ b/make/java/security/Makefile @@ -40,7 +40,8 @@ AUTO_FILES_JAVA_DIRS = java/security # 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) PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-solaris diff --git a/make/jprt.properties b/make/jprt.properties index cbf8540e02f4dd3dbad2a6fe95ecf4fa564ba0e2..4bd2d4b84c61657f9179a2f6c9fc1a17ba220ad7 100644 --- a/make/jprt.properties +++ b/make/jprt.properties @@ -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_text}, \ ${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_other} @@ -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_beans2}, \ ${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_swing} diff --git a/make/tools/src/build/tools/cldrconverter/Bundle.java b/make/tools/src/build/tools/cldrconverter/Bundle.java index dc277ea684e4086d4d745d559f3caaf111104c4c..701ea4b057d80ae8bb745e1c45e40a1787cad13b 100644 --- a/make/tools/src/build/tools/cldrconverter/Bundle.java +++ b/make/tools/src/build/tools/cldrconverter/Bundle.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.EnumSet; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -86,7 +87,23 @@ class Bundle { private final static String[] ERA_KEYS = { "long.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; @@ -98,6 +115,7 @@ class Bundle { return bundles.get(id); } + @SuppressWarnings("ConvertToStringSwitch") Bundle(String id, String cldrPath, String bundles, String currencies) { this.id = id; this.cldrPath = cldrPath; @@ -242,9 +260,12 @@ class Bundle { // handle multiple inheritance for month and day names handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNames"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthAbbreviations"); + handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNarrows"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNames"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayAbbreviations"); + handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNarrows"); handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "AmPmMarkers"); + handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "narrow.AmPmMarkers"); adjustEraNames(myMap, calendarType); @@ -253,6 +274,99 @@ class Bundle { 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 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 nameMap = (Map) 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 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 nameMap = (Map) 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 parentNames = (Map) 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 m = (Map) 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; } @@ -352,20 +466,10 @@ class Bundle { realKeys[index] = realKey; eraNames[index++] = value; } - if (eraNames[0] != null) { - if (eraNames[1] != null) { - if (eraNames[2] == 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])); + for (int i = 0; i < eraNames.length; i++) { + if (eraNames[i] == null) { + map.put(realKeys[i], null); } - // remove long.Eras - map.remove(realKeys[0]); } } @@ -473,6 +577,86 @@ class Bundle { 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 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 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) { switch (cldrLetter) { case 'G': @@ -539,4 +723,13 @@ class Bundle { 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; + } } diff --git a/make/tools/src/build/tools/cldrconverter/BundleGenerator.java b/make/tools/src/build/tools/cldrconverter/BundleGenerator.java index f06a903a26ed3a0a4dae713e61f70a28ac154ef6..14760bcbb4dad6644748ab3ba1034c6e87689725 100644 --- a/make/tools/src/build/tools/cldrconverter/BundleGenerator.java +++ b/make/tools/src/build/tools/cldrconverter/BundleGenerator.java @@ -30,8 +30,27 @@ import java.util.Map; import java.util.SortedSet; 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, - boolean useJava, Map map, boolean open) throws IOException; + boolean useJava, Map map, BundleType type) throws IOException; public void generateMetaInfo(Map> metaInfo) throws IOException; } diff --git a/make/tools/src/build/tools/cldrconverter/CLDRConverter.java b/make/tools/src/build/tools/cldrconverter/CLDRConverter.java index 106e3475a8e5601017393fd35013753ff489a119..1d5cd5e2d8fb6f8feec3ebcf0173c2e6edbe2e5e 100644 --- a/make/tools/src/build/tools/cldrconverter/CLDRConverter.java +++ b/make/tools/src/build/tools/cldrconverter/CLDRConverter.java @@ -25,6 +25,7 @@ package build.tools.cldrconverter; +import build.tools.cldrconverter.BundleGenerator.BundleType; import java.io.File; import java.nio.file.DirectoryStream; import java.nio.file.FileSystems; @@ -58,9 +59,8 @@ public class CLDRConverter { static final String CURRENCY_SYMBOL_PREFIX = "currency.symbol."; static final String CURRENCY_NAME_PREFIX = "currency.displayname."; 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_NAME_PREFIX = "metazone.displayname."; private static SupplementDataParseHandler handlerSuppl; static NumberingSystemsParseHandler handlerNumbering; @@ -236,7 +236,14 @@ public class CLDRConverter { if (sb.indexOf("root") == -1) { 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 { Map> metaInfo = new HashMap<>(); metaInfo.put("LocaleNames", new TreeSet()); metaInfo.put("CurrencyNames", new TreeSet()); + metaInfo.put("TimeZoneNames", new TreeSet()); metaInfo.put("CalendarData", new TreeSet()); metaInfo.put("FormatData", new TreeSet()); @@ -348,24 +356,28 @@ public class CLDRConverter { Map localeNamesMap = extractLocaleNames(targetMap, bundle.getID()); if (!localeNamesMap.isEmpty() || bundle.isRoot()) { 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)) { Map currencyNamesMap = extractCurrencyNames(targetMap, bundle.getID(), bundle.getCurrencies()); if (!currencyNamesMap.isEmpty() || bundle.isRoot()) { 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)) { Map 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)) { Map calendarDataMap = extractCalendarData(targetMap, bundle.getID()); if (!calendarDataMap.isEmpty() || bundle.isRoot()) { 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)) { @@ -373,9 +385,10 @@ public class CLDRConverter { // LocaleData.getAvailableLocales depends on having FormatData bundles around if (!formatDataMap.isEmpty() || bundle.isRoot()) { 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 SortedSet allLocales = new TreeSet<>(); allLocales.addAll(metaInfo.get("CurrencyNames")); @@ -431,6 +444,7 @@ public class CLDRConverter { private KeyComparator() { } + @Override public int compare(String o1, String o2) { int len1 = o1.length(); int len2 = o2.length(); @@ -476,7 +490,26 @@ public class CLDRConverter { } private static Map extractZoneNames(Map map, String id) { - return null; + Map 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 extractCalendarData(Map map, String id) { @@ -494,11 +527,19 @@ public class CLDRConverter { copyIfPresent(map, prefix + "standalone.MonthNames", formatData); copyIfPresent(map, prefix + "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 + "standalone.DayNames", 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 + "narrow.AmPmMarkers", formatData); + copyIfPresent(map, prefix + "long.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 + "DatePatterns", formatData); copyIfPresent(map, prefix + "DateTimePatterns", formatData); @@ -560,7 +601,6 @@ public class CLDRConverter { if (x == 0 || escapeSpace) { outBuffer.append('\\'); } - outBuffer.append(' '); break; case '\\': @@ -584,7 +624,7 @@ public class CLDRConverter { outBuffer.append('f'); break; default: - if (!USE_UTF8 && ((aChar < 0x0020) || (aChar > 0x007e))) { + if (aChar < 0x0020 || (!USE_UTF8 && aChar > 0x007e)) { formatter.format("\\u%04x", (int)aChar); } else { if (specialSaveChars.indexOf(aChar) != -1) { diff --git a/make/tools/src/build/tools/cldrconverter/LDMLParseHandler.java b/make/tools/src/build/tools/cldrconverter/LDMLParseHandler.java index 128eaf6ef5745f3a0ef2f98a02d71f258925610c..812aab244fa1e0a6f5ba61ab72c4b5be311a5f15 100644 --- a/make/tools/src/build/tools/cldrconverter/LDMLParseHandler.java +++ b/make/tools/src/build/tools/cldrconverter/LDMLParseHandler.java @@ -155,6 +155,9 @@ class LDMLParseHandler extends AbstractLDMLHandler { case "abbreviated": pushStringArrayEntry(qName, attributes, prefix + "MonthAbbreviations/" + getContainerKey(), 13); break; + case "narrow": + pushStringArrayEntry(qName, attributes, prefix + "MonthNarrows/" + getContainerKey(), 13); + break; default: pushIgnoredContainer(qName); break; @@ -191,6 +194,9 @@ class LDMLParseHandler extends AbstractLDMLHandler { case "abbreviated": pushStringArrayEntry(qName, attributes, prefix + "DayAbbreviations/" + getContainerKey(), 7); break; + case "narrow": + pushStringArrayEntry(qName, attributes, prefix + "DayNarrows/" + getContainerKey(), 7); + break; default: pushIgnoredContainer(qName); break; @@ -219,25 +225,36 @@ class LDMLParseHandler extends AbstractLDMLHandler { case "dayPeriodWidth": // for FormatData // 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); - } else { + break; + case "narrow": + pushStringArrayEntry(qName, attributes, "narrow.AmPmMarkers/" + getContainerKey(), 2); + break; + default: pushIgnoredContainer(qName); + break; } break; case "dayPeriod": // for FormatData // add to string array entry of AmPmMarkers element - switch (attributes.getValue("type")) { - case "am": - pushStringArrayElement(qName, attributes, 0); - break; - case "pm": - pushStringArrayElement(qName, attributes, 1); - break; - default: + if (attributes.getValue("alt") == null) { + switch (attributes.getValue("type")) { + case "am": + pushStringArrayElement(qName, attributes, 0); + break; + case "pm": + pushStringArrayElement(qName, attributes, 1); + break; + default: + pushIgnoredContainer(qName); + break; + } + } else { + // discard alt values pushIgnoredContainer(qName); - break; } break; case "eraNames": @@ -269,7 +286,7 @@ class LDMLParseHandler extends AbstractLDMLHandler { assert currentContainer instanceof IgnoredContainer; pushIgnoredContainer(qName); } else { - String key = currentCalendarType.keyElementName() + "short.Eras"; + String key = currentCalendarType.keyElementName() + "narrow.Eras"; pushStringArrayEntry(qName, attributes, key, currentCalendarType.getEraLength(qName)); } break; @@ -301,15 +318,15 @@ class LDMLParseHandler extends AbstractLDMLHandler { break; case "zone": { - String zone = attributes.getValue("type"); + String tzid = attributes.getValue("type"); // Olson tz id zonePrefix = CLDRConverter.TIMEZONE_ID_PREFIX; - put(zonePrefix + zone, new HashMap()); - pushKeyContainer(qName, attributes, zone); + put(zonePrefix + tzid, new HashMap()); + pushKeyContainer(qName, attributes, tzid); } break; case "metazone": { - String zone = attributes.getValue("type"); + String zone = attributes.getValue("type"); // LDML meta zone id zonePrefix = CLDRConverter.METAZONE_ID_PREFIX; put(zonePrefix + zone, new HashMap()); pushKeyContainer(qName, attributes, zone); @@ -323,16 +340,12 @@ class LDMLParseHandler extends AbstractLDMLHandler { zoneNameStyle = "short"; pushContainer(qName, attributes); break; - case "generic": // not used in JDK - pushIgnoredContainer(qName); - break; - case "standard": // standard time - pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "standard." + zoneNameStyle); - break; - case "daylight": - pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "daylight." + zoneNameStyle); + case "generic": // generic name + case "standard": // standard time name + case "daylight": // daylight saving (summer) time name + pushStringEntry(qName, attributes, CLDRConverter.ZONE_NAME_PREFIX + qName + "." + zoneNameStyle); break; - case "exemplarCity": + case "exemplarCity": // not used in JDK pushIgnoredContainer(qName); break; @@ -530,6 +543,7 @@ class LDMLParseHandler extends AbstractLDMLHandler { case "timeZoneNames": zonePrefix = null; break; + case "generic": case "standard": case "daylight": if (zonePrefix != null && (currentContainer instanceof Entry)) { diff --git a/make/tools/src/build/tools/cldrconverter/MetaZonesParseHandler.java b/make/tools/src/build/tools/cldrconverter/MetaZonesParseHandler.java index 5c6f50b4ae9ea0396a0342af2346223a216f4a29..99be8cfd882bd837db3f5beabba4e519d7886c07 100644 --- a/make/tools/src/build/tools/cldrconverter/MetaZonesParseHandler.java +++ b/make/tools/src/build/tools/cldrconverter/MetaZonesParseHandler.java @@ -46,8 +46,9 @@ class MetaZonesParseHandler extends AbstractLDMLHandler { return null; } + // metaZone: ID -> metazone + // per locale: ID -> names, metazone -> names @Override - @SuppressWarnings("fallthrough") public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { switch (qName) { case "timezone": diff --git a/make/tools/src/build/tools/cldrconverter/ResourceBundleGenerator.java b/make/tools/src/build/tools/cldrconverter/ResourceBundleGenerator.java index 2d031fa8ba3ec8af093bcfa0129243bb8a1e8ce8..c7826a2519b247728bbad542fbb89dea7cd1d867 100644 --- a/make/tools/src/build/tools/cldrconverter/ResourceBundleGenerator.java +++ b/make/tools/src/build/tools/cldrconverter/ResourceBundleGenerator.java @@ -28,14 +28,16 @@ package build.tools.cldrconverter; import java.io.File; import java.io.IOException; import java.io.PrintWriter; +import java.util.Formatter; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.SortedSet; class ResourceBundleGenerator implements BundleGenerator { - @Override public void generateBundle(String packageName, String baseName, String localeID, boolean useJava, - Map map, boolean open) throws IOException { + Map map, BundleType type) throws IOException { String suffix = useJava ? ".java" : ".properties"; String lang = CLDRConverter.getLanguageCode(localeID); String dirName = CLDRConverter.DESTINATION_DIR + File.separator + "sun" + File.separator @@ -67,6 +69,28 @@ class ResourceBundleGenerator implements BundleGenerator { encoding = "iso-8859-1"; } + Formatter fmt = null; + if (type == BundleType.TIMEZONE) { + fmt = new Formatter(); + Set 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)) { // Output copyright headers out.println(CopyrightHeaders.getOpenJDKCopyright()); @@ -74,16 +98,15 @@ class ResourceBundleGenerator implements BundleGenerator { if (useJava) { out.println("package sun." + packageName + ";\n"); - if (open) { - out.println("import sun.util.resources.OpenListResourceBundle;\n"); - 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.printf("import %s;\n\n", type.getPathName()); + out.printf("public class %s%s extends %s {\n", baseName, "root".equals(localeID) ? "" : "_" + localeID, type.getClassName()); + out.println(" @Override\n" + - " protected final Object[][] getContents() {\n" + - " final Object[][] data = new Object[][] {"); + " protected final Object[][] getContents() {"); + if (fmt != null) { + out.print(fmt.toString()); + } + out.println(" final Object[][] data = new Object[][] {"); } for (String key : map.keySet()) { if (useJava) { @@ -91,7 +114,11 @@ class ResourceBundleGenerator implements BundleGenerator { if (value == null) { CLDRConverter.warning("null value for " + key); } 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[]) { String[] values = (String[]) value; out.println(" { \"" + key + "\",\n new String[] {"); diff --git a/makefiles/CompileDemos.gmk b/makefiles/CompileDemos.gmk index 7de9166cffe886d2cc8e6119ab5063443b881b92..bf67ff124bd5de5b609b336367e8bf0f5713e3c5 100644 --- a/makefiles/CompileDemos.gmk +++ b/makefiles/CompileDemos.gmk @@ -166,9 +166,9 @@ $(eval $(call SetupDemo,SampleTree,jfc,,SampleTree,,,README*)) $(eval $(call SetupDemo,SwingApplet,jfc,,SwingApplet,,,README* *.html)) $(eval $(call SetupDemo,TableExample,jfc,,TableExample,,,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,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,VerboseGC,management,,VerboseGC,,,README*)) $(eval $(call SetupDemo,zipfs,nio,,,,,README* *.java,,,,Main-Class: \n)) diff --git a/makefiles/CompileJavaClasses.gmk b/makefiles/CompileJavaClasses.gmk index 1c5913dd167849bff6edd87311777f0b08e4fa41..93ab2f25a357607890d3a9e8dda644a08542659b 100644 --- a/makefiles/CompileJavaClasses.gmk +++ b/makefiles/CompileJavaClasses.gmk @@ -121,6 +121,7 @@ ifneq ($(OPENJDK_TARGET_OS),linux) sun/nio/fs/LinuxFileStore.java \ sun/nio/fs/LinuxFileSystem.java \ sun/nio/fs/LinuxFileSystemProvider.java \ + sun/nio/fs/MagicFileTypeDetector.java \ sun/nio/fs/LinuxNativeDispatcher.java \ sun/nio/fs/LinuxUserDefinedFileAttributeView.java \ sun/nio/fs/LinuxWatchService.java diff --git a/makefiles/CompileLaunchers.gmk b/makefiles/CompileLaunchers.gmk index 586ecd473dcc565cd980d443843990d26aa68373..102a2e7831f64d1f05c1b4578da5339c9d6775a8 100644 --- a/makefiles/CompileLaunchers.gmk +++ b/makefiles/CompileLaunchers.gmk @@ -238,7 +238,7 @@ $(eval $(call SetupLauncher,jar,\ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }')) $(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,\ -DEXPAND_CLASSPATH_WILDCARDS \ diff --git a/makefiles/CompileNativeLibraries.gmk b/makefiles/CompileNativeLibraries.gmk index e898ed294fdd11767c6dc384445a86816a10e5e8..1461085b5d131883dc8128b4b44efe1b82a3e3d4 100644 --- a/makefiles/CompileNativeLibraries.gmk +++ b/makefiles/CompileNativeLibraries.gmk @@ -104,7 +104,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\ LANG:=C,\ CFLAGS:=$(CFLAGS_JDKLIB) \ -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)) $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) : $(BUILD_LIBFDLIBM) @@ -240,7 +240,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA,\ LDFLAGS:=$(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ 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_macosx:=-L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \ -framework CoreFoundation \ @@ -905,57 +905,34 @@ endif ########################################################################################## -BUILD_LIBZIP_FILES:=\ - CRC32.c \ - Adler32.c \ - Deflater.c \ - Inflater.c \ - ZipFile.c \ - zip_util.c - +BUILD_LIBZIP_EXCLUDES := ifeq ($(USE_EXTERNAL_LIBZ),true) - LIBZ:=-lz + LIBZ := -lz + LIBZIP_EXCLUDES += zlib-1.2.5 else -BUILD_LIBZIP_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 -LIBZ_INCLUDE:=-I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5 -endif - -BUILD_LIBZIP_REORDER:= + ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5 +endif + +BUILD_LIBZIP_REORDER := ifeq ($(OPENJDK_TARGET_OS), solaris) 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 ifeq ($(LIBZIP_CAN_USE_MMAP), true) - BUILD_LIBZIP_MMAP:=-DUSE_MMAP + BUILD_LIBZIP_MMAP := -DUSE_MMAP endif $(eval $(call SetupNativeCompilation,BUILD_LIBZIP,\ LIBRARY:=zip,\ 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,\ OPTIMIZATION:=LOW, \ + SRC:=$(JDK_TOPDIR)/src/share/native/java/util/zip,\ + EXCLUDES:=$(LIBZIP_EXCLUDES),\ CFLAGS:=$(CFLAGS_JDKLIB) \ - $(LIBZ_INCLUDE) \ + $(ZLIB_CPPFLAGS) \ -I$(JDK_TOPDIR)/src/share/native/java/io \ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io,\ CFLAGS_posix:=$(BUILD_LIBZIP_MMAP) -UDEBUG,\ @@ -1238,15 +1215,7 @@ ifdef OPENJDK $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS,\ LIBRARY:=lcms,\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ - 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,\ + SRC:=$(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms,\ LANG:=C,\ OPTIMIZATION:=LOW, \ CFLAGS:=$(filter-out -xc99=%none,$(CFLAGS_JDKLIB)) \ @@ -1928,6 +1897,7 @@ ifeq ($(OPENJDK_TARGET_OS), linux) UnixAsynchronousServerSocketChannelImpl.c \ UnixAsynchronousSocketChannelImpl.c \ GnomeFileTypeDetector.c \ + MagicFileTypeDetector.c \ LinuxNativeDispatcher.c \ LinuxWatchService.c \ UnixCopyFile.c \ @@ -2006,7 +1976,7 @@ $(BUILD_LIBNIO) : $(BUILD_LIBNET) ########################################################################################## ifeq ($(OPENJDK_TARGET_OS_API),posix) - # TODO make this work on macosx + ifneq ($(OPENJDK_TARGET_OS),macosx) SCTP_WERROR := -Werror @@ -2034,7 +2004,6 @@ ifeq ($(OPENJDK_TARGET_OS_API),posix) LDFLAGS_SUFFIX_posix:=-lnio -lnet,\ LDFLAGS_SUFFIX_solaris:=-lsocket -ljava -ljvm -lc,\ LDFLAGS_SUFFIX_macosx:=-ljava -ljvm,\ - INCLUDE_FILES:=SctpNet.c SctpChannelImpl.c SctpServerChannelImpl.c,\ OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsctp)) BUILD_LIBRARIES += $(BUILD_LIBSCTP) @@ -2105,7 +2074,7 @@ endif ifneq ($(USE_EXTERNAL_LIBZ),true) 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 += \ inflate.c \ inftrees.c \ @@ -2416,8 +2385,14 @@ LIBSPLASHSCREEN_DIRS:=\ $(JDK_TOPDIR)/src/share/native/sun/awt/giflib \ $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \ $(JDK_TOPDIR)/src/share/native/sun/awt/libpng \ - $(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen \ - $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen + $(JDK_TOPDIR)/src/share/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 \ $(foreach dir,$(LIBSPLASHSCREEN_DIRS),-I$(dir)) @@ -2443,104 +2418,11 @@ else LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32 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:= ifneq ($(USE_EXTERNAL_LIBZ),true) LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5 - LIBSPLASHSCREEN_CFLAGS += $(LIBZ_INCLUDE) - 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 + LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS) endif ifeq ($(OPENJDK_TARGET_OS), macosx) @@ -2560,7 +2442,7 @@ $(eval $(call SetupNativeCompilation,LIBSPLASHSCREEN,\ LIBRARY:=splashscreen,\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ SRC:=$(LIBSPLASHSCREEN_DIRS),\ - INCLUDE_FILES:=$(LIBSPLASHSCREEN_FILES),\ + EXCLUDE_FILES:=imageioJPEG.c jpegdecoder.c pngtest.c,\ LANG:=C,\ OPTIMIZATION:=LOW, \ CFLAGS:=$(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB),\ @@ -2683,14 +2565,13 @@ endif BUILD_LIBKRB5_NAME:= ifeq ($(OPENJDK_TARGET_OS), windows) 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_LIBS:=advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \ gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \ ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib else ifeq ($(OPENJDK_TARGET_OS), macosx) 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 endif @@ -2698,9 +2579,7 @@ ifneq ($(BUILD_LIBKRB5_NAME),) $(eval $(call SetupNativeCompilation,BUILD_LIBKRB5,\ LIBRARY:=$(BUILD_LIBKRB5_NAME),\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ - SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/krb5 \ - $(BUILD_LIBKRB5_SRC) ,\ - INCLUDE_FILES:=$(BUILD_LIBKRB5_FILES),\ + SRC:=$(BUILD_LIBKRB5_SRC),\ LANG:=C,\ OPTIMIZATION:=LOW, \ CFLAGS:=$(CFLAGS_JDKLIB) \ @@ -3071,18 +2950,11 @@ endif ifeq ($(OPENJDK_TARGET_OS), macosx) -LIBAPPLESCRIPTENGINE_FILES:=\ - AppleScriptEngine.m \ - AppleScriptExecutionContext.m \ - AS_NS_ConversionUtils.m \ - NS_Java_ConversionUtils.m - $(eval $(call SetupNativeCompilation,BUILD_LIBAPPLESCRIPTENGINE,\ LIBRARY:=AppleScriptEngine,\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ SRC:=$(JDK_TOPDIR)/src/macosx/native/apple/applescript,\ LANG:=C,\ - INCLUDE_FILES:=$(LIBAPPLESCRIPTENGINE_FILES),\ OPTIMIZATION:=LOW, \ CFLAGS:=$(CFLAGS_JDKLIB) \ -I$(JDK_TOPDIR)/src/macosx/native/apple/applescript \ @@ -3107,18 +2979,11 @@ endif ifeq ($(OPENJDK_TARGET_OS), macosx) -LIBOSXAPP_FILES:=\ - NSApplicationAWT.m \ - QueuingApplicationDelegate.m \ - PropertiesUtilities.m \ - ThreadUtilities.m - $(eval $(call SetupNativeCompilation,BUILD_LIBOSXAPP,\ LIBRARY:=osxapp,\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ SRC:=$(JDK_TOPDIR)/src/macosx/native/sun/osxapp,\ LANG:=C,\ - INCLUDE_FILES:=$(LIBOSXAPP_FILES),\ OPTIMIZATION:=LOW, \ CFLAGS:=$(CFLAGS_JDKLIB) \ -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \ @@ -3151,14 +3016,6 @@ endif ifeq ($(OPENJDK_TARGET_OS), macosx) -LIBOSX_FILES:=\ - Dispatch.m \ - CFileManager.m \ - KeystoreImpl.m \ - JavaAppLauncher.m \ - MacOSXPreferencesFile.m \ - SCDynamicStoreConfig.m - LIBOSX_DIRS:=\ $(JDK_TOPDIR)/src/macosx/native/com/apple/concurrent \ $(JDK_TOPDIR)/src/macosx/native/java/util \ @@ -3171,7 +3028,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBOSX,\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ SRC:=$(LIBOSX_DIRS),\ LANG:=C,\ - INCLUDE_FILES:=$(LIBOSX_FILES),\ OPTIMIZATION:=LOW, \ CFLAGS:=$(CFLAGS_JDKLIB) \ $(foreach dir,$(LIBOSX_DIRS),-I$(dir)) \ @@ -3341,22 +3197,11 @@ endif 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,\ LIBRARY:=osxui,\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ SRC:=$(JDK_TOPDIR)/src/macosx/native/com/apple/laf,\ LANG:=C,\ - INCLUDE_FILES:=$(LIBOSXUI_FILES),\ OPTIMIZATION:=LOW, \ CFLAGS:=$(CFLAGS_JDKLIB) \ -I$(JDK_TOPDIR)/src/macosx/native/com/apple/laf \ diff --git a/makefiles/CopyFiles.gmk b/makefiles/CopyFiles.gmk index e0c8d620f2d386338d59709a1b76661652523a4e..be24ab2281994383f75c31e436e8d422f4bdf513 100644 --- a/makefiles/CopyFiles.gmk +++ b/makefiles/CopyFiles.gmk @@ -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 -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) $(MKDIR) -p $(@D) $(RM) $@ diff --git a/makefiles/CreateJars.gmk b/makefiles/CreateJars.gmk index 65b506a03963ee8660a8e99362e8737b5b31a71a..c317d8d795c95e895280561c4a4cd190c2f700ef 100644 --- a/makefiles/CreateJars.gmk +++ b/makefiles/CreateJars.gmk @@ -419,6 +419,23 @@ $(eval $(call SetupArchive,BUILD_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 @@ -440,8 +457,11 @@ else SUFFIXES:=.class,\ INCLUDES:=sun/security/pkcs11,\ JAR:=$(SUNPKCS11_JAR_DST), \ + MANIFEST:=$(JCE_MANIFEST), \ SKIP_METAINF := true)) + $(SUNPKCS11_JAR_DST): $(JCE_MANIFEST) + endif JARS += $(SUNPKCS11_JAR_DST) @@ -452,9 +472,9 @@ SUNEC_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunec.jar 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..." $(MKDIR) -p $(@D) $(RM) $@ @@ -462,13 +482,16 @@ $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC) else -$(eval $(call SetupArchive,BUILD_SUNEC_JAR,,\ + $(eval $(call SetupArchive,BUILD_SUNEC_JAR,,\ SRCS:=$(JDK_OUTPUTDIR)/classes, \ SUFFIXES:=.class,\ INCLUDES:=sun/security/ec,\ JAR:=$(SUNEC_JAR_DST), \ + MANIFEST:=$(JCE_MANIFEST), \ SKIP_METAINF := true)) + $(SUNEC_JAR_DST): $(JCE_MANIFEST) + endif JARS += $(SUNEC_JAR_DST) @@ -505,9 +528,11 @@ else SUFFIXES:=.class,\ INCLUDES:= com/sun/crypto/provider,\ JAR:=$(SUNJCE_PROVIDER_JAR_DST), \ - MANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf, \ - EXTRA_MANIFEST_ATTR := Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \ + MANIFEST:=$(JCE_MANIFEST), \ SKIP_METAINF := true)) + + $(SUNJCE_PROVIDER_JAR_DST): $(JCE_MANIFEST) + endif JARS += $(SUNJCE_PROVIDER_JAR_DST) @@ -516,9 +541,9 @@ JCE_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/jce.jar 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..." $(MKDIR) -p $(@D) $(RM) $@ @@ -526,14 +551,16 @@ $(JCE_JAR_DST) : $(JCE_JAR_SRC) else -$(eval $(call SetupArchive,BUILD_JCE_JAR,,\ + $(eval $(call SetupArchive,BUILD_JCE_JAR,,\ SRCS:=$(JDK_OUTPUTDIR)/classes, \ SUFFIXES:=.class,\ INCLUDES:= javax/crypto sun/security/internal,\ JAR:=$(JCE_JAR_DST), \ - MANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf, \ - EXTRA_MANIFEST_ATTR := Extension-Name: javax.crypto\nImplementation-Vendor-Id: com.sun, \ + MANIFEST:=$(JCE_MANIFEST), \ SKIP_METAINF := true)) + + $(JCE_JAR_DST): $(JCE_MANIFEST) + endif JARS += $(JCE_JAR_DST) diff --git a/makefiles/mapfiles/libnio/mapfile-linux b/makefiles/mapfiles/libnio/mapfile-linux index d78a74400b3ce821b01aa870357422a5d8f7c68d..92c7d318894ded0b9951a7c69f7253ca4d8eb9aa 100644 --- a/makefiles/mapfiles/libnio/mapfile-linux +++ b/makefiles/mapfiles/libnio/mapfile-linux @@ -130,6 +130,8 @@ SUNWprivate_1.1 { Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio; Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs; 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_eventOffsets; Java_sun_nio_fs_LinuxWatchService_inotifyInit; diff --git a/src/share/back/debugInit.c b/src/share/back/debugInit.c index 490099b06c5976da089a8afb20a03089bdf06416..25ffbffc91a3b4e4b3af98209679dc36d2088bbe 100644 --- a/src/share/back/debugInit.c +++ b/src/share/back/debugInit.c @@ -1,5 +1,5 @@ /* - * 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. * * This code is free software; you can redistribute it and/or modify it @@ -37,6 +37,7 @@ #include "debugLoop.h" #include "bag.h" #include "invoker.h" +#include "sys.h" /* How the options get to OnLoad: */ #define XDEBUG "-Xdebug" @@ -201,6 +202,8 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) jint jvmtiCompileTimeMajorVersion; jint jvmtiCompileTimeMinorVersion; jint jvmtiCompileTimeMicroVersion; + char *boot_path = NULL; + char npt_lib[MAXPATHLEN]; /* See if it's already loaded */ if ( gdata!=NULL && gdata->isLoaded==JNI_TRUE ) { @@ -227,18 +230,6 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) vmInitialized = 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(). */ error = JVM_FUNC_PTR(vm,GetEnv) (vm, (void **)&(gdata->jvmti), JVMTI_VERSION_1); @@ -277,6 +268,24 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) 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 */ if (!parseOptions(options)) { /* No message necessary, should have been printed out already */ diff --git a/src/share/back/error_messages.c b/src/share/back/error_messages.c index 13a04b5173a9505ea4447a3939ee1b5f8cdd6e06..2ec5bbfa2e5d24a073dc66d116e5f74e915f9e5c 100644 --- a/src/share/back/error_messages.c +++ b/src/share/back/error_messages.c @@ -1,5 +1,5 @@ /* - * 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. * * 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, len = (int)strlen((char*)utf8buf); /* Convert to platform encoding (ignore errors, dangerous area) */ - (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf, - utf8buf, len, pbuf, MAX_MESSAGE_LEN); + if (gdata->npt != NULL) { + (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); } diff --git a/src/share/back/transport.c b/src/share/back/transport.c index b3154941729bb5b9e3c8b7a021582c5037850a72..40608b3123954e9ef3836469bff6083776a2e13e 100644 --- a/src/share/back/transport.c +++ b/src/share/back/transport.c @@ -1,5 +1,5 @@ /* - * 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. * * This code is free software; you can redistribute it and/or modify it @@ -144,7 +144,9 @@ loadTransport(char *name, jdwpTransportEnv **transportPtr) /* First, look in sun.boot.library.path. This should find the standard * dt_socket and dt_shmem transport libraries, or any library * 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; if (libdir == NULL) { diff --git a/src/share/classes/com/sun/java/util/jar/pack/PropMap.java b/src/share/classes/com/sun/java/util/jar/pack/PropMap.java index e1a385546c96e91ecee0a2bbe655704b12d3a8e5..6199c77b51d8fee079d369b465963ba7f784512f 100644 --- a/src/share/classes/com/sun/java/util/jar/pack/PropMap.java +++ b/src/share/classes/com/sun/java/util/jar/pack/PropMap.java @@ -25,8 +25,6 @@ package com.sun.java.util.jar.pack; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeEvent; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; @@ -42,40 +40,39 @@ import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; 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. */ final class PropMap implements SortedMap { private final TreeMap theMap = new TreeMap<>();; - private final List listenerList = new ArrayList<>(1); - void addListener(PropertyChangeListener listener) { + // type is erased, elements are of type java.beans.PropertyChangeListener + private final List listenerList = new ArrayList<>(1); + + void addListener(Object listener) { + assert Beans.isPropertyChangeListener(listener); listenerList.add(listener); } - void removeListener(PropertyChangeListener listener) { + void removeListener(Object listener) { + assert Beans.isPropertyChangeListener(listener); listenerList.remove(listener); } - void addListeners(ArrayList listeners) { - listenerList.addAll(listeners); - } - - void removeListeners(ArrayList listeners) { - listenerList.removeAll(listeners); - } - // Override: public String put(String key, String value) { String oldValue = theMap.put(key, value); if (value != oldValue && !listenerList.isEmpty()) { + assert Beans.isBeansPresent(); // Post the property change event. - PropertyChangeEvent event = - new PropertyChangeEvent(this, key, - oldValue, value); - for (PropertyChangeListener listener : listenerList) { - listener.propertyChange(event); + Object event = Beans.newPropertyChangeEvent(this, key, oldValue, value); + for (Object listener : listenerList) { + Beans.invokePropertyChange(listener, event); } } return oldValue; @@ -339,4 +336,113 @@ final class PropMap implements SortedMap { public String 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); + } + } + } } diff --git a/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java b/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java index 8824f8c0f0a644d62cb12c4be0dc033b49115298..db14e424b29bc47685d952a0e870bd67a7d89854 100644 --- a/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java +++ b/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java @@ -264,7 +264,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { * false otherwise */ public boolean writeData(RowSetInternal caller) throws SQLException { - boolean conflict = false; + long conflicts = 0; boolean showDel = false; PreparedStatement pstmtIns = null; iChangedValsInDbAndCRS = 0; @@ -337,8 +337,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { while (crs.next()) { if (crs.rowDeleted()) { // The row has been deleted. - if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) { + if (deleteOriginalRow(crs, this.crsResolve)) { status.add(rows, SyncResolver.DELETE_ROW_CONFLICT); + conflicts++; } else { // delete happened without any occurrence of conflicts // so update status accordingly @@ -349,8 +350,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { // The row has been inserted. 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); + conflicts++; } else { // insert happened without any occurrence of conflicts // so update status accordingly @@ -358,8 +360,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { } } else if (crs.rowUpdated()) { // The row has been updated. - if ( conflict = (updateOriginalRow(crs)) == true) { + if (updateOriginalRow(crs)) { status.add(rows, SyncResolver.UPDATE_ROW_CONFLICT); + conflicts++; } else { // update happened without any occurrence of conflicts // so update status accordingly @@ -395,21 +398,12 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable { // reset crs.setShowDeleted(showDel); - boolean boolConf = false; - for (int j=1;jget or set method) has its own, independently initialized - * copy of the variable. ThreadLocal instances are typically private + * {@code get} or {@code set} method) has its own, independently initialized + * copy of the variable. {@code ThreadLocal} instances are typically private * static fields in classes that wish to associate state with a thread (e.g., * a user ID or Transaction ID). * *

For example, the class below generates unique identifiers local to each * thread. - * A thread's id is assigned the first time it invokes ThreadId.get() + * A thread's id is assigned the first time it invokes {@code ThreadId.get()} * and remains unchanged on subsequent calls. *

  * import java.util.concurrent.atomic.AtomicInteger;
@@ -61,7 +63,7 @@ import java.util.concurrent.atomic.AtomicInteger;
  * }
  * 
*

Each thread holds an implicit reference to its copy of a thread-local - * variable as long as the thread is alive and the ThreadLocal + * 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 * thread-local instances are subject to garbage collection (unless other * references to these copies exist). @@ -108,14 +110,14 @@ public class ThreadLocal { * thread-local variable. This method will be invoked the first * time a thread accesses the variable with the {@link #get} * method, unless the thread previously invoked the {@link #set} - * method, in which case the initialValue method will not + * method, in which case the {@code initialValue} method will not * be invoked for the thread. Normally, this method is invoked at * most once per thread, but it may be invoked again in case of * subsequent invocations of {@link #remove} followed by {@link #get}. * - *

This implementation simply returns null; if the + *

This implementation simply returns {@code null}; if the * programmer desires thread-local variables to have an initial - * value other than null, ThreadLocal must be + * value other than {@code null}, {@code ThreadLocal} must be * subclassed, and this method overridden. Typically, an * anonymous inner class will be used. * @@ -125,8 +127,22 @@ public class ThreadLocal { 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 ThreadLocal withInitial(Supplier supplier) { + return new SuppliedThreadLocal<>(supplier); + } + /** * Creates a thread local variable. + * @see #withInitial(java.util.function.Supplier) */ public ThreadLocal() { } @@ -195,7 +211,7 @@ public class ThreadLocal { * reinitialized by invoking its {@link #initialValue} method, * unless its value is {@linkplain #set set} by the current thread * in the interim. This may result in multiple invocations of the - * initialValue method in the current thread. + * {@code initialValue} method in the current thread. * * @since 1.5 */ @@ -250,6 +266,24 @@ public class ThreadLocal { throw new UnsupportedOperationException(); } + /** + * An extension of ThreadLocal that obtains its initial value from + * the specified {@code Supplier}. + */ + static final class SuppliedThreadLocal extends ThreadLocal { + + private final Supplier supplier; + + SuppliedThreadLocal(Supplier supplier) { + this.supplier = Objects.requireNonNull(supplier); + } + + @Override + protected T initialValue() { + return supplier.get(); + } + } + /** * ThreadLocalMap is a customized hash map suitable only for * maintaining thread local values. No operations are exported @@ -599,9 +633,9 @@ public class ThreadLocal { * @param i a position known NOT to hold a stale entry. The * scan starts at the element after i. * - * @param n scan control: log2(n) cells are scanned, + * @param n scan control: {@code log2(n)} cells are scanned, * unless a stale entry is found, in which case - * log2(table.length)-1 additional cells are scanned. + * {@code log2(table.length)-1} additional cells are scanned. * When called from insertions, this parameter is the number * of elements, but when from replaceStaleEntry, it is the * table length. (Note: all this could be changed to be either diff --git a/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java b/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java index 9e786e8f5b980af59ed529898aa976b6dd5581f5..13999001cdc259c3adf9ee83a76beea77e8ac3e9 100644 --- a/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java +++ b/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java @@ -25,15 +25,15 @@ package java.lang.invoke; -import java.io.FileOutputStream; -import java.io.IOException; +import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.security.ProtectionDomain; import java.util.concurrent.atomic.AtomicInteger; -import sun.util.logging.PlatformLogger; import jdk.internal.org.objectweb.asm.*; import static jdk.internal.org.objectweb.asm.Opcodes.*; import sun.misc.Unsafe; +import java.security.AccessController; +import java.security.PrivilegedAction; /** * InnerClassLambdaMetafactory @@ -120,13 +120,34 @@ import sun.misc.Unsafe; * * @return a CallSite, which, when invoked, will return an instance of the * functional interface - * @throws ReflectiveOperationException + * @throws ReflectiveOperationException, LambdaConversionException */ @Override CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException { final Class innerClass = spinInnerClass(); if (invokedType.parameterCount() == 0) { - return new ConstantCallSite(MethodHandles.constant(samBase, innerClass.newInstance())); + final Constructor[] ctrs = AccessController.doPrivileged( + new PrivilegedAction() { + @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() { + @Override + public Void run() { + ctrs[0].setAccessible(true); + return null; + } + }); + Object inst = ctrs[0].newInstance(); + return new ConstantCallSite(MethodHandles.constant(samBase, inst)); } else { return new ConstantCallSite( MethodHandles.Lookup.IMPL_LOOKUP @@ -144,7 +165,7 @@ import sun.misc.Unsafe; private Class spinInnerClass() throws LambdaConversionException { 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}); // Generate final fields to be filled in by constructor @@ -186,17 +207,27 @@ import sun.misc.Unsafe; 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); try (FileOutputStream fos = new FileOutputStream(lambdaClassName.replace('/', '.') + ".class")) { fos.write(classBytes); } 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(); - ProtectionDomain pd = (loader == null) ? null : targetClass.getProtectionDomain(); + ProtectionDomain pd = (loader == null) + ? null + : AccessController.doPrivileged( + new PrivilegedAction() { + @Override + public ProtectionDomain run() { + return targetClass.getProtectionDomain(); + } + } + ); + return (Class) Unsafe.getUnsafe().defineClass(lambdaClassName, classBytes, 0, classBytes.length, loader, pd); } @@ -205,7 +236,7 @@ import sun.misc.Unsafe; */ private void generateConstructor() { // 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.visitVarInsn(ALOAD, 0); ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR, METHOD_DESCRIPTOR_VOID); diff --git a/src/share/classes/java/text/DateFormatSymbols.java b/src/share/classes/java/text/DateFormatSymbols.java index ee688abd9b652ed61f25b6c89a990c263b04c8ea..bde39a66ed1ddf10dc34b374bf902ab9508f40cb 100644 --- a/src/share/classes/java/text/DateFormatSymbols.java +++ b/src/share/classes/java/text/DateFormatSymbols.java @@ -688,7 +688,16 @@ public class DateFormatSymbols implements Serializable, Cloneable { } 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"); shortMonths = resource.getStringArray("MonthAbbreviations"); ampms = resource.getStringArray("AmPmMarkers"); diff --git a/src/share/classes/java/text/SimpleDateFormat.java b/src/share/classes/java/text/SimpleDateFormat.java index b434b6b782ac42d002c9f9959a06054617dede88..0c1f4aa6a61d3f773acced6acb11280ce17e64f6 100644 --- a/src/share/classes/java/text/SimpleDateFormat.java +++ b/src/share/classes/java/text/SimpleDateFormat.java @@ -48,12 +48,13 @@ import java.util.GregorianCalendar; import java.util.Locale; import java.util.Map; import java.util.SimpleTimeZone; +import java.util.SortedMap; import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import sun.util.locale.provider.LocaleProviderAdapter; import sun.util.calendar.CalendarUtils; import sun.util.calendar.ZoneInfoFile; +import sun.util.locale.provider.LocaleProviderAdapter; /** * SimpleDateFormat is a concrete class for formatting and @@ -1593,6 +1594,17 @@ public class SimpleDateFormat extends DateFormat { private int matchString(String text, int start, int field, Map data, CalendarBuilder calb) { 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; for (String name : data.keySet()) { @@ -1803,7 +1815,7 @@ public class SimpleDateFormat extends DateFormat { boolean obeyCount, boolean[] ambiguousYear, ParsePosition origPos, boolean useFollowingMinusSignAsDelimiter, CalendarBuilder calb) { - Number number = null; + Number number; int value = 0; ParsePosition pos = new ParsePosition(0); pos.index = start; @@ -1876,9 +1888,7 @@ public class SimpleDateFormat extends DateFormat { return index; } } else { - Map map = calendar.getDisplayNames(field, - Calendar.ALL_STYLES, - locale); + Map map = getDisplayNamesMap(field, locale); if ((index = matchString(text, start, field, map, calb)) > 0) { return index; } @@ -1940,7 +1950,7 @@ public class SimpleDateFormat extends DateFormat { // count >= 3 // i.e., MMM or MMMM // Want to be able to parse both short and long forms. // Try count == 4 first: - int newStart = 0; + int newStart; if ((newStart = matchString(text, start, Calendar.MONTH, formatData.getMonths(), calb)) > 0) { return newStart; @@ -1951,9 +1961,7 @@ public class SimpleDateFormat extends DateFormat { return index; } } else { - Map map = calendar.getDisplayNames(field, - Calendar.ALL_STYLES, - locale); + Map map = getDisplayNamesMap(field, locale); if ((index = matchString(text, start, field, map, calb)) > 0) { return index; } @@ -1979,7 +1987,7 @@ public class SimpleDateFormat extends DateFormat { if (useDateFormatSymbols) { // Want to be able to parse both short and long forms. // Try count == 4 (DDDD) first: - int newStart = 0; + int newStart; if ((newStart=matchString(text, start, Calendar.DAY_OF_WEEK, formatData.getWeekdays(), calb)) > 0) { return newStart; @@ -2008,7 +2016,7 @@ public class SimpleDateFormat extends DateFormat { return index; } } else { - Map map = calendar.getDisplayNames(field, Calendar.ALL_STYLES, locale); + Map map = getDisplayNamesMap(field, locale); if ((index = matchString(text, start, field, map, calb)) > 0) { return index; } @@ -2098,7 +2106,7 @@ public class SimpleDateFormat extends DateFormat { break parsing; } - int sign = 0; + int sign; char c = text.charAt(pos.index); if (c == 'Z') { calb.set(Calendar.ZONE_OFFSET, 0).set(Calendar.DST_OFFSET, 0); @@ -2340,6 +2348,21 @@ public class SimpleDateFormat extends DateFormat { && formatData.equals(that.formatData)); } + private static final int[] REST_OF_STYLES = { + Calendar.SHORT_STANDALONE, Calendar.LONG_FORMAT, Calendar.LONG_STANDALONE, + }; + private Map getDisplayNamesMap(int field, Locale locale) { + Map map = calendar.getDisplayNames(field, Calendar.SHORT_FORMAT, locale); + // Get all SHORT and LONG styles (avoid NARROW styles). + for (int style : REST_OF_STYLES) { + Map m = calendar.getDisplayNames(field, style, locale); + if (m != null) { + map.putAll(m); + } + } + return map; + } + /** * After reading an object from the input stream, the format * pattern in the object is verified. diff --git a/src/share/classes/java/util/Base64.java b/src/share/classes/java/util/Base64.java index db46a3e4b5a91a07dec9ee584143ecee21557c40..f5ff211f8d46d8239aba01fe4f52f1362d07c769 100644 --- a/src/share/classes/java/util/Base64.java +++ b/src/share/classes/java/util/Base64.java @@ -289,8 +289,8 @@ public class Base64 { * *

This method first encodes all input bytes into a base64 encoded * 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} - * charset. + * array and the {@link java.nio.charset.StandardCharsets#ISO_8859_1 + * ISO-8859-1} charset. * *

In other words, an invocation of this method has exactly the same * effect as invoking @@ -358,9 +358,9 @@ public class Base64 { * to encode any more input bytes. The encoding operation can be * continued, if there is more bytes in input buffer to be encoded, * by invoking this method again with an output buffer that has more - * {@linkplain Buffer#remaining remaining} bytes. This is typically - * done by draining any encoded bytes from the output buffer. The - * value returned from last invocation needs to be passed in as the + * {@linkplain java.nio.Buffer#remaining remaining} bytes. This is + * typically done by draining any encoded bytes from the output buffer. + * The value returned from last invocation needs to be passed in as the * third parameter {@code bytesOut} if it is to continue an unfinished * encoding, 0 otherwise. * @@ -806,9 +806,9 @@ public class Base64 { * buffer has insufficient space to decode any more input bytes. * The decoding operation can be continued, if there is more bytes * in input buffer to be decoded, by invoking this method again with - * an output buffer that has more {@linkplain Buffer#remaining remaining} - * bytes.This is typically done by draining any decoded bytes from the - * output buffer. + * an output buffer that has more {@linkplain java.nio.Buffer#remaining + * remaining} bytes. This is typically done by draining any decoded + * bytes from the output buffer. * *

Recommended Usage Example *

@@ -901,7 +901,7 @@ public class Base64 {
                     shiftto -= 6;
                     if (shiftto < 0) {
                         if (dl < dp + 3)
-                            return dp;
+                            return dp - dp0;
                         da[dp++] = (byte)(bits >> 16);
                         da[dp++] = (byte)(bits >>  8);
                         da[dp++] = (byte)(bits);
@@ -912,7 +912,7 @@ public class Base64 {
                 }
                 if (shiftto == 6) {
                     if (dl - dp < 1)
-                        return dp;
+                        return dp - dp0;
                     if (padding && (sp + 1 != sl || sa[sp++] != '='))
                         throw new IllegalArgumentException(
                             "Input buffer has wrong 4-byte ending unit");
@@ -920,7 +920,7 @@ public class Base64 {
                     mark = sp;
                 } else if (shiftto == 0) {
                     if (dl - dp < 2)
-                        return dp;
+                        return dp - dp0;
                     if (padding && sp != sl)
                         throw new IllegalArgumentException(
                             "Input buffer has wrong 4-byte ending unit");
@@ -969,7 +969,7 @@ public class Base64 {
                     shiftto -= 6;
                     if (shiftto < 0) {
                         if (dl < dp + 3)
-                            return dp;
+                            return dp - dp0;
                         dst.put(dp++, (byte)(bits >> 16));
                         dst.put(dp++, (byte)(bits >>  8));
                         dst.put(dp++, (byte)(bits));
@@ -980,7 +980,7 @@ public class Base64 {
                 }
                 if (shiftto == 6) {
                     if (dl - dp < 1)
-                        return dp;
+                        return dp - dp0;
                     if (padding && (sp + 1 != sl || src.get(sp++) != '='))
                         throw new IllegalArgumentException(
                             "Input buffer has wrong 4-byte ending unit");
@@ -988,7 +988,7 @@ public class Base64 {
                      mark = sp;
                 } else if (shiftto == 0) {
                     if (dl - dp < 2)
-                        return dp;
+                        return dp - dp0;
                     if (padding && sp != sl)
                         throw new IllegalArgumentException(
                             "Input buffer has wrong 4-byte ending unit");
diff --git a/src/share/classes/java/util/Calendar.java b/src/share/classes/java/util/Calendar.java
index f641a37e632d5897a02982f5948182cefe66d716..9b61012003efdc62c33184e0b1f822c5889682f5 100644
--- a/src/share/classes/java/util/Calendar.java
+++ b/src/share/classes/java/util/Calendar.java
@@ -53,9 +53,7 @@ import java.text.DateFormat;
 import java.text.DateFormatSymbols;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import java.util.spi.CalendarDataProvider;
 import sun.util.BuddhistCalendar;
-import sun.util.locale.provider.LocaleProviderAdapter;
 import sun.util.calendar.ZoneInfo;
 import sun.util.locale.provider.CalendarDataUtility;
 
@@ -743,6 +741,32 @@ public abstract class Calendar implements Serializable, Cloneable, Comparablefield in the given style, or
-     *        null if no string representation is
+     *        {@code field} in the given {@code style}, or
+     *        {@code null} if no string representation is
      *        applicable.
      * @exception IllegalArgumentException
-     *        if field or style is invalid,
-     *        or if this Calendar is non-lenient and any
+     *        if {@code field} or {@code style} is invalid,
+     *        or if this {@code Calendar} is non-lenient and any
      *        of the calendar fields have invalid values
      * @exception NullPointerException
-     *        if locale is null
+     *        if {@code locale} is null
      * @since 1.6
      */
     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)) {
             return null;
         }
 
-        // the standalone styles are supported only through CalendarDataProviders.
-        if (isStandaloneStyle(style)) {
+        // the standalone and narrow styles are supported only through CalendarDataProviders.
+        if (isStandaloneStyle(style) || isNarrowStyle(style)) {
             return CalendarDataUtility.retrieveFieldValueName(getCalendarType(),
                                                               field, get(field),
                                                               style, locale);
@@ -1513,26 +1538,30 @@ public abstract class Calendar implements Serializable, Cloneable, ComparableMap containing all names of the calendar
-     * field in the given style and
-     * locale and their corresponding field values. For
-     * example, if this Calendar is a {@link
+     * Returns a {@code Map} containing all names of the calendar
+     * {@code field} in the given {@code style} and
+     * {@code locale} and their corresponding field values. For
+     * example, if this {@code Calendar} is a {@link
      * GregorianCalendar}, the returned map would contain "Jan" to
      * {@link #JANUARY}, "Feb" to {@link #FEBRUARY}, and so on, in the
      * {@linkplain #SHORT short} style in an English locale.
      *
+     * 

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}. + * *

The values of other calendar fields may be taken into * account to determine a set of display names. For example, if - * this Calendar 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 * month, this method would return month names containing the leap * month name, and month names are mapped to their values specific * for the year. * *

The default implementation supports display names contained in - * a {@link DateFormatSymbols}. For example, if field - * is {@link #MONTH} and style is {@link - * #ALL_STYLES}, this method returns a Map containing + * a {@link DateFormatSymbols}. For example, if {@code field} + * is {@link #MONTH} and {@code style} is {@link + * #ALL_STYLES}, this method returns a {@code Map} containing * all strings returned by {@link DateFormatSymbols#getShortMonths()} * and {@link DateFormatSymbols#getMonths()}. * @@ -1541,30 +1570,31 @@ public abstract class Calendar implements Serializable, Cloneable, ComparableMap containing all display names in - * style and locale and their - * field values, or null if no display names - * are defined for field + * @return a {@code Map} containing all display names in + * {@code style} and {@code locale} and their + * field values, or {@code null} if no display names + * are defined for {@code field} * @exception IllegalArgumentException - * if field or style is invalid, - * or if this Calendar is non-lenient and any + * if {@code field} or {@code style} is invalid, + * or if this {@code Calendar} is non-lenient and any * of the calendar fields have invalid values * @exception NullPointerException - * if locale is null + * if {@code locale} is null * @since 1.6 */ public Map 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)) { return null; } if (style == ALL_STYLES || isStandaloneStyle(style)) { return CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale); } - // SHORT or LONG + // SHORT, LONG, or NARROW return getDisplayNamesImpl(field, style, locale); } @@ -1599,6 +1629,12 @@ public abstract class Calendar implements Serializable, Cloneable, ComparableCurrency instance using * the getInstance methods. *

- * Users can supersede the Java runtime currency data by creating a properties - * file named <JAVA_HOME>/lib/currency.properties. The contents - * of the properties file are key/value pairs of the ISO 3166 country codes - * and the ISO 4217 currency data respectively. The value part consists of - * three ISO 4217 values of a currency, i.e., an alphabetic code, a numeric - * code, and a minor unit. Those three ISO 4217 values are separated by commas. + * Users can supersede the Java runtime currency data by means of the system + * property {@code java.util.currency.data}. If this system property is + * defined then its value is the location of a properties file, the contents of + * which are key/value pairs of the ISO 3166 country codes and the ISO 4217 + * currency data respectively. The value part consists of three ISO 4217 values + * 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 * 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 @@ -246,10 +247,13 @@ public final class Currency implements Serializable { } // 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 { - File propFile = new File(homeDir + File.separator + - "lib" + File.separator + - "currency.properties"); + File propFile = new File(propsFile); if (propFile.exists()) { Properties props = new Properties(); try (FileReader fr = new FileReader(propFile)) { diff --git a/src/share/classes/java/util/JapaneseImperialCalendar.java b/src/share/classes/java/util/JapaneseImperialCalendar.java index 566d59ade2c1b0596a2939c9afd486000c0fed96..11b88e68e0f2dcf413d02125f379c2d2b6318238 100644 --- a/src/share/classes/java/util/JapaneseImperialCalendar.java +++ b/src/share/classes/java/util/JapaneseImperialCalendar.java @@ -946,8 +946,9 @@ class JapaneseImperialCalendar extends Calendar { set(field, getRolledValue(internalGet(field), amount, min, max)); } + @Override 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)) { return null; } @@ -956,11 +957,12 @@ class JapaneseImperialCalendar extends Calendar { // "GanNen" is supported only in the LONG style. if (field == YEAR - && (getBaseStyle(style) == SHORT || fieldValue != 1 || get(ERA) == 0)) { + && (getBaseStyle(style) != LONG || fieldValue != 1 || get(ERA) == 0)) { 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 // try to get its name or abbreviation from the Era instance. if (name == null && field == ERA && fieldValue < eras.length) { @@ -970,27 +972,37 @@ class JapaneseImperialCalendar extends Calendar { return name; } + @Override public Map 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)) { return null; } - Map names = CalendarDataUtility.retrieveFieldValueNames("japanese", field, style, locale); + Map names; + names = CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale); // If strings[] has fewer than eras[], get more names from eras[]. - if (field == ERA) { - int size = names.size(); - if (style == ALL_STYLES) { - size /= 2; // SHORT and LONG - } - 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) { - names.put(era.getAbbreviation(), i); + if (names != null) { + if (field == ERA) { + int size = names.size(); + if (style == ALL_STYLES) { + Set values = new HashSet<>(); + // count unique era values + for (String key : names.keySet()) { + values.add(names.get(key)); } - if (baseStyle == ALL_STYLES || baseStyle == LONG) { - names.put(era.getName(), i); + size = values.size(); + } + 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); + } } } } diff --git a/src/share/classes/java/util/TimeZone.java b/src/share/classes/java/util/TimeZone.java index 13ede9c2a12acd3d994ef06932a88dc718e2faed..9d9fbcc8fd1937c773c8926ec8d141aebd2bd2e9 100644 --- a/src/share/classes/java/util/TimeZone.java +++ b/src/share/classes/java/util/TimeZone.java @@ -43,12 +43,12 @@ import java.lang.ref.SoftReference; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.concurrent.ConcurrentHashMap; -import sun.misc.SharedSecrets; import sun.misc.JavaAWTAccess; +import sun.misc.SharedSecrets; import sun.security.action.GetPropertyAction; -import sun.util.locale.provider.TimeZoneNameUtility; import sun.util.calendar.ZoneInfo; import sun.util.calendar.ZoneInfoFile; +import sun.util.locale.provider.TimeZoneNameUtility; /** * TimeZone represents a time zone offset, and also figures out daylight @@ -399,28 +399,23 @@ abstract public class TimeZone implements Serializable, Cloneable { if (style != SHORT && style != LONG) { throw new IllegalArgumentException("Illegal style: " + style); } - String id = getID(); - String[] names = getDisplayNames(id, locale); - if (names == null) { - if (id.startsWith("GMT") && id.length() > 3) { - char sign = id.charAt(3); - if (sign == '+' || sign == '-') { - return id; - } - } - int offset = getRawOffset(); - if (daylight) { - offset += getDSTSavings(); - } - return ZoneInfoFile.toCustomID(offset); + String name = TimeZoneNameUtility.retrieveDisplayName(id, daylight, style, locale); + if (name != null) { + return name; } - int index = daylight ? 3 : 1; - if (style == SHORT) { - index++; + if (id.startsWith("GMT") && id.length() > 3) { + char sign = id.charAt(3); + if (sign == '+' || sign == '-') { + return id; + } } - return names[index]; + int offset = getRawOffset(); + if (daylight) { + offset += getDSTSavings(); + } + return ZoneInfoFile.toCustomID(offset); } private static class DisplayNames { @@ -429,9 +424,12 @@ abstract public class TimeZone implements Serializable, Cloneable { // Map(key=id, value=SoftReference(Map(key=locale, value=displaynames))) private static final Map>> CACHE = new ConcurrentHashMap<>(); + + private DisplayNames() { + } } - private static final String[] getDisplayNames(String id, Locale locale) { + private static String[] getDisplayNames(String id, Locale locale) { Map>> displayNames = DisplayNames.CACHE; SoftReference> ref = displayNames.get(id); @@ -631,14 +629,14 @@ abstract public class TimeZone implements Serializable, Cloneable { } private static synchronized TimeZone setDefaultZone() { - TimeZone tz = null; + TimeZone tz; // get the time zone ID from the system properties String zoneID = AccessController.doPrivileged( new GetPropertyAction("user.timezone")); // if the time zone ID is not set (yet), perform the // platform to Java time zone ID mapping. - if (zoneID == null || zoneID.equals("")) { + if (zoneID == null || zoneID.isEmpty()) { String country = AccessController.doPrivileged( new GetPropertyAction("user.country")); String javaHome = AccessController.doPrivileged( @@ -670,8 +668,9 @@ abstract public class TimeZone implements Serializable, Cloneable { assert tz != null; final String id = zoneID; - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Void run() { System.setProperty("user.timezone", id); return null; } diff --git a/src/share/classes/java/util/TreeMap.java b/src/share/classes/java/util/TreeMap.java index 59a0eaadd7c852a6970a2a663bfe008dacf4ed8e..14d75e7187be773620b832b4a6502222e1c06e69 100644 --- a/src/share/classes/java/util/TreeMap.java +++ b/src/share/classes/java/util/TreeMap.java @@ -1759,7 +1759,7 @@ public class TreeMap public Set> entrySet() { EntrySetView es = entrySetView; - return (es != null) ? es : new AscendingEntrySetView(); + return (es != null) ? es : (entrySetView = new AscendingEntrySetView()); } TreeMap.Entry subLowest() { return absLowest(); } @@ -1840,7 +1840,7 @@ public class TreeMap public Set> entrySet() { EntrySetView es = entrySetView; - return (es != null) ? es : new DescendingEntrySetView(); + return (es != null) ? es : (entrySetView = new DescendingEntrySetView()); } TreeMap.Entry subLowest() { return absHighest(); } diff --git a/src/share/classes/java/util/logging/LogManager.java b/src/share/classes/java/util/logging/LogManager.java index 69c3504ab19f424ec34faea4967a040ec71b2eec..e3a8bf278853c0c1198dca726e5cfb0074ab50e0 100644 --- a/src/share/classes/java/util/logging/LogManager.java +++ b/src/share/classes/java/util/logging/LogManager.java @@ -31,10 +31,10 @@ import java.util.*; import java.security.*; import java.lang.ref.ReferenceQueue; 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.PropertyChangeEvent; -import java.net.URL; -import sun.security.action.GetPropertyAction; /** * There is a single global LogManager object that is used to @@ -56,20 +56,14 @@ import sun.security.action.GetPropertyAction; * At startup the LogManager class is located using the * java.util.logging.manager system property. *

- * By default, the LogManager reads its initial configuration from - * a properties file "lib/logging.properties" in the JRE directory. - * If you edit that property file you can change the default logging - * configuration for all uses of that JRE. - *

- * In addition, the LogManager uses two optional system properties that - * allow more control over reading the initial configuration: + * The LogManager defines two optional system properties that allow control over + * the initial configuration: *

    *
  • "java.util.logging.config.class" *
  • "java.util.logging.config.file" *
- * These two properties may be set via the Preferences API, or as - * command line property definitions to the "java" command, or as - * system property definitions passed to JNI_CreateJavaVM. + * These two properties may be specified on the command line to the "java" + * command, or as system property definitions passed to JNI_CreateJavaVM. *

* 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 @@ -84,9 +78,10 @@ import sun.security.action.GetPropertyAction; * to specify a properties file (in java.util.Properties format). The * initial logging configuration will be read from this file. *

- * If neither of these properties is defined then, as described - * above, the LogManager will read its initial configuration from - * a properties file "lib/logging.properties" in the JRE directory. + * If neither of these properties is defined then the LogManager uses its + * default configuration. The default configuration is typically loaded from the + * properties file "{@code lib/logging.properties}" in the Java installation + * directory. *

* The properties for loggers and Handlers will have names starting * with the dot-separated name for the handler or logger. @@ -155,7 +150,7 @@ public class LogManager { // 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. - private final Map listenerMap = new HashMap<>(); + private final Map listenerMap = new HashMap<>(); // Table of named Loggers that maps names to Loggers. private Hashtable namedLoggers = new Hashtable<>(); @@ -248,7 +243,7 @@ public class LogManager { * Protected constructor. This is protected so that container applications * (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 - * retrieved by calling Logmanager.getLogManager. + * retrieved by calling LogManager.getLogManager. */ protected LogManager() { // Add a shutdown hook to close the global handlers. @@ -976,22 +971,24 @@ public class LogManager { // 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 // locks when calling the listeners. - Map listeners = null; + Map listeners = null; synchronized (listenerMap) { if (!listenerMap.isEmpty()) listeners = new HashMap<>(listenerMap); } if (listeners != null) { - PropertyChangeEvent ev = new PropertyChangeEvent(LogManager.class, null, null, null); - for (Map.Entry entry : listeners.entrySet()) { - PropertyChangeListener listener = entry.getKey(); + assert Beans.isBeansPresent(); + Object ev = Beans.newPropertyChangeEvent(LogManager.class, null, null, null); + for (Map.Entry entry : listeners.entrySet()) { + Object listener = entry.getKey(); int count = entry.getValue().intValue(); for (int i = 0; i < count; i++) { - listener.propertyChange(ev); + Beans.invokePropertyChange(listener, ev); } } } + // Note that we need to reinitialize global handles when // they are first referenced. synchronized (this) { @@ -1274,4 +1271,100 @@ public class LogManager { 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); + } + } + } } diff --git a/src/share/classes/java/util/spi/CalendarNameProvider.java b/src/share/classes/java/util/spi/CalendarNameProvider.java index 20122cf5466a3df6ca1ae6ca14562281692be5ac..8e8d54e8ecde546388daf0aa88ffcc9ef526c6fd 100644 --- a/src/share/classes/java/util/spi/CalendarNameProvider.java +++ b/src/share/classes/java/util/spi/CalendarNameProvider.java @@ -174,7 +174,8 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider { *

{@code style} gives the style of the string representation. It is one * of {@link Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}), * {@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}. * *

For example, the following call will return {@code "Sunday"}. *

@@ -195,8 +196,10 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider {
      *              the string representation style: one of {@link
      *              Calendar#SHORT_FORMAT} ({@link Calendar#SHORT SHORT}),
      *              {@link Calendar#SHORT_STANDALONE}, {@link
-     *              Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or
-     *              {@link Calendar#LONG_STANDALONE}
+     *              Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}),
+     *              {@link Calendar#LONG_STANDALONE},
+     *              {@link Calendar#NARROW_FORMAT},
+     *              or {@link Calendar#NARROW_STANDALONE}
      * @param locale
      *              the desired locale
      * @return the string representation of the {@code field value}, or {@code
@@ -226,8 +229,11 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider {
      * 

{@code style} gives the style of the string representation. It must be * one of {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT} ({@link * Calendar#SHORT SHORT}), {@link Calendar#SHORT_STANDALONE}, {@link - * Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), or {@link - * Calendar#LONG_STANDALONE}. + * Calendar#LONG_FORMAT} ({@link Calendar#LONG LONG}), {@link + * 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. * *

For example, the following call will return a {@code Map} containing * {@code "January"} to {@link Calendar#JANUARY}, {@code "Jan"} to {@link @@ -247,8 +253,9 @@ public abstract class CalendarNameProvider extends LocaleServiceProvider { * {@link Calendar#ALL_STYLES}, {@link Calendar#SHORT_FORMAT} * ({@link Calendar#SHORT SHORT}), {@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} * @param locale * the desired locale * @return a {@code Map} containing all display names of {@code field} in diff --git a/src/share/classes/java/util/spi/TimeZoneNameProvider.java b/src/share/classes/java/util/spi/TimeZoneNameProvider.java index 730b507ca97f560ebc1d32e192f432596566630e..766c4e38463b1e77ea469840c24e4842a4ef8661 100644 --- a/src/share/classes/java/util/spi/TimeZoneNameProvider.java +++ b/src/share/classes/java/util/spi/TimeZoneNameProvider.java @@ -1,5 +1,5 @@ /* - * 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. * * This code is free software; you can redistribute it and/or modify it @@ -77,4 +77,34 @@ public abstract class TimeZoneNameProvider extends LocaleServiceProvider { * @see java.util.TimeZone#getDisplayName(boolean, int, java.util.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. + * + *

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 style is invalid, + * or locale isn't one of the locales returned from + * {@link LocaleServiceProvider#getAvailableLocales() + * getAvailableLocales()}. + * @exception NullPointerException if ID or locale + * is {@code null} + * @since 1.8 + */ + public String getGenericDisplayName(String ID, int style, Locale locale) { + return null; + } } diff --git a/src/share/classes/sun/awt/im/InputContext.java b/src/share/classes/sun/awt/im/InputContext.java index 27f05465d9505755a5a56c2bfa59f78a98e63296..1eccb6aa79256f09ceb912daf94e524d89a8d14d 100644 --- a/src/share/classes/sun/awt/im/InputContext.java +++ b/src/share/classes/sun/awt/im/InputContext.java @@ -1,5 +1,5 @@ /* - * 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. * * 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 public void disableNativeIM() { InputMethod inputMethod = getInputMethod(); if (inputMethod != null && inputMethod instanceof InputMethodAdapter) { - ((InputMethodAdapter)inputMethod).disableInputMethod(); + ((InputMethodAdapter)inputMethod).stopListening(); } } diff --git a/src/share/classes/sun/awt/im/InputMethodAdapter.java b/src/share/classes/sun/awt/im/InputMethodAdapter.java index 0b5b02837d29ab84e711e6caa211e7882fbef120..dfc31799bfb037a5a798edb943545d4dea82298b 100644 --- a/src/share/classes/sun/awt/im/InputMethodAdapter.java +++ b/src/share/classes/sun/awt/im/InputMethodAdapter.java @@ -1,5 +1,5 @@ /* - * 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. * * This code is free software; you can redistribute it and/or modify it @@ -79,7 +79,6 @@ public abstract class InputMethodAdapter implements InputMethod { /** * 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() { // ignore - adapters can override if needed diff --git a/src/share/classes/sun/net/www/MessageHeader.java b/src/share/classes/sun/net/www/MessageHeader.java index dbb2cfc7c3a0f22b6408b154f60ca3cd258eb4d0..3a46def13b3afa32d9b10594aba332e9fd656851 100644 --- a/src/share/classes/sun/net/www/MessageHeader.java +++ b/src/share/classes/sun/net/www/MessageHeader.java @@ -137,6 +137,43 @@ class MessageHeader { 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 5 + && values[i].substring(0, 5).equalsIgnoreCase("NTLM ")) { + found = true; + break; + } + } + if (found) { + int j = 0; + for (int i=0; i { int index = 0; int next = -1; diff --git a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java index 87fdaa82bf2a4e41263a2e5478d661aea6e834f3..8003b5a5433122eb3faa5470c121e4a9ad950224 100644 --- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java +++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java @@ -1326,6 +1326,16 @@ public class HttpURLConnection extends java.net.HttpURLConnection { if (logger.isLoggable(PlatformLogger.FINE)) { 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(); respCode = getResponseCode(); @@ -1784,6 +1794,13 @@ public class HttpURLConnection extends java.net.HttpURLConnection { 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); StringTokenizer st = new StringTokenizer(statusLine); st.nextToken(); diff --git a/src/share/classes/sun/nio/ch/ThreadPool.java b/src/share/classes/sun/nio/ch/ThreadPool.java index 4efcfd5304e085ae0106b19ec2cbdd7aa031f848..6a2fe42c747286ecb6ae361d63609ad785d391af 100644 --- a/src/share/classes/sun/nio/ch/ThreadPool.java +++ b/src/share/classes/sun/nio/ch/ThreadPool.java @@ -102,11 +102,7 @@ public class ThreadPool { if (threadFactory == null) threadFactory = defaultThreadFactory; // create thread pool - ExecutorService executor = - new ThreadPoolExecutor(0, Integer.MAX_VALUE, - Long.MAX_VALUE, TimeUnit.MILLISECONDS, - new SynchronousQueue(), - threadFactory); + ExecutorService executor = Executors.newCachedThreadPool(threadFactory); return new ThreadPool(executor, false, initialSize); } diff --git a/src/share/classes/sun/reflect/annotation/AnnotationSupport.java b/src/share/classes/sun/reflect/annotation/AnnotationSupport.java index a019d4b506ef50d98025fb60f6fc9e52cf35cce4..3046792b161ef923a5b7cdcade87b36c746b7fcd 100644 --- a/src/share/classes/sun/reflect/annotation/AnnotationSupport.java +++ b/src/share/classes/sun/reflect/annotation/AnnotationSupport.java @@ -37,7 +37,7 @@ import sun.reflect.Reflection; import sun.misc.JavaLangAccess; 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 @@ -104,7 +104,7 @@ public final class AnnotationSupport { /** * Unpacks the {@code annotationMap} parameter into an array of * {@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 * ContainerFor} annotation. * @@ -175,7 +175,6 @@ public final class AnnotationSupport { IllegalArgumentException | // parameters doesn't match InvocationTargetException | // the value method threw an exception ClassCastException e) { // well, a cast failed ... - e.getCause().printStackTrace(); throw new InvalidContainerAnnotationError(containerInstance + " is an invalid container for repeating annotations", e, containerInstance, diff --git a/src/share/classes/sun/security/jgss/krb5/Krb5Util.java b/src/share/classes/sun/security/jgss/krb5/Krb5Util.java index 97f1a12447cfd569b375307d2108b493f9d55701..ec5bc9ca43b30a6f0f35e20bec021d8771892b62 100644 --- a/src/share/classes/sun/security/jgss/krb5/Krb5Util.java +++ b/src/share/classes/sun/security/jgss/krb5/Krb5Util.java @@ -40,10 +40,7 @@ import sun.security.krb5.EncryptionKey; import sun.security.krb5.KrbException; import java.io.IOException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; -import java.util.Objects; -import java.util.Set; import sun.security.krb5.KerberosSecrets; import sun.security.krb5.PrincipalName; /** @@ -189,18 +186,6 @@ public class Krb5Util { 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 * identity, which can be: @@ -239,7 +224,7 @@ public class Krb5Util { // Compatibility with old behavior: even when there is no // KerberosPrincipal, we can find one from KerberosKeys List keys = SubjectComber.findMany( - subj, null, null, KerberosKey.class); + subj, serverPrincipal, null, KerberosKey.class); if (!keys.isEmpty()) { sc.kp = keys.get(0).getPrincipal(); serverPrincipal = sc.kp.getName(); @@ -255,9 +240,9 @@ public class Krb5Util { subj, null, null, KeyTab.class); sc.kk = SubjectComber.findMany( subj, serverPrincipal, null, KerberosKey.class); - sc.tgt = SubjectComber.find(subj, null, null, KerberosTicket.class); - - if (sc.ktabs.isEmpty() && sc.kk.isEmpty()) { + sc.tgt = SubjectComber.find( + subj, null, serverPrincipal, KerberosTicket.class); + if (sc.ktabs.isEmpty() && sc.kk.isEmpty() && sc.tgt == null) { return null; } return sc; @@ -268,37 +253,16 @@ public class Krb5Util { } public KerberosKey[] getKKeys() { - if (ktabs.isEmpty()) { - return kk.toArray(new KerberosKey[kk.size()]); - } else { - List keys = new ArrayList<>(); - for (KeyTab ktab: ktabs) { - for (KerberosKey k: ktab.getKeys(kp)) { - keys.add(k); - } - } - // Compatibility: also add keys to privCredSet. Remove old - // ones first, only remove those from keytab. - if (!subj.isReadOnly()) { - Set pcs = subj.getPrivateCredentials(); - synchronized (pcs) { - Iterator 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)); - } + List keys = new ArrayList<>(); + for (KerberosKey k: kk) { + keys.add(k); + } + for (KeyTab ktab: ktabs) { + for (KerberosKey k: ktab.getKeys(kp)) { + keys.add(k); } - return keys.toArray(new KerberosKey[keys.size()]); } + return keys.toArray(new KerberosKey[keys.size()]); } public EncryptionKey[] getEKeys() { diff --git a/src/share/classes/sun/security/provider/certpath/OCSP.java b/src/share/classes/sun/security/provider/certpath/OCSP.java index 365741f493233946883c6f6cbc363a5405cb4189..f57c832bfa5474b893e9587361e044be2d931a88 100644 --- a/src/share/classes/sun/security/provider/certpath/OCSP.java +++ b/src/share/classes/sun/security/provider/certpath/OCSP.java @@ -43,6 +43,7 @@ import java.util.List; import java.util.Map; import static sun.security.provider.certpath.OCSPResponse.*; +import sun.security.action.GetIntegerAction; import sun.security.util.Debug; import sun.security.util.ObjectIdentifier; import sun.security.x509.AccessDescription; @@ -69,7 +70,31 @@ public final class OCSP { 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() {} diff --git a/src/share/classes/sun/text/resources/FormatData.java b/src/share/classes/sun/text/resources/FormatData.java index 2031cb42228f9a0d4d55705cfb3b890e1f1d5bea..d6c306709a89c23d44d567da9c0d7b93d381fe1c 100644 --- a/src/share/classes/sun/text/resources/FormatData.java +++ b/src/share/classes/sun/text/resources/FormatData.java @@ -50,6 +50,20 @@ public class FormatData extends ListResourceBundle { * Overrides ListResourceBundle */ 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[][] { { "MonthNames", new String[] { @@ -107,29 +121,49 @@ public class FormatData extends ListResourceBundle { "Sat" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "T", + "W", + "T", + "F", + "S", + } + }, { "AmPmMarkers", new String[] { "AM", // am marker "PM" // pm marker } }, + { "narrow.AmPmMarkers", + new String[] { + "a", // am marker + "p" // pm marker + } + }, { "Eras", new String[] { // era strings for GregorianCalendar "BC", "AD" } }, - { "buddhist.Eras", - new String[] { // Thai Buddhist calendar era strings - "BC", // BC - "B.E." // Buddhist Era + { "narrow.Eras", + new String[] { + "B", + "A", } }, + { "buddhist.Eras", + buddhistEras + }, { "buddhist.short.Eras", - new String[] { // Thai Buddhist calendar era strings - "BC", // BC - "B.E." // Buddhist Era - } + buddhistEras + }, + { "buddhist.narrow.Eras", + buddhistEras }, { "japanese.Eras", new String[] { // Japanese imperial calendar era strings @@ -141,13 +175,10 @@ public class FormatData extends ListResourceBundle { } }, { "japanese.short.Eras", - new String[] { // Japanese imperial calendar era abbreviations - "", - "M", - "T", - "S", - "H", - } + japaneseEraAbbrs + }, + { "japanese.narrow.Eras", + japaneseEraAbbrs }, { "japanese.FirstYear", new String[] { // Japanese imperial calendar year name diff --git a/src/share/classes/sun/text/resources/ar/FormatData_ar.java b/src/share/classes/sun/text/resources/ar/FormatData_ar.java index 98b2e4e4e9edeb1bdd37743693e58af69d6f0878..a6593b0a45cb964f1a78afbf5b034548d3a7ca65 100644 --- a/src/share/classes/sun/text/resources/ar/FormatData_ar.java +++ b/src/share/classes/sun/text/resources/ar/FormatData_ar.java @@ -107,6 +107,17 @@ public class FormatData_ar extends ListResourceBundle { "\u0633" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u062d", + "\u0646", + "\u062b", + "\u0631", + "\u062e", + "\u062c", + "\u0633", + } + }, { "AmPmMarkers", new String[] { "\u0635", // am marker diff --git a/src/share/classes/sun/text/resources/be/FormatData_be.java b/src/share/classes/sun/text/resources/be/FormatData_be.java index 754532659ff59d56bca50283878818a11b0e1807..7bf6c012163db6cab54fbfb6081749a5f500dccb 100644 --- a/src/share/classes/sun/text/resources/be/FormatData_be.java +++ b/src/share/classes/sun/text/resources/be/FormatData_be.java @@ -85,6 +85,23 @@ public class FormatData_be extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "\u0441", + "\u043b", + "\u0441", + "\u043a", + "\u043c", + "\u0447", + "\u043b", + "\u0436", + "\u0432", + "\u043a", + "\u043b", + "\u0441", + "", + } + }, { "DayNames", new String[] { "\u043d\u044f\u0434\u0437\u0435\u043b\u044f", // Sunday @@ -107,6 +124,17 @@ public class FormatData_be extends ListResourceBundle { "\u0441\u0431" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0430", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { // era strings "\u0434\u0430 \u043d.\u0435.", diff --git a/src/share/classes/sun/text/resources/bg/FormatData_bg.java b/src/share/classes/sun/text/resources/bg/FormatData_bg.java index 2fe39282e3544299e9245549a2d5cd277ee6e472..2b7285eefad74fd46f334b5e9028af6b849de41a 100644 --- a/src/share/classes/sun/text/resources/bg/FormatData_bg.java +++ b/src/share/classes/sun/text/resources/bg/FormatData_bg.java @@ -107,6 +107,17 @@ public class FormatData_bg extends ListResourceBundle { "\u0421\u0431" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0432", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { // era strings "\u043f\u0440.\u043d.\u0435.", diff --git a/src/share/classes/sun/text/resources/ca/FormatData_ca.java b/src/share/classes/sun/text/resources/ca/FormatData_ca.java index 2f9cf3967d3ce1ff9ded2c7daea5e35d1dc83cec..d6774dbacb66bc789a63f15051b1b66da3502bef 100644 --- a/src/share/classes/sun/text/resources/ca/FormatData_ca.java +++ b/src/share/classes/sun/text/resources/ca/FormatData_ca.java @@ -119,6 +119,23 @@ public class FormatData_ca extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "g", + "f", + "m", + "a", + "m", + "j", + "j", + "a", + "s", + "o", + "n", + "d", + "", + } + }, { "DayNames", new String[] { "diumenge", // Sunday @@ -141,6 +158,28 @@ public class FormatData_ca extends ListResourceBundle { "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", new String[] { ",", // decimal separator diff --git a/src/share/classes/sun/text/resources/cs/FormatData_cs.java b/src/share/classes/sun/text/resources/cs/FormatData_cs.java index 2bbc8c03bdf016be3d7e11cf1dd65e4119a971fd..e0d34098b0990652d76bb479fcffc29ccf0e250e 100644 --- a/src/share/classes/sun/text/resources/cs/FormatData_cs.java +++ b/src/share/classes/sun/text/resources/cs/FormatData_cs.java @@ -141,6 +141,17 @@ public class FormatData_cs extends ListResourceBundle { "So" // abb Saturday } }, + { "DayNarrows", + new String[] { + "N", + "P", + "\u00da", + "S", + "\u010c", + "P", + "S", + } + }, { "AmPmMarkers", new String[] { "dop.", // am marker diff --git a/src/share/classes/sun/text/resources/da/FormatData_da.java b/src/share/classes/sun/text/resources/da/FormatData_da.java index d9535cf551e6aa9bb8385945de7f4a33a5d559ed..2686877c0a377a854d7864fdd003b960985b258d 100644 --- a/src/share/classes/sun/text/resources/da/FormatData_da.java +++ b/src/share/classes/sun/text/resources/da/FormatData_da.java @@ -124,6 +124,17 @@ public class FormatData_da extends ListResourceBundle { "l\u00f8" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "T", + "O", + "T", + "F", + "L", + } + }, { "NumberElements", new String[] { ",", // decimal separator diff --git a/src/share/classes/sun/text/resources/de/FormatData_de.java b/src/share/classes/sun/text/resources/de/FormatData_de.java index d2fe2f22190a37f071cb667fbb9768f71c8af53e..3f55bb20ba6361e6b440ecd142f5f761003fb8f0 100644 --- a/src/share/classes/sun/text/resources/de/FormatData_de.java +++ b/src/share/classes/sun/text/resources/de/FormatData_de.java @@ -124,6 +124,17 @@ public class FormatData_de extends ListResourceBundle { "Sa" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "M", + "D", + "M", + "D", + "F", + "S", + } + }, { "Eras", new String[] { // era strings "v. Chr.", diff --git a/src/share/classes/sun/text/resources/el/FormatData_el.java b/src/share/classes/sun/text/resources/el/FormatData_el.java index 49e0602f525f7605355dac1cf68f5a683c830f68..fd91ad2aea3ceb3fcd0f8457cf2d49298262e2c2 100644 --- a/src/share/classes/sun/text/resources/el/FormatData_el.java +++ b/src/share/classes/sun/text/resources/el/FormatData_el.java @@ -124,6 +124,17 @@ public class FormatData_el extends ListResourceBundle { "\u03a3\u03b1\u03b2" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u039a", + "\u0394", + "\u03a4", + "\u03a4", + "\u03a0", + "\u03a0", + "\u03a3", + } + }, { "AmPmMarkers", new String[] { "\u03c0\u03bc", // am marker diff --git a/src/share/classes/sun/text/resources/es/FormatData_es.java b/src/share/classes/sun/text/resources/es/FormatData_es.java index 3ee44ba042b19fe7ef49af70a5d99265f9b54a9b..f19685dd83d02b47561004b573127a9ecdb3d334 100644 --- a/src/share/classes/sun/text/resources/es/FormatData_es.java +++ b/src/share/classes/sun/text/resources/es/FormatData_es.java @@ -104,6 +104,17 @@ public class FormatData_es extends ListResourceBundle { "s\u00e1b" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "L", + "M", + "X", + "J", + "V", + "S", + } + }, { "NumberPatterns", new String[] { "#,##0.###;-#,##0.###", // decimal pattern diff --git a/src/share/classes/sun/text/resources/et/FormatData_et.java b/src/share/classes/sun/text/resources/et/FormatData_et.java index 90f4dcc7daad3888f242f9b121dabc2e6f2a0c20..844b8af42851d641f710703079048c93ed678f5d 100644 --- a/src/share/classes/sun/text/resources/et/FormatData_et.java +++ b/src/share/classes/sun/text/resources/et/FormatData_et.java @@ -104,6 +104,17 @@ public class FormatData_et extends ListResourceBundle { "L" // abb Saturday } }, + { "DayNarrows", + new String[] { + "P", + "E", + "T", + "K", + "N", + "R", + "L", + } + }, { "Eras", new String[] { // era strings "e.m.a.", diff --git a/src/share/classes/sun/text/resources/fi/FormatData_fi.java b/src/share/classes/sun/text/resources/fi/FormatData_fi.java index d8a610d60568ab7db803814dd49a1bdc01a58a55..91c5ea9a57a0c2be05ffaea1deeef8ade35b903f 100644 --- a/src/share/classes/sun/text/resources/fi/FormatData_fi.java +++ b/src/share/classes/sun/text/resources/fi/FormatData_fi.java @@ -116,6 +116,23 @@ public class FormatData_fi extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "T", + "H", + "M", + "H", + "T", + "K", + "H", + "E", + "S", + "L", + "M", + "J", + "", + } + }, { "DayNames", new String[] { "sunnuntai", // Sunday @@ -138,6 +155,28 @@ public class FormatData_fi extends ListResourceBundle { "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", new String[] { ",", // decimal separator @@ -181,6 +220,12 @@ public class FormatData_fi extends ListResourceBundle { "ip." // pm marker } }, + { "narrow.AmPmMarkers", + new String[] { + "ap.", + "ip.", + } + }, }; } } diff --git a/src/share/classes/sun/text/resources/fr/FormatData_fr.java b/src/share/classes/sun/text/resources/fr/FormatData_fr.java index de857d7c8799913aa686e3949881fe7caaf5eccb..f0354ec1066eacbfe1ea6837e7beb1019faa081c 100644 --- a/src/share/classes/sun/text/resources/fr/FormatData_fr.java +++ b/src/share/classes/sun/text/resources/fr/FormatData_fr.java @@ -104,6 +104,17 @@ public class FormatData_fr extends ListResourceBundle { "sam." // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "L", + "M", + "M", + "J", + "V", + "S", + } + }, { "Eras", new String[] { // era strings "BC", diff --git a/src/share/classes/sun/text/resources/hi/FormatData_hi_IN.java b/src/share/classes/sun/text/resources/hi/FormatData_hi_IN.java index b6c1647275f12b112b91f2d3689308c8e1c655e3..7f1deb81c3a64b78acff7cc3474b55649c2e58f2 100644 --- a/src/share/classes/sun/text/resources/hi/FormatData_hi_IN.java +++ b/src/share/classes/sun/text/resources/hi/FormatData_hi_IN.java @@ -99,6 +99,17 @@ public class FormatData_hi_IN extends ListResourceBundle { "\u0936\u0928\u093f" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u0930", + "\u0938\u094b", + "\u092e\u0902", + "\u092c\u0941", + "\u0917\u0941", + "\u0936\u0941", + "\u0936", + } + }, { "AmPmMarkers", new String[] { "\u092a\u0942\u0930\u094d\u0935\u093e\u0939\u094d\u0928", // am marker diff --git a/src/share/classes/sun/text/resources/hr/FormatData_hr.java b/src/share/classes/sun/text/resources/hr/FormatData_hr.java index 635b3b97ff2db05a8a6f47db4232b84e80c42f4f..cec08671ca18b0cfcbcc3730cdfa23d7ab3a7086 100644 --- a/src/share/classes/sun/text/resources/hr/FormatData_hr.java +++ b/src/share/classes/sun/text/resources/hr/FormatData_hr.java @@ -116,6 +116,23 @@ public class FormatData_hr extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "1.", + "2.", + "3.", + "4.", + "5.", + "6.", + "7.", + "8.", + "9.", + "10.", + "11.", + "12.", + "", + } + }, { "DayNames", new String[] { "nedjelja", // Sunday @@ -138,6 +155,28 @@ public class FormatData_hr extends ListResourceBundle { "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", new String[] { ",", // decimal separator diff --git a/src/share/classes/sun/text/resources/hu/FormatData_hu.java b/src/share/classes/sun/text/resources/hu/FormatData_hu.java index a1ab3906f44dae4d6514d93a8122f30d94fe0a1e..0f00a40aa5fafd5f5ec423068df85834b616f5d4 100644 --- a/src/share/classes/sun/text/resources/hu/FormatData_hu.java +++ b/src/share/classes/sun/text/resources/hu/FormatData_hu.java @@ -104,6 +104,17 @@ public class FormatData_hu extends ListResourceBundle { "Szo" // abb Saturday } }, + { "DayNarrows", + new String[] { + "V", + "H", + "K", + "Sz", + "Cs", + "P", + "Sz", + } + }, { "AmPmMarkers", new String[] { "DE", // am marker diff --git a/src/share/classes/sun/text/resources/is/FormatData_is.java b/src/share/classes/sun/text/resources/is/FormatData_is.java index 9a3e0ff21cbc16a5dce22d5c5c282a2ce23a2620..6b6d92c64211319cfaaf5e0b8f7c71f4748b1623 100644 --- a/src/share/classes/sun/text/resources/is/FormatData_is.java +++ b/src/share/classes/sun/text/resources/is/FormatData_is.java @@ -82,6 +82,23 @@ public class FormatData_is extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "j", + "f", + "m", + "a", + "m", + "j", + "j", + "\u00e1", + "s", + "o", + "n", + "d", + "", + } + }, { "DayNames", new String[] { "sunnudagur", // Sunday @@ -104,6 +121,28 @@ public class FormatData_is extends ListResourceBundle { "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", new String[] { ",", // decimal separator diff --git a/src/share/classes/sun/text/resources/it/FormatData_it.java b/src/share/classes/sun/text/resources/it/FormatData_it.java index a9843cca23da2a3aa2f0b673e8b53b39f957bbc1..5b3fa9ca82e05c8cd6b61aade969a28786248f3e 100644 --- a/src/share/classes/sun/text/resources/it/FormatData_it.java +++ b/src/share/classes/sun/text/resources/it/FormatData_it.java @@ -121,6 +121,17 @@ public class FormatData_it extends ListResourceBundle { "sab" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "L", + "M", + "M", + "G", + "V", + "S", + } + }, { "Eras", new String[] { // era strings "BC", diff --git a/src/share/classes/sun/text/resources/iw/FormatData_iw.java b/src/share/classes/sun/text/resources/iw/FormatData_iw.java index cfadcdfbf9310064915300069e50f3743eb2d28c..80fb1ac4b83053124e3e709038b264a62391a591 100644 --- a/src/share/classes/sun/text/resources/iw/FormatData_iw.java +++ b/src/share/classes/sun/text/resources/iw/FormatData_iw.java @@ -121,6 +121,28 @@ public class FormatData_iw extends ListResourceBundle { "\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", new String[] { // era strings "\u05dc\u05e1\u05d4\"\u05e0", diff --git a/src/share/classes/sun/text/resources/ja/FormatData_ja.java b/src/share/classes/sun/text/resources/ja/FormatData_ja.java index 6217d5a4a168049a8caebbea2a32e8c883b75eb7..a45992952ea490ced4ac715a478706f6a8a4e8bc 100644 --- a/src/share/classes/sun/text/resources/ja/FormatData_ja.java +++ b/src/share/classes/sun/text/resources/ja/FormatData_ja.java @@ -104,6 +104,17 @@ public class FormatData_ja extends ListResourceBundle { "\u571f" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u65e5", + "\u6708", + "\u706b", + "\u6c34", + "\u6728", + "\u91d1", + "\u571f", + } + }, { "AmPmMarkers", new String[] { "\u5348\u524d", // am marker diff --git a/src/share/classes/sun/text/resources/ko/FormatData_ko.java b/src/share/classes/sun/text/resources/ko/FormatData_ko.java index b574bfba890e03ebb434ee42f19e4066f4b985e9..fc8badb82bfb7dbfb8dca3258bd689702513a576 100644 --- a/src/share/classes/sun/text/resources/ko/FormatData_ko.java +++ b/src/share/classes/sun/text/resources/ko/FormatData_ko.java @@ -104,6 +104,17 @@ public class FormatData_ko extends ListResourceBundle { "\ud1a0" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\uc77c", + "\uc6d4", + "\ud654", + "\uc218", + "\ubaa9", + "\uae08", + "\ud1a0", + } + }, { "AmPmMarkers", new String[] { "\uc624\uc804", // am marker diff --git a/src/share/classes/sun/text/resources/lt/FormatData_lt.java b/src/share/classes/sun/text/resources/lt/FormatData_lt.java index 6fdb6c1085801b22cd24191a3823f7a892128762..9e949ecf5634e88857ceb2026007621504e29aba 100644 --- a/src/share/classes/sun/text/resources/lt/FormatData_lt.java +++ b/src/share/classes/sun/text/resources/lt/FormatData_lt.java @@ -99,6 +99,23 @@ public class FormatData_lt extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "S", + "V", + "K", + "B", + "G", + "B", + "L", + "R", + "R", + "S", + "L", + "G", + "", + } + }, { "DayNames", new String[] { "Sekmadienis", // Sunday @@ -121,6 +138,28 @@ public class FormatData_lt extends ListResourceBundle { "\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", new String[] { // era strings "pr.Kr.", diff --git a/src/share/classes/sun/text/resources/lv/FormatData_lv.java b/src/share/classes/sun/text/resources/lv/FormatData_lv.java index e1aadceb01b069a0575ec02b1c4391e5fbb97e5f..ff9eb470d4b9ee9ec464431697c2a43395ac6cad 100644 --- a/src/share/classes/sun/text/resources/lv/FormatData_lv.java +++ b/src/share/classes/sun/text/resources/lv/FormatData_lv.java @@ -121,6 +121,17 @@ public class FormatData_lv extends ListResourceBundle { "S" // abb Saturday } }, + { "DayNarrows", + new String[] { + "S", + "P", + "O", + "T", + "C", + "P", + "S", + } + }, { "Eras", new String[] { // era strings "pm\u0113", diff --git a/src/share/classes/sun/text/resources/mk/FormatData_mk.java b/src/share/classes/sun/text/resources/mk/FormatData_mk.java index ba42eeb0ae930d62b10ad89a73137bbfd8d019d3..cd09d3ef1ee267b062ae1f9d7898ac4763812bd7 100644 --- a/src/share/classes/sun/text/resources/mk/FormatData_mk.java +++ b/src/share/classes/sun/text/resources/mk/FormatData_mk.java @@ -104,6 +104,17 @@ public class FormatData_mk extends ListResourceBundle { "\u0441\u0430\u0431." // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0432", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { // era strings "\u043f\u0440.\u043d.\u0435.", diff --git a/src/share/classes/sun/text/resources/ms/FormatData_ms.java b/src/share/classes/sun/text/resources/ms/FormatData_ms.java index e3936d86fe95d359e2d1e045479c9df7a6167dba..13a8d51dd1d4ccd27f8a48e520ee5915ca2db209 100644 --- a/src/share/classes/sun/text/resources/ms/FormatData_ms.java +++ b/src/share/classes/sun/text/resources/ms/FormatData_ms.java @@ -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", new String[] { "Ahad", @@ -103,6 +120,28 @@ public class FormatData_ms extends ListResourceBundle { "Sab", } }, + { "DayNarrows", + new String[] { + "A", + "I", + "S", + "R", + "K", + "J", + "S", + } + }, + { "standalone.DayNarrows", + new String[] { + "A", + "I", + "S", + "R", + "K", + "J", + "S", + } + }, { "Eras", new String[] { "BCE", diff --git a/src/share/classes/sun/text/resources/mt/FormatData_mt.java b/src/share/classes/sun/text/resources/mt/FormatData_mt.java index 49751272506a8caaaa1f885d4fb26abb25adde6f..4ef0957eba59c28bbd7ab86346c8eefb2fdc2fa0 100644 --- a/src/share/classes/sun/text/resources/mt/FormatData_mt.java +++ b/src/share/classes/sun/text/resources/mt/FormatData_mt.java @@ -103,6 +103,17 @@ public class FormatData_mt extends ListResourceBundle { "Sib", } }, + { "DayNarrows", + new String[] { + "\u0126", + "T", + "T", + "E", + "\u0126", + "\u0120", + "S", + } + }, { "AmPmMarkers", new String[] { "QN", diff --git a/src/share/classes/sun/text/resources/nl/FormatData_nl.java b/src/share/classes/sun/text/resources/nl/FormatData_nl.java index 4d041dd46fd061eedf553045ae88f0c69f554c5e..78b937c2d646b963695b3322a71dc4ab1e372545 100644 --- a/src/share/classes/sun/text/resources/nl/FormatData_nl.java +++ b/src/share/classes/sun/text/resources/nl/FormatData_nl.java @@ -104,6 +104,17 @@ public class FormatData_nl extends ListResourceBundle { "za" // abb Saturday } }, + { "DayNarrows", + new String[] { + "Z", + "M", + "D", + "W", + "D", + "V", + "Z", + } + }, { "Eras", new String[] { // era strings for GregorianCalendar "v. Chr.", diff --git a/src/share/classes/sun/text/resources/pl/FormatData_pl.java b/src/share/classes/sun/text/resources/pl/FormatData_pl.java index 3e52ed187da1f15c6bcbfbeca9d6950caf0a9e20..824645ef0db74bc41d6a1312ecf3e817d6e22070 100644 --- a/src/share/classes/sun/text/resources/pl/FormatData_pl.java +++ b/src/share/classes/sun/text/resources/pl/FormatData_pl.java @@ -121,6 +121,17 @@ public class FormatData_pl extends ListResourceBundle { "So" // abb Saturday } }, + { "DayNarrows", + new String[] { + "N", + "P", + "W", + "\u015a", + "C", + "P", + "S", + } + }, { "Eras", new String[] { // era strings "p.n.e.", diff --git a/src/share/classes/sun/text/resources/pt/FormatData_pt.java b/src/share/classes/sun/text/resources/pt/FormatData_pt.java index e926701019abc85d5d4d3f01ce13f35e2160cf71..4a0de29ad5492d1d3822e4a17c37a817b6235b8e 100644 --- a/src/share/classes/sun/text/resources/pt/FormatData_pt.java +++ b/src/share/classes/sun/text/resources/pt/FormatData_pt.java @@ -104,6 +104,17 @@ public class FormatData_pt extends ListResourceBundle { "S\u00e1b" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "S", + "T", + "Q", + "Q", + "S", + "S", + } + }, { "NumberElements", new String[] { ",", // decimal al separator diff --git a/src/share/classes/sun/text/resources/ro/FormatData_ro.java b/src/share/classes/sun/text/resources/ro/FormatData_ro.java index 49a0cb13e89165e0a011c4862b1e959b74b4450d..c28502c107228e98b3a0794bd38d4e9367ca20dc 100644 --- a/src/share/classes/sun/text/resources/ro/FormatData_ro.java +++ b/src/share/classes/sun/text/resources/ro/FormatData_ro.java @@ -82,6 +82,23 @@ public class FormatData_ro extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "I", + "F", + "M", + "A", + "M", + "I", + "I", + "A", + "S", + "O", + "N", + "D", + "", + } + }, { "DayNames", new String[] { "duminic\u0103", // Sunday @@ -104,6 +121,29 @@ public class FormatData_ro extends ListResourceBundle { "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", new String[] { // era strings "d.C.", diff --git a/src/share/classes/sun/text/resources/ru/FormatData_ru.java b/src/share/classes/sun/text/resources/ru/FormatData_ru.java index 2eb144aee66d2cacd28245b8d1c8323a457feea4..820bf53497f8506ba1346f59bc41baae11a0d765 100644 --- a/src/share/classes/sun/text/resources/ru/FormatData_ru.java +++ b/src/share/classes/sun/text/resources/ru/FormatData_ru.java @@ -138,6 +138,28 @@ public class FormatData_ru extends ListResourceBundle { "\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", new String[] { // era strings "\u0434\u043e \u043d.\u044d.", diff --git a/src/share/classes/sun/text/resources/sk/FormatData_sk.java b/src/share/classes/sun/text/resources/sk/FormatData_sk.java index 38787ad81b07e5407fbc12e5232eaf6ebd04489a..110985614a9699e08913f7453881db97d28cafe0 100644 --- a/src/share/classes/sun/text/resources/sk/FormatData_sk.java +++ b/src/share/classes/sun/text/resources/sk/FormatData_sk.java @@ -138,6 +138,17 @@ public class FormatData_sk extends ListResourceBundle { "So" // abb Saturday } }, + { "DayNarrows", + new String[] { + "N", + "P", + "U", + "S", + "\u0160", + "P", + "S", + } + }, { "Eras", new String[] { // era strings "pred n.l.", diff --git a/src/share/classes/sun/text/resources/sl/FormatData_sl.java b/src/share/classes/sun/text/resources/sl/FormatData_sl.java index 65be14ab2c6be39689e6600bee3fb0082a8fda67..34ce565af9c2b95d57cd9d3d68546f0677e98c8c 100644 --- a/src/share/classes/sun/text/resources/sl/FormatData_sl.java +++ b/src/share/classes/sun/text/resources/sl/FormatData_sl.java @@ -121,6 +121,17 @@ public class FormatData_sl extends ListResourceBundle { "Sob" // abb Saturday } }, + { "DayNarrows", + new String[] { + "n", + "p", + "t", + "s", + "\u010d", + "p", + "s", + } + }, { "Eras", new String[] { // era strings "pr.n.\u0161.", diff --git a/src/share/classes/sun/text/resources/sq/FormatData_sq.java b/src/share/classes/sun/text/resources/sq/FormatData_sq.java index b7f4038cb9bf916819d60f216cb1d2c232deca08..0984bb613b1c3b3371b4556d63a1a0816f82bb25 100644 --- a/src/share/classes/sun/text/resources/sq/FormatData_sq.java +++ b/src/share/classes/sun/text/resources/sq/FormatData_sq.java @@ -104,6 +104,17 @@ public class FormatData_sq extends ListResourceBundle { "Sht" // abb Saturday } }, + { "DayNarrows", + new String[] { + "D", + "H", + "M", + "M", + "E", + "P", + "S", + } + }, { "AmPmMarkers", new String[] { "PD", // am marker diff --git a/src/share/classes/sun/text/resources/sr/FormatData_sr.java b/src/share/classes/sun/text/resources/sr/FormatData_sr.java index fb96b66f60e272a70e5c30a64c50f62feee48680..d331a8d9a3f8cb3433e7e2d046d3649461cb8df7 100644 --- a/src/share/classes/sun/text/resources/sr/FormatData_sr.java +++ b/src/share/classes/sun/text/resources/sr/FormatData_sr.java @@ -103,12 +103,35 @@ public class FormatData_sr extends ListResourceBundle { "\u0441\u0443\u0431", } }, + { "DayNarrows", + new String[] { + "\u043d", + "\u043f", + "\u0443", + "\u0441", + "\u0447", + "\u043f", + "\u0441", + } + }, { "Eras", new String[] { "\u043f. \u043d. \u0435.", "\u043d. \u0435", } }, + { "short.Eras", + new String[] { + "\u043f. \u043d. \u0435.", + "\u043d. \u0435.", + } + }, + { "narrow.Eras", + new String[] { + "\u043f.\u043d.\u0435.", + "\u043d.\u0435.", + } + }, { "NumberPatterns", new String[] { "#,##0.###", diff --git a/src/share/classes/sun/text/resources/sv/FormatData_sv.java b/src/share/classes/sun/text/resources/sv/FormatData_sv.java index a7aca447af88759119441ec8bb136a7f88999919..7368a49c0eaac61541c3343371ecfd65323eb1f8 100644 --- a/src/share/classes/sun/text/resources/sv/FormatData_sv.java +++ b/src/share/classes/sun/text/resources/sv/FormatData_sv.java @@ -82,6 +82,23 @@ public class FormatData_sv extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "J", + "F", + "M", + "A", + "M", + "J", + "J", + "A", + "S", + "O", + "N", + "D", + "", + } + }, { "DayNames", new String[] { "s\u00f6ndag", // Sunday @@ -104,12 +121,46 @@ public class FormatData_sv extends ListResourceBundle { "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", new String[] { "fm", // am marker "em" // pm marker } }, + { "narrow.AmPmMarkers", + new String[] { + "f", + "e", + } + }, { "NumberElements", new String[] { ",", // decimal separator diff --git a/src/share/classes/sun/text/resources/th/FormatData_th.java b/src/share/classes/sun/text/resources/th/FormatData_th.java index 4313b905fb12e9f430feb778ff51fb45ec5bbb50..bec15d101914a554f4325e914b40f686124e5b62 100644 --- a/src/share/classes/sun/text/resources/th/FormatData_th.java +++ b/src/share/classes/sun/text/resources/th/FormatData_th.java @@ -99,6 +99,23 @@ public class FormatData_th extends ListResourceBundle { "" // 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", new String[] { "\u0e27\u0e31\u0e19\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c", // Sunday @@ -121,6 +138,17 @@ public class FormatData_th extends ListResourceBundle { "\u0e2a." // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u0e2d", + "\u0e08", + "\u0e2d", + "\u0e1e", + "\u0e1e", + "\u0e28", + "\u0e2a", + } + }, { "AmPmMarkers", new String[] { "\u0e01\u0e48\u0e2d\u0e19\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07", // am marker @@ -145,6 +173,12 @@ public class FormatData_th extends ListResourceBundle { "\u0e04.\u0e28." } }, + { "narrow.Eras", + new String[] { + "\u0e01\u0e48\u0e2d\u0e19 \u0e04.\u0e28.", + "\u0e04.\u0e28.", + } + }, { "buddhist.TimePatterns", timePatterns }, diff --git a/src/share/classes/sun/text/resources/tr/FormatData_tr.java b/src/share/classes/sun/text/resources/tr/FormatData_tr.java index 9df7ac1e57829e956445ba90cfc3420db0cbe972..2be1b12f588fbab049b798ef1ccbe7380ab00afb 100644 --- a/src/share/classes/sun/text/resources/tr/FormatData_tr.java +++ b/src/share/classes/sun/text/resources/tr/FormatData_tr.java @@ -82,6 +82,23 @@ public class FormatData_tr extends ListResourceBundle { "" // abb month 13 if applicable } }, + { "standalone.MonthNarrows", + new String[] { + "O", + "\u015e", + "M", + "N", + "M", + "H", + "T", + "A", + "E", + "E", + "K", + "A", + "", + } + }, { "DayNames", new String[] { "Pazar", // Sunday @@ -104,6 +121,17 @@ public class FormatData_tr extends ListResourceBundle { "Cmt" // abb Saturday } }, + { "DayNarrows", + new String[] { + "P", + "P", + "S", + "\u00c7", + "P", + "C", + "C", + } + }, { "NumberPatterns", new String[] { "#,##0.###;-#,##0.###", // decimal pattern diff --git a/src/share/classes/sun/text/resources/uk/FormatData_uk.java b/src/share/classes/sun/text/resources/uk/FormatData_uk.java index d9514e0513707e2bca95e79fc347ca279496ecd4..7aa0e0c451b6b5f1fc11d832c2fdde68e48ba31d 100644 --- a/src/share/classes/sun/text/resources/uk/FormatData_uk.java +++ b/src/share/classes/sun/text/resources/uk/FormatData_uk.java @@ -138,6 +138,17 @@ public class FormatData_uk extends ListResourceBundle { "\u0441\u0431" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u041d", + "\u041f", + "\u0412", + "\u0421", + "\u0427", + "\u041f", + "\u0421", + } + }, { "Eras", new String[] { // era strings "\u0434\u043e \u043d.\u0435.", diff --git a/src/share/classes/sun/text/resources/vi/FormatData_vi.java b/src/share/classes/sun/text/resources/vi/FormatData_vi.java index c5e43eedea19174f27d58bbcc13ab9a62338862d..fd892d96606f117af8930b00229aec9f1d0238fa 100644 --- a/src/share/classes/sun/text/resources/vi/FormatData_vi.java +++ b/src/share/classes/sun/text/resources/vi/FormatData_vi.java @@ -106,6 +106,17 @@ public class FormatData_vi extends ListResourceBundle { "Th 7" // abb Saturday } }, + { "DayNarrows", + new String[] { + "CN", + "T2", + "T3", + "T4", + "T5", + "T6", + "T7", + } + }, { "AmPmMarkers", new String[] { "SA", // am marker diff --git a/src/share/classes/sun/text/resources/zh/FormatData_zh.java b/src/share/classes/sun/text/resources/zh/FormatData_zh.java index 57bf686d7f18aee176991069bf656a919d32861f..57dbe2a0c61eaeb61e381c01d0fc76058aeef862 100644 --- a/src/share/classes/sun/text/resources/zh/FormatData_zh.java +++ b/src/share/classes/sun/text/resources/zh/FormatData_zh.java @@ -82,6 +82,23 @@ public class FormatData_zh extends ListResourceBundle { "" // 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", new String[] { "\u661f\u671f\u65e5", // Sunday @@ -104,6 +121,17 @@ public class FormatData_zh extends ListResourceBundle { "\u661f\u671f\u516d" // abb Saturday } }, + { "DayNarrows", + new String[] { + "\u65e5", + "\u4e00", + "\u4e8c", + "\u4e09", + "\u56db", + "\u4e94", + "\u516d", + } + }, { "AmPmMarkers", new String[] { "\u4e0a\u5348", // am marker diff --git a/src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java b/src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java index e84113463948609187013fa1e466a8a45e616e60..77f7b843d64b1b47cfea62f607ca10a2645bfeef 100644 --- a/src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java +++ b/src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java @@ -88,11 +88,6 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter { return null; } - @Override - public TimeZoneNameProvider getTimeZoneNameProvider() { - return null; - } - @Override public Locale[] getAvailableLocales() { Set all = createLanguageTagSet("All"); diff --git a/src/share/classes/sun/util/locale/provider/CalendarDataUtility.java b/src/share/classes/sun/util/locale/provider/CalendarDataUtility.java index e86e27234bd0d7225743c08ec39cebda9d30c5ae..f181c98d6552d1ad2b14a2d31daa5fed319d7ae3 100644 --- a/src/share/classes/sun/util/locale/provider/CalendarDataUtility.java +++ b/src/share/classes/sun/util/locale/provider/CalendarDataUtility.java @@ -25,7 +25,6 @@ package sun.util.locale.provider; -import java.util.Calendar; import static java.util.Calendar.*; import java.util.Locale; import java.util.Map; diff --git a/src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java b/src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java index 1f262a8445a0ae547a158f721f6b22e7771013c3..20be38607f8aee906eee5f0c258ed75df5e9651c 100644 --- a/src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java +++ b/src/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java @@ -52,7 +52,7 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av @Override public String getDisplayName(String calendarType, int field, int value, int style, Locale locale) { String name = null; - String key = getKey(calendarType, field, style); + String key = getResourceKey(calendarType, field, style); if (key != null) { ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getDateFormatData(locale); if (rb.containsKey(key)) { @@ -64,9 +64,10 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av name = strings[value]; // If name is empty in standalone, try its `format' style. if (name.length() == 0 - && (style == SHORT_STANDALONE || style == LONG_STANDALONE)) { + && (style == SHORT_STANDALONE || style == LONG_STANDALONE + || style == NARROW_STANDALONE)) { name = getDisplayName(calendarType, field, value, - style == SHORT_STANDALONE ? SHORT_FORMAT : LONG_FORMAT, + getBaseStyle(style), locale); } } @@ -75,15 +76,17 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av return name; } + private static int[] REST_OF_STYLES = { + SHORT_STANDALONE, LONG_FORMAT, LONG_STANDALONE, + NARROW_FORMAT, NARROW_STANDALONE + }; @Override public Map getDisplayNames(String calendarType, int field, int style, Locale locale) { Map names; if (style == ALL_STYLES) { names = getDisplayNamesImpl(calendarType, field, SHORT_FORMAT, locale); - if (field != AM_PM) { - for (int st : new int[] { SHORT_STANDALONE, LONG_FORMAT, LONG_STANDALONE }) { - names.putAll(getDisplayNamesImpl(calendarType, field, st, locale)); - } + for (int st : REST_OF_STYLES) { + names.putAll(getDisplayNamesImpl(calendarType, field, st, locale)); } } else { // specific style @@ -94,26 +97,28 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av private Map getDisplayNamesImpl(String calendarType, int field, int style, Locale locale) { - String key = getKey(calendarType, field, style); + String key = getResourceKey(calendarType, field, style); Map map = new TreeMap<>(LengthBasedComparator.INSTANCE); if (key != null) { ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getDateFormatData(locale); if (rb.containsKey(key)) { String[] strings = rb.getStringArray(key); - if (field == YEAR) { - if (strings.length > 0) { - map.put(strings[0], 1); - } - } else { - int base = (field == DAY_OF_WEEK) ? 1 : 0; - for (int i = 0; i < strings.length; i++) { - String name = strings[i]; - // Ignore any empty string (some standalone month names - // are not defined) - if (name.length() == 0) { - continue; + if (!hasDuplicates(strings)) { + if (field == YEAR) { + if (strings.length > 0) { + map.put(strings[0], 1); + } + } else { + int base = (field == DAY_OF_WEEK) ? 1 : 0; + for (int i = 0; i < strings.length; i++) { + String name = strings[i]; + // Ignore any empty string (some standalone month names + // are not defined) + 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 return map; } + private int getBaseStyle(int style) { + return style & ~(SHORT_STANDALONE - SHORT_FORMAT); + } + /** * Comparator implementation for TreeMap which iterates keys from longest * to shortest. @@ -180,55 +189,92 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av return langtags; } - private int getIntData(String key, Locale locale) { - ResourceBundle rb = LocaleProviderAdapter.forType(type).getLocaleData().getCalendarData(locale); - if (rb.containsKey(key)) { - String firstday = rb.getString(key); - return Integer.parseInt(firstday); + private boolean hasDuplicates(String[] strings) { + int len = strings.length; + for (int i = 0; i < len - 1; i++) { + String a = strings[i]; + 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 0; + return false; } - private String getKey(String type, int field, int style) { - boolean standalone = (style & 0x8000) != 0; - style &= ~0x8000; + private String getResourceKey(String type, int field, int style) { + int baseStyle = getBaseStyle(style); + boolean isStandalone = (style != baseStyle); if ("gregory".equals(type)) { type = null; } - + boolean isNarrow = (baseStyle == NARROW_FORMAT); StringBuilder key = new StringBuilder(); switch (field) { case ERA: if (type != null) { key.append(type).append('.'); } - if (style == SHORT) { - key.append("short."); + if (isNarrow) { + 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"); break; case YEAR: - key.append(type).append(".FirstYear"); + if (!isNarrow) { + key.append(type).append(".FirstYear"); + } break; case MONTH: - if (standalone) { + if (isStandalone) { key.append("standalone."); } - key.append(style == SHORT ? "MonthAbbreviations" : "MonthNames"); + key.append("Month").append(toStyleName(baseStyle)); break; 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; case AM_PM: + if (isNarrow) { + key.append("narrow."); + } key.append("AmPmMarkers"); break; } 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"; + } } diff --git a/src/share/classes/sun/util/locale/provider/LocaleResources.java b/src/share/classes/sun/util/locale/provider/LocaleResources.java index 16aae9ac4239614f1222a78c617311b79f021e52..ff389f61b35fe9e6bfb006eacf9527723069d16e 100644 --- a/src/share/classes/sun/util/locale/provider/LocaleResources.java +++ b/src/share/classes/sun/util/locale/provider/LocaleResources.java @@ -46,7 +46,7 @@ import java.util.Locale; import java.util.ResourceBundle; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import sun.util.resources.OpenListResourceBundle; +import sun.util.resources.TimeZoneNamesBundle; /** * Central accessor to locale-dependent resources. @@ -67,13 +67,13 @@ public class LocaleResources { this.locale = locale; } - public OpenListResourceBundle getTimeZoneNames() { - OpenListResourceBundle tznames = (OpenListResourceBundle) cache.get("TimeZoneNames"); + public TimeZoneNamesBundle getTimeZoneNames() { + TimeZoneNamesBundle tznames = (TimeZoneNamesBundle) cache.get("TimeZoneNames"); if (tznames == null) { tznames = adapter.getLocaleData().getTimeZoneNames(locale); - OpenListResourceBundle olrb = (OpenListResourceBundle) cache.putIfAbsent("TimeZoneNames", tznames); - if (olrb != null) { - tznames = olrb; + TimeZoneNamesBundle tznb = (TimeZoneNamesBundle) cache.putIfAbsent("TimeZoneNames", tznames); + if (tznb != null) { + tznames = tznb; } } return tznames; diff --git a/src/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java b/src/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java index 15de9f5228361c5ab4ab280331b892651d203107..59de0e2a629ca7b9dfc7563a8956838175e711b6 100644 --- a/src/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java +++ b/src/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java @@ -604,5 +604,12 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter { assert tznp != null; 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); + } } } diff --git a/src/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java b/src/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java index ff092861824cbc396054b598aa97d2d45aba28b9..28fd7af5a9011f46082699ffb271f9d93713c5c1 100644 --- a/src/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java +++ b/src/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java @@ -25,11 +25,14 @@ package sun.util.locale.provider; +import java.util.LinkedHashSet; import java.util.Locale; -import java.util.ResourceBundle; +import java.util.Map; import java.util.Set; import java.util.TimeZone; import java.util.spi.TimeZoneNameProvider; +import sun.util.calendar.ZoneInfo; +import sun.util.resources.TimeZoneNamesBundle; /** * Concrete implementation of the @@ -96,21 +99,67 @@ public class TimeZoneNameProviderImpl extends TimeZoneNameProvider { */ @Override 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) { 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); - ResourceBundle rb = adapter.getLocaleResources(locale).getTimeZoneNames(); - if (rb.containsKey(id)) { - String[] names = rb.getStringArray(id); - int index = daylight ? 3 : 1; - if (style == TimeZone.SHORT) { - index++; + TimeZoneNamesBundle rb = adapter.getLocaleResources(locale).getTimeZoneNames(); + Set keyset = rb.keySet(); + // Use a LinkedHashSet to preseve the order + Set value = new LinkedHashSet<>(); + for (String key : keyset) { + 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 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][]); } } diff --git a/src/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java b/src/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java index c28b0cb65c7f559e29edf5557d3a0df414496398..a8e09a0d6cf3798ba1925e7bb9fec2e8cfc66139 100644 --- a/src/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java +++ b/src/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java @@ -26,28 +26,28 @@ package sun.util.locale.provider; import java.lang.ref.SoftReference; -import java.util.Enumeration; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.spi.TimeZoneNameProvider; import sun.util.calendar.ZoneInfo; import sun.util.resources.OpenListResourceBundle; +import sun.util.resources.TimeZoneNamesBundle; /** * Utility class that deals with the localized time zone names * * @author Naoto Sato + * @author Masayoshi Okutsu */ public final class TimeZoneNameUtility { /** * cache to hold time zone resource bundles. Keyed by Locale */ - private static ConcurrentHashMap> cachedBundles = + private static ConcurrentHashMap> cachedBundles = new ConcurrentHashMap<>(); /** @@ -73,15 +73,19 @@ public final class TimeZoneNameUtility { } 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 zones = new LinkedList<>(); OpenListResourceBundle rb = getBundle(locale); - Enumeration keys = rb.getKeys(); - String[] names; - - while(keys.hasMoreElements()) { - String key = keys.nextElement(); - - names = retrieveDisplayNames(rb, key, locale); + for (String key : rb.keySet()) { + String[] names = retrieveDisplayNamesImpl(key, locale); if (names != null) { zones.add(names); } @@ -95,24 +99,50 @@ public final class TimeZoneNameUtility { * Retrieve display names for a time zone ID. */ 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) { 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.getPool(TimeZoneNameProvider.class); - return pool.getLocalizedObject(TimeZoneNameGetter.INSTANCE, locale, id); + return pool.getLocalizedObject(TimeZoneNameArrayGetter.INSTANCE, locale, id); } - private static OpenListResourceBundle getBundle(Locale locale) { - OpenListResourceBundle rb; - SoftReference data = cachedBundles.get(locale); + private static TimeZoneNamesBundle getBundle(Locale locale) { + TimeZoneNamesBundle rb; + SoftReference data = cachedBundles.get(locale); if (data == null || ((rb = data.get()) == null)) { rb = LocaleProviderAdapter.forJRE().getLocaleData().getTimeZoneNames(locale); @@ -127,19 +157,18 @@ public final class TimeZoneNameUtility { * Obtains a localized time zone strings from a TimeZoneNameProvider * implementation. */ - private static class TimeZoneNameGetter + private static class TimeZoneNameArrayGetter implements LocaleServiceProviderPool.LocalizedObjectGetter{ - private static final TimeZoneNameGetter INSTANCE = - new TimeZoneNameGetter(); + private static final TimeZoneNameArrayGetter INSTANCE = + new TimeZoneNameArrayGetter(); @Override public String[] getObject(TimeZoneNameProvider timeZoneNameProvider, - Locale locale, - String requestID, - Object... params) { + Locale locale, + String requestID, + Object... params) { assert params.length == 0; - String queryID = requestID; // First, try to get names with the request ID String[] names = buildZoneStrings(timeZoneNameProvider, locale, requestID); @@ -150,21 +179,15 @@ public final class TimeZoneNameUtility { if (aliases != null) { // Check whether this id is an alias, if so, // look for the standard id. - if (aliases.containsKey(queryID)) { - String prevID = queryID; - while ((queryID = aliases.get(queryID)) != null) { - prevID = queryID; - } - queryID = prevID; + String canonicalID = aliases.get(requestID); + if (canonicalID != null) { + names = buildZoneStrings(timeZoneNameProvider, locale, canonicalID); } - - names = buildZoneStrings(timeZoneNameProvider, locale, queryID); - if (names == null) { // There may be a case that a standard id has become an // alias. so, check the aliases backward. names = examineAliases(timeZoneNameProvider, locale, - queryID, aliases, aliases.entrySet()); + canonicalID == null ? requestID : canonicalID, aliases); } } } @@ -178,20 +201,18 @@ public final class TimeZoneNameUtility { private static String[] examineAliases(TimeZoneNameProvider tznp, Locale locale, String id, - Map aliases, - Set> aliasesSet) { + Map aliases) { if (aliases.containsValue(id)) { - for (Map.Entry entry : aliasesSet) { + for (Map.Entry entry : aliases.entrySet()) { if (entry.getValue().equals(id)) { String alias = entry.getKey(); String[] names = buildZoneStrings(tznp, locale, alias); if (names != null) { return names; - } else { - names = examineAliases(tznp, locale, alias, aliases, aliasesSet); - if (names != null) { - return names; - } + } + names = examineAliases(tznp, locale, alias, aliases); + if (names != null) { + return names; } } } @@ -201,7 +222,7 @@ public final class TimeZoneNameUtility { } private static String[] buildZoneStrings(TimeZoneNameProvider tznp, - Locale locale, String id) { + Locale locale, String id) { String[] names = new String[5]; for (int i = 1; i <= 4; i ++) { @@ -220,6 +241,77 @@ public final class TimeZoneNameUtility { } } + private static class TimeZoneNameGetter + implements LocaleServiceProviderPool.LocalizedObjectGetter { + 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 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 aliases) { + if (aliases.containsValue(tzid)) { + for (Map.Entry 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 private TimeZoneNameUtility() { } diff --git a/src/share/classes/sun/util/resources/LocaleData.java b/src/share/classes/sun/util/resources/LocaleData.java index 4570406f2a8293aa6897bdb5e41606a1a980f6e7..9a7a7c401194b1794337f028ed39e088ba1ed14b 100644 --- a/src/share/classes/sun/util/resources/LocaleData.java +++ b/src/share/classes/sun/util/resources/LocaleData.java @@ -46,9 +46,9 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.ResourceBundle; +import sun.util.locale.provider.LocaleDataMetaInfo; import sun.util.locale.provider.LocaleProviderAdapter; import static sun.util.locale.provider.LocaleProviderAdapter.Type.JRE; -import sun.util.locale.provider.LocaleDataMetaInfo; /** * Provides information about and access to resource bundles in the @@ -94,8 +94,8 @@ public class LocaleData { * Gets a time zone names resource bundle, using privileges * to allow accessing a sun.* package. */ - public OpenListResourceBundle getTimeZoneNames(Locale locale) { - return (OpenListResourceBundle) getBundle(type.getUtilResourcesPackage() + ".TimeZoneNames", locale); + public TimeZoneNamesBundle getTimeZoneNames(Locale locale) { + return (TimeZoneNamesBundle) getBundle(type.getUtilResourcesPackage() + ".TimeZoneNames", locale); } /** @@ -158,30 +158,33 @@ public class LocaleData { /* Get the locale string list from LocaleDataMetaInfo class. */ String localeString = LocaleDataMetaInfo.getSupportedLocaleString(baseName); - if (localeString == null || localeString.length() == 0) { - return candidates; - } - - for (Iterator l = candidates.iterator(); l.hasNext(); ) { - Locale loc = l.next(); - String lstr; - if (loc.getScript().length() > 0) { - lstr = loc.toLanguageTag().replace('-', '_'); - } else { - lstr = loc.toString(); - int idx = lstr.indexOf("_#"); - if (idx >= 0) { - lstr = lstr.substring(0, idx); + if (localeString != null && localeString.length() != 0) { + for (Iterator l = candidates.iterator(); l.hasNext();) { + Locale loc = l.next(); + String lstr; + if (loc.getScript().length() > 0) { + lstr = loc.toLanguageTag().replace('-', '_'); + } else { + lstr = loc.toString(); + int idx = lstr.indexOf("_#"); + if (idx >= 0) { + lstr = lstr.substring(0, idx); + } + } + /* Every locale string in the locale string list returned from + the above getSupportedLocaleString is enclosed + within two white spaces so that we could check some locale + such as "en". + */ + if (lstr.length() != 0 && localeString.indexOf(" " + lstr + " ") == -1) { + l.remove(); } } - /* Every locale string in the locale string list returned from - the above getSupportedLocaleString is enclosed - within two white spaces so that we could check some locale - such as "en". - */ - if (lstr.length() != 0 && localeString.indexOf(" " + lstr + " ") == -1) { - l.remove(); - } + } + // Force fallback to Locale.ENGLISH for CLDR time zone names support + if (locale.getLanguage() != "en" + && baseName.contains(CLDR) && baseName.endsWith("TimeZoneNames")) { + candidates.add(candidates.size() - 1, Locale.ENGLISH); } return candidates; } diff --git a/src/share/classes/sun/util/resources/OpenListResourceBundle.java b/src/share/classes/sun/util/resources/OpenListResourceBundle.java index e0551931d19e664acf0a7fc0b5e60f8422bf3e3a..494e5c89c08b7355495d93aa2c38855d6414fcd1 100644 --- a/src/share/classes/sun/util/resources/OpenListResourceBundle.java +++ b/src/share/classes/sun/util/resources/OpenListResourceBundle.java @@ -67,6 +67,7 @@ public abstract class OpenListResourceBundle extends ResourceBundle { } // Implements java.util.ResourceBundle.handleGetObject; inherits javadoc specification. + @Override public Object handleGetObject(String key) { if (key == null) { throw new NullPointerException(); @@ -79,6 +80,7 @@ public abstract class OpenListResourceBundle extends ResourceBundle { /** * Implementation of ResourceBundle.getKeys. */ + @Override public Enumeration getKeys() { ResourceBundle parent = this.parent; return new ResourceBundleEnumeration(handleGetKeys(), @@ -86,7 +88,8 @@ public abstract class OpenListResourceBundle extends ResourceBundle { } /** - * Returns a set of keys provided in this resource bundle + * Returns a set of keys provided in this resource bundle, + * including no parents. */ public Set handleGetKeys() { loadLookupTablesIfNecessary(); @@ -99,7 +102,7 @@ public abstract class OpenListResourceBundle extends ResourceBundle { if (keyset != null) { return keyset; } - Set ks = new HashSet<>(); + Set ks = createSet(); ks.addAll(handleGetKeys()); if (parent != null) { ks.addAll(parent.keySet()); @@ -112,13 +115,6 @@ public abstract class OpenListResourceBundle extends ResourceBundle { return keyset; } - /** - * Returns the parent bundle - */ - public OpenListResourceBundle getParent() { - return (OpenListResourceBundle)parent; - } - /** * See ListResourceBundle class description. */ @@ -160,10 +156,14 @@ public abstract class OpenListResourceBundle extends ResourceBundle { * Lets subclasses provide specialized Map implementations. * Default uses HashMap. */ - protected Map createMap(int size) { + protected Map createMap(int size) { return new HashMap<>(size); } + protected Set createSet() { + return new HashSet<>(); + } + private volatile Map lookup = null; private volatile Set keyset; } diff --git a/src/share/classes/sun/util/resources/TimeZoneNames.java b/src/share/classes/sun/util/resources/TimeZoneNames.java index 5b2931b7b6275aee6ece465cf397b38e8409345d..59af1d215bf7d8d98c2393ac929dfabb5f09400d 100644 --- a/src/share/classes/sun/util/resources/TimeZoneNames.java +++ b/src/share/classes/sun/util/resources/TimeZoneNames.java @@ -43,160 +43,238 @@ package sun.util.resources; public final class TimeZoneNames extends TimeZoneNamesBundle { protected final Object[][] getContents() { + // Note: generic names came from CLDR with some adjustments. String ACT[] = new String[] {"Acre Time", "ACT", - "Acre Summer Time", "ACST"}; + "Acre Summer Time", "ACST", + "Acre Time", "ACT"}; String ADELAIDE[] = new String[] {"Central Standard Time (South Australia)", "CST", - "Central Summer Time (South Australia)", "CST"}; + "Central Summer Time (South Australia)", "CST", + "Central Time (South Australia)", "CT"}; String AGT[] = new String[] {"Argentine Time", "ART", - "Argentine Summer Time", "ARST"}; + "Argentine Summer Time", "ARST", + "Argentine Time", "ART"}; String AKST[] = new String[] {"Alaska Standard Time", "AKST", - "Alaska Daylight Time", "AKDT"}; + "Alaska Daylight Time", "AKDT", + "Alaska Time", "AKT"}; String AMT[] = new String[] {"Amazon Time", "AMT", - "Amazon Summer Time", "AMST"}; + "Amazon Summer Time", "AMST", + "Amazon Time", "AMT"}; String ARAST[] = new String[] {"Arabia Standard Time", "AST", - "Arabia Daylight Time", "ADT"}; + "Arabia Daylight Time", "ADT", + "Arabia Time", "AT"}; String ARMT[] = new String[] {"Armenia Time", "AMT", - "Armenia Summer Time", "AMST"}; + "Armenia Summer Time", "AMST", + "Armenia Time", "AMT"}; String AST[] = new String[] {"Atlantic Standard Time", "AST", - "Atlantic Daylight Time", "ADT"}; + "Atlantic Daylight Time", "ADT", + "Atlantic Time", "AT"}; String BDT[] = new String[] {"Bangladesh Time", "BDT", - "Bangladesh Summer Time", "BDST"}; + "Bangladesh Summer Time", "BDST", + "Bangladesh Time", "BDT"}; String BRISBANE[] = new String[] {"Eastern Standard Time (Queensland)", "EST", - "Eastern Summer Time (Queensland)", "EST"}; + "Eastern Summer Time (Queensland)", "EST", + "Eastern Time (Queensland)", "ET"}; String BROKEN_HILL[] = new String[] {"Central Standard Time (South Australia/New South Wales)", "CST", - "Central Summer Time (South Australia/New South Wales)", "CST"}; + "Central Summer Time (South Australia/New South Wales)", "CST", + "Central Time (South Australia/New South Wales)", "CT"}; String BRT[] = new String[] {"Brasilia Time", "BRT", - "Brasilia Summer Time", "BRST"}; + "Brasilia Summer Time", "BRST", + "Brasilia Time", "BRT"}; String BTT[] = new String[] {"Bhutan Time", "BTT", - "Bhutan Summer Time", "BTST"}; + "Bhutan Summer Time", "BTST", + "Bhutan Time", "BTT"}; String CAT[] = new String[] {"Central African Time", "CAT", - "Central African Summer Time", "CAST"}; + "Central African Summer Time", "CAST", + "Central Africa Time", "CAT"}; String CET[] = new String[] {"Central European Time", "CET", - "Central European Summer Time", "CEST"}; + "Central European Summer Time", "CEST", + "Central European Time", "CET"}; String CHAST[] = new String[] {"Chatham Standard Time", "CHAST", - "Chatham Daylight Time", "CHADT"}; + "Chatham Daylight Time", "CHADT", + "Chatham Time", "CHAT"}; String CHUT[] = new String[] {"Chuuk Time", "CHUT", - "Chuuk Summer Time", "CHUST"}; + "Chuuk Summer Time", "CHUST", + "Chuuk Time", "CHUT"}; String CIT[] = new String[] {"Central Indonesia Time", "CIT", - "Central Indonesia Summer Time", "CIST"}; + "Central Indonesia Summer Time", "CIST", + "Central Indonesia Time", "CIT"}; String CLT[] = new String[] {"Chile Time", "CLT", - "Chile Summer Time", "CLST"}; + "Chile Summer Time", "CLST", + "Chile Time", "CLT"}; String CST[] = new String[] {"Central Standard Time", "CST", - "Central Daylight Time", "CDT"}; + "Central Daylight Time", "CDT", + "Central Time", "CT"}; String CTT[] = new String[] {"China Standard Time", "CST", - "China Daylight Time", "CDT"}; + "China Daylight Time", "CDT", + "China Time", "CT"}; String CUBA[] = new String[] {"Cuba Standard Time", "CST", - "Cuba Daylight Time", "CDT"}; + "Cuba Daylight Time", "CDT", + "Cuba Time", "CT"}; String DARWIN[] = new String[] {"Central Standard Time (Northern Territory)", "CST", - "Central Summer Time (Northern Territory)", "CST"}; + "Central Summer Time (Northern Territory)", "CST", + "Central Time (Northern Territory)", "CT"}; String DUBLIN[] = new String[] {"Greenwich Mean Time", "GMT", - "Irish Summer Time", "IST"}; + "Irish Summer Time", "IST", + "Irish Time", "IT"}; String EAT[] = new String[] {"Eastern African Time", "EAT", - "Eastern African Summer Time", "EAST"}; + "Eastern African Summer Time", "EAST", + "Eastern Africa Time", "EAT"}; String EASTER[] = new String[] {"Easter Is. Time", "EAST", - "Easter Is. Summer Time", "EASST"}; + "Easter Is. Summer Time", "EASST", + "Easter Is. Time", "EAST"}; String EET[] = new String[] {"Eastern European Time", "EET", - "Eastern European Summer Time", "EEST"}; + "Eastern European Summer Time", "EEST", + "Eastern European Time", "EET"}; String EGT[] = new String[] {"Eastern Greenland Time", "EGT", - "Eastern Greenland Summer Time", "EGST"}; + "Eastern Greenland Summer Time", "EGST", + "Eastern Greenland Time", "EGT"}; String EST[] = new String[] {"Eastern Standard Time", "EST", - "Eastern Daylight Time", "EDT"}; + "Eastern Daylight Time", "EDT", + "Eastern Time", "ET"}; String EST_NSW[] = new String[] {"Eastern Standard Time (New South Wales)", "EST", - "Eastern Summer Time (New South Wales)", "EST"}; + "Eastern Summer Time (New South Wales)", "EST", + "Eastern Time (New South Wales)", "ET"}; String FET[] = new String[] {"Further-eastern European Time", "FET", - "Further-eastern European Summer Time", "FEST"}; + "Further-eastern European Summer Time", "FEST", + "Further-eastern European Time", "FET"}; String GHMT[] = new String[] {"Ghana Mean Time", "GMT", - "Ghana Summer Time", "GHST"}; + "Ghana Summer Time", "GHST", + "Ghana Mean Time", "GMT"}; String GAMBIER[] = new String[] {"Gambier Time", "GAMT", - "Gambier Summer Time", "GAMST"}; + "Gambier Summer Time", "GAMST", + "Gambier Time", "GAMT"}; String GMT[] = new String[] {"Greenwich Mean Time", "GMT", + "Greenwich Mean Time", "GMT", "Greenwich Mean Time", "GMT"}; String GMTBST[] = new String[] {"Greenwich Mean Time", "GMT", - "British Summer Time", "BST"}; + "British Summer Time", "BST", + "British Time", "BT"}; String GST[] = new String[] {"Gulf Standard Time", "GST", - "Gulf Daylight Time", "GDT"}; + "Gulf Daylight Time", "GDT", + "Gulf Time", "GT"}; String HAST[] = new String[] {"Hawaii-Aleutian Standard Time", "HAST", - "Hawaii-Aleutian Daylight Time", "HADT"}; + "Hawaii-Aleutian Daylight Time", "HADT", + "Hawaii-Aleutian Time", "HAT"}; String HKT[] = new String[] {"Hong Kong Time", "HKT", - "Hong Kong Summer Time", "HKST"}; + "Hong Kong Summer Time", "HKST", + "Hong Kong Time", "HKT"}; String HST[] = new String[] {"Hawaii Standard Time", "HST", - "Hawaii Daylight Time", "HDT"}; + "Hawaii Daylight Time", "HDT", + "Hawaii Time", "HT"}; String ICT[] = new String[] {"Indochina Time", "ICT", - "Indochina Summer Time", "ICST"}; + "Indochina Summer Time", "ICST", + "Indochina Time", "ICT"}; String IRT[] = new String[] {"Iran Standard Time", "IRST", - "Iran Daylight Time", "IRDT"}; + "Iran Daylight Time", "IRDT", + "Iran Time", "IRT"}; String ISRAEL[] = new String[] {"Israel Standard Time", "IST", - "Israel Daylight Time", "IDT"}; + "Israel Daylight Time", "IDT", + "Israel Time", "IT"}; String IST[] = new String[] {"India Standard Time", "IST", - "India Daylight Time", "IDT"}; + "India Daylight Time", "IDT", + "India Time", "IT"}; String JST[] = new String[] {"Japan Standard Time", "JST", - "Japan Daylight Time", "JDT"}; + "Japan Daylight Time", "JDT", + "Japan Time", "JT"}; String KST[] = new String[] {"Korea Standard Time", "KST", - "Korea Daylight Time", "KDT"}; + "Korea Daylight Time", "KDT", + "Korea Time", "KT"}; String LORD_HOWE[] = new String[] {"Lord Howe Standard Time", "LHST", - "Lord Howe Summer Time", "LHST"}; + "Lord Howe Summer Time", "LHST", + "Lord Howe Time", "LHT"}; String MHT[] = new String[] {"Marshall Islands Time", "MHT", - "Marshall Islands Summer Time", "MHST"}; + "Marshall Islands Summer Time", "MHST", + "Marshall Islands Time", "MHT"}; String MSK[] = new String[] {"Moscow Standard Time", "MSK", - "Moscow Daylight Time", "MSD"}; + "Moscow Daylight Time", "MSD", + "Moscow Time", "MT"}; String MST[] = new String[] {"Mountain Standard Time", "MST", - "Mountain Daylight Time", "MDT"}; + "Mountain Daylight Time", "MDT", + "Mountain Time", "MT"}; String MYT[] = new String[] {"Malaysia Time", "MYT", - "Malaysia Summer Time", "MYST"}; + "Malaysia Summer Time", "MYST", + "Malaysia Time", "MYT"}; String NORONHA[] = new String[] {"Fernando de Noronha Time", "FNT", - "Fernando de Noronha Summer Time", "FNST"}; + "Fernando de Noronha Summer Time", "FNST", + "Fernando de Noronha Time", "FNT"}; String NOVT[] = new String[] {"Novosibirsk Time", "NOVT", - "Novosibirsk Summer Time", "NOVST"}; + "Novosibirsk Summer Time", "NOVST", + "Novosibirsk Time", "NOVT"}; String NPT[] = new String[] {"Nepal Time", "NPT", - "Nepal Summer Time", "NPST"}; + "Nepal Summer Time", "NPST", + "Nepal Time", "NPT"}; String NST[] = new String[] {"Newfoundland Standard Time", "NST", - "Newfoundland Daylight Time", "NDT"}; + "Newfoundland Daylight Time", "NDT", + "Newfoundland Time", "NT"}; String NZST[] = new String[] {"New Zealand Standard Time", "NZST", - "New Zealand Daylight Time", "NZDT"}; + "New Zealand Daylight Time", "NZDT", + "New Zealand Time", "NZT"}; String PITCAIRN[] = new String[] {"Pitcairn Standard Time", "PST", - "Pitcairn Daylight Time", "PDT"}; + "Pitcairn Daylight Time", "PDT", + "Pitcairn Time", "PT"}; String PKT[] = new String[] {"Pakistan Time", "PKT", - "Pakistan Summer Time", "PKST"}; + "Pakistan Summer Time", "PKST", + "Pakistan Time", "PKT"}; String PONT[] = new String[] {"Pohnpei Time", "PONT", - "Pohnpei Summer Time", "PONST"}; + "Pohnpei Summer Time", "PONST", + "Ponape Time", "PONT"}; String PST[] = new String[] {"Pacific Standard Time", "PST", - "Pacific Daylight Time", "PDT"}; + "Pacific Daylight Time", "PDT", + "Pacific Time", "PT"}; String SAST[] = new String[] {"South Africa Standard Time", "SAST", - "South Africa Summer Time", "SAST"}; + "South Africa Summer Time", "SAST", + "South Africa Time", "SAT"}; String SBT[] = new String[] {"Solomon Is. Time", "SBT", - "Solomon Is. Summer Time", "SBST"}; + "Solomon Is. Summer Time", "SBST", + "Solomon Is. Time", "SBT"}; String SGT[] = new String[] {"Singapore Time", "SGT", - "Singapore Summer Time", "SGST"}; + "Singapore Summer Time", "SGST", + "Singapore Time", "SGT"}; String SLST[] = new String[] {"Greenwich Mean Time", "GMT", - "Sierra Leone Summer Time", "SLST"}; + "Sierra Leone Summer Time", "SLST", + "Sierra Leone Time", "SLT"}; String TASMANIA[] = new String[] {"Eastern Standard Time (Tasmania)", "EST", - "Eastern Summer Time (Tasmania)", "EST"}; + "Eastern Summer Time (Tasmania)", "EST", + "Eastern Time (Tasmania)", "ET"}; String TMT[] = new String[] {"Turkmenistan Time", "TMT", - "Turkmenistan Summer Time", "TMST"}; + "Turkmenistan Summer Time", "TMST", + "Turkmenistan Time", "TMT"}; String ULAT[]= new String[] {"Ulaanbaatar Time", "ULAT", - "Ulaanbaatar Summer Time", "ULAST"}; + "Ulaanbaatar Summer Time", "ULAST", + "Ulaanbaatar Time", "ULAT"}; String WART[] = new String[] {"Western Argentine Time", "WART", - "Western Argentine Summer Time", "WARST"}; + "Western Argentine Summer Time", "WARST", + "Western Argentine Time", "WART"}; String WAT[] = new String[] {"Western African Time", "WAT", - "Western African Summer Time", "WAST"}; + "Western African Summer Time", "WAST", + "Western African Time", "WAT"}; String WET[] = new String[] {"Western European Time", "WET", - "Western European Summer Time", "WEST"}; + "Western European Summer Time", "WEST", + "Western European Time", "WET"}; String WIT[] = new String[] {"West Indonesia Time", "WIT", - "West Indonesia Summer Time", "WIST"}; + "West Indonesia Summer Time", "WIST", + "West Indonesia Time", "WIT"}; String WST_AUS[] = new String[] {"Western Standard Time (Australia)", "WST", - "Western Summer Time (Australia)", "WST"}; + "Western Summer Time (Australia)", "WST", + "Western Time (Australia)", "WT"}; String SAMOA[] = new String[] {"Samoa Standard Time", "SST", - "Samoa Daylight Time", "SDT"}; + "Samoa Daylight Time", "SDT", + "Samoa Time", "ST"}; String WST_SAMOA[] = new String[] {"West Samoa Time", "WST", - "West Samoa Daylight Time", "WSDT"}; + "West Samoa Daylight Time", "WSDT", + "West Samoa Time", "WST"}; String ChST[] = new String[] {"Chamorro Standard Time", "ChST", - "Chamorro Daylight Time", "ChDT"}; + "Chamorro Daylight Time", "ChDT", + "Chamorro Time", "ChT"}; String VICTORIA[] = new String[] {"Eastern Standard Time (Victoria)", "EST", - "Eastern Summer Time (Victoria)", "EST"}; + "Eastern Summer Time (Victoria)", "EST", + "Eastern Time (Victoria)", "ET"}; String UTC[] = new String[] {"Coordinated Universal Time", "UTC", + "Coordinated Universal Time", "UTC", "Coordinated Universal Time", "UTC"}; String UZT[] = new String[] {"Uzbekistan Time", "UZT", - "Uzbekistan Summer Time", "UZST"}; + "Uzbekistan Summer Time", "UZST", + "Uzbekistan Time", "UZT"}; return new Object[][] { {"America/Los_Angeles", PST}, @@ -309,7 +387,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Argentina/Ushuaia", AGT}, {"America/Aruba", AST}, {"America/Asuncion", new String[] {"Paraguay Time", "PYT", - "Paraguay Summer Time", "PYST"}}, + "Paraguay Summer Time", "PYST", + "Paraguay Time", "PYT"}}, {"America/Atikokan", EST}, {"America/Atka", HAST}, {"America/Bahia", BRT}, @@ -320,17 +399,20 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Blanc-Sablon", AST}, {"America/Boa_Vista", AMT}, {"America/Bogota", new String[] {"Colombia Time", "COT", - "Colombia Summer Time", "COST"}}, + "Colombia Summer Time", "COST", + "Colombia Time", "COT"}}, {"America/Boise", MST}, {"America/Buenos_Aires", AGT}, {"America/Cambridge_Bay", MST}, {"America/Campo_Grande", AMT}, {"America/Cancun", CST}, {"America/Caracas", new String[] {"Venezuela Time", "VET", - "Venezuela Summer Time", "VEST"}}, + "Venezuela Summer Time", "VEST", + "Venezuela Time", "VET"}}, {"America/Catamarca", AGT}, {"America/Cayenne", new String[] {"French Guiana Time", "GFT", - "French Guiana Summer Time", "GFST"}}, + "French Guiana Summer Time", "GFST", + "French Guiana Time", "GFT"}}, {"America/Cayman", EST}, {"America/Chihuahua", MST}, {"America/Creston", MST}, @@ -352,16 +434,19 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Fortaleza", BRT}, {"America/Glace_Bay", AST}, {"America/Godthab", new String[] {"Western Greenland Time", "WGT", - "Western Greenland Summer Time", "WGST"}}, + "Western Greenland Summer Time", "WGST", + "Western Greenland Time", "WGT"}}, {"America/Goose_Bay", AST}, {"America/Grand_Turk", EST}, {"America/Grenada", AST}, {"America/Guadeloupe", AST}, {"America/Guatemala", CST}, {"America/Guayaquil", new String[] {"Ecuador Time", "ECT", - "Ecuador Summer Time", "ECST"}}, + "Ecuador Summer Time", "ECST", + "Ecuador Time", "ECT"}}, {"America/Guyana", new String[] {"Guyana Time", "GYT", - "Guyana Summer Time", "GYST"}}, + "Guyana Summer Time", "GYST", + "Guyana Time", "GYT"}}, {"America/Havana", CUBA}, {"America/Hermosillo", MST}, {"America/Indiana/Indianapolis", EST}, @@ -382,9 +467,11 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Knox_IN", CST}, {"America/Kralendijk", AST}, {"America/La_Paz", new String[] {"Bolivia Time", "BOT", - "Bolivia Summer Time", "BOST"}}, + "Bolivia Summer Time", "BOST", + "Bolivia Time", "BOT"}}, {"America/Lima", new String[] {"Peru Time", "PET", - "Peru Summer Time", "PEST"}}, + "Peru Summer Time", "PEST", + "Peru Time", "PET"}}, {"America/Louisville", EST}, {"America/Lower_Princes", AST}, {"America/Maceio", BRT}, @@ -398,13 +485,16 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Menominee", CST}, {"America/Merida", CST}, {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST", - "Metlakatla Daylight Time", "MeDT"}}, + "Metlakatla Daylight Time", "MeDT", + "Metlakatla Time", "MeT"}}, {"America/Mexico_City", CST}, {"America/Miquelon", new String[] {"Pierre & Miquelon Standard Time", "PMST", - "Pierre & Miquelon Daylight Time", "PMDT"}}, + "Pierre & Miquelon Daylight Time", "PMDT", + "Pierre & Miquelon Time", "PMT"}}, {"America/Moncton", AST}, {"America/Montevideo", new String[] {"Uruguay Time", "UYT", - "Uruguay Summer Time", "UYST"}}, + "Uruguay Summer Time", "UYST", + "Uruguay Time", "UYT"}}, {"America/Monterrey", CST}, {"America/Montreal", EST}, {"America/Montserrat", AST}, @@ -419,7 +509,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Panama", EST}, {"America/Pangnirtung", EST}, {"America/Paramaribo", new String[] {"Suriname Time", "SRT", - "Suriname Summer Time", "SRST"}}, + "Suriname Summer Time", "SRST", + "Suriname Time", "SRT"}}, {"America/Port-au-Prince", EST}, {"America/Port_of_Spain", AST}, {"America/Porto_Acre", AMT}, @@ -459,113 +550,143 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"America/Yellowknife", MST}, {"Antarctica/Casey", WST_AUS}, {"Antarctica/Davis", new String[] {"Davis Time", "DAVT", - "Davis Summer Time", "DAVST"}}, + "Davis Summer Time", "DAVST", + "Davis Time", "DAVT"}}, {"Antarctica/DumontDUrville", new String[] {"Dumont-d'Urville Time", "DDUT", - "Dumont-d'Urville Summer Time", "DDUST"}}, + "Dumont-d'Urville Summer Time", "DDUST", + "Dumont-d'Urville Time", "DDUT"}}, {"Antarctica/Macquarie", new String[] {"Macquarie Island Time", "MIST", - "Macquarie Island Summer Time", "MIST"}}, + "Macquarie Island Summer Time", "MIST", + "Macquarie Island Time", "MIST"}}, {"Antarctica/Mawson", new String[] {"Mawson Time", "MAWT", - "Mawson Summer Time", "MAWST"}}, + "Mawson Summer Time", "MAWST", + "Mawson Time", "MAWT"}}, {"Antarctica/McMurdo", NZST}, {"Antarctica/Palmer", CLT}, {"Antarctica/Rothera", new String[] {"Rothera Time", "ROTT", - "Rothera Summer Time", "ROTST"}}, + "Rothera Summer Time", "ROTST", + "Rothera Time", "ROTT"}}, {"Antarctica/South_Pole", NZST}, {"Antarctica/Syowa", new String[] {"Syowa Time", "SYOT", - "Syowa Summer Time", "SYOST"}}, + "Syowa Summer Time", "SYOST", + "Syowa Time", "SYOT"}}, {"Antarctica/Vostok", new String[] {"Vostok Time", "VOST", - "Vostok Summer Time", "VOSST"}}, + "Vostok Summer Time", "VOSST", + "Vostok Time", "VOST"}}, {"Arctic/Longyearbyen", CET}, {"Asia/Aden", ARAST}, {"Asia/Almaty", new String[] {"Alma-Ata Time", "ALMT", - "Alma-Ata Summer Time", "ALMST"}}, + "Alma-Ata Summer Time", "ALMST", + "Alma-Ata Time", "ALMT"}}, {"Asia/Amman", EET}, {"Asia/Anadyr", new String[] {"Anadyr Time", "ANAT", - "Anadyr Summer Time", "ANAST"}}, + "Anadyr Summer Time", "ANAST", + "Anadyr Time", "ANAT"}}, {"Asia/Aqtau", new String[] {"Aqtau Time", "AQTT", - "Aqtau Summer Time", "AQTST"}}, + "Aqtau Summer Time", "AQTST", + "Aqtau Time", "AQTT"}}, {"Asia/Aqtobe", new String[] {"Aqtobe Time", "AQTT", - "Aqtobe Summer Time", "AQTST"}}, + "Aqtobe Summer Time", "AQTST", + "Aqtobe Time", "AQTT"}}, {"Asia/Ashgabat", TMT}, {"Asia/Ashkhabad", TMT}, {"Asia/Baghdad", ARAST}, {"Asia/Bahrain", ARAST}, {"Asia/Baku", new String[] {"Azerbaijan Time", "AZT", - "Azerbaijan Summer Time", "AZST"}}, + "Azerbaijan Summer Time", "AZST", + "Azerbaijan Time", "AZT"}}, {"Asia/Bangkok", ICT}, {"Asia/Beirut", EET}, {"Asia/Bishkek", new String[] {"Kirgizstan Time", "KGT", - "Kirgizstan Summer Time", "KGST"}}, + "Kirgizstan Summer Time", "KGST", + "Kirgizstan Time", "KGT"}}, {"Asia/Brunei", new String[] {"Brunei Time", "BNT", - "Brunei Summer Time", "BNST"}}, + "Brunei Summer Time", "BNST", + "Brunei Time", "BNT"}}, {"Asia/Calcutta", IST}, {"Asia/Choibalsan", new String[] {"Choibalsan Time", "CHOT", - "Choibalsan Summer Time", "CHOST"}}, + "Choibalsan Summer Time", "CHOST", + "Choibalsan Time", "CHOT"}}, {"Asia/Chongqing", CTT}, {"Asia/Chungking", CTT}, {"Asia/Colombo", IST}, {"Asia/Dacca", BDT}, {"Asia/Dhaka", BDT}, {"Asia/Dili", new String[] {"Timor-Leste Time", "TLT", - "Timor-Leste Summer Time", "TLST"}}, + "Timor-Leste Summer Time", "TLST", + "Timor-Leste Time", "TLT"}}, {"Asia/Damascus", EET}, {"Asia/Dubai", GST}, {"Asia/Dushanbe", new String[] {"Tajikistan Time", "TJT", - "Tajikistan Summer Time", "TJST"}}, + "Tajikistan Summer Time", "TJST", + "Tajikistan Time", "TJT"}}, {"Asia/Gaza", EET}, {"Asia/Harbin", CTT}, {"Asia/Hebron", EET}, {"Asia/Ho_Chi_Minh", ICT}, {"Asia/Hong_Kong", HKT}, {"Asia/Hovd", new String[] {"Hovd Time", "HOVT", - "Hovd Summer Time", "HOVST"}}, + "Hovd Summer Time", "HOVST", + "Hovd Time", "HOVT"}}, {"Asia/Irkutsk", new String[] {"Irkutsk Time", "IRKT", - "Irkutsk Summer Time", "IRKST"}}, + "Irkutsk Summer Time", "IRKST", + "Irkutsk Time", "IRKT"}}, {"Asia/Istanbul", EET}, {"Asia/Jakarta", WIT}, {"Asia/Jayapura", new String[] {"East Indonesia Time", "EIT", - "East Indonesia Summer Time", "EIST"}}, + "East Indonesia Summer Time", "EIST", + "East Indonesia Time", "EIT"}}, {"Asia/Kabul", new String[] {"Afghanistan Time", "AFT", - "Afghanistan Summer Time", "AFST"}}, + "Afghanistan Summer Time", "AFST", + "Afghanistan Time", "AFT"}}, {"Asia/Kamchatka", new String[] {"Petropavlovsk-Kamchatski Time", "PETT", - "Petropavlovsk-Kamchatski Summer Time", "PETST"}}, + "Petropavlovsk-Kamchatski Summer Time", "PETST", + "Petropavlovsk-Kamchatski Time", "PETT"}}, {"Asia/Karachi", PKT}, {"Asia/Kashgar", CTT}, {"Asia/Kathmandu", NPT}, {"Asia/Katmandu", NPT}, {"Asia/Kolkata", IST}, {"Asia/Krasnoyarsk", new String[] {"Krasnoyarsk Time", "KRAT", - "Krasnoyarsk Summer Time", "KRAST"}}, + "Krasnoyarsk Summer Time", "KRAST", + "Krasnoyarsk Time", "KRAT"}}, {"Asia/Kuala_Lumpur", MYT}, {"Asia/Kuching", MYT}, {"Asia/Kuwait", ARAST}, {"Asia/Macao", CTT}, {"Asia/Macau", CTT}, {"Asia/Magadan", new String[] {"Magadan Time", "MAGT", - "Magadan Summer Time", "MAGST"}}, + "Magadan Summer Time", "MAGST", + "Magadan Time", "MAGT"}}, {"Asia/Makassar", CIT}, {"Asia/Manila", new String[] {"Philippines Time", "PHT", - "Philippines Summer Time", "PHST"}}, + "Philippines Summer Time", "PHST", + "Philippines Time", "PHT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", NOVT}, {"Asia/Novosibirsk", NOVT}, {"Asia/Oral", new String[] {"Oral Time", "ORAT", - "Oral Summer Time", "ORAST"}}, + "Oral Summer Time", "ORAST", + "Oral Time", "ORAT"}}, {"Asia/Omsk", new String[] {"Omsk Time", "OMST", - "Omsk Summer Time", "OMSST"}}, + "Omsk Summer Time", "OMSST", + "Omsk Time", "OMST"}}, {"Asia/Phnom_Penh", ICT}, {"Asia/Pontianak", WIT}, {"Asia/Pyongyang", KST}, {"Asia/Qatar", ARAST}, {"Asia/Qyzylorda", new String[] {"Qyzylorda Time", "QYZT", - "Qyzylorda Summer Time", "QYZST"}}, + "Qyzylorda Summer Time", "QYZST", + "Qyzylorda Time", "QYZT"}}, {"Asia/Rangoon", new String[] {"Myanmar Time", "MMT", - "Myanmar Summer Time", "MMST"}}, + "Myanmar Summer Time", "MMST", + "Myanmar Time", "MMT"}}, {"Asia/Riyadh", ARAST}, {"Asia/Saigon", ICT}, {"Asia/Sakhalin", new String[] {"Sakhalin Time", "SAKT", - "Sakhalin Summer Time", "SAKST"}}, + "Sakhalin Summer Time", "SAKST", + "Sakhalin Time", "SAKT"}}, {"Asia/Samarkand", UZT}, {"Asia/Seoul", KST}, {"Asia/Singapore", SGT}, @@ -573,7 +694,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Asia/Tel_Aviv", ISRAEL}, {"Asia/Tashkent", UZT}, {"Asia/Tbilisi", new String[] {"Georgia Time", "GET", - "Georgia Summer Time", "GEST"}}, + "Georgia Summer Time", "GEST", + "Georgia Time", "GET"}}, {"Asia/Tehran", IRT}, {"Asia/Thimbu", BTT}, {"Asia/Thimphu", BTT}, @@ -583,28 +705,35 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Asia/Urumqi", CTT}, {"Asia/Vientiane", ICT}, {"Asia/Vladivostok", new String[] {"Vladivostok Time", "VLAT", - "Vladivostok Summer Time", "VLAST"}}, + "Vladivostok Summer Time", "VLAST", + "Vladivostok Time", "VLAT"}}, {"Asia/Yakutsk", new String[] {"Yakutsk Time", "YAKT", - "Yakutsk Summer Time", "YAKST"}}, + "Yakutsk Summer Time", "YAKST", + "Yakutsk Time", "YAKT"}}, {"Asia/Yekaterinburg", new String[] {"Yekaterinburg Time", "YEKT", - "Yekaterinburg Summer Time", "YEKST"}}, + "Yekaterinburg Summer Time", "YEKST", + "Yekaterinburg Time", "YEKT"}}, {"Asia/Yerevan", ARMT}, {"Atlantic/Azores", new String[] {"Azores Time", "AZOT", - "Azores Summer Time", "AZOST"}}, + "Azores Summer Time", "AZOST", + "Azores Time", "AZOT"}}, {"Atlantic/Bermuda", AST}, {"Atlantic/Canary", WET}, {"Atlantic/Cape_Verde", new String[] {"Cape Verde Time", "CVT", - "Cape Verde Summer Time", "CVST"}}, + "Cape Verde Summer Time", "CVST", + "Cape Verde Time", "CVT"}}, {"Atlantic/Faeroe", WET}, {"Atlantic/Faroe", WET}, {"Atlantic/Jan_Mayen", CET}, {"Atlantic/Madeira", WET}, {"Atlantic/Reykjavik", GMT}, {"Atlantic/South_Georgia", new String[] {"South Georgia Standard Time", "GST", - "South Georgia Daylight Time", "GDT"}}, + "South Georgia Daylight Time", "GDT", + "South Georgia Time", "GT"}}, {"Atlantic/St_Helena", GMT}, {"Atlantic/Stanley", new String[] {"Falkland Is. Time", "FKT", - "Falkland Is. Summer Time", "FKST"}}, + "Falkland Is. Summer Time", "FKST", + "Falkland Is. Time", "FKT"}}, {"Australia/ACT", EST_NSW}, {"Australia/Adelaide", ADELAIDE}, {"Australia/Brisbane", BRISBANE}, @@ -613,7 +742,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Australia/Currie", EST_NSW}, {"Australia/Darwin", DARWIN}, {"Australia/Eucla", new String[] {"Central Western Standard Time (Australia)", "CWST", - "Central Western Summer Time (Australia)", "CWST"}}, + "Central Western Summer Time (Australia)", "CWST", + "Central Western Time (Australia)", "CWT"}}, {"Australia/Hobart", TASMANIA}, {"Australia/LHI", LORD_HOWE}, {"Australia/Lindeman", BRISBANE}, @@ -697,7 +827,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Europe/Riga", EET}, {"Europe/Rome", CET}, {"Europe/Samara", new String[] {"Samara Time", "SAMT", - "Samara Summer Time", "SAMST"}}, + "Samara Summer Time", "SAMST", + "Samara Time", "SAMT"}}, {"Europe/San_Marino", CET}, {"Europe/Sarajevo", CET}, {"Europe/Simferopol", EET}, @@ -713,7 +844,8 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Europe/Vienna", CET}, {"Europe/Vilnius", EET}, {"Europe/Volgograd", new String[] {"Volgograd Time", "VOLT", - "Volgograd Summer Time", "VOLST"}}, + "Volgograd Summer Time", "VOLST", + "Volgograd Time", "VOLT"}}, {"Europe/Warsaw", CET}, {"Europe/Zagreb", CET}, {"Europe/Zaporozhye", EET}, @@ -727,30 +859,39 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"IST", IST}, {"Indian/Antananarivo", EAT}, {"Indian/Chagos", new String[] {"Indian Ocean Territory Time", "IOT", - "Indian Ocean Territory Summer Time", "IOST"}}, + "Indian Ocean Territory Summer Time", "IOST", + "Indian Ocean Territory Time", "IOT"}}, {"Indian/Christmas", new String[] {"Christmas Island Time", "CXT", - "Christmas Island Summer Time", "CXST"}}, + "Christmas Island Summer Time", "CXST", + "Christmas Island Time", "CIT"}}, {"Indian/Cocos", new String[] {"Cocos Islands Time", "CCT", - "Cocos Islands Summer Time", "CCST"}}, + "Cocos Islands Summer Time", "CCST", + "Cocos Islands Time", "CCT"}}, {"Indian/Comoro", EAT}, {"Indian/Kerguelen", new String[] {"French Southern & Antarctic Lands Time", "TFT", - "French Southern & Antarctic Lands Summer Time", "TFST"}}, + "French Southern & Antarctic Lands Summer Time", "TFST", + "French Southern & Antarctic Lands Time", "TFT"}}, {"Indian/Mahe", new String[] {"Seychelles Time", "SCT", - "Seychelles Summer Time", "SCST"}}, + "Seychelles Summer Time", "SCST", + "Seychelles Time", "SCT"}}, {"Indian/Maldives", new String[] {"Maldives Time", "MVT", - "Maldives Summer Time", "MVST"}}, + "Maldives Summer Time", "MVST", + "Maldives Time", "MVT"}}, {"Indian/Mauritius", new String[] {"Mauritius Time", "MUT", - "Mauritius Summer Time", "MUST"}}, + "Mauritius Summer Time", "MUST", + "Mauritius Time", "MUT"}}, {"Indian/Mayotte", EAT}, {"Indian/Reunion", new String[] {"Reunion Time", "RET", - "Reunion Summer Time", "REST"}}, + "Reunion Summer Time", "REST", + "Reunion Time", "RET"}}, {"Israel", ISRAEL}, {"Jamaica", EST}, {"Japan", JST}, {"Kwajalein", MHT}, {"Libya", EET}, {"MET", new String[] {"Middle Europe Time", "MET", - "Middle Europe Summer Time", "MEST"}}, + "Middle Europe Summer Time", "MEST", + "Middle Europe Time", "MET"}}, {"Mexico/BajaNorte", PST}, {"Mexico/BajaSur", MST}, {"Mexico/General", CST}, @@ -770,61 +911,82 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Pacific/Chuuk", CHUT}, {"Pacific/Easter", EASTER}, {"Pacific/Efate", new String[] {"Vanuatu Time", "VUT", - "Vanuatu Summer Time", "VUST"}}, + "Vanuatu Summer Time", "VUST", + "Vanuatu Time", "VUT"}}, {"Pacific/Enderbury", new String[] {"Phoenix Is. Time", "PHOT", - "Phoenix Is. Summer Time", "PHOST"}}, + "Phoenix Is. Summer Time", "PHOST", + "Phoenix Is. Time", "PHOT"}}, {"Pacific/Fakaofo", new String[] {"Tokelau Time", "TKT", - "Tokelau Summer Time", "TKST"}}, + "Tokelau Summer Time", "TKST", + "Tokelau Time", "TKT"}}, {"Pacific/Fiji", new String[] {"Fiji Time", "FJT", - "Fiji Summer Time", "FJST"}}, + "Fiji Summer Time", "FJST", + "Fiji Time", "FJT"}}, {"Pacific/Funafuti", new String[] {"Tuvalu Time", "TVT", - "Tuvalu Summer Time", "TVST"}}, + "Tuvalu Summer Time", "TVST", + "Tuvalu Time", "TVT"}}, {"Pacific/Galapagos", new String[] {"Galapagos Time", "GALT", - "Galapagos Summer Time", "GALST"}}, + "Galapagos Summer Time", "GALST", + "Galapagos Time", "GALT"}}, {"Pacific/Gambier", GAMBIER}, {"Pacific/Guadalcanal", SBT}, {"Pacific/Guam", ChST}, {"Pacific/Johnston", HST}, {"Pacific/Kiritimati", new String[] {"Line Is. Time", "LINT", - "Line Is. Summer Time", "LINST"}}, + "Line Is. Summer Time", "LINST", + "Line Is. Time", "LINT"}}, {"Pacific/Kosrae", new String[] {"Kosrae Time", "KOST", - "Kosrae Summer Time", "KOSST"}}, + "Kosrae Summer Time", "KOSST", + "Kosrae Time", "KOST"}}, {"Pacific/Kwajalein", MHT}, {"Pacific/Majuro", MHT}, {"Pacific/Marquesas", new String[] {"Marquesas Time", "MART", - "Marquesas Summer Time", "MARST"}}, + "Marquesas Summer Time", "MARST", + "Marquesas Time", "MART"}}, {"Pacific/Midway", SAMOA}, {"Pacific/Nauru", new String[] {"Nauru Time", "NRT", - "Nauru Summer Time", "NRST"}}, + "Nauru Summer Time", "NRST", + "Nauru Time", "NRT"}}, {"Pacific/Niue", new String[] {"Niue Time", "NUT", - "Niue Summer Time", "NUST"}}, + "Niue Summer Time", "NUST", + "Niue Time", "NUT"}}, {"Pacific/Norfolk", new String[] {"Norfolk Time", "NFT", - "Norfolk Summer Time", "NFST"}}, + "Norfolk Summer Time", "NFST", + "Norfolk Time", "NFT"}}, {"Pacific/Noumea", new String[] {"New Caledonia Time", "NCT", - "New Caledonia Summer Time", "NCST"}}, + "New Caledonia Summer Time", "NCST", + "New Caledonia Time", "NCT"}}, {"Pacific/Pago_Pago", SAMOA}, {"Pacific/Palau", new String[] {"Palau Time", "PWT", - "Palau Summer Time", "PWST"}}, + "Palau Summer Time", "PWST", + "Palau Time", "PWT"}}, {"Pacific/Pitcairn", PITCAIRN}, {"Pacific/Pohnpei", PONT}, {"Pacific/Ponape", PONT}, {"Pacific/Port_Moresby", new String[] {"Papua New Guinea Time", "PGT", - "Papua New Guinea Summer Time", "PGST"}}, + "Papua New Guinea Summer Time", "PGST", + "Papua New Guinea Time", "PGT"}}, {"Pacific/Rarotonga", new String[] {"Cook Is. Time", "CKT", - "Cook Is. Summer Time", "CKHST"}}, + "Cook Is. Summer Time", "CKHST", + "Cook Is. Time", "CKT"}}, {"Pacific/Saipan", ChST}, {"Pacific/Samoa", SAMOA}, {"Pacific/Tahiti", new String[] {"Tahiti Time", "TAHT", - "Tahiti Summer Time", "TAHST"}}, + "Tahiti Summer Time", "TAHST", + "Tahiti Time", "TAHT"}}, {"Pacific/Tarawa", new String[] {"Gilbert Is. Time", "GILT", - "Gilbert Is. Summer Time", "GILST"}}, + "Gilbert Is. Summer Time", "GILST", + "Gilbert Is. Time", "GILT"}}, {"Pacific/Tongatapu", new String[] {"Tonga Time", "TOT", - "Tonga Summer Time", "TOST"}}, + "Tonga Summer Time", "TOST", + "Tonga Time", "TOT"}}, {"Pacific/Truk", CHUT}, {"Pacific/Wake", new String[] {"Wake Time", "WAKT", - "Wake Summer Time", "WAKST"}}, + "Wake Summer Time", "WAKST", + "Wake Time", "WAKT"}}, {"Pacific/Wallis", new String[] {"Wallis & Futuna Time", "WFT", - "Wallis & Futuna Summer Time", "WFST"}}, + "Wallis & Futuna Summer Time", "WFST", + "Wallis & Futuna Time", "WFT"}}, {"Pacific/Yap", CHUT}, {"Poland", CET}, {"PRC", CTT}, diff --git a/src/share/classes/sun/util/resources/TimeZoneNamesBundle.java b/src/share/classes/sun/util/resources/TimeZoneNamesBundle.java index 3757ed121a5098674272f39c290a3229b9bc2761..a3c37ecc05ebfb5980a2c9b9bbe91d8ddf7731fd 100644 --- a/src/share/classes/sun/util/resources/TimeZoneNamesBundle.java +++ b/src/share/classes/sun/util/resources/TimeZoneNamesBundle.java @@ -42,6 +42,9 @@ package sun.util.resources; import java.util.Map; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.MissingResourceException; +import java.util.Set; /** * Subclass of ResourceBundle with special @@ -57,6 +60,26 @@ import java.util.LinkedHashMap; */ public abstract class TimeZoneNamesBundle extends OpenListResourceBundle { + /** + * Returns a String array containing time zone names. The String array has + * at most size elements. + * + * @param key the time zone ID for which names are obtained + * @param size the requested size of array for names + * @return a String array containing names + */ + public String[] getStringArray(String key, int size) { + String[] names = handleGetObject(key, size); + if ((names == null || names.length != size) && parent != null) { + names = ((TimeZoneNamesBundle)parent).getStringArray(key, size); + } + if (names == null) { + throw new MissingResourceException("no time zone names", getClass().getName(), key); + } + return names; + + } + /** * Maps time zone IDs to locale-specific names. * The value returned is an array of five strings: @@ -71,13 +94,17 @@ public abstract class TimeZoneNamesBundle extends OpenListResourceBundle { * getContents implementations, while the time zone * ID is inserted into the returned array by this method. */ + @Override public Object handleGetObject(String key) { + return handleGetObject(key, 5); + } + + private String[] handleGetObject(String key, int n) { String[] contents = (String[]) super.handleGetObject(key); if (contents == null) { return null; } - - int clen = contents.length; + int clen = Math.min(n, contents.length); String[] tmpobj = new String[clen+1]; tmpobj[0] = key; System.arraycopy(contents, 0, tmpobj, 1, clen); @@ -85,13 +112,23 @@ public abstract class TimeZoneNamesBundle extends OpenListResourceBundle { } /** - * Use LinkedHashMap to preserve order of bundle entries. + * Use LinkedHashMap to preserve the order of bundle entries. */ @Override - protected Map createMap(int size) { + protected Map createMap(int size) { return new LinkedHashMap<>(size); } + /** + * Use LinkedHashSet to preserve the key order. + * @param the type of elements + * @return a Set + */ + @Override + protected Set createSet() { + return new LinkedHashSet<>(); + } + /** * Provides key/value mappings for a specific * resource bundle. Each entry of the array diff --git a/src/share/demo/jvmti/hprof/hprof.h b/src/share/demo/jvmti/hprof/hprof.h index 6e61affce1165067dc0612157f9da138427b2e8a..ec9fbf0187014fc930e30771211f88445662dab1 100644 --- a/src/share/demo/jvmti/hprof/hprof.h +++ b/src/share/demo/jvmti/hprof/hprof.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -65,6 +65,7 @@ #include "jni.h" #include "jvmti.h" #include "classfile_constants.h" +#include "jvm_md.h" #ifndef SKIP_NPT #include "npt.h" /* To get NptEnv for doing character conversions */ diff --git a/src/share/demo/jvmti/hprof/hprof_init.c b/src/share/demo/jvmti/hprof/hprof_init.c index 9183800c42895930555677b41098cfd06a10da52..328c474d410dbce5db68eba119b6dcf1322af195 100644 --- a/src/share/demo/jvmti/hprof/hprof_init.c +++ b/src/share/demo/jvmti/hprof/hprof_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1899,6 +1899,7 @@ load_library(char *name) */ getSystemProperty("sun.boot.library.path", &boot_path); md_build_library_name(lname, FILENAME_MAX, boot_path, name); + jvmtiDeallocate(boot_path); handle = md_load_library(lname, err_buf, (int)sizeof(err_buf)); if ( handle == NULL ) { /* This may be necessary on Windows. */ @@ -1941,6 +1942,9 @@ lookup_library_symbol(void *library, char **symbols, int nsymbols) JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { + char *boot_path = NULL; + char npt_lib[JVM_MAXPATHLEN]; + /* See if it's already loaded */ if ( gdata!=NULL && gdata->isLoaded==JNI_TRUE ) { HPROF_ERROR(JNI_TRUE, "Cannot load this JVM TI agent twice, check your java command line for duplicate hprof options."); @@ -1957,9 +1961,15 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) gdata->jvm = vm; + /* Get the JVMTI environment */ + getJvmti(); + #ifndef SKIP_NPT + getSystemProperty("sun.boot.library.path", &boot_path); /* Load in NPT library for character conversions */ - NPT_INITIALIZE(&(gdata->npt), NPT_VERSION, NULL); + md_build_library_name(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME); + jvmtiDeallocate(boot_path); + NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL); if ( gdata->npt == NULL ) { HPROF_ERROR(JNI_TRUE, "Cannot load npt library"); } @@ -1969,9 +1979,6 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) } #endif - /* Get the JVMTI environment */ - getJvmti(); - /* Lock needed to protect debug_malloc() code, which is not MT safe */ #ifdef DEBUG gdata->debug_malloc_lock = createRawMonitor("HPROF debug_malloc lock"); diff --git a/src/share/lib/security/java.security b/src/share/lib/security/java.security-linux similarity index 100% rename from src/share/lib/security/java.security rename to src/share/lib/security/java.security-linux diff --git a/src/solaris/back/linker_md.c b/src/solaris/back/linker_md.c index 5cc83f3df89f0f2005a7e0cb054337f4bcae67eb..a1cbcce3fcf9da985b214a761c3bf16e1af11774 100644 --- a/src/solaris/back/linker_md.c +++ b/src/solaris/back/linker_md.c @@ -54,6 +54,32 @@ #define LIB_SUFFIX "so" #endif +static void dll_build_name(char* buffer, size_t buflen, + const char* pname, const char* fname) { + // Based on os_solaris.cpp + + char *path_sep = PATH_SEPARATOR; + char *pathname = (char *)pname; + while (strlen(pathname) > 0) { + char *p = strchr(pathname, *path_sep); + if (p == NULL) { + p = pathname + strlen(pathname); + } + /* check for NULL path */ + if (p == pathname) { + continue; + } + (void)snprintf(buffer, buflen, "%.*s/lib%s." LIB_SUFFIX, (p - pathname), + pathname, fname); + + if (access(buffer, F_OK) == 0) { + break; + } + pathname = p + 1; + *buffer = '\0'; + } +} + /* * create a string for the JNI native function name by adding the * appropriate decorations. @@ -76,16 +102,16 @@ dbgsysBuildLibName(char *holder, int holderlen, char *pname, char *fname) { const int pnamelen = pname ? strlen(pname) : 0; + *holder = '\0'; /* Quietly truncate on buffer overflow. Should be an error. */ if (pnamelen + (int)strlen(fname) + 10 > holderlen) { - *holder = '\0'; return; } if (pnamelen == 0) { (void)snprintf(holder, holderlen, "lib%s." LIB_SUFFIX, fname); } else { - (void)snprintf(holder, holderlen, "%s/lib%s." LIB_SUFFIX, pname, fname); + dll_build_name(holder, holderlen, pname, fname); } } diff --git a/src/solaris/bin/java_md_solinux.c b/src/solaris/bin/java_md_solinux.c index 46ae9d635ea5816df99ef0eb0d308fbf3bcf6b5e..f3cf522d3237699e016ea1c7056a0afb30f36c21 100644 --- a/src/solaris/bin/java_md_solinux.c +++ b/src/solaris/bin/java_md_solinux.c @@ -811,7 +811,6 @@ GetJREPath(char *path, jint pathsize, const char * arch, jboolean speculative) jboolean LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn) { - Dl_info dlinfo; void *libjvm; JLI_TraceLauncher("JVM path is %s\n", jvmpath); diff --git a/src/solaris/classes/sun/awt/X11InputMethod.java b/src/solaris/classes/sun/awt/X11InputMethod.java index ccfa5104809864c79daff2345f043e3a6a3206bd..b2a62c60ce8ed04cdef5ccbe380c9df88551ce3b 100644 --- a/src/solaris/classes/sun/awt/X11InputMethod.java +++ b/src/solaris/classes/sun/awt/X11InputMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, 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. * * This code is free software; you can redistribute it and/or modify it @@ -415,6 +415,10 @@ public abstract class X11InputMethod extends InputMethodAdapter { setXICFocus(getPeer(lastXICFocussedComponent), false, isLastXICActive); lastXICFocussedComponent = null; isLastXICActive = false; + + resetXIC(); + needResetXICClient = null; + needResetXIC = false; } } diff --git a/src/solaris/classes/sun/java2d/xr/XRRenderer.java b/src/solaris/classes/sun/java2d/xr/XRRenderer.java index f2fd155ca8722028404ce8094945b196a16aa0cb..933f54523788500545b99872258ae990a76d683d 100644 --- a/src/solaris/classes/sun/java2d/xr/XRRenderer.java +++ b/src/solaris/classes/sun/java2d/xr/XRRenderer.java @@ -27,7 +27,6 @@ package sun.java2d.xr; import java.awt.*; import java.awt.geom.*; - import sun.awt.SunToolkit; import sun.java2d.SunGraphics2D; import sun.java2d.loops.*; @@ -39,6 +38,9 @@ import sun.java2d.pipe.SpanIterator; import sun.java2d.pipe.ShapeSpanIterator; import sun.java2d.pipe.LoopPipe; +import static sun.java2d.xr.XRUtils.clampToShort; +import static sun.java2d.xr.XRUtils.clampToUShort; + /** * XRender provides only accalerated rectangles. To emulate higher "order" * geometry we have to pass everything else to DoPath/FillSpans. @@ -70,17 +72,16 @@ public class XRRenderer implements PixelDrawPipe, PixelFillPipe, ShapeDrawPipe { public void drawLine(SunGraphics2D sg2d, int x1, int y1, int x2, int y2) { Region compClip = sg2d.getCompClip(); - int transX1 = x1 + sg2d.transX; - int transY1 = y1 + sg2d.transY; - int transX2 = x2 + sg2d.transX; - int transY2 = y2 + sg2d.transY; + int transX1 = Region.clipAdd(x1, sg2d.transX); + int transY1 = Region.clipAdd(y1, sg2d.transY); + int transX2 = Region.clipAdd(x2, sg2d.transX); + int transY2 = Region.clipAdd(y2, sg2d.transY); // Non clipped fast path if (compClip.contains(transX1, transY1) && compClip.contains(transX2, transY2)) { + SunToolkit.awtLock(); try { - SunToolkit.awtLock(); - validateSurface(sg2d); tileManager.addLine(transX1, transY1, transX2, transY2); tileManager.fillMask((XRSurfaceData) sg2d.surfaceData); @@ -115,20 +116,40 @@ public class XRRenderer implements PixelDrawPipe, PixelFillPipe, ShapeDrawPipe { draw(sg2d, new Polygon(xpoints, ypoints, npoints)); } - public synchronized void fillRect(SunGraphics2D sg2d, - int x, int y, int width, int height) { - SunToolkit.awtLock(); - try { - validateSurface(sg2d); + public void fillRect(SunGraphics2D sg2d, int x, int y, int width, int height) { + x = Region.clipAdd(x, sg2d.transX); + y = Region.clipAdd(y, sg2d.transY); - XRSurfaceData xrsd = (XRSurfaceData) sg2d.surfaceData; + /* + * Limit x/y to signed short, width/height to unsigned short, + * to match the X11 coordinate limits for rectangles. + * Correct width/height in case x/y have been modified by clipping. + */ + if (x > Short.MAX_VALUE || y > Short.MAX_VALUE) { + return; + } - x += sg2d.transform.getTranslateX(); - y += sg2d.transform.getTranslateY(); + int x2 = Region.dimAdd(x, width); + int y2 = Region.dimAdd(y, height); - tileManager.addRect(x, y, width, height); - tileManager.fillMask(xrsd); + if (x2 < Short.MIN_VALUE || y2 < Short.MIN_VALUE) { + return; + } + + x = clampToShort(x); + y = clampToShort(y); + width = clampToUShort(x2 - x); + height = clampToUShort(y2 - y); + + if (width == 0 || height == 0) { + return; + } + SunToolkit.awtLock(); + try { + validateSurface(sg2d); + tileManager.addRect(x, y, width, height); + tileManager.fillMask((XRSurfaceData) sg2d.surfaceData); } finally { SunToolkit.awtUnlock(); } diff --git a/src/solaris/classes/sun/java2d/xr/XRUtils.java b/src/solaris/classes/sun/java2d/xr/XRUtils.java index e7e05e4f2cc20b5dba0b0528f52256f972dd2f08..7a47999ffa2ff79441564265615a9767214ef0df 100644 --- a/src/solaris/classes/sun/java2d/xr/XRUtils.java +++ b/src/solaris/classes/sun/java2d/xr/XRUtils.java @@ -255,7 +255,7 @@ public class XRUtils { : (x < Short.MIN_VALUE ? Short.MIN_VALUE : x)); } - public static short clampToUShort(int x) { - return (short) (x > 65535 ? 65535 : (x < 0) ? 0 : x); + public static int clampToUShort(int x) { + return (x > 65535 ? 65535 : (x < 0) ? 0 : x); } } diff --git a/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java b/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java index eaf49ddd2a724bc50305f8e86426d3d56e73f680..3bb08d7d94c7bbf2f1d0c5b4ef617d1eb50fb4ad 100644 --- a/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java +++ b/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java @@ -25,8 +25,6 @@ package sun.nio.fs; -import java.nio.file.*; -import java.nio.file.attribute.*; import java.io.IOException; /** diff --git a/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java b/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java index 557fc16e5d6e6165f19a581d05db56110a26a416..5cf76fb3d05e62527825cbf2cffa882d091a1ce1 100644 --- a/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java +++ b/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java @@ -29,6 +29,8 @@ import java.nio.file.*; import java.nio.file.attribute.*; import java.nio.file.spi.FileTypeDetector; import java.io.IOException; +import java.security.AccessController; +import sun.security.action.GetPropertyAction; /** * Linux implementation of FileSystemProvider @@ -100,6 +102,13 @@ public class LinuxFileSystemProvider extends UnixFileSystemProvider { @Override FileTypeDetector getFileTypeDetector() { - return new GnomeFileTypeDetector(); + Path userMimeTypes = Paths.get(AccessController.doPrivileged( + new GetPropertyAction("user.home")), ".mime.types"); + Path etcMimeTypes = Paths.get("/etc/mime.types"); + + return chain(new GnomeFileTypeDetector(), + new MimeTypesFileTypeDetector(userMimeTypes), + new MimeTypesFileTypeDetector(etcMimeTypes), + new MagicFileTypeDetector()); } } diff --git a/src/solaris/classes/sun/nio/fs/MacOSXFileSystemProvider.java b/src/solaris/classes/sun/nio/fs/MacOSXFileSystemProvider.java index 528603fa791ea8760aed696d733fd99c1f45ff79..bf50e71b1c7b1461353996b5ee3f4c37e421fc4c 100644 --- a/src/solaris/classes/sun/nio/fs/MacOSXFileSystemProvider.java +++ b/src/solaris/classes/sun/nio/fs/MacOSXFileSystemProvider.java @@ -25,9 +25,11 @@ package sun.nio.fs; -import java.nio.file.*; -import java.nio.file.attribute.*; -import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.spi.FileTypeDetector; +import java.security.AccessController; +import sun.security.action.GetPropertyAction; /** * MacOSX implementation of FileSystemProvider @@ -42,4 +44,11 @@ public class MacOSXFileSystemProvider extends BsdFileSystemProvider { MacOSXFileSystem newFileSystem(String dir) { return new MacOSXFileSystem(this, dir); } + + @Override + FileTypeDetector getFileTypeDetector() { + Path userMimeTypes = Paths.get(AccessController.doPrivileged( + new GetPropertyAction("user.home")), ".mime.types"); + return new MimeTypesFileTypeDetector(userMimeTypes); + } } diff --git a/src/solaris/classes/sun/nio/fs/MagicFileTypeDetector.java b/src/solaris/classes/sun/nio/fs/MagicFileTypeDetector.java new file mode 100644 index 0000000000000000000000000000000000000000..11bc3a529d7eb4c8a3ed1f5e0823c05a4f0cdba1 --- /dev/null +++ b/src/solaris/classes/sun/nio/fs/MagicFileTypeDetector.java @@ -0,0 +1,79 @@ +/* + * 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. + */ + +package sun.nio.fs; + +import java.io.IOException; +import java.nio.file.Path; +import java.security.AccessController; +import java.security.PrivilegedAction; + +/** + * File type detector that uses the libmagic to guess the MIME type of a file. + */ + +class MagicFileTypeDetector extends AbstractFileTypeDetector { + + private static final String UNKNOW_MIME_TYPE = "application/octet-stream"; + + // true if libmagic is available and successfully loaded + private final boolean libmagicAvailable; + + public MagicFileTypeDetector() { + libmagicAvailable = initialize0(); + } + + @Override + protected String implProbeContentType(Path obj) throws IOException { + if (!libmagicAvailable || !(obj instanceof UnixPath)) + return null; + + UnixPath path = (UnixPath) obj; + path.checkRead(); + + NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls()); + try { + byte[] type = probe0(buffer.address()); + String mimeType = (type == null) ? null : new String(type); + return UNKNOW_MIME_TYPE.equals(mimeType) ? null : mimeType; + } finally { + buffer.release(); + } + } + + private static native boolean initialize0(); + + private static native byte[] probe0(long pathAddress); + + static { + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Void run() { + System.loadLibrary("nio"); + return null; + } + }); + } +} diff --git a/src/solaris/classes/sun/nio/fs/MimeTypesFileTypeDetector.java b/src/solaris/classes/sun/nio/fs/MimeTypesFileTypeDetector.java new file mode 100644 index 0000000000000000000000000000000000000000..8878703a343afaaff98917ade9b3910f75d41865 --- /dev/null +++ b/src/solaris/classes/sun/nio/fs/MimeTypesFileTypeDetector.java @@ -0,0 +1,208 @@ +/* + * 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. + */ + +package sun.nio.fs; + +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * File type detector that uses a file extension to look up its MIME type + * based on a mime.types file. + */ + +class MimeTypesFileTypeDetector extends AbstractFileTypeDetector { + + // path to mime.types file + private final Path mimeTypesFile; + + // map of extension to MIME type + private Map mimeTypeMap; + + // set to true when file loaded + private volatile boolean loaded = false; + + public MimeTypesFileTypeDetector(Path filePath) { + mimeTypesFile = filePath; + } + + @Override + protected String implProbeContentType(Path path) { + Path fn = path.getFileName(); + if (fn == null) + return null; // no file name + + String ext = getExtension(fn.toString()); + if (ext.isEmpty()) + return null; // no extension + + loadMimeTypes(); + if (mimeTypeMap == null || mimeTypeMap.isEmpty()) + return null; + + // Case-sensitive search + String mimeType; + do { + mimeType = mimeTypeMap.get(ext); + if (mimeType == null) + ext = getExtension(ext); + } while (mimeType == null && !ext.isEmpty()); + + return mimeType; + } + + // Get the extension of a file name. + private static String getExtension(String name) { + String ext = ""; + if (name != null && !name.isEmpty()) { + int dot = name.indexOf('.'); + if ((dot >= 0) && (dot < name.length() - 1)) { + ext = name.substring(dot + 1); + } + } + return ext; + } + + /** + * Parse the mime types file, and store the type-extension mappings into + * mimeTypeMap. The mime types file is not loaded until the first probe + * to achieve the lazy initialization. It adopts double-checked locking + * optimization to reduce the locking overhead. + */ + private void loadMimeTypes() { + if (!loaded) { + synchronized (this) { + if (!loaded) { + List lines = AccessController.doPrivileged( + new PrivilegedAction>() { + @Override + public List run() { + try { + return Files.readAllLines(mimeTypesFile, + Charset.defaultCharset()); + } catch (IOException ignore) { + return Collections.emptyList(); + } + } + }); + + mimeTypeMap = new HashMap<>(lines.size()); + String entry = ""; + for (String line : lines) { + entry += line; + if (entry.endsWith("\\")) { + entry = entry.substring(0, entry.length() - 1); + continue; + } + parseMimeEntry(entry); + entry = ""; + } + if (!entry.isEmpty()) { + parseMimeEntry(entry); + } + loaded = true; + } + } + } + } + + /** + * Parse a mime-types entry, which can have the following formats. + * 1) Simple space-delimited format + * image/jpeg jpeg jpg jpe JPG + * + * 2) Netscape key-value pair format + * type=application/x-java-jnlp-file desc="Java Web Start" exts="jnlp" + * or + * type=text/html exts=htm,html + */ + private void parseMimeEntry(String entry) { + entry = entry.trim(); + if (entry.isEmpty() || entry.charAt(0) == '#') + return; + + entry = entry.replaceAll("\\s*#.*", ""); + int equalIdx = entry.indexOf('='); + if (equalIdx > 0) { + // Parse a mime-types command having the key-value pair format + final String TYPEEQUAL = "type="; + String typeRegex = "\\b" + TYPEEQUAL + + "(\"\\p{Graph}+?/\\p{Graph}+?\"|\\p{Graph}+/\\p{Graph}+\\b)"; + Pattern typePattern = Pattern.compile(typeRegex); + Matcher typeMatcher = typePattern.matcher(entry); + + if (typeMatcher.find()) { + String type = typeMatcher.group().substring(TYPEEQUAL.length()); + if (type.charAt(0) == '"') { + type = type.substring(1, type.length() - 1); + } + + final String EXTEQUAL = "exts="; + String extRegex = "\\b" + EXTEQUAL + + "(\"[\\p{Graph}|\\p{Blank}]+?\"|\\p{Graph}+\\b)"; + Pattern extPattern = Pattern.compile(extRegex); + Matcher extMatcher = extPattern.matcher(entry); + + if (extMatcher.find()) { + String exts = + extMatcher.group().substring(EXTEQUAL.length()); + if (exts.charAt(0) == '"') { + exts = exts.substring(1, exts.length() - 1); + } + String[] extList = exts.split("[\\p{Blank}|\\p{Punct}]+"); + for (String ext : extList) { + putIfAbsent(ext, type); + } + } + } + } else { + // Parse a mime-types command having the space-delimited format + String[] elements = entry.split("\\s+"); + int i = 1; + while (i < elements.length) { + putIfAbsent(elements[i++], elements[0]); + } + } + } + + private void putIfAbsent(String key, String value) { + if (key != null && !key.isEmpty() && + value != null && !value.isEmpty() && + !mimeTypeMap.containsKey(key)) + { + mimeTypeMap.put(key, value); + } + } +} diff --git a/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java b/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java index cb34adf3b9aa7b908217701f2676113a4447da94..d81bac1b6560ae4a96df76d8c3c799c5d0d9226f 100644 --- a/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java +++ b/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java @@ -29,6 +29,8 @@ import java.nio.file.*; import java.nio.file.attribute.*; import java.nio.file.spi.FileTypeDetector; import java.io.IOException; +import java.security.AccessController; +import sun.security.action.GetPropertyAction; /** * Solaris implementation of FileSystemProvider @@ -83,6 +85,12 @@ public class SolarisFileSystemProvider extends UnixFileSystemProvider { @Override FileTypeDetector getFileTypeDetector() { - return new GnomeFileTypeDetector(); + Path userMimeTypes = Paths.get(AccessController.doPrivileged( + new GetPropertyAction("user.home")), ".mime.types"); + Path etcMimeTypes = Paths.get("/etc/mime.types"); + + return chain(new GnomeFileTypeDetector(), + new MimeTypesFileTypeDetector(userMimeTypes), + new MimeTypesFileTypeDetector(etcMimeTypes)); } } diff --git a/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java b/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java index 5058f3147cbf8e5d1d1257c1c16c08c95a1351ae..fc0f943a97a93fcf0ddf08c68696bff46b7314d4 100644 --- a/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java +++ b/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java @@ -509,4 +509,24 @@ public abstract class UnixFileSystemProvider }; } + /** + * Returns a {@code FileTypeDetector} that chains the given array of file + * type detectors. When the {@code implProbeContentType} method is invoked + * then each of the detectors is invoked in turn, the result from the + * first to detect the file type is returned. + */ + final FileTypeDetector chain(final AbstractFileTypeDetector... detectors) { + return new AbstractFileTypeDetector() { + @Override + protected String implProbeContentType(Path file) throws IOException { + for (AbstractFileTypeDetector detector : detectors) { + String result = detector.implProbeContentType(file); + if (result != null && !result.isEmpty()) { + return result; + } + } + return null; + } + }; + } } diff --git a/src/solaris/demo/jvmti/hprof/hprof_md.c b/src/solaris/demo/jvmti/hprof/hprof_md.c index 284a2e6fee7cb4ba207fc602a785dc9867fb1d92..1df2271ce4e359b64116bf6889663c4b0ba5ad8f 100644 --- a/src/solaris/demo/jvmti/hprof/hprof_md.c +++ b/src/solaris/demo/jvmti/hprof/hprof_md.c @@ -380,6 +380,31 @@ md_ntohl(unsigned l) return ntohl(l); } +static void dll_build_name(char* buffer, size_t buflen, + const char* pname, const char* fname) { + // Loosely based on os_solaris.cpp + + char *pathname = (char *)pname; + while (strlen(pathname) > 0) { + char *p = strchr(pathname, ':'); + if (p == NULL) { + p = pathname + strlen(pathname); + } + /* check for NULL path */ + if (p == pathname) { + continue; + } + (void)snprintf(buffer, buflen, "%.*s/lib%s" JNI_LIB_SUFFIX, + (p - pathname), pathname, fname); + + if (access(buffer, F_OK) == 0) { + break; + } + pathname = p + 1; + *buffer = '\0'; + } +} + /* Create the actual fill filename for a dynamic library. */ void md_build_library_name(char *holder, int holderlen, char *pname, char *fname) @@ -389,9 +414,9 @@ md_build_library_name(char *holder, int holderlen, char *pname, char *fname) /* Length of options directory location. */ pnamelen = pname ? strlen(pname) : 0; + *holder = '\0'; /* Quietly truncate on buffer overflow. Should be an error. */ if (pnamelen + (int)strlen(fname) + 10 > holderlen) { - *holder = '\0'; return; } @@ -399,7 +424,7 @@ md_build_library_name(char *holder, int holderlen, char *pname, char *fname) if (pnamelen == 0) { (void)snprintf(holder, holderlen, "lib%s" JNI_LIB_SUFFIX, fname); } else { - (void)snprintf(holder, holderlen, "%s/lib%s" JNI_LIB_SUFFIX, pname, fname); + dll_build_name(holder, holderlen, pname, fname); } } diff --git a/src/solaris/native/sun/nio/fs/MagicFileTypeDetector.c b/src/solaris/native/sun/nio/fs/MagicFileTypeDetector.c new file mode 100644 index 0000000000000000000000000000000000000000..b70c6f764872b5c78f04fdb50dc95dc18d19d697 --- /dev/null +++ b/src/solaris/native/sun/nio/fs/MagicFileTypeDetector.c @@ -0,0 +1,108 @@ +/* + * 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. + */ + +#include "jni.h" +#include "jni_util.h" +#include "jvm.h" +#include "jlong.h" + +#include +#include + +#define MAGIC_MIME_TYPE 0x000010 /* Return the MIME type */ + +typedef struct magic_set magic_t; + +typedef magic_t* (*magic_open_func)(int flags); +typedef int (*magic_load_func)(magic_t* cookie, const char* filename); +typedef const char* (*magic_file_func)(magic_t* cookie, const char* filename); +typedef void (*magic_close_func)(magic_t* cookie); + +static void* magic_handle; +static magic_open_func magic_open; +static magic_load_func magic_load; +static magic_file_func magic_file; +static magic_close_func magic_close; + +#include "sun_nio_fs_MagicFileTypeDetector.h" + +JNIEXPORT jboolean JNICALL +Java_sun_nio_fs_MagicFileTypeDetector_initialize0 + (JNIEnv* env, jclass this) +{ + magic_handle = dlopen("libmagic.so", RTLD_LAZY); + if (magic_handle == NULL) { + magic_handle = dlopen("libmagic.so.1", RTLD_LAZY); + if (magic_handle == NULL) { + return JNI_FALSE; + } + } + + magic_open = (magic_open_func)dlsym(magic_handle, "magic_open"); + + magic_load = (magic_load_func)dlsym(magic_handle, "magic_load"); + + magic_file = (magic_file_func)dlsym(magic_handle, "magic_file"); + + magic_close = (magic_close_func)dlsym(magic_handle, "magic_close"); + + if (magic_open == NULL || + magic_load == NULL || + magic_file == NULL || + magic_close == NULL) + { + dlclose(magic_handle); + return JNI_FALSE; + } + + return JNI_TRUE; +} + +JNIEXPORT jbyteArray JNICALL +Java_sun_nio_fs_MagicFileTypeDetector_probe0 + (JNIEnv* env, jclass this, jlong pathAddress) +{ + char* path = (char*)jlong_to_ptr(pathAddress); + magic_t* cookie; + jbyteArray result = NULL; + + cookie = (*magic_open)(MAGIC_MIME_TYPE); + + if (cookie != NULL) { + if ((*magic_load)(cookie, NULL) != -1) { + const char* type = (*magic_file)(cookie, path); + if (type != NULL) { + jsize len = strlen(type); + result = (*env)->NewByteArray(env, len); + if (result != NULL) { + (*env)->SetByteArrayRegion(env, result, 0, len, (jbyte*)type); + } + } + } + (*magic_close)(cookie); + } + + return result; +} diff --git a/src/solaris/npt/npt_md.h b/src/solaris/npt/npt_md.h index 9b0c33655a3f8cd5bce0b6d1ecd9212ea345d3f6..76d5b663c046371d0f9bd0d6a2b91580357ab6a1 100644 --- a/src/solaris/npt/npt_md.h +++ b/src/solaris/npt/npt_md.h @@ -36,14 +36,14 @@ #define NPT_LIBNAME "npt" -#define NPT_INITIALIZE(pnpt,version,options) \ +#define NPT_INITIALIZE(path,pnpt,version,options) \ { \ void *_handle; \ void *_sym; \ \ if ( (pnpt) == NULL ) NPT_ERROR("NptEnv* is NULL"); \ *(pnpt) = NULL; \ - _handle = dlopen(JNI_LIB_NAME(NPT_LIBNAME), RTLD_LAZY); \ + _handle = dlopen(path, RTLD_LAZY); \ if ( _handle == NULL ) NPT_ERROR("Cannot open library"); \ _sym = dlsym(_handle, "nptInitialize"); \ if ( _sym == NULL ) NPT_ERROR("Cannot find nptInitialize"); \ diff --git a/src/windows/back/linker_md.c b/src/windows/back/linker_md.c index a651eee4b872231925a327d7b144b4ad5e8dafb6..e3ca2584cef0c8ff1940ae5a09f9953d828dc1cc 100644 --- a/src/windows/back/linker_md.c +++ b/src/windows/back/linker_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, 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. * * This code is free software; you can redistribute it and/or modify it @@ -32,11 +32,42 @@ #include #include #include +#include #include "sys.h" #include "path_md.h" +static void dll_build_name(char* buffer, size_t buflen, + const char* pname, const char* fname) { + // Based on os_windows.cpp + + char *path_sep = PATH_SEPARATOR; + char *pathname = (char *)pname; + while (strlen(pathname) > 0) { + char *p = strchr(pathname, *path_sep); + if (p == NULL) { + p = pathname + strlen(pathname); + } + /* check for NULL path */ + if (p == pathname) { + continue; + } + if (*(p-1) == ':' || *(p-1) == '\\') { + (void)_snprintf(buffer, buflen, "%.*s%s.dll", (p - pathname), + pathname, fname); + } else { + (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (p - pathname), + pathname, fname); + } + if (_access(buffer, 0) == 0) { + break; + } + pathname = p + 1; + *buffer = '\0'; + } +} + /* * From system_md.c v1.54 */ @@ -80,20 +111,17 @@ void dbgsysBuildLibName(char *holder, int holderlen, char *pname, char *fname) { const int pnamelen = pname ? (int)strlen(pname) : 0; - const char c = (pnamelen > 0) ? pname[pnamelen-1] : 0; + *holder = '\0'; /* Quietly truncates on buffer overflow. Should be an error. */ if (pnamelen + (int)strlen(fname) + 10 > holderlen) { - *holder = '\0'; return; } if (pnamelen == 0) { sprintf(holder, "%s.dll", fname); - } else if (c == ':' || c == '\\') { - sprintf(holder, "%s%s.dll", pname, fname); } else { - sprintf(holder, "%s\\%s.dll", pname, fname); + dll_build_name(holder, holderlen, pname, fname); } } diff --git a/src/windows/classes/sun/nio/fs/WindowsFileAttributes.java b/src/windows/classes/sun/nio/fs/WindowsFileAttributes.java index dffa4f06e8d147fb535a148cb04301074c4013fe..208435dc97e1baffe12d34be8d782d1f2d11ba83 100644 --- a/src/windows/classes/sun/nio/fs/WindowsFileAttributes.java +++ b/src/windows/classes/sun/nio/fs/WindowsFileAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -383,20 +383,14 @@ class WindowsFileAttributes } int volSerialNumber() { - if (volSerialNumber == 0) - throw new AssertionError("Should not get here"); return volSerialNumber; } int fileIndexHigh() { - if (volSerialNumber == 0) - throw new AssertionError("Should not get here"); return fileIndexHigh; } int fileIndexLow() { - if (volSerialNumber == 0) - throw new AssertionError("Should not get here"); return fileIndexLow; } diff --git a/src/windows/demo/jvmti/hprof/hprof_md.c b/src/windows/demo/jvmti/hprof/hprof_md.c index 2f3ba24fc9a0ca970bc7141dc8b0ee87cda40809..e5cbeda0f695d26586a7b7a7285ecd6444000af7 100644 --- a/src/windows/demo/jvmti/hprof/hprof_md.c +++ b/src/windows/demo/jvmti/hprof/hprof_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -367,28 +367,53 @@ get_last_error_string(char *buf, int len) return 0; } +static void dll_build_name(char* buffer, size_t buflen, + const char* pname, const char* fname) { + // Loosley based on os_windows.cpp + + char *pathname = (char *)pname; + while (strlen(pathname) > 0) { + char *p = strchr(pathname, ';'); + if (p == NULL) { + p = pathname + strlen(pathname); + } + /* check for NULL path */ + if (p == pathname) { + continue; + } + if (*(p-1) == ':' || *(p-1) == '\\') { + (void)_snprintf(buffer, buflen, "%.*s%s.dll", (p - pathname), + pathname, fname); + } else { + (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (p - pathname), + pathname, fname); + } + if (_access(buffer, 0) == 0) { + break; + } + pathname = p + 1; + *buffer = '\0'; + } +} + /* Build a machine dependent library name out of a path and file name. */ void md_build_library_name(char *holder, int holderlen, char *pname, char *fname) { int pnamelen; - char c; pnamelen = pname ? (int)strlen(pname) : 0; - c = (pnamelen > 0) ? pname[pnamelen-1] : 0; + *holder = '\0'; /* Quietly truncates on buffer overflow. Should be an error. */ if (pnamelen + strlen(fname) + 10 > (unsigned int)holderlen) { - *holder = '\0'; return; } if (pnamelen == 0) { sprintf(holder, "%s.dll", fname); - } else if (c == ':' || c == '\\') { - sprintf(holder, "%s%s.dll", pname, fname); } else { - sprintf(holder, "%s\\%s.dll", pname, fname); + dll_build_name(holder, holderlen, pname, fname); } } diff --git a/src/windows/native/java/net/NetworkInterface.c b/src/windows/native/java/net/NetworkInterface.c index b0f9344db4a571f851d89b2db6f2bd3fc7b35b3c..6d144659235e0f117fd1e9f0594994d0b478bdc5 100644 --- a/src/windows/native/java/net/NetworkInterface.c +++ b/src/windows/native/java/net/NetworkInterface.c @@ -178,7 +178,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP) int count; netif *netifP; DWORD i; - int lo=0, eth=0, tr=0, fddi=0, ppp=0, sl=0, wlan=0, net=0; + int lo=0, eth=0, tr=0, fddi=0, ppp=0, sl=0, wlan=0, net=0, wlen=0; /* * Ask the IP Helper library to enumerate the adapters @@ -260,8 +260,17 @@ int enumInterfaces(JNIEnv *env, netif **netifPP) */ curr = (netif *)calloc(1, sizeof(netif)); if (curr != NULL) { + wlen = MultiByteToWideChar(CP_OEMCP, 0, ifrowP->bDescr, + ifrowP->dwDescrLen, NULL, 0); + if(wlen == 0) { + // MultiByteToWideChar should not fail + // But in rare case it fails, we allow 'char' to be displayed + curr->displayName = (char *)malloc(ifrowP->dwDescrLen + 1); + } else { + curr->displayName = (wchar_t *)malloc(wlen*(sizeof(wchar_t))+1); + } + curr->name = (char *)malloc(strlen(dev_name) + 1); - curr->displayName = (char *)malloc(ifrowP->dwDescrLen + 1); if (curr->name == NULL || curr->displayName == NULL) { if (curr->name) free(curr->name); @@ -282,8 +291,29 @@ int enumInterfaces(JNIEnv *env, netif **netifPP) * 32-bit numbers as index values. */ strcpy(curr->name, dev_name); - strncpy(curr->displayName, ifrowP->bDescr, ifrowP->dwDescrLen); - curr->displayName[ifrowP->dwDescrLen] = '\0'; + if (wlen == 0) { + // display char type in case of MultiByteToWideChar failure + strncpy(curr->displayName, ifrowP->bDescr, ifrowP->dwDescrLen); + curr->displayName[ifrowP->dwDescrLen] = '\0'; + } else { + // call MultiByteToWideChar again to fill curr->displayName + // it should not fail, because we have called it once before + if (MultiByteToWideChar(CP_OEMCP, 0, ifrowP->bDescr, + ifrowP->dwDescrLen, curr->displayName, wlen) == 0) { + JNU_ThrowByName(env, "java/lang/Error", + "Cannot get multibyte char for interface display name"); + free_netif(netifP); + free(tableP); + free(curr->name); + free(curr->displayName); + free(curr); + return -1; + } else { + curr->displayName[wlen*(sizeof(wchar_t))] = '\0'; + curr->dNameIsUnicode = TRUE; + } + } + curr->dwIndex = ifrowP->dwIndex; curr->ifType = ifrowP->dwType; curr->index = GetFriendlyIfIndex(ifrowP->dwIndex); diff --git a/src/windows/npt/npt_md.h b/src/windows/npt/npt_md.h index 50747ddd7fd7c550a30210cf8e84ca3a9c607eff..e4e5dc3ffe32ea5bea0e85138a7bb5dd4ffce11e 100644 --- a/src/windows/npt/npt_md.h +++ b/src/windows/npt/npt_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -33,30 +33,16 @@ #include #include -#define NPT_LIBNAME "npt.dll" +#define NPT_LIBNAME "npt" -#define NPT_INITIALIZE(pnpt,version,options) \ +#define NPT_INITIALIZE(path,pnpt,version,options) \ { \ - HINSTANCE jvm; \ void *_handle; \ void *_sym; \ - char buf[FILENAME_MAX+32]; \ - char *lastSlash; \ \ if ( (pnpt) == NULL ) NPT_ERROR("NptEnv* is NULL"); \ - _handle = NULL; \ *(pnpt) = NULL; \ - buf[0] = 0; \ - jvm = GetModuleHandle("jvm.dll"); \ - if ( jvm == NULL ) NPT_ERROR("Cannot find jvm.dll"); \ - GetModuleFileName(jvm, buf, FILENAME_MAX); \ - lastSlash = strrchr(buf, '\\'); \ - if ( lastSlash != NULL ) { \ - *lastSlash = '\0'; \ - (void)strcat(buf, "\\..\\"); \ - (void)strcat(buf, NPT_LIBNAME); \ - _handle = LoadLibrary(buf); \ - } \ + _handle = LoadLibrary(path); \ if ( _handle == NULL ) NPT_ERROR("Cannot open library"); \ _sym = GetProcAddress(_handle, "nptInitialize"); \ if ( _sym == NULL ) NPT_ERROR("Cannot find nptInitialize"); \ diff --git a/test/ProblemList.txt b/test/ProblemList.txt index e17da5e9b91ed7a94dffdfa5e007e994b604330f..b41e357bdb32af604ade035757980019d501d931 100644 --- a/test/ProblemList.txt +++ b/test/ProblemList.txt @@ -141,6 +141,9 @@ java/lang/management/MemoryMXBean/LowMemoryTest2.sh generic-all # jdk_management +# 7158614 +sun/management/jmxremote/startstop/JMXStartStopTest.sh linux-all + ############################################################################ # jdk_jmx @@ -162,6 +165,9 @@ javax/management/remote/mandatory/notif/DiffHBTest.java generic-all # 6988950 demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java generic-all +# 7027502 +demo/jvmti/hprof/MonitorTest.java generic-all + ############################################################################ # jdk_net @@ -204,6 +210,9 @@ java/net/CookieHandler/CookieManagerTest.java macosx-all # jdk_io +# 7160013 +java/io/File/MaxPathLength.java windows-all + ############################################################################ # jdk_nio @@ -225,6 +234,9 @@ java/nio/channels/DatagramChannel/ChangingAddress.java macosx-all # 7132677 java/nio/channels/Selector/OutOfBand.java macosx-all +# 8003895 +java/nio/channels/AsynchronousChannelGroup/Unbounded.java windows-amd64 + ############################################################################ # jdk_rmi @@ -242,7 +254,7 @@ java/rmi/reliability/benchmark/runRmiBench.sh generic-all java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java generic-all # 7195095 -sun/rmi/transport/proxy/EagerHttpFallback.java linux-all +sun/rmi/transport/proxy/EagerHttpFallback.java generic-all ############################################################################ @@ -283,6 +295,12 @@ sun/security/tools/keytool/standard.sh solaris-all # 8000439: NPG: REGRESSION : sun/security/krb5/auto/MaxRetries.java fails with timeout sun/security/krb5/auto/MaxRetries.java solaris-sparcv9 +# 7194428 +sun/security/mscapi/ShortRSAKey1024.sh windows-all + +# 8000897, vm crash +sun/security/provider/DSA/TestAlgParameterGenerator.java generic-all + ############################################################################ # jdk_sound @@ -345,9 +363,6 @@ java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java generic-all # Filed 6772009 java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all -# 8003596 -java/util/logging/CheckLockLocationTest.java windows-all - # 7041639, Solaris DSA keypair generation bug java/util/TimeZone/TimeZoneDatePermissionCheck.sh solaris-all diff --git a/test/java/beans/EventHandler/Test6277266.java b/test/java/beans/EventHandler/Test6277266.java index 60bc13727e0f791eb2995ae7274457e9465a7cb4..72383f4217df986e870d8dc4f621d17dd8f29282 100644 --- a/test/java/beans/EventHandler/Test6277266.java +++ b/test/java/beans/EventHandler/Test6277266.java @@ -51,9 +51,11 @@ public class Test6277266 { ) ); throw new Error("SecurityException expected"); + } catch (SecurityException exception) { + return; // expected security exception in JDK 7 } catch (InvocationTargetException exception) { if (exception.getCause() instanceof SecurityException){ - return; // expected security exception + return; // expected security exception in JDK 8 } throw new Error("unexpected exception", exception); } catch (InterruptedException exception) { diff --git a/test/java/lang/Math/DivModTests.java b/test/java/lang/Math/DivModTests.java index 43e88bdcebba643ea7e23f662fa9ca426e300f92..2cea8cb8c12c80f126c494168e2426bbdfe73a86 100644 --- a/test/java/lang/Math/DivModTests.java +++ b/test/java/lang/Math/DivModTests.java @@ -65,7 +65,7 @@ public class DivModTests { * Math and StrictMath tested and the same results are expected for both. */ static void testIntFloorDivMod() { - testIntFloorDivMod(4, 0, new ArithmeticException("/ by zero"), new ArithmeticException("/ by zero")); // Should throw ArithmeticException + testIntFloorDivMod(4, 0, new ArithmeticException(), new ArithmeticException()); // Should throw ArithmeticException testIntFloorDivMod(4, 3, 1, 1); testIntFloorDivMod(3, 3, 1, 0); testIntFloorDivMod(2, 3, 0, 2); @@ -151,7 +151,7 @@ public class DivModTests { * Test the floorDiv and floorMod methods for primitive long. */ static void testLongFloorDivMod() { - testLongFloorDivMod(4L, 0L, new ArithmeticException("/ by zero"), new ArithmeticException("/ by zero")); // Should throw ArithmeticException + testLongFloorDivMod(4L, 0L, new ArithmeticException(), new ArithmeticException()); // Should throw ArithmeticException testLongFloorDivMod(4L, 3L, 1L, 1L); testLongFloorDivMod(3L, 3L, 1L, 0L); testLongFloorDivMod(2L, 3L, 0L, 2L); @@ -385,9 +385,7 @@ public class DivModTests { } // Handle special case to compare ArithmeticExceptions if (result instanceof ArithmeticException && expected instanceof ArithmeticException) { - ArithmeticException ae1 = (ArithmeticException)result; - ArithmeticException ae2 = (ArithmeticException)expected; - return ae1.getMessage().equals(ae2.getMessage()); + return true; } return false; } diff --git a/test/java/lang/ThreadLocal/ThreadLocalSupplierTest.java b/test/java/lang/ThreadLocal/ThreadLocalSupplierTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5601ac50bc4a5c69221b26714c9c4888b04f6a61 --- /dev/null +++ b/test/java/lang/ThreadLocal/ThreadLocalSupplierTest.java @@ -0,0 +1,125 @@ +/* + * 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. + * + * 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. + */ + +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * @test + * @run testng ThreadLocalSupplierTest + * @summary tests ThreadLocal.withInitial(). + * Adapted from java.lang.Basic functional test of ThreadLocal + * + * @author Jim Gish + */ +@Test +public class ThreadLocalSupplierTest { + + static final class IntegerSupplier implements Supplier { + + private final AtomicInteger supply = new AtomicInteger(0); + + @Override + public Integer get() { + return supply.getAndIncrement(); + } + + public int numCalls() { + return supply.intValue(); + } + } + + static IntegerSupplier theSupply = new IntegerSupplier(); + + static final class MyThreadLocal extends ThreadLocal { + + private final ThreadLocal delegate; + + public volatile boolean everCalled; + + public MyThreadLocal(Supplier supplier) { + delegate = ThreadLocal.withInitial(supplier); + } + + @Override + public Integer get() { + return delegate.get(); + } + + @Override + protected synchronized Integer initialValue() { + // this should never be called since we are using the factory instead + everCalled = true; + return null; + } + } + + /** + * Our one and only ThreadLocal from which we get thread ids using a + * supplier which simply increments a counter on each call of get(). + */ + static MyThreadLocal threadLocal = new MyThreadLocal(theSupply); + + public void testMultiThread() throws Exception { + final int threadCount = 500; + final Thread th[] = new Thread[threadCount]; + final boolean visited[] = new boolean[threadCount]; + + // Create and start the threads + for (int i = 0; i < threadCount; i++) { + th[i] = new Thread() { + @Override + public void run() { + final int threadId = threadLocal.get(); + assertFalse(visited[threadId], "visited[" + threadId + "]=" + visited[threadId]); + visited[threadId] = true; + // check the get() again + final int secondCheckThreadId = threadLocal.get(); + assertEquals(secondCheckThreadId, threadId); + } + }; + th[i].start(); + } + + // Wait for the threads to finish + for (int i = 0; i < threadCount; i++) { + th[i].join(); + } + + assertEquals(theSupply.numCalls(), threadCount); + // make sure the provided initialValue() has not been called + assertFalse(threadLocal.everCalled); + // Check results + for (int i = 0; i < threadCount; i++) { + assertTrue(visited[i], "visited[" + i + "]=" + visited[i]); + } + } + + public void testSimple() { + final String expected = "OneWithEverything"; + final ThreadLocal threadLocal = ThreadLocal.withInitial(() -> expected); + assertEquals(expected, threadLocal.get()); + } +} diff --git a/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java b/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java new file mode 100644 index 0000000000000000000000000000000000000000..8c3d1c5ed5baa4dfbfb493370cc20345ef34d831 --- /dev/null +++ b/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java @@ -0,0 +1,226 @@ +/* + * 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. + * + * 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. + */ + +/* + * @test + * @bug 8003881 + * @summary tests DoPrivileged action (implemented as lambda expressions) by + * inserting them into the BootClassPath. + * @compile -XDignore.symbol.file LambdaAccessControlDoPrivilegedTest.java + * @run main/othervm LambdaAccessControlDoPrivilegedTest + */ +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class LambdaAccessControlDoPrivilegedTest extends LUtils { + public static void main(String... args) { + final List scratch = new ArrayList(); + scratch.clear(); + scratch.add("import java.security.*;"); + scratch.add("public class DoPriv {"); + scratch.add("public static void main(String... args) {"); + scratch.add("String prop = AccessController.doPrivileged((PrivilegedAction) () -> {"); + scratch.add("return System.getProperty(\"user.home\");"); + scratch.add("});"); + scratch.add("}"); + scratch.add("}"); + File doprivJava = new File("DoPriv.java"); + File doprivClass = getClassFile(doprivJava); + createFile(doprivJava, scratch); + + scratch.clear(); + scratch.add("public class Bar {"); + scratch.add("public static void main(String... args) {"); + scratch.add("System.out.println(\"sun.boot.class.path\" + \"=\" +"); + scratch.add(" System.getProperty(\"sun.boot.class.path\", \"\"));"); + scratch.add("System.setSecurityManager(new SecurityManager());"); + scratch.add("DoPriv.main();"); + scratch.add("}"); + scratch.add("}"); + + File barJava = new File("Bar.java"); + File barClass = getClassFile(barJava); + createFile(barJava, scratch); + + String[] javacArgs = {barJava.getName(), doprivJava.getName()}; + compile(javacArgs); + File jarFile = new File("foo.jar"); + String[] jargs = {"cvf", jarFile.getName(), doprivClass.getName()}; + jarTool.run(jargs); + doprivJava.delete(); + doprivClass.delete(); + TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), + "-Xbootclasspath/p:foo.jar", + "-cp", ".", "Bar"); + tr.assertZero("testDoPrivileged fails"); + barJava.delete(); + barClass.delete(); + jarFile.delete(); + } +} + +/* + * support infrastructure to invoke a java class from the command line + */ +class LUtils { + static final sun.tools.jar.Main jarTool = + new sun.tools.jar.Main(System.out, System.err, "jar-tool"); + static final com.sun.tools.javac.Main javac = + new com.sun.tools.javac.Main(); + static final File cwd = new File(".").getAbsoluteFile(); + static final String JAVAHOME = System.getProperty("java.home"); + static final boolean isWindows = + System.getProperty("os.name", "unknown").startsWith("Windows"); + //static final boolean isSDK = JAVAHOME.endsWith("jre"); + static final File JAVA_BIN_FILE = new File(JAVAHOME, "bin"); + static final File JAVA_CMD = new File(JAVA_BIN_FILE, + isWindows ? "java.exe" : "java"); + + protected LUtils() { + } + + public static void compile(String... args) { + if (javac.compile(args) != 0) { + throw new RuntimeException("compilation fails"); + } + } + + static void createFile(File outFile, List content) { + try { + Files.write(outFile.getAbsoluteFile().toPath(), content, + Charset.defaultCharset()); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + } + + static File getClassFile(File javaFile) { + return javaFile.getName().endsWith(".java") + ? new File(javaFile.getName().replace(".java", ".class")) + : null; + } + + static String getSimpleName(File inFile) { + String fname = inFile.getName(); + return fname.substring(0, fname.indexOf(".")); + } + + static TestResult doExec(String... cmds) { + return doExec(null, null, cmds); + } + + /* + * A method which executes a java cmd and returns the results in a container + */ + static TestResult doExec(Map envToSet, + java.util.Set envToRemove, String... cmds) { + String cmdStr = ""; + for (String x : cmds) { + cmdStr = cmdStr.concat(x + " "); + } + ProcessBuilder pb = new ProcessBuilder(cmds); + Map env = pb.environment(); + if (envToRemove != null) { + for (String key : envToRemove) { + env.remove(key); + } + } + if (envToSet != null) { + env.putAll(envToSet); + } + BufferedReader rdr = null; + try { + List outputList = new ArrayList<>(); + pb.redirectErrorStream(true); + Process p = pb.start(); + rdr = new BufferedReader(new InputStreamReader(p.getInputStream())); + String in = rdr.readLine(); + while (in != null) { + outputList.add(in); + in = rdr.readLine(); + } + p.waitFor(); + p.destroy(); + + return new TestResult(cmdStr, p.exitValue(), outputList, + env, new Throwable("current stack of the test")); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException(ex.getMessage()); + } + } + + static class TestResult { + String cmd; + int exitValue; + List testOutput; + Map env; + Throwable t; + + public TestResult(String str, int rv, List oList, + Map env, Throwable t) { + cmd = str; + exitValue = rv; + testOutput = oList; + this.env = env; + this.t = t; + } + + void assertZero(String message) { + if (exitValue != 0) { + System.err.println(this); + throw new RuntimeException(message); + } + } + + @Override + public String toString() { + StringWriter sw = new StringWriter(); + PrintWriter status = new PrintWriter(sw); + status.println("Cmd: " + cmd); + status.println("Return code: " + exitValue); + status.println("Environment variable:"); + for (String x : env.keySet()) { + status.println("\t" + x + "=" + env.get(x)); + } + status.println("Output:"); + for (String x : testOutput) { + status.println("\t" + x); + } + status.println("Exception:"); + status.println(t.getMessage()); + t.printStackTrace(status); + + return sw.getBuffer().toString(); + } + } +} diff --git a/test/java/lang/invoke/lambda/LambdaAccessControlTest.java b/test/java/lang/invoke/lambda/LambdaAccessControlTest.java new file mode 100644 index 0000000000000000000000000000000000000000..361a4cffccef412c6b0c2f5af5505d8606145c39 --- /dev/null +++ b/test/java/lang/invoke/lambda/LambdaAccessControlTest.java @@ -0,0 +1,49 @@ +/* + * 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. + * + * 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. + */ + +/* + * @test + * @bug 8003881 + * @summary tests Lambda expression with a a security manager at top level + * @compile -XDignore.symbol.file LambdaAccessControlTest.java + * + * @run main/othervm LambdaAccessControlTest + */ + +public class LambdaAccessControlTest extends LUtils { + public static void main(String... args) { + System.setSecurityManager(new SecurityManager()); + JJ iii = (new CC())::impl; + System.out.printf(">>> %s\n", iii.foo(44)); + iii = DD::impl; + System.out.printf(">>> %s\n", iii.foo(44)); + return; + } +} +/* + * support classes for the test + */ +interface II { Object foo(T x); } +interface JJ extends II { } +class CC { String impl(int i) { return "impl:"+i; }} +class DD { static String impl(int i) { return "impl:"+i; }} diff --git a/test/java/rmi/testlibrary/TestLibrary.java b/test/java/rmi/testlibrary/TestLibrary.java index 734d805091809eb5bd955bdee84f40a8194e18b7..07ed308355c6eedb70ad3058700abda6067d5c4a 100644 --- a/test/java/rmi/testlibrary/TestLibrary.java +++ b/test/java/rmi/testlibrary/TestLibrary.java @@ -54,6 +54,7 @@ import java.rmi.server.RemoteRef; import java.rmi.server.UnicastRemoteObject; import java.util.Enumeration; import java.util.Properties; + import sun.rmi.registry.RegistryImpl; import sun.rmi.server.UnicastServerRef; import sun.rmi.transport.Endpoint; @@ -92,6 +93,7 @@ public class TestLibrary { public final static int INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT = 64003; public final static int INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT = 64004; public final static int READTEST_REGISTRY_PORT = 64005; + private final static int MAX_SERVER_SOCKET_TRIES = 10; static void mesg(Object mesg) { System.err.println("TEST_LIBRARY: " + mesg.toString()); @@ -125,36 +127,15 @@ public class TestLibrary { bomb(null, e); } - /** - * Property accessors - */ - private static boolean getBoolean(String name) { - return (new Boolean(getProperty(name, "false")).booleanValue()); - } - private static Integer getInteger(String name) { - int val = 0; - Integer value = null; - - String propVal = getProperty(name, null); - if (propVal == null) { - return null; - } - - try { - value = new Integer(Integer.parseInt(propVal)); - } catch (NumberFormatException nfe) { - } - return value; - } public static String getProperty(String property, String defaultVal) { final String prop = property; final String def = defaultVal; - return ((String) java.security.AccessController.doPrivileged - (new java.security.PrivilegedAction() { - public Object run() { + return java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public String run() { return System.getProperty(prop, def); } - })); + }); } /** @@ -169,9 +150,9 @@ public class TestLibrary { public static void setProperty(String property, String value) { final String prop = property; final String val = value; - java.security.AccessController.doPrivileged - (new java.security.PrivilegedAction() { - public Object run() { + java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public Void run() { System.setProperty(prop, val); return null; } @@ -188,7 +169,7 @@ public class TestLibrary { out.println("-------------------Test environment----------" + "---------"); - for(Enumeration keys = System.getProperties().keys(); + for(Enumeration keys = System.getProperties().keys(); keys.hasMoreElements();) { String property = (String) keys.nextElement(); @@ -252,7 +233,7 @@ public class TestLibrary { /* * Obtain the URL for the codebase. */ - URL codebaseURL = dstDir.toURL(); + URL codebaseURL = dstDir.toURI().toURL(); /* * Specify where we will copy the class definition from, if @@ -407,26 +388,46 @@ public class TestLibrary { */ public static int getUnusedRandomPort() { int numTries = 0; - int unusedRandomPort = FIXED_PORT_MIN; - Exception ex = null; + IOException ex = null; - while (numTries++ < 10) { + while (numTries++ < MAX_SERVER_SOCKET_TRIES) { + int unusedRandomPort = -1; ex = null; //reset try (ServerSocket ss = new ServerSocket(0)) { unusedRandomPort = ss.getLocalPort(); - } catch (Exception e) { + } catch (IOException e) { ex = e; + // temporarily print stack trace here until we find out why + // tests are failing. + System.err.println("TestLibrary.getUnusedRandomPort() caught " + + "exception on iteration " + numTries + + (numTries==MAX_SERVER_SOCKET_TRIES ? " (the final try)." + : ".")); + ex.printStackTrace(); } - if (!isReservedPort(unusedRandomPort)) { - return unusedRandomPort; + if (unusedRandomPort >= 0) { + if (isReservedPort(unusedRandomPort)) { + System.out.println("INFO: On try # " + numTries + + (numTries==MAX_SERVER_SOCKET_TRIES ? ", the final try, ": ",") + + " ServerSocket(0) returned the reserved port " + + unusedRandomPort + + " in TestLibrary.getUnusedRandomPort() "); + } else { + return unusedRandomPort; + } } } // If we're here, then either an exception was thrown or the port is // a reserved port. - throw new RuntimeException("Error getting unused random port.", ex); + if (ex==null) { + throw new RuntimeException("Error getting unused random port. The" + +" last port returned by ServerSocket(0) was a reserved port"); + } else { + throw new RuntimeException("Error getting unused random port.", ex); + } } /** diff --git a/test/java/util/Base64/TestBase64.java b/test/java/util/Base64/TestBase64.java index 84e3885511dafdc7ab2f7f2eacd0847a98063ea4..6b37772d7f623da3e60cfa7741afbe60957b526d 100644 --- a/test/java/util/Base64/TestBase64.java +++ b/test/java/util/Base64/TestBase64.java @@ -22,7 +22,7 @@ */ /** - * @test 4235519 + * @test 4235519 8004212 * @summary tests java.util.Base64 */ @@ -106,6 +106,9 @@ public class TestBase64 { Base64.getDecoder().decode(ByteBuffer.wrap(decoded), ByteBuffer.allocate(1024)); }}); checkIAE(new Runnable() { public void run() { Base64.getDecoder().decode(ByteBuffer.wrap(decoded), ByteBuffer.allocateDirect(1024)); }}); + + // test return value from decode(ByteBuffer, ByteBuffer) + testDecBufRet(); } private static sun.misc.BASE64Encoder sunmisc = new sun.misc.BASE64Encoder(); @@ -351,6 +354,52 @@ public class TestBase64 { } catch (IllegalArgumentException iae) {} } + + private static void testDecBufRet() throws Throwable { + Random rnd = new java.util.Random(); + Base64.Encoder encoder = Base64.getEncoder(); + Base64.Decoder decoder = Base64.getDecoder(); + // src pos, len expected + int[][] tests = { { 6, 3, 3, 3}, // xxx xxx -> yyyy yyyy + { 6, 3, 4, 3}, + { 6, 3, 5, 3}, + { 6, 3, 6, 6}, + { 6, 11, 4, 3}, + { 6, 11, 4, 3}, + { 6, 11, 5, 3}, + { 6, 11, 6, 6}, + { 7, 3, 6, 6}, // xxx xxx x -> yyyy yyyy yy== + { 7, 3, 7, 7}, + { 7, 11, 6, 6}, + { 7, 11, 7, 7}, + { 8, 3, 6, 6}, // xxx xxx xx -> yyyy yyyy yyy= + { 8, 3, 7, 6}, + { 8, 3, 8, 8}, + { 8, 13, 6, 6}, + { 8, 13, 7, 6}, + { 8, 13, 8, 8}, + + }; + ByteBuffer dstBuf = ByteBuffer.allocate(100); + for (boolean direct : new boolean[] { false, true}) { + for (int[] test : tests) { + byte[] src = new byte[test[0]]; + rnd.nextBytes(src); + ByteBuffer srcBuf = direct ? ByteBuffer.allocate(100) + : ByteBuffer.allocateDirect(100); + srcBuf.put(encoder.encode(src)).flip(); + dstBuf.clear().position(test[1]).limit(test[1]+ test[2]); + int ret = decoder.decode(srcBuf, dstBuf); + if (ret != test[3]) { + System.out.printf(" [%6s] src=%d, pos=%d, len=%d, expected=%d, ret=%d%n", + direct?"direct":"", + test[0], test[1], test[2], test[3], ret); + throw new RuntimeException("ret != expected"); + } + } + } + } + private static final void testEncode(Base64.Encoder enc, ByteBuffer bin, byte[] expected) throws Throwable { diff --git a/test/java/util/Calendar/GenericTimeZoneNamesTest.java b/test/java/util/Calendar/GenericTimeZoneNamesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f2dcbe5cfd5a6d68b621f5f56d2c26b6272a5daf --- /dev/null +++ b/test/java/util/Calendar/GenericTimeZoneNamesTest.java @@ -0,0 +1,57 @@ +/* + * 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. + * + * 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. + */ + +import java.util.*; +import sun.util.locale.provider.TimeZoneNameUtility; + +public class GenericTimeZoneNamesTest { + private static final String[] PT = { + "America/Los_Angeles", "US/Pacific", "PST" + }; + + private static int errors = 0; + + public static void main(String[] args) { + for (String tag : args) { + Locale locale = Locale.forLanguageTag(tag); + for (String tzid : PT) { + test(tzid, TimeZone.LONG, locale, "Pacific Time"); + test(tzid, TimeZone.SHORT, locale, "PT"); + } + } + + if (errors != 0) { + throw new RuntimeException("test failed"); + } + } + + private static void test(String tzid, int style, Locale locale, String expected) { + // No public API to get generic time zone names (JDK 8) + String got = TimeZoneNameUtility.retrieveGenericDisplayName(tzid, style, locale); + if (!expected.equals(got)) { + System.err.printf("test: tzid=%s, locale=%s, style=%d, got=\"%s\", expected=\"%s\"%n", + tzid, locale, style, got, expected); + errors++; + } + } +} diff --git a/test/java/util/Calendar/GenericTimeZoneNamesTest.sh b/test/java/util/Calendar/GenericTimeZoneNamesTest.sh new file mode 100644 index 0000000000000000000000000000000000000000..a5491891bbb2dd6ff5903a79617da3e76c57bc06 --- /dev/null +++ b/test/java/util/Calendar/GenericTimeZoneNamesTest.sh @@ -0,0 +1,47 @@ +# +# 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. +# +# 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. +# + +# @test +# @bug 8003267 +# @summary Unit test for generic time zone names support +# @compile -XDignore.symbol.file GenericTimeZoneNamesTest.java +# @run shell GenericTimeZoneNamesTest.sh + +# This test is locale data-dependent and assumes that both JRE and CLDR +# have the same geneic time zone names in English. + +STATUS=0 +echo "Locale providers: default" +# TODO: The purpose of ja-JP is to make sure the fallback for generic +# names works. Remove ja-JP when adding generic names to localized +# resources. +if ! ${TESTJAVA}/bin/java -esa -cp "${TESTCLASSES}" GenericTimeZoneNamesTest en-US ja-JP; then + STATUS=1 +fi + +echo "Locale providers: CLDR" +if ! ${TESTJAVA}/bin/java -esa -cp "${TESTCLASSES}" -Djava.locale.providers=CLDR GenericTimeZoneNamesTest en-US; then + STATUS=1 +fi +exit ${STATUS} + diff --git a/test/java/util/Calendar/NarrowNamesTest.java b/test/java/util/Calendar/NarrowNamesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7338792abd35a3c00a093cd6f7384c717b7bc7e3 --- /dev/null +++ b/test/java/util/Calendar/NarrowNamesTest.java @@ -0,0 +1,172 @@ +/* + * 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. + * + * 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. + */ + +import java.util.*; +import static java.util.GregorianCalendar.*; + +public class NarrowNamesTest { + private static final Locale US = Locale.US; + private static final Locale JAJPJP = new Locale("ja", "JP", "JP"); + private static final Locale THTH = new Locale("th", "TH"); + + private static final String RESET_INDEX = "RESET_INDEX"; + + private static int errors = 0; + + // This test is locale data-dependent. + public static void main(String[] args) { + test(US, ERA, "B", + ERA, BC, YEAR, 1); + test(US, ERA, "A", + ERA, AD, YEAR, 2012); + test(US, DAY_OF_WEEK, "S", + YEAR, 2012, MONTH, DECEMBER, DAY_OF_MONTH, 23); + test(US, AM_PM, "a", + HOUR_OF_DAY, 10); + test(US, AM_PM, "p", + HOUR_OF_DAY, 23); + test(JAJPJP, DAY_OF_WEEK, "\u65e5", + YEAR, 24, MONTH, DECEMBER, DAY_OF_MONTH, 23); + test(THTH, MONTH, NARROW_STANDALONE, "\u0e18.\u0e04.", + YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5); + test(THTH, DAY_OF_WEEK, "\u0e1e", + YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5); + + testMap(US, DAY_OF_WEEK, ALL_STYLES, // shouldn't include any narrow names + "", // 1-based indexing for DAY_OF_WEEK + "Sunday", // Sunday + "Monday", // Monday + "Tuesday", // Tuesday + "Wednesday", // Wednesday + "Thursday", // Thursday + "Friday", // Friday + "Saturday", // Saturday + RESET_INDEX, + "", // 1-based indexing for DAY_OF_WEEK + "Sun", // abb Sunday + "Mon", // abb Monday + "Tue", // abb Tuesday + "Wed", // abb Wednesday + "Thu", // abb Thursday + "Fri", // abb Friday + "Sat" // abb Saturday + ); + testMap(US, DAY_OF_WEEK, NARROW_FORMAT); // expect null + testMap(US, AM_PM, ALL_STYLES, + "AM", "PM", + RESET_INDEX, + "a", "p"); + testMap(JAJPJP, DAY_OF_WEEK, NARROW_STANDALONE); // expect null + testMap(JAJPJP, DAY_OF_WEEK, NARROW_FORMAT, + "", // 1-based indexing for DAY_OF_WEEK + "\u65e5", + "\u6708", + "\u706b", + "\u6c34", + "\u6728", + "\u91d1", + "\u571f"); + testMap(THTH, MONTH, NARROW_FORMAT); // expect null + testMap(THTH, MONTH, NARROW_STANDALONE, + "\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."); + + if (errors != 0) { + throw new RuntimeException("test failed"); + } + } + + private static void test(Locale locale, int field, String expected, int... data) { + test(locale, field, NARROW_FORMAT, expected, data); + } + + private static void test(Locale locale, int field, int style, String expected, int... fieldValuePairs) { + Calendar cal = Calendar.getInstance(locale); + cal.clear(); + for (int i = 0; i < fieldValuePairs.length;) { + int f = fieldValuePairs[i++]; + int v = fieldValuePairs[i++]; + cal.set(f, v); + } + String got = cal.getDisplayName(field, style, locale); + if (!expected.equals(got)) { + System.err.printf("test: locale=%s, field=%d, value=%d, style=%d, got=\"%s\", expected=\"%s\"%n", + locale, field, cal.get(field), style, got, expected); + errors++; + } + } + + private static void testMap(Locale locale, int field, int style, String... expected) { + Map expectedMap = null; + if (expected.length > 0) { + expectedMap = new TreeMap<>(LengthBasedComparator.INSTANCE); + int index = 0; + for (int i = 0; i < expected.length; i++) { + if (expected[i].isEmpty()) { + index++; + continue; + } + if (expected[i] == RESET_INDEX) { + index = 0; + continue; + } + expectedMap.put(expected[i], index++); + } + } + Calendar cal = Calendar.getInstance(locale); + Map got = cal.getDisplayNames(field, style, locale); + if (!(expectedMap == null && got == null) + && !expectedMap.equals(got)) { + System.err.printf("testMap: locale=%s, field=%d, style=%d, expected=%s, got=%s%n", + locale, field, style, expectedMap, got); + errors++; + } + } + + /** + * Comparator implementation for TreeMap which iterates keys from longest + * to shortest. + */ + private static class LengthBasedComparator implements Comparator { + private static final LengthBasedComparator INSTANCE = new LengthBasedComparator(); + + private LengthBasedComparator() { + } + + @Override + public int compare(String o1, String o2) { + int n = o2.length() - o1.length(); + return (n == 0) ? o1.compareTo(o2) : n; + } + } +} diff --git a/test/java/util/Calendar/NarrowNamesTest.sh b/test/java/util/Calendar/NarrowNamesTest.sh new file mode 100644 index 0000000000000000000000000000000000000000..742e35ac29172555424f6fa45278d73637f4557e --- /dev/null +++ b/test/java/util/Calendar/NarrowNamesTest.sh @@ -0,0 +1,41 @@ +# +# 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. +# +# 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. +# + +# @test +# @bug 8000983 +# @summary Unit test for narrow names support +# @build NarrowNamesTest +# @run shell NarrowNamesTest.sh + +# This test is locale data-dependent and assumes that both JRE and CLDR +# have the same narrow names. + +STATUS=0 +for P in "JRE,SPI" "CLDR" +do + echo "Locale providers: $P" + if ! ${TESTJAVA}/bin/java -esa -cp "${TESTCLASSES}" -Djava.locale.providers="${P}" NarrowNamesTest; then + STATUS=1 + fi +done +exit ${STATUS} diff --git a/test/java/util/Currency/PropertiesTest.java b/test/java/util/Currency/PropertiesTest.java index ab78ec08f3a4bcaff8ada0880059ba5a407d03cb..4b84e06584e8eb1a88c9d2f0b7ec6077493cbe1d 100644 --- a/test/java/util/Currency/PropertiesTest.java +++ b/test/java/util/Currency/PropertiesTest.java @@ -27,22 +27,15 @@ import java.util.*; import java.util.regex.*; public class PropertiesTest { - public static void main(String[] s) throws Exception { - for (int i = 0; i < s.length; i ++) { - if ("-d".equals(s[i])) { - i++; - if (i == s.length) { - throw new RuntimeException("-d needs output file name"); - } else { - dump(s[i]); - } - } else if ("-c".equals(s[i])) { - if (i+2 == s.length) { - throw new RuntimeException("-d needs two file name arguments, before and after respectively"); - } else { - compare(s[++i], s[++i]); - } - } + public static void main(String[] args) throws Exception { + if (args.length == 2 && args[0].equals("-d")) { + dump(args[1]); + } else if (args.length == 4 && args[0].equals("-c")) { + compare(args[1], args[2], args[3]); + } else { + System.err.println("Usage: java PropertiesTest -d "); + System.err.println(" java PropertiesTest -c "); + System.exit(-1); } } @@ -77,15 +70,17 @@ public class PropertiesTest { pw.close(); } - private static void compare(String beforeFile, String afterFile) throws Exception { + private static void compare(String beforeFile, String afterFile, String propsFile) + throws IOException + { // load file contents Properties before = new Properties(); + try (Reader reader = new FileReader(beforeFile)) { + before.load(reader); + } Properties after = new Properties(); - try { - before.load(new FileReader(beforeFile)); - after.load(new FileReader(afterFile)); - } catch (IOException ioe) { - throw new RuntimeException(ioe); + try (Reader reader = new FileReader(afterFile)) { + after.load(reader); } // remove the same contents from the 'after' properties @@ -103,13 +98,9 @@ public class PropertiesTest { } // now look at the currency.properties - String propFileName = System.getProperty("java.home") + File.separator + - "lib" + File.separator + "currency.properties"; Properties p = new Properties(); - try { - p.load(new FileReader(propFileName)); - } catch (IOException ioe) { - throw new RuntimeException(ioe); + try (Reader reader = new FileReader(propsFile)) { + p.load(reader); } // test each replacements diff --git a/test/java/util/Currency/PropertiesTest.sh b/test/java/util/Currency/PropertiesTest.sh index f016eed3d812639feda4451f2e1b386f90bef420..874e7ac301859c06185223a3c6148ddf4624829a 100644 --- a/test/java/util/Currency/PropertiesTest.sh +++ b/test/java/util/Currency/PropertiesTest.sh @@ -1,7 +1,29 @@ #!/bin/sh + +# Copyright (c) 2007, 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. +# +# 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. +# + # @test -# @bug 6332666 7180362 +# @bug 6332666 7180362 8003846 # @summary tests the capability of replacing the currency data with user # specified currency properties file # @build PropertiesTest @@ -36,7 +58,7 @@ case "$OS" in ;; Windows* | CYGWIN* ) PS=";" - FS="\\" + FS="/" ;; * ) echo "Unrecognized system!" @@ -44,23 +66,31 @@ case "$OS" in ;; esac -# Currency dump path #1. Just dump currencies with the bare JRE +failures=0 -# run -RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} PropertiesTest -d dump1" +run() { + echo '' + sh -xc "${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} $*" 2>&1 + if [ $? != 0 ]; then failures=`expr $failures + 1`; fi +} -echo ${RUNCMD} -${RUNCMD} -result=$? +PROPS=${TESTSRC}${FS}currency.properties -if [ $result -eq 0 ] -then - echo "Execution successful" -else - echo "Execution of the test case failed." -fi -# Currency dump path #2. Dump currencies using the JRE with replacement currencies +# Dump built-in currency data + +run PropertiesTest -d dump1 + + +# Dump built-in currency data + overrides in properties file specified +# by system property. + +run -Djava.util.currency.data=${PROPS} PropertiesTest -d dump2 +run PropertiesTest -c dump1 dump2 ${PROPS} + + +# Dump built-in currency data + overrides in properties file copied into +# JRE image. # copy the test properties file COPIED=0 @@ -79,44 +109,27 @@ then else PROPLOCATION=${WRITABLEJDK}${FS}lib fi -cp ${TESTSRC}${FS}currency.properties $PROPLOCATION +cp ${PROPS} $PROPLOCATION # run -RUNCMD="${WRITABLEJDK}${FS}bin${FS}java -classpath ${TESTCLASSES} PropertiesTest -d dump2" - -echo ${RUNCMD} -${RUNCMD} -result=$? - -if [ $result -eq 0 ] -then - echo "Execution successful" -else - echo "Execution of the test case failed." -fi - -# Now compare the two dump files - -RUNCMD="${WRITABLEJDK}${FS}bin${FS}java -classpath ${TESTCLASSES} PropertiesTest -c dump1 dump2" - -echo ${RUNCMD} -${RUNCMD} -result=$? - -if [ $result -eq 0 ] -then - echo "Execution successful" -else - echo "Execution of the test case failed." -fi +echo '' +sh -xc "${WRITABLEJDK}${FS}bin${FS}java -cp ${TESTCLASSES} PropertiesTest -d dump3" +if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # Cleanup -rm -f dump1 -rm -f dump2 rm -f ${PROPLOCATION}${FS}currency.properties if [ $COPIED -eq 1 ] then rm -rf $WRITABLEJDK fi -exit $result +# compare the two dump files +run PropertiesTest -c dump1 dump3 ${PROPS} + + +# Results +echo '' +if [ $failures -gt 0 ]; + then echo "$failures tests failed"; + else echo "All tests passed"; fi +exit $failures diff --git a/test/java/util/PluggableLocale/GenericTest.java b/test/java/util/PluggableLocale/GenericTest.java index 8be74cdca91fa7e0141c18c5a3f09727e49865f7..eee0f95ff3a1bcc13f20454209838fe2e686454e 100644 --- a/test/java/util/PluggableLocale/GenericTest.java +++ b/test/java/util/PluggableLocale/GenericTest.java @@ -41,6 +41,7 @@ public class GenericTest { com.bar.CurrencyNameProviderImpl2 currencyNP2 = new com.bar.CurrencyNameProviderImpl2(); com.bar.LocaleNameProviderImpl localeNP = new com.bar.LocaleNameProviderImpl(); com.bar.TimeZoneNameProviderImpl tzNP = new com.bar.TimeZoneNameProviderImpl(); + com.bar.GenericTimeZoneNameProviderImpl tzGenNP = new com.bar.GenericTimeZoneNameProviderImpl(); com.bar.CalendarDataProviderImpl calDataP = new com.bar.CalendarDataProviderImpl(); com.bar.CalendarNameProviderImpl calNameP = new com.bar.CalendarNameProviderImpl(); @@ -73,6 +74,7 @@ public class GenericTest { expected.addAll(Arrays.asList(currencyNP2.getAvailableLocales())); expected.addAll(Arrays.asList(localeNP.getAvailableLocales())); expected.addAll(Arrays.asList(tzNP.getAvailableLocales())); + expected.addAll(Arrays.asList(tzGenNP.getAvailableLocales())); expected.addAll(Arrays.asList(calDataP.getAvailableLocales())); expected.addAll(Arrays.asList(calNameP.getAvailableLocales())); if (!result.equals(expected)) { diff --git a/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java b/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java index cc71e6c6543ebf9354d3dd1e1e2489427b4f8b8d..7ed2fc11429831675f33ee9ebd25b48932d90e23 100644 --- a/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java +++ b/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java @@ -40,6 +40,7 @@ public class TimeZoneNameProviderTest extends ProviderTest { TimeZoneNameProviderTest() { test1(); test2(); + test3(); aliasTest(); } @@ -92,6 +93,7 @@ public class TimeZoneNameProviderTest extends ProviderTest { final String pattern = "z"; final Locale OSAKA = new Locale("ja", "JP", "osaka"); final Locale KYOTO = new Locale("ja", "JP", "kyoto"); + final Locale GENERIC = new Locale("ja", "JP", "generic"); final String[] TIMEZONES = { "GMT", "America/Los_Angeles", "SystemV/PST8", @@ -157,6 +159,29 @@ public class TimeZoneNameProviderTest extends ProviderTest { } } + void test3() { + final String[] TZNAMES = { + LATIME, PST, PST8PDT, US_PACIFIC, + TOKYOTIME, JST, JAPAN, + }; + for (String tzname : TZNAMES) { + TimeZone tz = TimeZone.getTimeZone(tzname); + for (int style : new int[] { TimeZone.LONG, TimeZone.SHORT }) { + String osakaStd = tz.getDisplayName(false, style, OSAKA); + if (osakaStd != null) { + // No API for getting generic time zone names + String generic = TimeZoneNameUtility.retrieveGenericDisplayName(tzname, + style, GENERIC); + String expected = "Generic " + osakaStd; + if (!expected.equals(generic)) { + throw new RuntimeException("Wrong generic name: got=\"" + generic + + "\", expected=\"" + expected + "\""); + } + } + } + } + } + final String LATIME = "America/Los_Angeles"; final String PST = "PST"; final String PST8PDT = "PST8PDT"; diff --git a/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh b/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh index 76a08e6e83e5a147f8b487061e8cb9f9eb3c0801..4e34ae098141eec3e8a4f7e4512a4ff69995db24 100644 --- a/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh +++ b/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 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 @@ -23,6 +23,6 @@ #!/bin/sh # # @test -# @bug 4052440 +# @bug 4052440 8003267 # @summary TimeZoneNameProvider tests # @run shell ExecTest.sh bar TimeZoneNameProviderTest true diff --git a/test/java/util/PluggableLocale/barprovider.jar b/test/java/util/PluggableLocale/barprovider.jar index deed5facccbba17157bb62d49f5f82c70e7bbaf6..3a6f37a94588c36bed0fc0c8cc7e29aea3dfb2fb 100644 Binary files a/test/java/util/PluggableLocale/barprovider.jar and b/test/java/util/PluggableLocale/barprovider.jar differ diff --git a/test/java/util/PluggableLocale/providersrc/GenericTimeZoneNameProviderImpl.java b/test/java/util/PluggableLocale/providersrc/GenericTimeZoneNameProviderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b005b1a8b15ff91d44d57af9599bc093f4d72317 --- /dev/null +++ b/test/java/util/PluggableLocale/providersrc/GenericTimeZoneNameProviderImpl.java @@ -0,0 +1,58 @@ +/* + * 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. + * + * 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. + */ +/* + * + */ + +package com.bar; + +import java.util.*; +import java.util.spi.*; + +import com.foobar.Utils; + +/** + * Implementation class for getGenericTimeZoneName which returns "Generic "+. + */ +public class GenericTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl { + static final Locale jaJPGeneric = new Locale("ja", "JP", "generic"); + static final Locale OSAKA = new Locale("ja", "JP", "osaka"); + + static Locale[] avail = { + jaJPGeneric + }; + + @Override + public Locale[] getAvailableLocales() { + return avail; + } + + @Override + public String getGenericDisplayName(String id, int style, Locale locale) { + if (!jaJPGeneric.equals(locale)) { + return null; + } + String std = super.getDisplayName(id, false, style, OSAKA); + return (std != null) ? "Generic " + std : null; + } +} diff --git a/test/java/util/PluggableLocale/providersrc/Makefile b/test/java/util/PluggableLocale/providersrc/Makefile index 2af60665a361560e7477f97d2576b2cd6b3343ca..916fed91e62976e905da1251f02e3465194549e1 100644 --- a/test/java/util/PluggableLocale/providersrc/Makefile +++ b/test/java/util/PluggableLocale/providersrc/Makefile @@ -38,6 +38,7 @@ BARFILES_JAVA = \ CurrencyNameProviderImpl.java \ CurrencyNameProviderImpl2.java \ TimeZoneNameProviderImpl.java \ + GenericTimeZoneNameProviderImpl.java \ LocaleNameProviderImpl.java \ CalendarDataProviderImpl.java \ CalendarNameProviderImpl.java \ diff --git a/test/java/util/PluggableLocale/providersrc/java.util.spi.TimeZoneNameProvider b/test/java/util/PluggableLocale/providersrc/java.util.spi.TimeZoneNameProvider index c435e04e133df316bb5e53c9a013187a57779742..a72cb416c334d8893f64f22c68df28f863a3ee27 100644 --- a/test/java/util/PluggableLocale/providersrc/java.util.spi.TimeZoneNameProvider +++ b/test/java/util/PluggableLocale/providersrc/java.util.spi.TimeZoneNameProvider @@ -5,3 +5,4 @@ # implementation class # com.bar.TimeZoneNameProviderImpl +com.bar.GenericTimeZoneNameProviderImpl diff --git a/test/java/util/TimeZone/Bug6912560.java b/test/java/util/TimeZone/Bug6912560.java index c641f3329c66837b3f844ce1b47fa44be6853b8d..e88ffb04c19badc76e184bc54f53b54bbff6781d 100644 --- a/test/java/util/TimeZone/Bug6912560.java +++ b/test/java/util/TimeZone/Bug6912560.java @@ -40,6 +40,9 @@ public class Bug6912560 { // set the user.timezone property String tzname = "Asia/Tokyo"; System.setProperty("user.timezone", tzname); + // make sure the timezone will be initialized by + // the next call to TimeZone.getDefault() + TimeZone.setDefault(null); System.setSecurityManager(new SecurityManager()); TimeZone tz = TimeZone.getDefault(); diff --git a/test/java/util/logging/CheckLockLocationTest.java b/test/java/util/logging/CheckLockLocationTest.java index 0eb98c0d4a0f07c1f6c33fc153454cd415576dfe..ebf31a30c1283c5a24c2815d20900ad8ecd21220 100644 --- a/test/java/util/logging/CheckLockLocationTest.java +++ b/test/java/util/logging/CheckLockLocationTest.java @@ -42,17 +42,22 @@ public class CheckLockLocationTest { private static final String NOT_A_DIR = "not-a-dir"; private static final String WRITABLE_DIR = "writable-dir"; private static final String NON_EXISTENT_DIR = "non-existent-dir"; + private static boolean runNonWritableDirTest; public static void main(String... args) throws IOException { // we'll base all file creation attempts on the system temp directory, // %t and also try specifying non-existent directories and plain files // that should be directories, and non-writable directories, // to exercise all code paths of checking the lock location + // Note that on platforms like Windows that don't support + // setWritable() on a directory, we'll skip the non-writable + // directory test if setWritable(false) returns false. + // File writableDir = setup(); // we now have three files/directories to work with: // writableDir // notAdir - // nonWritableDir + // nonWritableDir (may not be possible on some platforms) // nonExistentDir (which doesn't exist) runTests(writableDir); } @@ -79,15 +84,19 @@ public class CheckLockLocationTest { } // Test 2: creating FileHandler in non-writable directory should fail - try { - new FileHandler("%t/" + NON_WRITABLE_DIR + "/log.log"); - throw new RuntimeException("Test failed: should not have been able" - + " to create FileHandler for " + "%t/" + NON_WRITABLE_DIR - + "/log.log in non-writable directory."); - } catch (IOException ex) { - // check for the right exception - if (!(ex instanceof AccessDeniedException)) { - throw new RuntimeException("Test failed: Expected exception was not an AccessDeniedException", ex); + if (runNonWritableDirTest) { + try { + new FileHandler("%t/" + NON_WRITABLE_DIR + "/log.log"); + throw new RuntimeException("Test failed: should not have been able" + + " to create FileHandler for " + "%t/" + NON_WRITABLE_DIR + + "/log.log in non-writable directory."); + } catch (IOException ex) { + // check for the right exception + if (!(ex instanceof AccessDeniedException)) { + throw new RuntimeException( + "Test failed: Expected exception was not an " + + "AccessDeniedException", ex); + } } } @@ -99,8 +108,11 @@ public class CheckLockLocationTest { + "/log.log in non-directory."); } catch (IOException ex) { // check for the right exception - if (!(ex instanceof FileSystemException && ex.getMessage().contains("Not a directory"))) { - throw new RuntimeException("Test failed: Expected exception was not a FileSystemException", ex); + if (!(ex instanceof FileSystemException + && ex.getMessage().contains("Not a directory"))) { + throw new RuntimeException( + "Test failed: Expected exception was not a " + + "FileSystemException", ex); } } @@ -113,7 +125,8 @@ public class CheckLockLocationTest { } catch (IOException ex) { // check for the right exception if (!(ex instanceof NoSuchFileException)) { - throw new RuntimeException("Test failed: Expected exception was not a NoSuchFileException", ex); + throw new RuntimeException("Test failed: Expected exception " + + "was not a NoSuchFileException", ex); } } } @@ -162,10 +175,14 @@ public class CheckLockLocationTest { nonWritableDir.deleteOnExit(); // make it non-writable - if (!nonWritableDir.setWritable(false)) { - throw new RuntimeException("Test setup failed: unable to make" + if (nonWritableDir.setWritable(false)) { + runNonWritableDirTest = true; + } else { + runNonWritableDirTest = false; + System.out.println( "Test Setup WARNING: unable to make" + " working directory " + nonWritableDir.getAbsolutePath() - + " non-writable."); + + " non-writable on platform " + System.getProperty("os.name")); + } // make sure non-existent directory really doesn't exist diff --git a/test/java/util/prefs/AddNodeChangeListener.java b/test/java/util/prefs/AddNodeChangeListener.java index 8b506dc7e1803fb6c4226386e7226d0c9eaa0eea..761ed2b48cf5967ff65400fd30a8eccbeafc872f 100644 --- a/test/java/util/prefs/AddNodeChangeListener.java +++ b/test/java/util/prefs/AddNodeChangeListener.java @@ -24,9 +24,10 @@ */ /* @test - * @bug 7160252 + * @bug 7160252 7197662 * @summary Checks if events are delivered to a listener * when a child node is added or removed + * @run main/othervm -Djava.util.prefs.userRoot=. AddNodeChangeListener */ import java.util.prefs.*; diff --git a/test/java/util/prefs/CheckUserPrefsStorage.sh b/test/java/util/prefs/CheckUserPrefsStorage.sh index 71ded594cb20974887a262fb61bd2907f8179323..5314b120c0cbf7104a33fde5e7c8a97de48cc376 100644 --- a/test/java/util/prefs/CheckUserPrefsStorage.sh +++ b/test/java/util/prefs/CheckUserPrefsStorage.sh @@ -22,10 +22,10 @@ # # @test -# @bug 7198073 +# @bug 7198073 7197662 # @build CheckUserPrefFirst CheckUserPrefLater # @run shell CheckUserPrefsStorage.sh -# @summary Tests that user preferences are stored in the +# @summary Tests that user preferences are stored in the # permanent storage # @@ -50,14 +50,14 @@ case "$OS" in esac # run CheckUserPrefFirst - creates and stores a user pref -${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} CheckUserPrefFirst +${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} -Djava.util.prefs.userRoot=. CheckUserPrefFirst result=$? if [ "$result" -ne "0" ]; then exit 1 fi # run CheckUserPrefLater - Looks for the stored pref -${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} CheckUserPrefLater +${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} -Djava.util.prefs.userRoot=. CheckUserPrefLater result=$? if [ "$result" -ne "0" ]; then exit 1 diff --git a/test/java/util/prefs/CommentsInXml.java b/test/java/util/prefs/CommentsInXml.java index bf8cdb9f7de14892c28bc09d9cf285fc2b408330..47011af880b93b7fa16cc8a448496746ff969f7e 100644 --- a/test/java/util/prefs/CommentsInXml.java +++ b/test/java/util/prefs/CommentsInXml.java @@ -23,8 +23,9 @@ /* * @test - * @bug 4619564 + * @bug 4619564 7197662 * @summary XMl Comments in Preferences File lead to ClassCastException + * @run main/othervm -Djava.util.prefs.userRoot=. CommentsInXml * @author kladko */ diff --git a/test/java/util/prefs/ConflictInFlush.java b/test/java/util/prefs/ConflictInFlush.java index 290bab7d5e853b8ea8bdc465b920d412bfe90251..1f13ca736efca16156cdc54087a126d69be985a1 100644 --- a/test/java/util/prefs/ConflictInFlush.java +++ b/test/java/util/prefs/ConflictInFlush.java @@ -23,8 +23,9 @@ /* * @test - * @bug 4703132 + * @bug 4703132 7197662 * @summary flush() throws an IllegalStateException on a removed node + * @run main/othervm -Djava.util.prefs.userRoot=. ConflictInFlush * @author Sucheta Dambalkar */ diff --git a/test/java/util/prefs/ExportNode.java b/test/java/util/prefs/ExportNode.java index 5ecab0ffd41dedc903bda3396f36fc38b7ab3108..601b18920b339b2f8cf2846d70234acc350867e1 100644 --- a/test/java/util/prefs/ExportNode.java +++ b/test/java/util/prefs/ExportNode.java @@ -24,9 +24,10 @@ /* * @test - * @bug 4387136 4947349 + * @bug 4387136 4947349 7197662 * @summary Due to a bug in XMLSupport.putPreferencesInXml(...), * node's keys would not get exported. + * @run main/othervm -Djava.util.prefs.userRoot=. ExportNode * @author Konstantin Kladko */ import java.util.prefs.*; diff --git a/test/java/util/prefs/ExportSubtree.java b/test/java/util/prefs/ExportSubtree.java index 36bfe79d53ff363f135a603b3213c3fc2c00fa6e..f1e632c6b4ed4e82b67375216ed2c8b2986da2c4 100644 --- a/test/java/util/prefs/ExportSubtree.java +++ b/test/java/util/prefs/ExportSubtree.java @@ -23,9 +23,10 @@ /* @test - @bug 6203576 4700020 - @summary checks if the output of exportSubtree() is identical to - the output from previous release. + * @bug 6203576 4700020 7197662 + * @summary checks if the output of exportSubtree() is identical to + * the output from previous release. + * @run main/othervm -Djava.util.prefs.userRoot=. ExportSubtree */ import java.io.*; diff --git a/test/java/util/prefs/PrefsSpi.sh b/test/java/util/prefs/PrefsSpi.sh index 10a0ded018f02d6d1232a61454c5d3e194b19fa1..b140b3062603906a94acf661b0e08c54688e907b 100644 --- a/test/java/util/prefs/PrefsSpi.sh +++ b/test/java/util/prefs/PrefsSpi.sh @@ -24,7 +24,7 @@ # # @test -# @bug 4991526 6514993 +# @bug 4991526 6514993 7197662 # @summary Unit test for Preferences jar providers # # @build PrefsSpi @@ -89,12 +89,16 @@ case "`uname`" in Windows*|CYGWIN* ) CPS=';';; *) CPS=':';; esac Sys "$java" "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \ -Djava.util.prefs.PreferencesFactory=StubPreferencesFactory \ + -Djava.util.prefs.userRoot=. \ PrefsSpi "StubPreferences" Sys "$java" "-cp" "$TESTCLASSES" \ + -Djava.util.prefs.userRoot=. \ PrefsSpi "java.util.prefs.*" Sys "$java" "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \ + -Djava.util.prefs.userRoot=. \ PrefsSpi "StubPreferences" Sys "$java" "-cp" "$TESTCLASSES" "-Djava.ext.dirs=extDir" \ + -Djava.util.prefs.userRoot=. \ PrefsSpi "StubPreferences" rm -rf jarDir extDir diff --git a/test/java/util/prefs/RemoveNullKeyCheck.java b/test/java/util/prefs/RemoveNullKeyCheck.java index c74f0d82d37ea129a40f474be5609e444d1978b1..eac63d5ead8bc6e9731df63decb12c3c66356e85 100644 --- a/test/java/util/prefs/RemoveNullKeyCheck.java +++ b/test/java/util/prefs/RemoveNullKeyCheck.java @@ -22,9 +22,10 @@ */ /* @test - * @bug 7160242 7165118 + * @bug 7160242 7165118 7197662 * @summary Check if NullPointerException is thrown if the key passed * to remove() is null. + * @run main/othervm -Djava.util.prefs.userRoot=. RemoveNullKeyCheck */ import java.util.prefs.Preferences; diff --git a/test/java/util/prefs/RemoveReadOnlyNode.java b/test/java/util/prefs/RemoveReadOnlyNode.java index 501a337b7579f1bf235da2c2721d00598c2471b5..ca7684fc0f93e0f6510aa55253e91eb2fc2f987e 100644 --- a/test/java/util/prefs/RemoveReadOnlyNode.java +++ b/test/java/util/prefs/RemoveReadOnlyNode.java @@ -23,10 +23,11 @@ /* @test - @bug 6178148 - @summary check if wrong exception gets thrown if one of the child - nodes is readonly on underlying filesystem when node is - being removed. + * @bug 6178148 7197662 + * @summary check if wrong exception gets thrown if one of the child + * nodes is readonly on underlying filesystem when node is + * being removed. + * @run main/othervm -Djava.util.prefs.userRoot=. RemoveReadOnlyNode */ import java.io.*; diff --git a/test/java/util/prefs/RemoveUnregedListener.java b/test/java/util/prefs/RemoveUnregedListener.java index 901dde3e0a0c63c2c9093504af229907290e0191..126a7d79f1e35ab8790c8789d7e338cb4828dd71 100644 --- a/test/java/util/prefs/RemoveUnregedListener.java +++ b/test/java/util/prefs/RemoveUnregedListener.java @@ -23,9 +23,10 @@ /* @test - * @bug 4705094 + * @bug 4705094 7197662 * @summary Checks if correct exception gets thrown when removing an * unregistered NodeChangeListener . + * @run main/othervm -Djava.util.prefs.userRoot=. RemoveUnregedListener */ import java.util.prefs.*; diff --git a/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.html b/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.html new file mode 100644 index 0000000000000000000000000000000000000000..690beeeb7fe86004dcb3408ed17b86b1d5822cf9 --- /dev/null +++ b/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.html @@ -0,0 +1,28 @@ + + + + + + + diff --git a/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.java b/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.java new file mode 100644 index 0000000000000000000000000000000000000000..b5e0f9eb973904740e6d4ebe2b4f4caef8a479bd --- /dev/null +++ b/test/javax/swing/text/StyledEditorKit/4506788/bug4506788.java @@ -0,0 +1,131 @@ +/* + * 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. + * + * 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. + */ + +/* @test + @bug 4506788 7147408 + @summary Tests if cursor gets stuck after insertion a character + @author Denis Sharypov + @run applet bug4506788.html + */ +import java.awt.*; +import java.awt.event.*; +import java.lang.reflect.InvocationTargetException; +import javax.swing.*; +import javax.swing.event.*; +import javax.swing.text.*; +import sun.awt.SunToolkit; + +public class bug4506788 extends JApplet { + + private volatile boolean passed = false; + private JEditorPane jep; + private SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + @Override + public void init() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + createAndShowGUI(); + } + }); + } catch (InterruptedException | InvocationTargetException ex) { + ex.printStackTrace(); + throw new RuntimeException("FAILED: SwingUtilities.invokeAndWait method failed then creating and showing GUI"); + } + } + + @Override + public void start() { + Robot robot; + try { + robot = new Robot(); + } catch (AWTException e) { + throw new RuntimeException("Robot could not be created"); + } + + toolkit.realSync(); + + Point p; + try { + p = getJEPLocOnScreen(); + } catch (Exception e) { + throw new RuntimeException("Could not get JEditorPane location on screen"); + } + + robot.setAutoDelay(50); + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.keyPress(KeyEvent.VK_RIGHT); + robot.keyRelease(KeyEvent.VK_RIGHT); + robot.keyPress(KeyEvent.VK_X); + robot.keyRelease(KeyEvent.VK_X); + robot.keyPress(KeyEvent.VK_RIGHT); + robot.keyRelease(KeyEvent.VK_RIGHT); + + toolkit.realSync(); + + if (!passed) { + throw new RuntimeException("Test failed."); + } + } + + private Point getJEPLocOnScreen() throws Exception { + + final Point[] result = new Point[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + result[0] = jep.getLocationOnScreen(); + } + }); + + return result[0]; + } + + private void createAndShowGUI() { + jep = new JEditorPane(); + String text = "abc"; + JFrame f = new JFrame(); + jep.setEditorKit(new StyledEditorKit()); + jep.setText(text); + jep.addCaretListener(new CaretListener() { + @Override + public void caretUpdate(CaretEvent e) { + passed = (e.getDot() == 3); + } + }); + + DefaultStyledDocument doc = (DefaultStyledDocument) jep.getDocument(); + MutableAttributeSet atr = new SimpleAttributeSet(); + StyleConstants.setBold(atr, true); + doc.setCharacterAttributes(1, 1, atr, false); + + f.getContentPane().add(jep); + f.setSize(100, 100); + f.setVisible(true); + } +} diff --git a/test/sun/net/www/MessageHeaderTest.java b/test/sun/net/www/MessageHeaderTest.java new file mode 100644 index 0000000000000000000000000000000000000000..aceb635cfae984b40021906ae53cd5247ad5a92f --- /dev/null +++ b/test/sun/net/www/MessageHeaderTest.java @@ -0,0 +1,74 @@ +/* + * 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. + * + * 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. + */ + +/** + * @test + * @bug 8003948 + * @run main MessageHeaderTest + */ +import java.io.*; +import sun.net.www.MessageHeader; + +public class MessageHeaderTest { + public static void main (String[] args) throws Exception { + for (int i=0; i<7; i++) { + ByteArrayInputStream bis = new ByteArrayInputStream(headers[i].getBytes()); + MessageHeader h = new MessageHeader(bis); + String before = h.toString(); + before = before.substring(before.indexOf('{')); + boolean result = h.filterNTLMResponses("WWW-Authenticate"); + String after = h.toString(); + after = after.substring(after.indexOf('{')); + if (!expected[i].equals(after)) { + throw new RuntimeException(Integer.toString(i) + " expected != after"); + } + if (result != expectedResult[i]) { + throw new RuntimeException(Integer.toString(i) + " result != expectedResult"); + } + } + } + + static String expected[] = { + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: }", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}", + "{null: HTTP/1.1 200 Ok}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM sdsds}{Bar: foo}", + "{null: HTTP/1.1 200 Ok}{WWW-Authenticate: Negotiate}{Foo: bar}{Bar: foo}{WWW-Authenticate: NTLM}{Bar: foo}{WWW-Authenticate: Kerberos}", + "{null: HTTP/1.1 200 Ok}{Foo: foo}{Bar: }{WWW-Authenticate: NTLM blob}{Bar: foo blob}" + }; + + static boolean[] expectedResult = { + false, false, true, true, true, false, false + }; + + static String[] headers = { + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds", + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate:", + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds\r\nWWW-Authenticate: Negotiate", + "HTTP/1.1 200 Ok\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds\r\nWWW-Authenticate: Negotiate\r\nWWW-Authenticate: Kerberos", + "HTTP/1.1 200 Ok\r\nWWW-Authenticate: Negotiate\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM sdsds\r\nBar: foo\r\nWWW-Authenticate: Kerberos", + "HTTP/1.1 200 Ok\r\nWWW-Authenticate: Negotiate\r\nFoo: bar\r\nBar: foo\r\nWWW-Authenticate: NTLM\r\nBar: foo\r\nWWW-Authenticate: Kerberos", + "HTTP/1.1 200 Ok\r\nFoo: foo\r\nBar:\r\nWWW-Authenticate: NTLM blob\r\nBar: foo blob" + }; +} diff --git a/test/sun/security/krb5/auto/KeyPermissions.java b/test/sun/security/krb5/auto/KeyPermissions.java new file mode 100644 index 0000000000000000000000000000000000000000..78f0eafc6c5b2b0d63072a961cedd66d6858c3be --- /dev/null +++ b/test/sun/security/krb5/auto/KeyPermissions.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * 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. + */ + +/* + * @test + * @bug 8004488 + * @summary wrong permissions checked in krb5 + * @compile -XDignore.symbol.file KeyPermissions.java + * @run main/othervm KeyPermissions + */ + +import java.security.AccessControlException; +import java.security.Permission; +import javax.security.auth.PrivateCredentialPermission; +import sun.security.jgss.GSSUtil; + +public class KeyPermissions extends SecurityManager { + + @Override + public void checkPermission(Permission perm) { + if (perm instanceof PrivateCredentialPermission) { + if (!perm.getName().startsWith("javax.security.auth.kerberos.")) { + throw new AccessControlException( + "I don't like this", perm); + } + } + } + + public static void main(String[] args) throws Exception { + System.setSecurityManager(new KeyPermissions()); + new OneKDC(null).writeJAASConf(); + Context s = Context.fromJAAS("server"); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + } +} + diff --git a/test/sun/security/krb5/auto/KeyTabCompat.java b/test/sun/security/krb5/auto/KeyTabCompat.java index f6763510fd261233e0dff38df26572917066c4b4..87a3e7e9c787a5032bebfff55bd0fb40e80b1c6a 100644 --- a/test/sun/security/krb5/auto/KeyTabCompat.java +++ b/test/sun/security/krb5/auto/KeyTabCompat.java @@ -24,6 +24,7 @@ /* * @test * @bug 6894072 + * @bug 8004488 * @compile -XDignore.symbol.file KeyTabCompat.java * @run main/othervm KeyTabCompat * @summary always refresh keytab @@ -70,21 +71,8 @@ public class KeyTabCompat { s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); s.status(); - if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) { - throw new Exception("There should be one KerberosKey"); + if (s.s().getPrivateCredentials(KerberosKey.class).size() != 0) { + throw new Exception("There should be no KerberosKey"); } - - Thread.sleep(2000); // make sure ktab timestamp is different - - kdc.addPrincipal(OneKDC.SERVER, "pass2".toCharArray()); - kdc.writeKtab(OneKDC.KTAB); - - Context.handshake(c, s); - s.status(); - - if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) { - throw new Exception("There should be only one KerberosKey"); - } - } } diff --git a/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java b/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java index 5ccaa0ab72a01272ecadccb72fd9777aa60ff269..2788f03f8adc48186e762929fcdf9c8f53d80fb8 100644 --- a/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java +++ b/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -21,6 +21,11 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 6405536 @@ -28,6 +33,7 @@ * @author Andreas Sterbenz * @library .. * @library ../../../../java/security/testlibrary + * @run main/othervm ClientJSSEServerJSSE */ import java.security.*; diff --git a/test/sun/security/tools/keytool/console.sh b/test/sun/security/tools/keytool/console.sh index 994befcde2841f05f5f57024d60d2dd11b7d4311..ec0f05961f80b348da58392820ac92944c87816d 100644 --- a/test/sun/security/tools/keytool/console.sh +++ b/test/sun/security/tools/keytool/console.sh @@ -31,62 +31,101 @@ # @run shell/manual console.sh if [ "$ALT_PASS" = "" ]; then - export PASS=äöäöäöäö + PASSW=äöäöäö else - export PASS=$ALT_PASS + PASSW=$ALT_PASS fi -echo "ATTENTION" -echo "===============================================================" +KS=/tmp/kkk.$$ + +cat <<____ + +ATTENTION +=============================================================== + +This test is about non-ASCII password input compatibility between +JDK 5.0 and later versions. Before running the test, make sure that -- + + \$J5 points to a JDK 5.0 installation + \$JM points to the current installation + +The password string used in this test is $PASSW. If you find difficulty +entering it in in your system, feel free to change it to something else +by providing \$ALT_PASS. It should be no less than 6 characters and include +some non-ASCII characters. + +For each test, type into the characters as described in the test header. + means the RETURN (or ENTER key). Please wait for a little while +after is pressed each time. + +\$J5 is now $J5 +\$JM is now $JM + +____ + + +if [ "$J5" = "" -o "$JM" = "" ]; then + echo "Define \$J5 and \$JM first" + exit 1 +fi + +echo "Press ENTER to start the test, or Ctrl-C to stop it" +read x + echo -echo "This test is about console password input compatibility between" -echo "Tiger and Mustang. Before running the test, make sure that --" -echo "\$J5 points to a JDK 5.0 installation" -echo "\$JM points to a JDK 6 installation". +echo "==========================================" +echo "Test #1: 5->6, non-prompt. Please type " +echo "==========================================" echo -echo "The password string used in this test is $PASS. If you find difficulty" -echo "entering it in in your system, feel free to change it to something else" -echo "by providing \$ALT_PASS (should be not less than 6 characters)" +rm $KS 2> /dev/null +$J5/bin/keytool -keystore $KS -genkey -dname CN=olala -storepass $PASSW || exit 1 +$JM/bin/keytool -keystore $KS -list -storepass $PASSW || exit 2 + +echo "==========================================" +echo "Test #2: 6->5, non-prompt. Please type " +echo "==========================================" echo -echo "For all prompt of \"Enter keystore password\", type $PASS and press ENTER" -echo "For all prompt of \"Enter key password for (RETURN if same as keystore password)\", press ENTER" -echo "If you see both the prompts appear, say --" -echo " Enter key password for " -echo " (RETURN if same as keystore password): Enter keystore password:" -echo "only response to the last prompt by typing $PASS and press ENTER" + +rm $KS 2> /dev/null +$JM/bin/keytool -keystore $KS -genkey -dname CN=olala -storepass $PASSW || exit 3 +$J5/bin/keytool -keystore $KS -list -storepass $PASSW || exit 4 + +echo "============================================================" +echo "Test #3: 5->6, prompt. Please type $PASSW $PASSW " +echo "============================================================" echo -echo "Only if all the command run correctly without showing any error " -echo "or warning, this test passes." + +rm $KS 2> /dev/null +$J5/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 5 +$JM/bin/keytool -keystore $KS -list || exit 6 +echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 7 +echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 8 + +echo "=======================================================================" +echo "Test #4: 6->5, prompt. Please type $PASSW $PASSW $PASSW " +echo "=======================================================================" echo -echo "Press ENTER to start the test, or Ctrl-C to stop it" -read + +rm $KS 2> /dev/null +$JM/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 9 +$J5/bin/keytool -keystore $KS -list || exit 10 +echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 11 +echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 12 + +echo "===========================================" +echo "Test #5: 5->6, pipe. Please type $PASSW " +echo "===========================================" +echo + +rm $KS 2> /dev/null +echo $PASSW| $J5/bin/keytool -keystore $KS -genkey -dname CN=olala || exit 13 +$JM/bin/keytool -keystore $KS -list || exit 14 +echo $PASSW| $J5/bin/keytool -keystore $KS -list || exit 15 +echo $PASSW| $JM/bin/keytool -keystore $KS -list || exit 16 + +rm $KS 2> /dev/null + echo -echo "Test #1: 5->6, non-prompt" -rm kkk -$J5/bin/keytool -keystore kkk -genkey -dname CN=olala -storepass $PASS -$JM/bin/keytool -keystore kkk -list -storepass $PASS -echo "Test #2: 6->5, non-prompt" -rm kkk -$JM/bin/keytool -keystore kkk -genkey -dname CN=olala -storepass $PASS -$J5/bin/keytool -keystore kkk -list -storepass $PASS -echo "Test #3: 5->6, prompt" -rm kkk -$J5/bin/keytool -keystore kkk -genkey -dname CN=olala -$JM/bin/keytool -keystore kkk -list -echo $PASS| $J5/bin/keytool -keystore kkk -list -echo $PASS| $JM/bin/keytool -keystore kkk -list -echo "Test #4: 6->5, prompt" -rm kkk -$JM/bin/keytool -keystore kkk -genkey -dname CN=olala -$J5/bin/keytool -keystore kkk -list -echo $PASS| $JM/bin/keytool -keystore kkk -list -echo $PASS| $J5/bin/keytool -keystore kkk -list -echo "Test #5: 5->6, pipe" -rm kkk -echo $PASS| $J5/bin/keytool -keystore kkk -genkey -dname CN=olala -$JM/bin/keytool -keystore kkk -list -echo $PASS| $J5/bin/keytool -keystore kkk -list -echo $PASS| $JM/bin/keytool -keystore kkk -list -rm kkk +echo "Success" exit 0 diff --git a/test/sun/text/resources/LocaleData b/test/sun/text/resources/LocaleData index 2e630767548ae492d7e017c1bb883bae47492383..8a85b7c9bf510bed769dc326fa974381220b9740 100644 --- a/test/sun/text/resources/LocaleData +++ b/test/sun/text/resources/LocaleData @@ -7074,3 +7074,586 @@ FormatData/sl/DatePatterns/1=dd. MMMM y # bug 7189611 CurrencyNames/es_VE/VEF=Bs.F. + +# rfe 8000983 (narrow names support) +FormatData//DayNarrows/0=S +FormatData//DayNarrows/1=M +FormatData//DayNarrows/2=T +FormatData//DayNarrows/3=W +FormatData//DayNarrows/4=T +FormatData//DayNarrows/5=F +FormatData//DayNarrows/6=S +FormatData//narrow.AmPmMarkers/0=a +FormatData//narrow.AmPmMarkers/1=p +FormatData//narrow.Eras/0=B +FormatData//narrow.Eras/1=A +FormatData//buddhist.narrow.Eras/0=BC +FormatData//buddhist.narrow.Eras/1=B.E. +FormatData//japanese.narrow.Eras/0= +FormatData//japanese.narrow.Eras/1=M +FormatData//japanese.narrow.Eras/2=T +FormatData//japanese.narrow.Eras/3=S +FormatData//japanese.narrow.Eras/4=H + +FormatData/ar/DayNarrows/0=\u062d +FormatData/ar/DayNarrows/1=\u0646 +FormatData/ar/DayNarrows/2=\u062b +FormatData/ar/DayNarrows/3=\u0631 +FormatData/ar/DayNarrows/4=\u062e +FormatData/ar/DayNarrows/5=\u062c +FormatData/ar/DayNarrows/6=\u0633 + +FormatData/be/standalone.MonthNarrows/0=\u0441 +FormatData/be/standalone.MonthNarrows/1=\u043b +FormatData/be/standalone.MonthNarrows/2=\u0441 +FormatData/be/standalone.MonthNarrows/3=\u043a +FormatData/be/standalone.MonthNarrows/4=\u043c +FormatData/be/standalone.MonthNarrows/5=\u0447 +FormatData/be/standalone.MonthNarrows/6=\u043b +FormatData/be/standalone.MonthNarrows/7=\u0436 +FormatData/be/standalone.MonthNarrows/8=\u0432 +FormatData/be/standalone.MonthNarrows/9=\u043a +FormatData/be/standalone.MonthNarrows/10=\u043b +FormatData/be/standalone.MonthNarrows/11=\u0441 +FormatData/be/standalone.MonthNarrows/12= +FormatData/be/DayNarrows/0=\u043d +FormatData/be/DayNarrows/1=\u043f +FormatData/be/DayNarrows/2=\u0430 +FormatData/be/DayNarrows/3=\u0441 +FormatData/be/DayNarrows/4=\u0447 +FormatData/be/DayNarrows/5=\u043f +FormatData/be/DayNarrows/6=\u0441 + +FormatData/bg/DayNarrows/0=\u043d +FormatData/bg/DayNarrows/1=\u043f +FormatData/bg/DayNarrows/2=\u0432 +FormatData/bg/DayNarrows/3=\u0441 +FormatData/bg/DayNarrows/4=\u0447 +FormatData/bg/DayNarrows/5=\u043f +FormatData/bg/DayNarrows/6=\u0441 + +FormatData/ca/standalone.MonthNarrows/0=g +FormatData/ca/standalone.MonthNarrows/1=f +FormatData/ca/standalone.MonthNarrows/2=m +FormatData/ca/standalone.MonthNarrows/3=a +FormatData/ca/standalone.MonthNarrows/4=m +FormatData/ca/standalone.MonthNarrows/5=j +FormatData/ca/standalone.MonthNarrows/6=j +FormatData/ca/standalone.MonthNarrows/7=a +FormatData/ca/standalone.MonthNarrows/8=s +FormatData/ca/standalone.MonthNarrows/9=o +FormatData/ca/standalone.MonthNarrows/10=n +FormatData/ca/standalone.MonthNarrows/11=d +FormatData/ca/standalone.MonthNarrows/12= +FormatData/ca/DayNarrows/0=G +# Note: "L" is a contribued item in CLDR +FormatData/ca/DayNarrows/1=L +FormatData/ca/DayNarrows/2=T +FormatData/ca/DayNarrows/3=C +FormatData/ca/DayNarrows/4=J +FormatData/ca/DayNarrows/5=V +FormatData/ca/DayNarrows/6=S +FormatData/ca/standalone.DayNarrows/0=g +FormatData/ca/standalone.DayNarrows/1=l +FormatData/ca/standalone.DayNarrows/2=t +FormatData/ca/standalone.DayNarrows/3=c +FormatData/ca/standalone.DayNarrows/4=j +FormatData/ca/standalone.DayNarrows/5=v +FormatData/ca/standalone.DayNarrows/6=s + +FormatData/cs/DayNarrows/0=N +FormatData/cs/DayNarrows/1=P +FormatData/cs/DayNarrows/2=\u00da +FormatData/cs/DayNarrows/3=S +FormatData/cs/DayNarrows/4=\u010c +FormatData/cs/DayNarrows/5=P +FormatData/cs/DayNarrows/6=S + +FormatData/da/DayNarrows/0=S +FormatData/da/DayNarrows/1=M +FormatData/da/DayNarrows/2=T +FormatData/da/DayNarrows/3=O +FormatData/da/DayNarrows/4=T +FormatData/da/DayNarrows/5=F +FormatData/da/DayNarrows/6=L + +FormatData/de/DayNarrows/0=S +FormatData/de/DayNarrows/1=M +FormatData/de/DayNarrows/2=D +FormatData/de/DayNarrows/3=M +FormatData/de/DayNarrows/4=D +FormatData/de/DayNarrows/5=F +FormatData/de/DayNarrows/6=S + +FormatData/el/DayNarrows/0=\u039a +FormatData/el/DayNarrows/1=\u0394 +FormatData/el/DayNarrows/2=\u03a4 +FormatData/el/DayNarrows/3=\u03a4 +FormatData/el/DayNarrows/4=\u03a0 +FormatData/el/DayNarrows/5=\u03a0 +FormatData/el/DayNarrows/6=\u03a3 + +FormatData/es/DayNarrows/0=D +FormatData/es/DayNarrows/1=L +FormatData/es/DayNarrows/2=M +FormatData/es/DayNarrows/3=X +FormatData/es/DayNarrows/4=J +FormatData/es/DayNarrows/5=V +FormatData/es/DayNarrows/6=S + +FormatData/et/DayNarrows/0=P +FormatData/et/DayNarrows/1=E +FormatData/et/DayNarrows/2=T +FormatData/et/DayNarrows/3=K +FormatData/et/DayNarrows/4=N +FormatData/et/DayNarrows/5=R +FormatData/et/DayNarrows/6=L + +FormatData/fi/standalone.MonthNarrows/0=T +FormatData/fi/standalone.MonthNarrows/1=H +FormatData/fi/standalone.MonthNarrows/2=M +FormatData/fi/standalone.MonthNarrows/3=H +FormatData/fi/standalone.MonthNarrows/4=T +FormatData/fi/standalone.MonthNarrows/5=K +FormatData/fi/standalone.MonthNarrows/6=H +FormatData/fi/standalone.MonthNarrows/7=E +FormatData/fi/standalone.MonthNarrows/8=S +FormatData/fi/standalone.MonthNarrows/9=L +FormatData/fi/standalone.MonthNarrows/10=M +FormatData/fi/standalone.MonthNarrows/11=J +FormatData/fi/standalone.MonthNarrows/12= +FormatData/fi/DayNarrows/0=S +FormatData/fi/DayNarrows/1=M +FormatData/fi/DayNarrows/2=T +FormatData/fi/DayNarrows/3=K +FormatData/fi/DayNarrows/4=T +FormatData/fi/DayNarrows/5=P +FormatData/fi/DayNarrows/6=L +FormatData/fi/standalone.DayNarrows/0=S +FormatData/fi/standalone.DayNarrows/1=M +FormatData/fi/standalone.DayNarrows/2=T +FormatData/fi/standalone.DayNarrows/3=K +FormatData/fi/standalone.DayNarrows/4=T +FormatData/fi/standalone.DayNarrows/5=P +FormatData/fi/standalone.DayNarrows/6=L +FormatData/fi/narrow.AmPmMarkers/0=ap. +FormatData/fi/narrow.AmPmMarkers/1=ip. + +FormatData/fr/DayNarrows/0=D +FormatData/fr/DayNarrows/1=L +FormatData/fr/DayNarrows/2=M +FormatData/fr/DayNarrows/3=M +FormatData/fr/DayNarrows/4=J +FormatData/fr/DayNarrows/5=V +FormatData/fr/DayNarrows/6=S + +FormatData/hi_IN/DayNarrows/0=\u0930 +FormatData/hi_IN/DayNarrows/1=\u0938\u094b +FormatData/hi_IN/DayNarrows/2=\u092e\u0902 +FormatData/hi_IN/DayNarrows/3=\u092c\u0941 +FormatData/hi_IN/DayNarrows/4=\u0917\u0941 +FormatData/hi_IN/DayNarrows/5=\u0936\u0941 +FormatData/hi_IN/DayNarrows/6=\u0936 + +FormatData/hr/standalone.MonthNarrows/0=1. +FormatData/hr/standalone.MonthNarrows/1=2. +FormatData/hr/standalone.MonthNarrows/2=3. +FormatData/hr/standalone.MonthNarrows/3=4. +FormatData/hr/standalone.MonthNarrows/4=5. +FormatData/hr/standalone.MonthNarrows/5=6. +FormatData/hr/standalone.MonthNarrows/6=7. +FormatData/hr/standalone.MonthNarrows/7=8. +FormatData/hr/standalone.MonthNarrows/8=9. +FormatData/hr/standalone.MonthNarrows/9=10. +FormatData/hr/standalone.MonthNarrows/10=11. +FormatData/hr/standalone.MonthNarrows/11=12. +FormatData/hr/standalone.MonthNarrows/12= +FormatData/hr/DayNarrows/0=N +FormatData/hr/DayNarrows/1=P +FormatData/hr/DayNarrows/2=U +FormatData/hr/DayNarrows/3=S +FormatData/hr/DayNarrows/4=\u010c +FormatData/hr/DayNarrows/5=P +FormatData/hr/DayNarrows/6=S +FormatData/hr/standalone.DayNarrows/0=n +FormatData/hr/standalone.DayNarrows/1=p +FormatData/hr/standalone.DayNarrows/2=u +FormatData/hr/standalone.DayNarrows/3=s +FormatData/hr/standalone.DayNarrows/4=\u010d +FormatData/hr/standalone.DayNarrows/5=p +FormatData/hr/standalone.DayNarrows/6=s + +FormatData/hu/DayNarrows/0=V +FormatData/hu/DayNarrows/1=H +FormatData/hu/DayNarrows/2=K +FormatData/hu/DayNarrows/3=Sz +FormatData/hu/DayNarrows/4=Cs +FormatData/hu/DayNarrows/5=P +FormatData/hu/DayNarrows/6=Sz + +FormatData/is/standalone.MonthNarrows/0=j +FormatData/is/standalone.MonthNarrows/1=f +FormatData/is/standalone.MonthNarrows/2=m +FormatData/is/standalone.MonthNarrows/3=a +FormatData/is/standalone.MonthNarrows/4=m +FormatData/is/standalone.MonthNarrows/5=j +FormatData/is/standalone.MonthNarrows/6=j +FormatData/is/standalone.MonthNarrows/7=\u00e1 +FormatData/is/standalone.MonthNarrows/8=s +FormatData/is/standalone.MonthNarrows/9=o +FormatData/is/standalone.MonthNarrows/10=n +FormatData/is/standalone.MonthNarrows/11=d +FormatData/is/standalone.MonthNarrows/12= +FormatData/is/DayNarrows/0=S +FormatData/is/DayNarrows/1=M +FormatData/is/DayNarrows/2=\u00de +FormatData/is/DayNarrows/3=M +FormatData/is/DayNarrows/4=F +FormatData/is/DayNarrows/5=F +FormatData/is/DayNarrows/6=L +FormatData/is/standalone.DayNarrows/0=s +FormatData/is/standalone.DayNarrows/1=m +FormatData/is/standalone.DayNarrows/2=\u00fe +FormatData/is/standalone.DayNarrows/3=m +FormatData/is/standalone.DayNarrows/4=f +FormatData/is/standalone.DayNarrows/5=f +FormatData/is/standalone.DayNarrows/6=l + +FormatData/it/DayNarrows/0=D +FormatData/it/DayNarrows/1=L +FormatData/it/DayNarrows/2=M +FormatData/it/DayNarrows/3=M +FormatData/it/DayNarrows/4=G +FormatData/it/DayNarrows/5=V +FormatData/it/DayNarrows/6=S + +FormatData/iw/DayNarrows/0=\u05d0 +FormatData/iw/DayNarrows/1=\u05d1 +FormatData/iw/DayNarrows/2=\u05d2 +FormatData/iw/DayNarrows/3=\u05d3 +FormatData/iw/DayNarrows/4=\u05d4 +FormatData/iw/DayNarrows/5=\u05d5 +FormatData/iw/DayNarrows/6=\u05e9 +FormatData/iw/standalone.DayNarrows/0=\u05d0 +FormatData/iw/standalone.DayNarrows/1=\u05d1 +FormatData/iw/standalone.DayNarrows/2=\u05d2 +FormatData/iw/standalone.DayNarrows/3=\u05d3 +FormatData/iw/standalone.DayNarrows/4=\u05d4 +FormatData/iw/standalone.DayNarrows/5=\u05d5 +FormatData/iw/standalone.DayNarrows/6=\u05e9 + +FormatData/ja/DayNarrows/0=\u65e5 +FormatData/ja/DayNarrows/1=\u6708 +FormatData/ja/DayNarrows/2=\u706b +FormatData/ja/DayNarrows/3=\u6c34 +FormatData/ja/DayNarrows/4=\u6728 +FormatData/ja/DayNarrows/5=\u91d1 +FormatData/ja/DayNarrows/6=\u571f + +FormatData/ko/DayNarrows/0=\uc77c +FormatData/ko/DayNarrows/1=\uc6d4 +FormatData/ko/DayNarrows/2=\ud654 +FormatData/ko/DayNarrows/3=\uc218 +FormatData/ko/DayNarrows/4=\ubaa9 +FormatData/ko/DayNarrows/5=\uae08 +FormatData/ko/DayNarrows/6=\ud1a0 + +FormatData/lt/standalone.MonthNarrows/0=S +FormatData/lt/standalone.MonthNarrows/1=V +FormatData/lt/standalone.MonthNarrows/2=K +FormatData/lt/standalone.MonthNarrows/3=B +FormatData/lt/standalone.MonthNarrows/4=G +FormatData/lt/standalone.MonthNarrows/5=B +FormatData/lt/standalone.MonthNarrows/6=L +FormatData/lt/standalone.MonthNarrows/7=R +FormatData/lt/standalone.MonthNarrows/8=R +FormatData/lt/standalone.MonthNarrows/9=S +FormatData/lt/standalone.MonthNarrows/10=L +FormatData/lt/standalone.MonthNarrows/11=G +FormatData/lt/standalone.MonthNarrows/12= + +FormatData/lt/DayNarrows/0=S +FormatData/lt/DayNarrows/1=P +FormatData/lt/DayNarrows/2=A +FormatData/lt/DayNarrows/3=T +FormatData/lt/DayNarrows/4=K +FormatData/lt/DayNarrows/5=P +FormatData/lt/DayNarrows/6=\u0160 +FormatData/lt/standalone.DayNarrows/0=S +FormatData/lt/standalone.DayNarrows/1=P +FormatData/lt/standalone.DayNarrows/2=A +FormatData/lt/standalone.DayNarrows/3=T +FormatData/lt/standalone.DayNarrows/4=K +FormatData/lt/standalone.DayNarrows/5=P +FormatData/lt/standalone.DayNarrows/6=\u0160 + +FormatData/lv/DayNarrows/0=S +FormatData/lv/DayNarrows/1=P +FormatData/lv/DayNarrows/2=O +FormatData/lv/DayNarrows/3=T +FormatData/lv/DayNarrows/4=C +FormatData/lv/DayNarrows/5=P +FormatData/lv/DayNarrows/6=S + +FormatData/mk/DayNarrows/0=\u043d +FormatData/mk/DayNarrows/1=\u043f +FormatData/mk/DayNarrows/2=\u0432 +FormatData/mk/DayNarrows/3=\u0441 +FormatData/mk/DayNarrows/4=\u0447 +FormatData/mk/DayNarrows/5=\u043f +FormatData/mk/DayNarrows/6=\u0441 + +FormatData/ms/standalone.MonthNarrows/0=J +FormatData/ms/standalone.MonthNarrows/1=F +FormatData/ms/standalone.MonthNarrows/2=M +FormatData/ms/standalone.MonthNarrows/3=A +FormatData/ms/standalone.MonthNarrows/4=M +FormatData/ms/standalone.MonthNarrows/5=J +FormatData/ms/standalone.MonthNarrows/6=J +FormatData/ms/standalone.MonthNarrows/7=O +FormatData/ms/standalone.MonthNarrows/8=S +FormatData/ms/standalone.MonthNarrows/9=O +FormatData/ms/standalone.MonthNarrows/10=N +FormatData/ms/standalone.MonthNarrows/11=D +FormatData/ms/standalone.MonthNarrows/12= +FormatData/ms/DayNarrows/0=A +FormatData/ms/DayNarrows/1=I +FormatData/ms/DayNarrows/2=S +FormatData/ms/DayNarrows/3=R +FormatData/ms/DayNarrows/4=K +FormatData/ms/DayNarrows/5=J +FormatData/ms/DayNarrows/6=S +FormatData/ms/standalone.DayNarrows/0=A +FormatData/ms/standalone.DayNarrows/1=I +FormatData/ms/standalone.DayNarrows/2=S +FormatData/ms/standalone.DayNarrows/3=R +FormatData/ms/standalone.DayNarrows/4=K +FormatData/ms/standalone.DayNarrows/5=J +FormatData/ms/standalone.DayNarrows/6=S + +FormatData/mt/DayNarrows/0=\u0126 +FormatData/mt/DayNarrows/1=T +FormatData/mt/DayNarrows/2=T +FormatData/mt/DayNarrows/3=E +FormatData/mt/DayNarrows/4=\u0126 +FormatData/mt/DayNarrows/5=\u0120 +FormatData/mt/DayNarrows/6=S + +FormatData/nl/DayNarrows/0=Z +FormatData/nl/DayNarrows/1=M +FormatData/nl/DayNarrows/2=D +FormatData/nl/DayNarrows/3=W +FormatData/nl/DayNarrows/4=D +FormatData/nl/DayNarrows/5=V +FormatData/nl/DayNarrows/6=Z + +FormatData/pl/DayNarrows/0=N +FormatData/pl/DayNarrows/1=P +FormatData/pl/DayNarrows/2=W +FormatData/pl/DayNarrows/3=\u015a +FormatData/pl/DayNarrows/4=C +FormatData/pl/DayNarrows/5=P +FormatData/pl/DayNarrows/6=S + +FormatData/pt/DayNarrows/0=D +FormatData/pt/DayNarrows/1=S +FormatData/pt/DayNarrows/2=T +FormatData/pt/DayNarrows/3=Q +FormatData/pt/DayNarrows/4=Q +FormatData/pt/DayNarrows/5=S +FormatData/pt/DayNarrows/6=S + +FormatData/ro/standalone.MonthNarrows/0=I +FormatData/ro/standalone.MonthNarrows/1=F +FormatData/ro/standalone.MonthNarrows/2=M +FormatData/ro/standalone.MonthNarrows/3=A +FormatData/ro/standalone.MonthNarrows/4=M +FormatData/ro/standalone.MonthNarrows/5=I +FormatData/ro/standalone.MonthNarrows/6=I +FormatData/ro/standalone.MonthNarrows/7=A +FormatData/ro/standalone.MonthNarrows/8=S +FormatData/ro/standalone.MonthNarrows/9=O +FormatData/ro/standalone.MonthNarrows/10=N +FormatData/ro/standalone.MonthNarrows/11=D +FormatData/ro/standalone.MonthNarrows/12= +# commented out DayNarrows due to mostly undefined +#FormatData/ro/DayNarrows/0=D +#FormatData/ro/DayNarrows/1= +#FormatData/ro/DayNarrows/2= +#FormatData/ro/DayNarrows/3= +#FormatData/ro/DayNarrows/4= +#FormatData/ro/DayNarrows/5= +#FormatData/ro/DayNarrows/6= +FormatData/ro/standalone.DayNarrows/0=D +FormatData/ro/standalone.DayNarrows/1=L +FormatData/ro/standalone.DayNarrows/2=M +FormatData/ro/standalone.DayNarrows/3=M +FormatData/ro/standalone.DayNarrows/4=J +FormatData/ro/standalone.DayNarrows/5=V +FormatData/ro/standalone.DayNarrows/6=S + +FormatData/ru/DayNarrows/0=\u0412 +FormatData/ru/DayNarrows/1=\u041f\u043d +FormatData/ru/DayNarrows/2=\u0412\u0442 +FormatData/ru/DayNarrows/3=\u0421 +FormatData/ru/DayNarrows/4=\u0427 +FormatData/ru/DayNarrows/5=\u041f +# Note: "sat" is an contributed item in CLDR. +FormatData/ru/DayNarrows/6=\u0421 + +FormatData/ru/standalone.DayNarrows/0=\u0412 +FormatData/ru/standalone.DayNarrows/1=\u041f +FormatData/ru/standalone.DayNarrows/2=\u0412 +FormatData/ru/standalone.DayNarrows/3=\u0421 +FormatData/ru/standalone.DayNarrows/4=\u0427 +FormatData/ru/standalone.DayNarrows/5=\u041f +FormatData/ru/standalone.DayNarrows/6=\u0421 + +FormatData/sk/DayNarrows/0=N +FormatData/sk/DayNarrows/1=P +FormatData/sk/DayNarrows/2=U +FormatData/sk/DayNarrows/3=S +FormatData/sk/DayNarrows/4=\u0160 +FormatData/sk/DayNarrows/5=P +FormatData/sk/DayNarrows/6=S + +FormatData/sl/DayNarrows/0=n +FormatData/sl/DayNarrows/1=p +FormatData/sl/DayNarrows/2=t +FormatData/sl/DayNarrows/3=s +FormatData/sl/DayNarrows/4=\u010d +FormatData/sl/DayNarrows/5=p +FormatData/sl/DayNarrows/6=s + +FormatData/sq/DayNarrows/0=D +FormatData/sq/DayNarrows/1=H +FormatData/sq/DayNarrows/2=M +FormatData/sq/DayNarrows/3=M +FormatData/sq/DayNarrows/4=E +FormatData/sq/DayNarrows/5=P +FormatData/sq/DayNarrows/6=S + +FormatData/sr/DayNarrows/0=\u043d +FormatData/sr/DayNarrows/1=\u043f +FormatData/sr/DayNarrows/2=\u0443 +FormatData/sr/DayNarrows/3=\u0441 +FormatData/sr/DayNarrows/4=\u0447 +FormatData/sr/DayNarrows/5=\u043f +FormatData/sr/DayNarrows/6=\u0441 +FormatData/sr/short.Eras/0=\u043f. \u043d. \u0435. +FormatData/sr/short.Eras/1=\u043d. \u0435. +FormatData/sr/narrow.Eras/0=\u043f.\u043d.\u0435. +FormatData/sr/narrow.Eras/1=\u043d.\u0435. + +FormatData/sv/standalone.MonthNarrows/0=J +FormatData/sv/standalone.MonthNarrows/1=F +FormatData/sv/standalone.MonthNarrows/2=M +FormatData/sv/standalone.MonthNarrows/3=A +FormatData/sv/standalone.MonthNarrows/4=M +FormatData/sv/standalone.MonthNarrows/5=J +FormatData/sv/standalone.MonthNarrows/6=J +FormatData/sv/standalone.MonthNarrows/7=A +FormatData/sv/standalone.MonthNarrows/8=S +FormatData/sv/standalone.MonthNarrows/9=O +FormatData/sv/standalone.MonthNarrows/10=N +FormatData/sv/standalone.MonthNarrows/11=D +FormatData/sv/standalone.MonthNarrows/12= +FormatData/sv/DayNarrows/0=S +FormatData/sv/DayNarrows/1=M +FormatData/sv/DayNarrows/2=T +FormatData/sv/DayNarrows/3=O +FormatData/sv/DayNarrows/4=T +FormatData/sv/DayNarrows/5=F +FormatData/sv/DayNarrows/6=L +FormatData/sv/standalone.DayNarrows/0=S +FormatData/sv/standalone.DayNarrows/1=M +FormatData/sv/standalone.DayNarrows/2=T +FormatData/sv/standalone.DayNarrows/3=O +FormatData/sv/standalone.DayNarrows/4=T +FormatData/sv/standalone.DayNarrows/5=F +FormatData/sv/standalone.DayNarrows/6=L +FormatData/sv/narrow.Eras/0=f.Kr. +FormatData/sv/narrow.Eras/1=e.Kr. +FormatData/sv/narrow.AmPmMarkers/0=f +FormatData/sv/narrow.AmPmMarkers/1=e + +FormatData/th/standalone.MonthNarrows/0=\u0e21.\u0e04. +FormatData/th/standalone.MonthNarrows/1=\u0e01.\u0e1e. +FormatData/th/standalone.MonthNarrows/2=\u0e21\u0e35.\u0e04. +FormatData/th/standalone.MonthNarrows/3=\u0e40\u0e21.\u0e22. +FormatData/th/standalone.MonthNarrows/4=\u0e1e.\u0e04. +FormatData/th/standalone.MonthNarrows/5=\u0e21\u0e34.\u0e22. +FormatData/th/standalone.MonthNarrows/6=\u0e01.\u0e04. +FormatData/th/standalone.MonthNarrows/7=\u0e2a.\u0e04. +FormatData/th/standalone.MonthNarrows/8=\u0e01.\u0e22. +FormatData/th/standalone.MonthNarrows/9=\u0e15.\u0e04. +FormatData/th/standalone.MonthNarrows/10=\u0e1e.\u0e22. +FormatData/th/standalone.MonthNarrows/11=\u0e18.\u0e04. +FormatData/th/standalone.MonthNarrows/12= +FormatData/th/DayNarrows/0=\u0e2d +FormatData/th/DayNarrows/1=\u0e08 +FormatData/th/DayNarrows/2=\u0e2d +FormatData/th/DayNarrows/3=\u0e1e +FormatData/th/DayNarrows/4=\u0e1e +FormatData/th/DayNarrows/5=\u0e28 +FormatData/th/DayNarrows/6=\u0e2a +FormatData/th/narrow.Eras/0=\u0e01\u0e48\u0e2d\u0e19 \u0e04.\u0e28. +FormatData/th/narrow.Eras/1=\u0e04.\u0e28. + +FormatData/tr/standalone.MonthNarrows/0=O +FormatData/tr/standalone.MonthNarrows/1=\u015e +FormatData/tr/standalone.MonthNarrows/2=M +FormatData/tr/standalone.MonthNarrows/3=N +FormatData/tr/standalone.MonthNarrows/4=M +FormatData/tr/standalone.MonthNarrows/5=H +FormatData/tr/standalone.MonthNarrows/6=T +FormatData/tr/standalone.MonthNarrows/7=A +FormatData/tr/standalone.MonthNarrows/8=E +FormatData/tr/standalone.MonthNarrows/9=E +FormatData/tr/standalone.MonthNarrows/10=K +FormatData/tr/standalone.MonthNarrows/11=A +FormatData/tr/standalone.MonthNarrows/12= +FormatData/tr/DayNarrows/0=P +FormatData/tr/DayNarrows/1=P +FormatData/tr/DayNarrows/2=S +FormatData/tr/DayNarrows/3=\u00c7 +FormatData/tr/DayNarrows/4=P +FormatData/tr/DayNarrows/5=C +FormatData/tr/DayNarrows/6=C + +FormatData/uk/DayNarrows/0=\u041d +FormatData/uk/DayNarrows/1=\u041f +FormatData/uk/DayNarrows/2=\u0412 +FormatData/uk/DayNarrows/3=\u0421 +FormatData/uk/DayNarrows/4=\u0427 +FormatData/uk/DayNarrows/5=\u041f +FormatData/uk/DayNarrows/6=\u0421 + +FormatData/vi/DayNarrows/0=CN +FormatData/vi/DayNarrows/1=T2 +FormatData/vi/DayNarrows/2=T3 +FormatData/vi/DayNarrows/3=T4 +FormatData/vi/DayNarrows/4=T5 +FormatData/vi/DayNarrows/5=T6 +FormatData/vi/DayNarrows/6=T7 + +FormatData/zh/standalone.MonthNarrows/0=1\u6708 +FormatData/zh/standalone.MonthNarrows/1=2\u6708 +FormatData/zh/standalone.MonthNarrows/2=3\u6708 +FormatData/zh/standalone.MonthNarrows/3=4\u6708 +FormatData/zh/standalone.MonthNarrows/4=5\u6708 +FormatData/zh/standalone.MonthNarrows/5=6\u6708 +FormatData/zh/standalone.MonthNarrows/6=7\u6708 +FormatData/zh/standalone.MonthNarrows/7=8\u6708 +FormatData/zh/standalone.MonthNarrows/8=9\u6708 +FormatData/zh/standalone.MonthNarrows/9=10\u6708 +FormatData/zh/standalone.MonthNarrows/10=11\u6708 +FormatData/zh/standalone.MonthNarrows/11=12\u6708 +FormatData/zh/standalone.MonthNarrows/12= +FormatData/zh/DayNarrows/0=\u65e5 +FormatData/zh/DayNarrows/1=\u4e00 +FormatData/zh/DayNarrows/2=\u4e8c +FormatData/zh/DayNarrows/3=\u4e09 +FormatData/zh/DayNarrows/4=\u56db +FormatData/zh/DayNarrows/5=\u4e94 +FormatData/zh/DayNarrows/6=\u516d diff --git a/test/sun/text/resources/LocaleDataTest.java b/test/sun/text/resources/LocaleDataTest.java index 51bf527bce11b3ebda0b278697407c55abb196d4..837a8aa411e26e63205093f99c72d9e8f27d0fc3 100644 --- a/test/sun/text/resources/LocaleDataTest.java +++ b/test/sun/text/resources/LocaleDataTest.java @@ -34,7 +34,7 @@ * 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611 * 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787 * 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495 - * 7003124 7085757 7028073 7171028 7189611 + * 7003124 7085757 7028073 7171028 7189611 8000983 * @summary Verify locale data * */ diff --git a/test/tools/launcher/Arrrghs.java b/test/tools/launcher/Arrrghs.java index 364589f5ad0df0f64834cee1f4256d8a25f97e23..9bf9f21b465e78472933b14f4c9081f3edbb2dff 100644 --- a/test/tools/launcher/Arrrghs.java +++ b/test/tools/launcher/Arrrghs.java @@ -27,7 +27,7 @@ * 6894719 6968053 7151434 7146424 * @summary Argument parsing validation. * @compile -XDignore.symbol.file Arrrghs.java - * @run main Arrrghs + * @run main/othervm Arrrghs */ import java.io.BufferedReader; @@ -204,8 +204,7 @@ public class Arrrghs extends TestHelper { // exiting the process prematurely can terminate the stderr. scratchpad.add(javaCmd + " -version " + inArgs); File batFile = new File("atest.bat"); - java.nio.file.Files.deleteIfExists(batFile.toPath()); - createFile(batFile, scratchpad); + createAFile(batFile, scratchpad); TestResult tr = doExec(batFile.getName()); diff --git a/test/tools/launcher/TestHelper.java b/test/tools/launcher/TestHelper.java index e630dd5df54bf08c1ac9fb7f2dc55a63c2150246..0115f0571421c123fce77714e0f953e14fbd3378 100644 --- a/test/tools/launcher/TestHelper.java +++ b/test/tools/launcher/TestHelper.java @@ -358,6 +358,51 @@ public class TestHelper { Files.copy(src.toPath(), dst.toPath(), COPY_ATTRIBUTES, REPLACE_EXISTING); } + /** + * Attempt to create a file at the given location. If an IOException + * occurs then back off for a moment and try again. When a number of + * attempts fail, give up and throw an exception. + */ + void createAFile(File aFile, List contents) throws IOException { + IOException cause = null; + for (int attempts = 0; attempts < 10; attempts++) { + try { + Files.write(aFile.getAbsoluteFile().toPath(), contents, + Charset.defaultCharset(), CREATE, TRUNCATE_EXISTING, WRITE); + if (cause != null) { + /* + * report attempts and errors that were encountered + * for diagnostic purposes + */ + System.err.println("Created batch file " + + aFile + " in " + (attempts + 1) + + " attempts"); + System.err.println("Errors encountered: " + cause); + cause.printStackTrace(); + } + return; + } catch (IOException ioe) { + if (cause != null) { + // chain the exceptions so they all get reported for diagnostics + cause.addSuppressed(ioe); + } else { + cause = ioe; + } + } + + try { + Thread.sleep(500); + } catch (InterruptedException ie) { + if (cause != null) { + // cause should alway be non-null here + ie.addSuppressed(cause); + } + throw new RuntimeException("Interrupted while creating batch file", ie); + } + } + throw new RuntimeException("Unable to create batch file", cause); + } + static void createFile(File outFile, List content) throws IOException { Files.write(outFile.getAbsoluteFile().toPath(), content, Charset.defaultCharset(), CREATE_NEW);