diff --git a/.hgtags b/.hgtags index 0181b2d733a0905203d7d0cc60d729e6ebdf4ec4..d941bf4d50e9a546c50ebc2f2abfb037a8b7df01 100644 --- a/.hgtags +++ b/.hgtags @@ -188,3 +188,5 @@ f117a3e06f78a258074674ad17601f99bcb1ce0d jdk8-b63 26dbd73fb7662a29b3e47179fdc88a0bfa4e231e jdk8-b64 130d3a54d28becaac0846137256c2684adb34c33 jdk8-b65 4d337fae2250135729ee9ed2bf8baf3c60da5d6d jdk8-b66 +ce9b02a3a17edd1983201002cfa0f364e4ab7524 jdk8-b67 +53fb43e4d614c92310e1fb00ec41d1960fd9facf jdk8-b68 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/docs/CORE_PKGS.gmk b/make/docs/CORE_PKGS.gmk index cdef9ebbc97ea9968218a776884b2d188739a244..2c2b1774f3269689655c87eae04a513c9364531a 100644 --- a/make/docs/CORE_PKGS.gmk +++ b/make/docs/CORE_PKGS.gmk @@ -131,6 +131,7 @@ CORE_PKGS = \ java.util.concurrent \ java.util.concurrent.atomic \ java.util.concurrent.locks \ + java.util.function \ java.util.jar \ java.util.logging \ java.util.prefs \ diff --git a/make/java/java/FILES_java.gmk b/make/java/java/FILES_java.gmk index c35bb29989c8d62cdcceeb972ed2696e3f00b4b9..33d35caeef5d7884b12059ec4f401c3338872702 100644 --- a/make/java/java/FILES_java.gmk +++ b/make/java/java/FILES_java.gmk @@ -147,6 +147,7 @@ JAVA_JAVA_java = \ java/lang/ref/PhantomReference.java \ java/lang/ref/ReferenceQueue.java \ java/lang/ref/Finalizer.java \ + java/util/Base64.java \ java/util/BitSet.java \ java/util/Calendar.java \ java/util/GregorianCalendar.java \ diff --git a/make/java/java/Makefile b/make/java/java/Makefile index b2d1c5ab09137b06e5f047b9db7b019ad84a2f37..54f4dbdebfabee931ac63a158adc03a5f9567e73 100644 --- a/make/java/java/Makefile +++ b/make/java/java/Makefile @@ -37,6 +37,8 @@ SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true JAVAC_MAX_WARNINGS=true include $(BUILDDIR)/common/Defs.gmk +AUTO_FILES_JAVA_DIRS = java/util/function + # windows compiler flags ifeq ($(PLATFORM),windows) OTHER_CFLAGS = diff --git a/make/java/net/Makefile b/make/java/net/Makefile index 60f83869f749101b190703e8af6dfd8a39d22b8d..d45c92087f4f922e5b0344a4235b3504470b2d8f 100644 --- a/make/java/net/Makefile +++ b/make/java/net/Makefile @@ -77,6 +77,7 @@ ifeq ($(PLATFORM), windows) FILES_export += java/net/DualStackPlainSocketImpl.java FILES_export += java/net/TwoStacksPlainDatagramSocketImpl.java FILES_export += java/net/DualStackPlainDatagramSocketImpl.java + FILES_export += sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java else FILES_export += java/net/PlainDatagramSocketImpl.java endif 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/sun/security/Makefile b/make/sun/security/Makefile index 50720320121feab3431f574b6e09389264e19487..9e9f8c50d3695d68635d67d4b94116ea90e3a158 100644 --- a/make/sun/security/Makefile +++ b/make/sun/security/Makefile @@ -38,10 +38,12 @@ SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true include $(BUILDDIR)/common/Defs.gmk -# build sun/security/jgss/wrapper on non-windows platform +# build sun/security/jgss/wrapper on non-windows non-macosx platforms JGSS_WRAPPER = ifneq ($(PLATFORM), windows) - JGSS_WRAPPER = jgss/wrapper + ifneq ($(PLATFORM), macosx) + JGSS_WRAPPER = jgss/wrapper + endif endif # Build PKCS#11 on all platforms 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 bf67ff124bd5de5b609b336367e8bf0f5713e3c5..949dcab03059ad6b007264971710a2c412f14c75 100644 --- a/makefiles/CompileDemos.gmk +++ b/makefiles/CompileDemos.gmk @@ -194,15 +194,6 @@ endif ################################################################################################## -# Why do we install a demo jar into the main jre/lib/ext???????????????? -$(JDK_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar - $(MKDIR) -p $(@D) - $(CP) $< $@ - -BUILD_DEMOS += $(JDK_OUTPUTDIR)/lib/ext/zipfs.jar - -################################################################################################## - # In the old makefiles, j2dbench was not compiled. #$(eval $(call SetupDemo,J2DBench,java2d,/src,,j2dbench/J2DBench)) diff --git a/makefiles/CompileJavaClasses.gmk b/makefiles/CompileJavaClasses.gmk index 1c5913dd167849bff6edd87311777f0b08e4fa41..2a7f4def4263d047cde04b856c042b122ea3aee8 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 @@ -220,24 +221,10 @@ endif EXFILES+=-linux-arm.java \ -linux-ppc.java -# TODO: Is this necessary? ifeq ($(OPENJDK_TARGET_OS), windows) EXFILES+=sun/nio/ch/AbstractPollSelectorImpl.java \ - sun/nio/ch/DevPollArrayWrapper.java \ - sun/nio/ch/DevPollSelectorImpl.java \ - sun/nio/ch/DevPollSelectorProvider.java \ - sun/nio/ch/InheritedChannel.java \ sun/nio/ch/PollSelectorProvider.java \ - sun/nio/ch/PollSelectorImpl.java \ - sun/nio/ch/Port.java \ - sun/nio/ch/SimpleAsynchronousFileChannelImpl.java \ - sun/nio/ch/SolarisAsynchronousChannelProvider.java \ - sun/nio/ch/SolarisEventPort.java \ - sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \ - sun/nio/ch/UnixAsynchronousSocketChannelImpl.java - EXFILES+=sun/net/sdp/SdpProvider.java -else - EXFILES+=sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java + sun/nio/ch/SimpleAsynchronousFileChannelImpl.java endif # Exclude nimbus files from rt.jar @@ -338,29 +325,14 @@ $(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers: $(JDK_BASE_HEADER_JAVA_FI ########################################################################################## -# -# This is an empty jar (only contains manifest) and fits poorly into framework... -# create simple rule instead -# -MANAGEMENT_AGENT_JAR_DEPS := $(JDK_TOPDIR)/src/share/classes/sun/management/manifest - -$(JDK_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest - $(JAR) cfm $@ $(JDK_TOPDIR)/src/share/classes/sun/management/manifest - -JARS += $(JDK_OUTPUTDIR)/lib/management-agent.jar - -########################################################################################## - ifndef OPENJDK -$(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES_JAR,\ + $(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES,\ SETUP:=GENERATE_JDKBYTECODE,\ SRC:=$(JDK_TOPDIR)/src/closed/share/altclasses, \ - BIN:=$(JDK_OUTPUTDIR)/altclasses_classes,\ - JAR:=$(JDK_OUTPUTDIR)/lib/alt-rt.jar)) + BIN:=$(JDK_OUTPUTDIR)/altclasses_classes)) -$(BUILD_ALTCLASSES_JAR): $(BUILD_JDK) -JARS += $(JDK_OUTPUTDIR)/lib/alt-rt.jar + $(BUILD_ALTCLASSES): $(BUILD_JDK) endif @@ -383,7 +355,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_15BYTECODE,\ SERVER_DIR:=$(SJAVAC_SERVER_DIR),\ SERVER_JVM:=$(SJAVAC_SERVER_JAVA))) -$(eval $(call SetupJavaCompilation,BUILD_JOBJC_JAR,\ +$(eval $(call SetupJavaCompilation,BUILD_JOBJC,\ SETUP:=GENERATE_15BYTECODE,\ DISABLE_SJAVAC:=true,\ SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \ @@ -395,11 +367,9 @@ $(eval $(call SetupJavaCompilation,BUILD_JOBJC_JAR,\ JAR:=$(JDK_OUTPUTDIR)/lib/JObjC.jar, \ JARINDEX := true)) -$(BUILD_JOBJC_JAR) : $(BUILD_JDK) +$(BUILD_JOBJC) : $(BUILD_JDK) -JARS += $(JDK_OUTPUTDIR)/lib/JObjC.jar - -$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS_JAR,\ +$(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS,\ SETUP:=GENERATE_JDKBYTECODE,\ SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \ $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \ @@ -409,16 +379,15 @@ $(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS_JAR,\ BIN:=$(JDK_OUTPUTDIR)/jobjc_classes_headers,\ HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers_jobjc)) -$(BUILD_JOBJC_HEADERS_JAR) : $(BUILD_JDK) - -JARS += $(BUILD_JOBJC_HEADERS_JAR) +$(BUILD_JOBJC_HEADERS) : $(BUILD_JDK) endif ########################################################################################## # copy with -a to preserve timestamps so dependencies down the line aren't messed up -all: $(BUILD_JDK) $(JARS) $(COPY_EXTRA) $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \ +all: $(BUILD_JDK) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \ + $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \ $(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers .PHONY: all diff --git a/makefiles/CompileNativeLibraries.gmk b/makefiles/CompileNativeLibraries.gmk index 23bf459ba2e240fad20f8ad71a63cc0568793cba..06abfab9406b12d444210d4f378d15c3b89bfec5 100644 --- a/makefiles/CompileNativeLibraries.gmk +++ b/makefiles/CompileNativeLibraries.gmk @@ -125,7 +125,7 @@ endif LIBVERIFY_OPTIMIZATION:=HIGH ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),) - ifeq ($(ENABLE_DEBUG_SYMBOLS), yes) + ifeq ($(ENABLE_DEBUG_SYMBOLS), true) LIBVERIFY_OPTIMIZATION:=LOW endif endif @@ -1645,7 +1645,7 @@ endif LIBMANAGEMENT_OPTIMIZATION:=HIGH ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),) - ifeq ($(ENABLE_DEBUG_SYMBOLS), yes) + ifeq ($(ENABLE_DEBUG_SYMBOLS), true) LIBMANAGEMENT_OPTIMIZATION:=LOW endif endif @@ -1688,7 +1688,7 @@ BUILD_LIBHPROF_LDFLAGS:= LIBHPROF_OPTIMIZATION:=HIGHEST ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),) - ifeq ($(ENABLE_DEBUG_SYMBOLS), yes) + ifeq ($(ENABLE_DEBUG_SYMBOLS), true) LIBHPROF_OPTIMIZATION:=LOW endif endif @@ -1897,6 +1897,7 @@ ifeq ($(OPENJDK_TARGET_OS), linux) UnixAsynchronousServerSocketChannelImpl.c \ UnixAsynchronousSocketChannelImpl.c \ GnomeFileTypeDetector.c \ + MagicFileTypeDetector.c \ LinuxNativeDispatcher.c \ LinuxWatchService.c \ UnixCopyFile.c \ @@ -2235,7 +2236,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBKCMS,\ $(call SET_SHARED_LIBRARY_ORIGIN),\ LDFLAGS_SUFFIX_linux:=-lc -lpthread,\ LDFLAGS_SUFFIX_windows:=$(WIN_JAVA_LIB) advapi32.lib user32.lib version.lib, \ - LDFLAGS_SUFFIX:=-lm $(LDFLAGS_JDKLIB_SUFFIX),\ + LDFLAGS_SUFFIX_posix:=-lm -ljava -ljvm,\ VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\ VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\ RC_FLAGS:=$(RC_FLAGS)\ @@ -2539,6 +2540,7 @@ BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC) ########################################################################################## ifneq ($(OPENJDK_TARGET_OS), windows) +ifneq ($(OPENJDK_TARGET_OS), macosx) $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\ LIBRARY:=j2gss,\ OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\ @@ -2558,6 +2560,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\ BUILD_LIBRARIES += $(BUILD_LIBJ2GSS) endif +endif ########################################################################################## 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 c317d8d795c95e895280561c4a4cd190c2f700ef..cd5ec1fd2583f9be3e7b3a0b94a65fdd7b663782 100644 --- a/makefiles/CreateJars.gmk +++ b/makefiles/CreateJars.gmk @@ -446,9 +446,7 @@ ifndef OPENJDK $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) else @@ -476,9 +474,7 @@ ifndef OPENJDK $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) else @@ -518,9 +514,8 @@ ifndef OPENJDK $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) + else $(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR,,\ @@ -545,9 +540,7 @@ ifndef OPENJDK $(JCE_JAR_DST) : $(JCE_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) else @@ -567,76 +560,86 @@ JARS += $(JCE_JAR_DST) ########################################################################################## -ifdef OPENJDK - -# -# TODO fix so that SetupArchive does not write files into SRCS -# then we don't need this extra copying -# -# NOTE: We currently do not place restrictions on our limited export -# policy. This was not a typo. -# US_EXPORT_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/US_export_policy.jar -US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited -US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp -$(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/% - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ +ifndef OPENJDK + + + $(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar + $(ECHO) $(LOG_INFO) Copying $(@F) + $(install-file) + +else + + # + # TODO fix so that SetupArchive does not write files into SRCS + # then we don't need this extra copying + # + # NOTE: We currently do not place restrictions on our limited export + # policy. This was not a typo. + # + US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited + US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp -US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy + $(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/% + $(install-file) -$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\ + US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy + + $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\ SRCS:=$(US_EXPORT_POLICY_JAR_TMP), \ SUFFIXES:= .policy,\ JAR:=$(US_EXPORT_POLICY_JAR_DST), \ EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \ SKIP_METAINF := true)) -JARS += $(US_EXPORT_POLICY_JAR_DST) - endif +JARS += $(US_EXPORT_POLICY_JAR_DST) + ########################################################################################## +LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar -ifdef OPENJDK +ifndef OPENJDK -# -# TODO fix so that SetupArchive does not write files into SRCS -# then we don't need this extra copying -# -LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar -LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp + $(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar + $(ECHO) $(LOG_INFO) Copying $(@F) + $(install-file) -ifeq ($(UNLIMITED_CRYPTO), true) - LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited - LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy - LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited else - LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited - LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \ - $(LOCAL_POLICY_JAR_TMP)/default_local.policy - LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited -endif -$(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/% - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ - -$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\ + # + # TODO fix so that SetupArchive does not write files into SRCS + # then we don't need this extra copying + # + LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp + + ifeq ($(UNLIMITED_CRYPTO), true) + LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited + LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy + LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited + else + LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited + LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \ + $(LOCAL_POLICY_JAR_TMP)/default_local.policy + LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited + endif + + $(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/% + $(install-file) + + $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\ SRCS:=$(LOCAL_POLICY_JAR_TMP),\ SUFFIXES:= .policy,\ JAR:=$(LOCAL_POLICY_JAR_DST), \ EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \ SKIP_METAINF := true)) -JARS += $(LOCAL_POLICY_JAR_DST) - endif +JARS += $(LOCAL_POLICY_JAR_DST) + ########################################################################################## ifeq ($(OPENJDK_TARGET_OS),windows) @@ -648,9 +651,7 @@ SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar $(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) else @@ -676,9 +677,7 @@ UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar $(UCRYPTO_JAR_DST) : $(UCRYPTO_JAR_SRC) @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..." - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) JARS += $(UCRYPTO_JAR_DST) @@ -897,14 +896,10 @@ LAUNCHER_ZIP_SRC := $(patsubst $(JDK_TOPDIR)/src/share/bin/%,$(IMAGES_OUTPUTDIR) $(LAUNCHER_SRC_FILES))) $(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/share/bin/% - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) $(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/% - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $< $@ + $(install-file) $(IMAGES_OUTPUTDIR)/src.zip: $(LAUNCHER_ZIP_SRC) @@ -922,6 +917,55 @@ JARS+=$(IMAGES_OUTPUTDIR)/src.zip ########################################################################################## +# +# This is an empty jar (only contains manifest) and fits poorly into framework... +# create simple rule instead +# +$(IMAGES_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest + $(JAR) cfm $@ $< + +JARS += $(IMAGES_OUTPUTDIR)/lib/management-agent.jar + +########################################################################################## + +$(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar + $(install-file) + +JARS += $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar + +########################################################################################## + +ifeq ($(OPENJDK_TARGET_OS),macosx) + $(eval $(call SetupArchive,BUILD_JOBJC_JAR,,\ + SRCS:=$(JDK_OUTPUTDIR)/jobjc_classes,\ + JAR:=$(IMAGES_OUTPUTDIR)/lib/JObjC.jar, \ + JARINDEX:=true)) + + JARS += $(IMAGES_OUTPUTDIR)/lib/JObjC.jar +endif + +########################################################################################## + +ifndef OPENJDK + $(eval $(call SetupArchive,BUILD_ALT_RT_JAR,,\ + SRCS:=$(JDK_OUTPUTDIR)/altclasses_classes,\ + JAR:=$(IMAGES_OUTPUTDIR)/lib/alt-rt.jar)) + + JARS += $(IMAGES_OUTPUTDIR)/lib/alt-rt.jar +endif + +########################################################################################## + +# This file is imported from hotspot in Import.gmk. Copying it into images/lib so that +# all jars can be found in one place when creating images in Images.gmk. It needs to be +# done here so that clean targets can be simple and accurate. +$(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar: $(JDK_OUTPUTDIR)/lib/sa-jdi.jar + $(install-file) + +JARS += $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar + +########################################################################################## + -include $(CUSTOM_MAKE_DIR)/CreateJars.gmk ########################################################################################## diff --git a/makefiles/Images.gmk b/makefiles/Images.gmk index 64d8bb19a226231590efae6d7aa74b1efaeb0c51..5a85e6c37f3ab3b1da259b9adbae6d3fa608fc4e 100644 --- a/makefiles/Images.gmk +++ b/makefiles/Images.gmk @@ -211,10 +211,11 @@ ifeq ($(OPENJDK_TARGET_OS), linux) endif # Find all files to copy from $(JDK_OUTPUTDIR)/lib +# Jar files are not expected to be here ALL_JDKOUT_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \ - \( -name "_the*" -o -name "javac_state " \) ) + \( -name "_the*" -o -name "javac_state " -o -name "*.jar" \) ) # Find all files to copy from $(IMAGES_OUTPUTDIR)/lib -# This might not exist if building overlay-images +# This is were the jar files are and might not exist if building overlay-images ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib),) ALL_IMAGES_LIB_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \ \( -name "_the*" -o -name "javac_state " \) ) diff --git a/makefiles/Import.gmk b/makefiles/Import.gmk index 692c6ee2a9c2b53573cdda3b640c1d5a4891d9e8..6d7673e0e0cdbae6b1c55c2f467a1776fb727699 100644 --- a/makefiles/Import.gmk +++ b/makefiles/Import.gmk @@ -231,22 +231,6 @@ define install-file endef endif -ifndef OPENJDK - -IMPORT_TARGET_FILES += \ - $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar \ - $(JDK_OUTPUTDIR)/lib/security/local_policy.jar - -$(JDK_OUTPUTDIR)/lib/security/local_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar - $(ECHO) $(LOG_INFO) Copying $(@F) - $(install-file) - -$(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar: $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar - $(ECHO) $(LOG_INFO) Copying $(@F) - $(install-file) - -endif # OPENJDK - ####### all: $(IMPORT_TARGET_FILES) 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/imageio/plugins/gif/GIFImageReader.java b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java index 36c78a4ede12e11e614ed3835ecf5957976c8640..d281e11c8c8a5431a3522362412c5bcbf68b771d 100644 --- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java +++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java @@ -30,14 +30,10 @@ import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.awt.image.DataBuffer; import java.awt.image.WritableRaster; -import java.io.BufferedInputStream; -import java.io.DataInputStream; import java.io.EOFException; -import java.io.InputStream; import java.io.IOException; import java.nio.ByteOrder; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; import javax.imageio.IIOException; @@ -48,6 +44,11 @@ import javax.imageio.metadata.IIOMetadata; import javax.imageio.spi.ImageReaderSpi; import javax.imageio.stream.ImageInputStream; import com.sun.imageio.plugins.common.ReaderUtil; +import java.awt.image.ColorModel; +import java.awt.image.IndexColorModel; +import java.awt.image.MultiPixelPackedSampleModel; +import java.awt.image.PixelInterleavedSampleModel; +import java.awt.image.SampleModel; public class GIFImageReader extends ImageReader { @@ -194,6 +195,36 @@ public class GIFImageReader extends ImageReader { return imageMetadata.imageHeight; } + // We don't check all parameters as ImageTypeSpecifier.createIndexed do + // since this method is private and we pass consistent data here + private ImageTypeSpecifier createIndexed(byte[] r, byte[] g, byte[] b, + int bits) { + ColorModel colorModel; + if (imageMetadata.transparentColorFlag) { + // Some files erroneously have a transparent color index + // of 255 even though there are fewer than 256 colors. + int idx = Math.min(imageMetadata.transparentColorIndex, + r.length - 1); + colorModel = new IndexColorModel(bits, r.length, r, g, b, idx); + } else { + colorModel = new IndexColorModel(bits, r.length, r, g, b); + } + + SampleModel sampleModel; + if (bits == 8) { + int[] bandOffsets = {0}; + sampleModel = + new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, + 1, 1, 1, 1, + bandOffsets); + } else { + sampleModel = + new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, + 1, 1, bits); + } + return new ImageTypeSpecifier(colorModel, sampleModel); + } + public Iterator getImageTypes(int imageIndex) throws IIOException { checkIndex(imageIndex); @@ -239,22 +270,7 @@ public class GIFImageReader extends ImageReader { b[i] = colorTable[rgbIndex++]; } - byte[] a = null; - if (imageMetadata.transparentColorFlag) { - a = new byte[lutLength]; - Arrays.fill(a, (byte)255); - - // Some files erroneously have a transparent color index - // of 255 even though there are fewer than 256 colors. - int idx = Math.min(imageMetadata.transparentColorIndex, - lutLength - 1); - a[idx] = (byte)0; - } - - int[] bitsPerSample = new int[1]; - bitsPerSample[0] = bits; - l.add(ImageTypeSpecifier.createIndexed(r, g, b, a, bits, - DataBuffer.TYPE_BYTE)); + l.add(createIndexed(r, g, b, bits)); return l.iterator(); } 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/jmx/snmp/EnumRowStatus.java b/src/share/classes/com/sun/jmx/snmp/EnumRowStatus.java index d92dd968f286307705064746e1ff4ee6be6b4b7b..74a05ae1b96f4ca22d05edadee2fd797b5b3e460 100644 --- a/src/share/classes/com/sun/jmx/snmp/EnumRowStatus.java +++ b/src/share/classes/com/sun/jmx/snmp/EnumRowStatus.java @@ -28,10 +28,6 @@ package com.sun.jmx.snmp; import java.io.Serializable; import java.util.Hashtable; -import com.sun.jmx.snmp.SnmpValue; -import com.sun.jmx.snmp.SnmpInt; - -import com.sun.jmx.snmp.Enumerated; /** * This class is an internal class which is used to represent RowStatus @@ -263,30 +259,30 @@ public class EnumRowStatus extends Enumerated implements Serializable { // Documented in Enumerated // - protected Hashtable getIntTable() { + @Override + protected Hashtable getIntTable() { return EnumRowStatus.getRSIntTable(); } // Documented in Enumerated // - protected Hashtable getStringTable() { + @Override + protected Hashtable getStringTable() { return EnumRowStatus.getRSStringTable(); } - static final Hashtable getRSIntTable() { + static Hashtable getRSIntTable() { return intTable ; } - static final Hashtable getRSStringTable() { + static Hashtable getRSStringTable() { return stringTable ; } // Initialize the mapping tables. // - final static Hashtable intTable = - new Hashtable(); - final static Hashtable stringTable = - new Hashtable(); + final static Hashtable intTable = new Hashtable<>(); + final static Hashtable stringTable = new Hashtable<>(); static { intTable.put(new Integer(0), "unspecified"); intTable.put(new Integer(3), "notReady"); diff --git a/src/share/classes/com/sun/jmx/snmp/Enumerated.java b/src/share/classes/com/sun/jmx/snmp/Enumerated.java index a4bca4e7053f02f5716923c21f8cd11ba8e68419..7cde19bc20bf424266bdf4e2345790f4c602f1ee 100644 --- a/src/share/classes/com/sun/jmx/snmp/Enumerated.java +++ b/src/share/classes/com/sun/jmx/snmp/Enumerated.java @@ -54,9 +54,9 @@ abstract public class Enumerated implements Serializable { * @exception IllegalArgumentException One of the arguments passed to the method is illegal or inappropriate. */ public Enumerated() throws IllegalArgumentException { - Enumeration e =getIntTable().keys() ; + Enumeration e =getIntTable().keys(); if (e.hasMoreElements()) { - value = ((Integer)e.nextElement()).intValue() ; + value = e.nextElement().intValue() ; } else { throw new IllegalArgumentException() ; @@ -100,7 +100,7 @@ abstract public class Enumerated implements Serializable { * to the method is illegal or inappropriate. */ public Enumerated(String valueString) throws IllegalArgumentException { - Integer index = (Integer)getStringTable().get(valueString) ; + Integer index = getStringTable().get(valueString) ; if (index == null) { throw new IllegalArgumentException() ; } @@ -127,7 +127,7 @@ abstract public class Enumerated implements Serializable { * @return An enumeration of Integer instances */ - public Enumeration valueIndexes() { + public Enumeration valueIndexes() { return getIntTable().keys() ; } @@ -138,7 +138,7 @@ abstract public class Enumerated implements Serializable { * @return An enumeration of String instances */ - public Enumeration valueStrings() { + public Enumeration valueStrings() { return getStringTable().keys() ; } @@ -153,6 +153,7 @@ abstract public class Enumerated implements Serializable { * * @return True if this and obj are the same; false otherwise */ + @Override public boolean equals(Object obj) { return ((obj != null) && @@ -166,6 +167,7 @@ abstract public class Enumerated implements Serializable { * * @return A hash code value for this object. */ + @Override public int hashCode() { String hashString = getClass().getName() + String.valueOf(value) ; return hashString.hashCode() ; @@ -177,9 +179,9 @@ abstract public class Enumerated implements Serializable { * * @return The string for for this object. */ - + @Override public String toString() { - return (String)getIntTable().get(new Integer(value)) ; + return getIntTable().get(new Integer(value)) ; } @@ -193,7 +195,7 @@ abstract public class Enumerated implements Serializable { * @return An hashtable for read-only purpose */ - protected abstract Hashtable getIntTable() ; + protected abstract Hashtable getIntTable() ; @@ -207,12 +209,12 @@ abstract public class Enumerated implements Serializable { * @return An hashtable for read-only purpose */ - protected abstract Hashtable getStringTable() ; + protected abstract Hashtable getStringTable() ; /** * This variable keeps the integer form of the enumerated. - * The string form is retreived using getIntTable(). + * The string form is retrieved using getIntTable(). */ protected int value ; diff --git a/src/share/classes/com/sun/jmx/snmp/IPAcl/AclImpl.java b/src/share/classes/com/sun/jmx/snmp/IPAcl/AclImpl.java index 353514c689e986701e6d3283b7c57d0e978484a0..b78c9ff7c037a529f124a83426ebbb0591b204eb 100644 --- a/src/share/classes/com/sun/jmx/snmp/IPAcl/AclImpl.java +++ b/src/share/classes/com/sun/jmx/snmp/IPAcl/AclImpl.java @@ -66,7 +66,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable { */ public AclImpl (PrincipalImpl owner, String name) { super(owner); - entryList = new Vector(); + entryList = new Vector<>(); aclName = name; } @@ -81,6 +81,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable { * of this ACL. * @see java.security.Principal */ + @Override public void setName(Principal caller, String name) throws NotOwnerException { if (!isOwner(caller)) @@ -93,6 +94,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable { * * @return the name of this ACL. */ + @Override public String getName(){ return aclName; } @@ -113,6 +115,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable { * this ACL. * @see java.security.Principal */ + @Override public boolean addEntry(Principal caller, AclEntry entry) throws NotOwnerException { if (!isOwner(caller)) @@ -144,6 +147,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable { * @see java.security.Principal * @see java.security.acl.AclEntry */ + @Override public boolean removeEntry(Principal caller, AclEntry entry) throws NotOwnerException { if (!isOwner(caller)) @@ -185,8 +189,9 @@ class AclImpl extends OwnerImpl implements Acl, Serializable { * is allowed. * @see java.security.Principal */ + @Override public Enumeration getPermissions(Principal user){ - Vector empty = new Vector(); + Vector empty = new Vector<>(); for (Enumeration e = entryList.elements();e.hasMoreElements();){ AclEntry ent = e.nextElement(); if (ent.getPrincipal().equals(user)) @@ -201,6 +206,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable { * * @return an enumeration of the entries in this ACL. */ + @Override public Enumeration entries(){ return entryList.elements(); } @@ -221,10 +227,11 @@ class AclImpl extends OwnerImpl implements Acl, Serializable { * @see java.security.Principal * @see java.security.Permission */ + @Override public boolean checkPermission(Principal user, java.security.acl.Permission perm) { - for (Enumeration e = entryList.elements();e.hasMoreElements();){ - AclEntry ent = (AclEntry) e.nextElement(); + for (Enumeration e = entryList.elements();e.hasMoreElements();){ + AclEntry ent = e.nextElement(); if (ent.getPrincipal().equals(user)) if (ent.checkPermission(perm)) return true; } @@ -250,7 +257,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable { */ public boolean checkPermission(Principal user, String community, java.security.acl.Permission perm) { - for (Enumeration e = entryList.elements();e.hasMoreElements();){ + for (Enumeration e = entryList.elements();e.hasMoreElements();){ AclEntryImpl ent = (AclEntryImpl) e.nextElement(); if (ent.getPrincipal().equals(user)) if (ent.checkPermission(perm) && ent.checkCommunity(community)) return true; @@ -269,7 +276,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable { * @see java.security.Permission */ public boolean checkCommunity(String community) { - for (Enumeration e = entryList.elements();e.hasMoreElements();){ + for (Enumeration e = entryList.elements();e.hasMoreElements();){ AclEntryImpl ent = (AclEntryImpl) e.nextElement(); if (ent.checkCommunity(community)) return true; } @@ -281,6 +288,7 @@ class AclImpl extends OwnerImpl implements Acl, Serializable { * * @return a string representation of the ACL contents. */ + @Override public String toString(){ return ("AclImpl: "+ getName()); } diff --git a/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMAclBlock.java b/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMAclBlock.java index a48039fabd4ae7b62989959050503bb1b1c09789..ca5720ef9a04d613dd84b6f33d08f66885c29a98 100644 --- a/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMAclBlock.java +++ b/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMAclBlock.java @@ -28,7 +28,9 @@ package com.sun.jmx.snmp.IPAcl; +import java.net.InetAddress; import java.util.Hashtable; +import java.util.Vector; class JDMAclBlock extends SimpleNode { JDMAclBlock(int id) { @@ -51,11 +53,13 @@ class JDMAclBlock extends SimpleNode { * Do no need to go through this part of the tree for * building TrapEntry. */ - public void buildTrapEntries(Hashtable dest) {} + @Override + public void buildTrapEntries(Hashtable> dest) {} /** * Do no need to go through this part of the tree for * building InformEntry. */ - public void buildInformEntries(Hashtable dest) {} + @Override + public void buildInformEntries(Hashtable> dest) {} } diff --git a/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformBlock.java b/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformBlock.java index 6f54a6178d946e5911fb005fda4b2b733850e31c..02a4550f1cec234876f928d2cdc17ecbb39a8c81 100644 --- a/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformBlock.java +++ b/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformBlock.java @@ -27,7 +27,9 @@ package com.sun.jmx.snmp.IPAcl; +import java.net.InetAddress; import java.util.Hashtable; +import java.util.Vector; class JDMInformBlock extends SimpleNode { JDMInformBlock(int id) { @@ -50,11 +52,13 @@ class JDMInformBlock extends SimpleNode { * Do no need to go through this part of the tree for * building AclEntry. */ + @Override public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {} /** * Do no need to go through this part of the tree for * building TrapEntry. */ - public void buildTrapEntries(Hashtable dest) {} + @Override + public void buildTrapEntries(Hashtable> dest) {} } diff --git a/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapBlock.java b/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapBlock.java index d14d3d76fe7b0c3257e3ad51f136470554e00f1c..ab3c5295865a0d749b4c3cb1d88f6f88ea63ef04 100644 --- a/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapBlock.java +++ b/src/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapBlock.java @@ -28,7 +28,9 @@ package com.sun.jmx.snmp.IPAcl; +import java.net.InetAddress; import java.util.Hashtable; +import java.util.Vector; class JDMTrapBlock extends SimpleNode { JDMTrapBlock(int id) { @@ -51,11 +53,13 @@ class JDMTrapBlock extends SimpleNode { * Do no need to go through this part of the tree for * building AclEntry. */ + @Override public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {} /** * Do no need to go through this part of the tree for * building InformEntry. */ - public void buildInformEntries(Hashtable dest) {} + @Override + public void buildInformEntries(Hashtable> dest) {} } diff --git a/src/share/classes/com/sun/jmx/snmp/IPAcl/JJTParserState.java b/src/share/classes/com/sun/jmx/snmp/IPAcl/JJTParserState.java index 83adecd97554026c69e860b884f326328af40a01..f68c13cf2606910dc75950741e99a22cb6567674 100644 --- a/src/share/classes/com/sun/jmx/snmp/IPAcl/JJTParserState.java +++ b/src/share/classes/com/sun/jmx/snmp/IPAcl/JJTParserState.java @@ -27,18 +27,17 @@ package com.sun.jmx.snmp.IPAcl; -@SuppressWarnings("unchecked") // generated code, not worth fixing class JJTParserState { - private java.util.Stack nodes; - private java.util.Stack marks; + private java.util.Stack nodes; + private java.util.Stack marks; private int sp; // number of nodes on stack private int mk; // current mark private boolean node_created; JJTParserState() { - nodes = new java.util.Stack(); - marks = new java.util.Stack(); + nodes = new java.util.Stack<>(); + marks = new java.util.Stack<>(); sp = 0; mk = 0; } @@ -62,7 +61,7 @@ class JJTParserState { /* Returns the root node of the AST. It only makes sense to call this after a successful parse. */ Node rootNode() { - return (Node)nodes.elementAt(0); + return nodes.elementAt(0); } /* Pushes a node on to the stack. */ @@ -75,14 +74,14 @@ class JJTParserState { stack. */ Node popNode() { if (--sp < mk) { - mk = ((Integer)marks.pop()).intValue(); + mk = marks.pop().intValue(); } - return (Node)nodes.pop(); + return nodes.pop(); } /* Returns the node currently on the top of the stack. */ Node peekNode() { - return (Node)nodes.peek(); + return nodes.peek(); } /* Returns the number of children on the stack in the current node @@ -96,7 +95,7 @@ class JJTParserState { while (sp > mk) { popNode(); } - mk = ((Integer)marks.pop()).intValue(); + mk = marks.pop().intValue(); } @@ -112,7 +111,7 @@ class JJTParserState { made the children of the definite node. Then the definite node is pushed on to the stack. */ void closeNodeScope(Node n, int num) { - mk = ((Integer)marks.pop()).intValue(); + mk = marks.pop().intValue(); while (num-- > 0) { Node c = popNode(); c.jjtSetParent(n); @@ -132,7 +131,7 @@ class JJTParserState { void closeNodeScope(Node n, boolean condition) { if (condition) { int a = nodeArity(); - mk = ((Integer)marks.pop()).intValue(); + mk = marks.pop().intValue(); while (a-- > 0) { Node c = popNode(); c.jjtSetParent(n); @@ -142,7 +141,7 @@ class JJTParserState { pushNode(n); node_created = true; } else { - mk = ((Integer)marks.pop()).intValue(); + mk = marks.pop().intValue(); node_created = false; } } diff --git a/src/share/classes/com/sun/jmx/snmp/IPAcl/Parser.java b/src/share/classes/com/sun/jmx/snmp/IPAcl/Parser.java index b2fe5f5d15786830d009d17d50575e4bfa11496b..f6ba9e029e109a3d60b70ec34d4b0504ca1f5f2d 100644 --- a/src/share/classes/com/sun/jmx/snmp/IPAcl/Parser.java +++ b/src/share/classes/com/sun/jmx/snmp/IPAcl/Parser.java @@ -1168,7 +1168,7 @@ jjtree.openNodeScope(jjtn000);Token t; return (jj_ntk = jj_nt.kind); } - private java.util.Vector jj_expentries = new java.util.Vector(); + private java.util.Vector jj_expentries = new java.util.Vector<>(); private int[] jj_expentry; private int jj_kind = -1; private int[] jj_lasttokens = new int[100]; @@ -1184,8 +1184,8 @@ jjtree.openNodeScope(jjtn000);Token t; jj_expentry[i] = jj_lasttokens[i]; } boolean exists = false; - for (java.util.Enumeration enumv = jj_expentries.elements(); enumv.hasMoreElements();) { - int[] oldentry = (int[])(enumv.nextElement()); + for (java.util.Enumeration enumv = jj_expentries.elements(); enumv.hasMoreElements();) { + int[] oldentry = enumv.nextElement(); if (oldentry.length == jj_expentry.length) { exists = true; for (int i = 0; i < jj_expentry.length; i++) { @@ -1236,7 +1236,7 @@ jjtree.openNodeScope(jjtn000);Token t; jj_add_error_token(0, 0); int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { - exptokseq[i] = (int[])jj_expentries.elementAt(i); + exptokseq[i] = jj_expentries.elementAt(i); } return new ParseException(token, exptokseq, tokenImage); } diff --git a/src/share/classes/com/sun/jmx/snmp/IPAcl/SnmpAcl.java b/src/share/classes/com/sun/jmx/snmp/IPAcl/SnmpAcl.java index 59f399693386dea9ba61147f69fbe0fb2230e288..ae5b7cf938618dede2d2a8912057b0067341e222 100644 --- a/src/share/classes/com/sun/jmx/snmp/IPAcl/SnmpAcl.java +++ b/src/share/classes/com/sun/jmx/snmp/IPAcl/SnmpAcl.java @@ -126,7 +126,7 @@ public class SnmpAcl implements InetAddressAcl, Serializable { * * @return An enumeration of the entries in this ACL. */ - public Enumeration entries() { + public Enumeration entries() { return acl.entries(); } @@ -137,11 +137,11 @@ public class SnmpAcl implements InetAddressAcl, Serializable { public Enumeration communities() { HashSet set = new HashSet(); Vector res = new Vector(); - for (Enumeration e = acl.entries() ; e.hasMoreElements() ;) { + for (Enumeration e = acl.entries() ; e.hasMoreElements() ;) { AclEntryImpl entry = (AclEntryImpl) e.nextElement(); - for (Enumeration cs = entry.communities(); + for (Enumeration cs = entry.communities(); cs.hasMoreElements() ;) { - set.add((String) cs.nextElement()); + set.add(cs.nextElement()); } } String[] objs = set.toArray(new String[0]); @@ -316,7 +316,7 @@ public class SnmpAcl implements InetAddressAcl, Serializable { * * @return An enumeration of the trap destinations (enumeration of InetAddress). */ - public Enumeration getTrapDestinations() { + public Enumeration getTrapDestinations() { return trapDestList.keys(); } @@ -327,16 +327,16 @@ public class SnmpAcl implements InetAddressAcl, Serializable { * * @return An enumeration of trap communities for a given host (enumeration of String). */ - public Enumeration getTrapCommunities(InetAddress i) { - Vector list = null; - if ((list = (Vector)trapDestList.get(i)) != null ) { + public Enumeration getTrapCommunities(InetAddress i) { + Vector list = null; + if ((list = trapDestList.get(i)) != null ) { if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(), "getTrapCommunities", "["+i.toString()+"] is in list"); } return list.elements(); } else { - list = new Vector(); + list = new Vector<>(); if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(), "getTrapCommunities", "["+i.toString()+"] is not in list"); @@ -350,7 +350,7 @@ public class SnmpAcl implements InetAddressAcl, Serializable { * * @return An enumeration of the inform destinations (enumeration of InetAddress). */ - public Enumeration getInformDestinations() { + public Enumeration getInformDestinations() { return informDestList.keys(); } @@ -361,16 +361,16 @@ public class SnmpAcl implements InetAddressAcl, Serializable { * * @return An enumeration of inform communities for a given host (enumeration of String). */ - public Enumeration getInformCommunities(InetAddress i) { - Vector list = null; - if ((list = (Vector)informDestList.get(i)) != null ) { + public Enumeration getInformCommunities(InetAddress i) { + Vector list = null; + if ((list = informDestList.get(i)) != null ) { if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(), "getInformCommunities", "["+i.toString()+"] is in list"); } return list.elements(); } else { - list = new Vector(); + list = new Vector<>(); if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(), "getInformCommunities", "["+i.toString()+"] is not in list"); @@ -426,15 +426,15 @@ public class SnmpAcl implements InetAddressAcl, Serializable { throw new IllegalArgumentException(err.getMessage()); } - for(Enumeration e = acl.entries(); e.hasMoreElements();) { + for(Enumeration e = acl.entries(); e.hasMoreElements();) { AclEntryImpl aa = (AclEntryImpl) e.nextElement(); if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(), "readAuthorizedListFile", "===> " + aa.getPrincipal().toString()); } - for (Enumeration eee = aa.permissions();eee.hasMoreElements();) { - java.security.acl.Permission perm = (java.security.acl.Permission)eee.nextElement(); + for (Enumeration eee = aa.permissions();eee.hasMoreElements();) { + java.security.acl.Permission perm = eee.nextElement(); if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(), "readAuthorizedListFile", "perm = " + perm); diff --git a/src/share/classes/com/sun/jmx/snmp/InetAddressAcl.java b/src/share/classes/com/sun/jmx/snmp/InetAddressAcl.java index 99800e1ba892a76de542e2d4c7ba396f34280493..690b933829ade5f38aef0993a4d51d2807b33639 100644 --- a/src/share/classes/com/sun/jmx/snmp/InetAddressAcl.java +++ b/src/share/classes/com/sun/jmx/snmp/InetAddressAcl.java @@ -99,7 +99,7 @@ public interface InetAddressAcl { * * @return An enumeration of the trap destinations (enumeration of InetAddress). */ - public Enumeration getTrapDestinations(); + public Enumeration getTrapDestinations(); /** * Returns an enumeration of trap communities for a given host. @@ -108,14 +108,14 @@ public interface InetAddressAcl { * * @return An enumeration of trap communities for a given host (enumeration of String). */ - public Enumeration getTrapCommunities(InetAddress address); + public Enumeration getTrapCommunities(InetAddress address); /** * Returns an enumeration of inform destinations. * * @return An enumeration of the inform destinations (enumeration of InetAddress). */ - public Enumeration getInformDestinations(); + public Enumeration getInformDestinations(); /** * Returns an enumeration of inform communities for a given host. @@ -124,5 +124,5 @@ public interface InetAddressAcl { * * @return An enumeration of inform communities for a given host (enumeration of String). */ - public Enumeration getInformCommunities(InetAddress address); + public Enumeration getInformCommunities(InetAddress address); } diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java index 35c2fb8d986694664834fbbf7a330ed651c46bdf..ffa64b2f5249520825aeec62eea782ea0aeb7896 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java @@ -59,6 +59,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * @exception IllegalAccessException The MIB cannot be initialized. */ + @Override public void init() throws IllegalAccessException { } @@ -74,6 +75,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * @exception java.lang.Exception */ + @Override public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { return name; @@ -87,6 +89,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * @return The returned oid is null. */ + @Override public long[] getRootOid() { return null; } @@ -99,6 +102,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * @exception SnmpStatusException An error occured during the operation. */ + @Override public void get(SnmpMibRequest inRequest) throws SnmpStatusException { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, @@ -108,9 +112,9 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne) throw new SnmpStatusException(SnmpStatusException.noSuchName); - Enumeration l = inRequest.getElements(); + Enumeration l = inRequest.getElements(); while(l.hasMoreElements()) { - SnmpVarBind varbind = (SnmpVarBind) l.nextElement(); + SnmpVarBind varbind = l.nextElement(); varbind.setNoSuchObject(); } } @@ -128,6 +132,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * cannot be performed. */ + @Override public void check(SnmpMibRequest inRequest) throws SnmpStatusException { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, @@ -145,6 +150,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * @exception SnmpStatusException An error occured during the operation. */ + @Override public void set(SnmpMibRequest inRequest) throws SnmpStatusException { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, @@ -162,6 +168,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * @exception SnmpStatusException An error occured during the operation. */ + @Override public void getNext(SnmpMibRequest inRequest) throws SnmpStatusException { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, @@ -171,9 +178,9 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne) throw new SnmpStatusException(SnmpStatusException.noSuchName); - Enumeration l = inRequest.getElements(); + Enumeration l = inRequest.getElements(); while(l.hasMoreElements()) { - SnmpVarBind varbind = (SnmpVarBind) l.nextElement(); + SnmpVarBind varbind = l.nextElement(); varbind.setEndOfMibView(); } } @@ -186,6 +193,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * @exception SnmpStatusException An error occured during the operation. */ + @Override public void getBulk(SnmpMibRequest inRequest, int nonRepeat, int maxRepeat) throws SnmpStatusException { @@ -196,9 +204,9 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne) throw new SnmpStatusException(SnmpDefinitions.snmpRspGenErr, 0); - Enumeration l = inRequest.getElements(); + Enumeration l = inRequest.getElements(); while(l.hasMoreElements()) { - SnmpVarBind varbind = (SnmpVarBind) l.nextElement(); + SnmpVarBind varbind = l.nextElement(); varbind.setEndOfMibView(); } } diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpGenericObjectServer.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpGenericObjectServer.java index 547c8ca21bcf598e29fdec995ed6ab0338ea38d7..689e08505a221dc1e598d27df4c1b803198cd697 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpGenericObjectServer.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpGenericObjectServer.java @@ -28,7 +28,6 @@ package com.sun.jmx.snmp.agent; // java imports // -import java.util.Vector; import java.util.Enumeration; import java.util.Iterator; @@ -149,8 +148,8 @@ public class SnmpGenericObjectServer { final long[] idList = new long[size]; int i = 0; - for (Enumeration e=req.getElements(); e.hasMoreElements();) { - final SnmpVarBind var= (SnmpVarBind) e.nextElement(); + for (Enumeration e=req.getElements(); e.hasMoreElements();) { + final SnmpVarBind var= e.nextElement(); try { final long id = var.oid.getOidArc(depth); nameList[i] = meta.getAttributeName(id); @@ -190,7 +189,7 @@ public class SnmpGenericObjectServer { } - final Iterator it = result.iterator(); + final Iterator it = result.iterator(); for (int j=0; j < i; j++) { if (!it.hasNext()) { @@ -312,8 +311,8 @@ public class SnmpGenericObjectServer { final long[] idList = new long[size]; int i = 0; - for (Enumeration e=req.getElements(); e.hasMoreElements();) { - final SnmpVarBind var= (SnmpVarBind) e.nextElement(); + for (Enumeration e=req.getElements(); e.hasMoreElements();) { + final SnmpVarBind var= e.nextElement(); try { final long id = var.oid.getOidArc(depth); final String attname = meta.getAttributeName(id); @@ -330,7 +329,7 @@ public class SnmpGenericObjectServer { } } - AttributeList result = null; + AttributeList result; int errorCode = SnmpStatusException.noAccess; try { @@ -345,7 +344,7 @@ public class SnmpGenericObjectServer { result = new AttributeList(); } - final Iterator it = result.iterator(); + final Iterator it = result.iterator(); for (int j=0; j < i; j++) { if (!it.hasNext()) { @@ -469,8 +468,8 @@ public class SnmpGenericObjectServer { final Object data = req.getUserData(); - for (Enumeration e=req.getElements(); e.hasMoreElements();) { - final SnmpVarBind var= (SnmpVarBind) e.nextElement(); + for (Enumeration e=req.getElements(); e.hasMoreElements();) { + final SnmpVarBind var= e.nextElement(); try { final long id = var.oid.getOidArc(depth); // call meta.check() here, and meta.check will call check() diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpIndex.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpIndex.java index d41e2e358651a7dfee966491e11b76bd8ed5681d..483a79618a8056063b9c3fd75b3ff4e4047ba20f 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpIndex.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpIndex.java @@ -164,11 +164,12 @@ public class SnmpIndex implements Serializable { * * @return A string representation of the index. */ + @Override public String toString() { - StringBuffer msg= new StringBuffer(); - for(Enumeration e= oids.elements(); e.hasMoreElements(); ) { - SnmpOid val= (SnmpOid) e.nextElement(); - msg.append( "//" + val.toString()); + final StringBuilder msg= new StringBuilder(); + for(Enumeration e= oids.elements(); e.hasMoreElements(); ) { + SnmpOid val= e.nextElement(); + msg.append("//").append( val.toString()); } return msg.toString(); } @@ -180,7 +181,7 @@ public class SnmpIndex implements Serializable { * The list of OIDs. * @serial */ - private Vector oids = new Vector(); + private Vector oids = new Vector<>(); /** * The number of elements in the index. diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java index 13ae08c9cbe27dcbd7fa93abc982375208390253..df7587404ef283564e2730fe3865a3d0120911e1 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java @@ -42,10 +42,6 @@ import com.sun.jmx.snmp.SnmpOid; import com.sun.jmx.snmp.SnmpVarBind; import com.sun.jmx.snmp.SnmpDefinitions; import com.sun.jmx.snmp.SnmpStatusException; -import com.sun.jmx.snmp.SnmpEngine; -import com.sun.jmx.snmp.SnmpUnknownModelException; -import com.sun.jmx.snmp.internal.SnmpAccessControlModel; -import com.sun.jmx.snmp.internal.SnmpEngineImpl; /** * Abstract class for representing an SNMP MIB. @@ -241,6 +237,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // Implements the method defined in SnmpMibAgent. See SnmpMibAgent // for java-doc // + @Override public void get(SnmpMibRequest req) throws SnmpStatusException { // Builds the request tree: creation is not allowed, operation @@ -259,8 +256,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // For each sub-request stored in the request-tree, invoke the // get() method. - for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) { - h = (SnmpRequestTree.Handler) eh.nextElement(); + for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) { + h = eh.nextElement(); // Gets the Meta node. It can be either a Group Meta or a // Table Meta. @@ -270,11 +267,11 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // Gets the depth of the Meta node in the OID tree final int depth = handlers.getOidDepth(h); - for (Enumeration rqs=handlers.getSubRequests(h); + for (Enumeration rqs=handlers.getSubRequests(h); rqs.hasMoreElements();) { // Invoke the get() operation. - meta.get((SnmpMibSubRequest)rqs.nextElement(),depth); + meta.get(rqs.nextElement(),depth); } } } @@ -286,6 +283,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // Implements the method defined in SnmpMibAgent. See SnmpMibAgent // for java-doc // + @Override public void set(SnmpMibRequest req) throws SnmpStatusException { SnmpRequestTree handlers = null; @@ -307,8 +305,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { handlers.switchCreationFlag(false); handlers.setPduType(reqType); - SnmpRequestTree.Handler h = null; - SnmpMibNode meta = null; + SnmpRequestTree.Handler h; + SnmpMibNode meta; if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(), @@ -317,8 +315,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // For each sub-request stored in the request-tree, invoke the // get() method. - for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) { - h = (SnmpRequestTree.Handler) eh.nextElement(); + for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) { + h = eh.nextElement(); // Gets the Meta node. It can be either a Group Meta or a // Table Meta. @@ -328,11 +326,11 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // Gets the depth of the Meta node in the OID tree final int depth = handlers.getOidDepth(h); - for (Enumeration rqs=handlers.getSubRequests(h); + for (Enumeration rqs=handlers.getSubRequests(h); rqs.hasMoreElements();) { // Invoke the set() operation - meta.set((SnmpMibSubRequest)rqs.nextElement(),depth); + meta.set(rqs.nextElement(),depth); } } } @@ -346,6 +344,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // Implements the method defined in SnmpMibAgent. See SnmpMibAgent // for java-doc // + @Override public void check(SnmpMibRequest req) throws SnmpStatusException { final int reqType = SnmpDefinitions.pduWalkRequest; @@ -353,8 +352,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // is atomic. SnmpRequestTree handlers = getHandlers(req,true,true,reqType); - SnmpRequestTree.Handler h = null; - SnmpMibNode meta = null; + SnmpRequestTree.Handler h; + SnmpMibNode meta; if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(), @@ -363,8 +362,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // For each sub-request stored in the request-tree, invoke the // check() method. - for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) { - h = (SnmpRequestTree.Handler) eh.nextElement(); + for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) { + h = eh.nextElement(); // Gets the Meta node. It can be either a Group Meta or a // Table Meta. @@ -374,11 +373,11 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // Gets the depth of the Meta node in the OID tree final int depth = handlers.getOidDepth(h); - for (Enumeration rqs=handlers.getSubRequests(h); + for (Enumeration rqs=handlers.getSubRequests(h); rqs.hasMoreElements();) { // Invoke the check() operation - meta.check((SnmpMibSubRequest)rqs.nextElement(),depth); + meta.check(rqs.nextElement(),depth); } } @@ -398,13 +397,14 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // Implements the method defined in SnmpMibAgent. See SnmpMibAgent // for java-doc // + @Override public void getNext(SnmpMibRequest req) throws SnmpStatusException { // Build the request tree for the operation // The subrequest stored in the request tree are valid GET requests SnmpRequestTree handlers = getGetNextHandlers(req); - SnmpRequestTree.Handler h = null; - SnmpMibNode meta = null; + SnmpRequestTree.Handler h; + SnmpMibNode meta; if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(), @@ -412,8 +412,8 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { } // Now invoke get() for each subrequest of the request tree. - for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) { - h = (SnmpRequestTree.Handler) eh.nextElement(); + for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) { + h = eh.nextElement(); // Gets the Meta node. It can be either a Group Meta or a // Table Meta. @@ -423,11 +423,11 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // Gets the depth of the Meta node in the OID tree int depth = handlers.getOidDepth(h); - for (Enumeration rqs=handlers.getSubRequests(h); + for (Enumeration rqs=handlers.getSubRequests(h); rqs.hasMoreElements();) { // Invoke the get() operation - meta.get((SnmpMibSubRequest)rqs.nextElement(),depth); + meta.get(rqs.nextElement(),depth); } } } @@ -442,6 +442,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // Implements the method defined in SnmpMibAgent. See SnmpMibAgent // for java-doc // + @Override public void getBulk(SnmpMibRequest req, int nonRepeat, int maxRepeat) throws SnmpStatusException { @@ -456,10 +457,11 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { * * @return The root object identifier. */ + @Override public long[] getRootOid() { if( rootOid == null) { - Vector list= new Vector(10); + Vector list= new Vector<>(10); // Ask the tree to do the job ! // @@ -507,13 +509,13 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { new SnmpRequestTree(req,createflag,type); int index=0; - SnmpVarBind var = null; + SnmpVarBind var; final int ver= req.getVersion(); // For each varbind in the list finds its handling node. - for (Enumeration e= req.getElements(); e.hasMoreElements(); index++) { + for (Enumeration e= req.getElements(); e.hasMoreElements(); index++) { - var= (SnmpVarBind) e.nextElement(); + var= e.nextElement(); try { // Find the handling node for this varbind. @@ -657,10 +659,10 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { // request into a valid GET request, replacing the OIDs in the // original GET-NEXT request with the OID of the first leaf that // follows. - for (Enumeration e= req.getElements(); e.hasMoreElements(); index++) { + for (Enumeration e= req.getElements(); e.hasMoreElements(); index++) { - var = (SnmpVarBind) e.nextElement(); - SnmpOid result = null; + var = e.nextElement(); + SnmpOid result; try { // Find the node handling the OID that follows the varbind // OID. `result' contains this next leaf OID. diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java index e0ba715d6e98362d697a49d5ac43d094e36322b9..451fa859df4a954a4aa7f8027d7b53a465ae55d1 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java @@ -33,14 +33,12 @@ package com.sun.jmx.snmp.agent; import java.io.Serializable; import java.util.Vector; import java.util.Enumeration; -import java.util.Set; // jmx imports // import javax.management.MBeanServer; import javax.management.MBeanRegistration; import javax.management.ObjectName; -import javax.management.MalformedObjectNameException; import javax.management.InstanceNotFoundException; import javax.management.ServiceNotFoundException; import javax.management.ReflectionException; @@ -94,6 +92,7 @@ public abstract class SnmpMibAgent * * @exception java.lang.Exception */ + @Override public abstract ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception; @@ -101,18 +100,21 @@ public abstract class SnmpMibAgent /** * Not used in this context. */ + @Override public void postRegister (Boolean registrationDone) { } /** * Not used in this context. */ + @Override public void preDeregister() throws java.lang.Exception { } /** * Not used in this context. */ + @Override public void postDeregister() { } @@ -127,6 +129,7 @@ public abstract class SnmpMibAgent * * @exception SnmpStatusException An error occured during the operation. */ + @Override public abstract void get(SnmpMibRequest req) throws SnmpStatusException; @@ -141,6 +144,7 @@ public abstract class SnmpMibAgent * * @exception SnmpStatusException An error occured during the operation. */ + @Override public abstract void getNext(SnmpMibRequest req) throws SnmpStatusException; @@ -164,6 +168,7 @@ public abstract class SnmpMibAgent * * @exception SnmpStatusException An error occured during the operation. */ + @Override public abstract void getBulk(SnmpMibRequest req, int nonRepeat, int maxRepeat) throws SnmpStatusException; @@ -185,6 +190,7 @@ public abstract class SnmpMibAgent * the exception is thrown in the {@link #check(SnmpMibRequest)} * method instead. */ + @Override public abstract void set(SnmpMibRequest req) throws SnmpStatusException; @@ -203,6 +209,7 @@ public abstract class SnmpMibAgent * @exception SnmpStatusException The set operation * cannot be performed. */ + @Override public abstract void check(SnmpMibRequest req) throws SnmpStatusException; @@ -226,6 +233,7 @@ public abstract class SnmpMibAgent * @return The MBean server or null if the MIB is not registered in any * MBean server. */ + @Override public MBeanServer getMBeanServer() { return server; } @@ -236,6 +244,7 @@ public abstract class SnmpMibAgent * * @return The SNMP MIB handler. */ + @Override public SnmpMibHandler getSnmpAdaptor() { return adaptor; } @@ -246,6 +255,7 @@ public abstract class SnmpMibAgent * * @param stack The SNMP MIB handler. */ + @Override public void setSnmpAdaptor(SnmpMibHandler stack) { if (adaptor != null) { adaptor.removeMib(this); @@ -266,6 +276,7 @@ public abstract class SnmpMibAgent * * @since 1.5 */ + @Override public void setSnmpAdaptor(SnmpMibHandler stack, SnmpOid[] oids) { if (adaptor != null) { adaptor.removeMib(this); @@ -288,6 +299,7 @@ public abstract class SnmpMibAgent * * @since 1.5 */ + @Override public void setSnmpAdaptor(SnmpMibHandler stack, String contextName) { if (adaptor != null) { adaptor.removeMib(this, contextName); @@ -309,6 +321,7 @@ public abstract class SnmpMibAgent * * @since 1.5 */ + @Override public void setSnmpAdaptor(SnmpMibHandler stack, String contextName, SnmpOid[] oids) { @@ -327,6 +340,7 @@ public abstract class SnmpMibAgent * * @return The name of the SNMP protocol adaptor. */ + @Override public ObjectName getSnmpAdaptorName() { return adaptorName; } @@ -344,6 +358,7 @@ public abstract class SnmpMibAgent * @exception ServiceNotFoundException This SNMP MIB is not registered * in the MBean server or the requested service is not supported. */ + @Override public void setSnmpAdaptorName(ObjectName name) throws InstanceNotFoundException, ServiceNotFoundException { @@ -389,6 +404,7 @@ public abstract class SnmpMibAgent * * @since 1.5 */ + @Override public void setSnmpAdaptorName(ObjectName name, SnmpOid[] oids) throws InstanceNotFoundException, ServiceNotFoundException { @@ -434,6 +450,7 @@ public abstract class SnmpMibAgent * * @since 1.5 */ + @Override public void setSnmpAdaptorName(ObjectName name, String contextName) throws InstanceNotFoundException, ServiceNotFoundException { @@ -481,6 +498,7 @@ public abstract class SnmpMibAgent * * @since 1.5 */ + @Override public void setSnmpAdaptorName(ObjectName name, String contextName, SnmpOid[] oids) throws InstanceNotFoundException, ServiceNotFoundException { @@ -522,6 +540,7 @@ public abstract class SnmpMibAgent * @return true if the MIB module is bound, * false otherwise. */ + @Override public boolean getBindingState() { if (adaptor == null) return false; @@ -534,6 +553,7 @@ public abstract class SnmpMibAgent * * @return The MIB name. */ + @Override public String getMibName() { return mibName; } @@ -681,7 +701,7 @@ public abstract class SnmpMibAgent private Vector splitFrom(Vector original, int limit) { int max= original.size(); - Vector result= new Vector(max - limit); + Vector result= new Vector<>(max - limit); int i= limit; // Ok the loop looks a bit strange. But in order to improve the @@ -697,21 +717,12 @@ public abstract class SnmpMibAgent return result; } - private void concatVector(SnmpMibRequest req, Vector source) { - for(Enumeration e= source.elements(); e.hasMoreElements(); ) { - SnmpVarBind var= (SnmpVarBind) e.nextElement(); - // We need to duplicate the SnmpVarBind otherwise it is going - // to be overloaded by the next get Next ... - req.addVarBind(new SnmpVarBind(var.oid, var.value)); - } - } - - private void concatVector(Vector target, Vector source) { + private void concatVector(SnmpMibRequest req, Vector source) { for(Enumeration e= source.elements(); e.hasMoreElements(); ) { SnmpVarBind var= e.nextElement(); // We need to duplicate the SnmpVarBind otherwise it is going // to be overloaded by the next get Next ... - target.addElement(new SnmpVarBind(var.oid, var.value)); + req.addVarBind(new SnmpVarBind(var.oid, var.value)); } } diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java index b34e0009481502750ee7ed43a296e50445a68fa8..29882ce01d4ff7c3a4e8b2c0e74ae0ef82dd8ee4 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java @@ -29,20 +29,13 @@ package com.sun.jmx.snmp.agent; // import java.io.Serializable; import java.util.Hashtable; -import java.util.Enumeration; import java.util.Vector; // jmx imports // -import com.sun.jmx.snmp.SnmpOid; -import com.sun.jmx.snmp.SnmpValue; import com.sun.jmx.snmp.SnmpVarBind; import com.sun.jmx.snmp.SnmpStatusException; -// SNMP Runtime imports -// -import com.sun.jmx.snmp.agent.SnmpMibOid; -import com.sun.jmx.snmp.agent.SnmpMibNode; /** * Represents a node in an SNMP MIB which corresponds to a group. @@ -174,6 +167,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid * @exception SnmpStatusException An error occurred while accessing * the MIB node. */ + @Override abstract public void get(SnmpMibSubRequest req, int depth) throws SnmpStatusException; @@ -203,6 +197,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid * @exception SnmpStatusException An error occurred while accessing * the MIB node. */ + @Override abstract public void set(SnmpMibSubRequest req, int depth) throws SnmpStatusException; @@ -234,6 +229,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid * @exception SnmpStatusException An error occurred while accessing * the MIB node. */ + @Override abstract public void check(SnmpMibSubRequest req, int depth) throws SnmpStatusException; @@ -241,8 +237,8 @@ public abstract class SnmpMibGroup extends SnmpMibOid // If we reach this node, we are below the root OID, so we just // return. // -------------------------------------------------------------------- - public void getRootOid(Vector result) { - return; + @Override + public void getRootOid(Vector result) { } // ------------------------------------------------------------------- @@ -264,7 +260,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid */ void registerNestedArc(long arc) { Long obj = new Long(arc); - if (subgroups == null) subgroups = new Hashtable(); + if (subgroups == null) subgroups = new Hashtable<>(); // registers the arc in the hashtable. subgroups.put(obj,obj); } @@ -312,6 +308,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid * @param node The node being registered. * */ + @Override void registerNode(long[] oid, int cursor ,SnmpMibNode node) throws IllegalAccessException { super.registerNode(oid,cursor,node); @@ -325,13 +322,13 @@ public abstract class SnmpMibGroup extends SnmpMibOid // ------------------------------------------------------------------- // see comments in SnmpMibNode // ------------------------------------------------------------------- + @Override void findHandlingNode(SnmpVarBind varbind, long[] oid, int depth, SnmpRequestTree handlers) throws SnmpStatusException { int length = oid.length; - SnmpMibNode node = null; if (handlers == null) throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr); @@ -349,7 +346,6 @@ public abstract class SnmpMibGroup extends SnmpMibOid // This arc leads to a subgroup: delegates the search to the // method defined in SnmpMibOid super.findHandlingNode(varbind,oid,depth,handlers); - return; } else if (isTable(arc)) { // This arc leads to a table: forward the search to the table. @@ -384,6 +380,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid // ------------------------------------------------------------------- // See comments in SnmpMibNode. // ------------------------------------------------------------------- + @Override long[] findNextHandlingNode(SnmpVarBind varbind, long[] oid, int pos, int depth, SnmpRequestTree handlers, AcmChecker checker) diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibOid.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibOid.java index a9411b9d17610baf406fdf097035ff641a759e66..f3965bce637e627d2215f024f48771dcffd1af38 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibOid.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibOid.java @@ -37,7 +37,6 @@ import java.util.Enumeration; // jmx imports // import com.sun.jmx.snmp.SnmpOid; -import com.sun.jmx.snmp.SnmpValue; import com.sun.jmx.snmp.SnmpVarBind; import com.sun.jmx.snmp.SnmpStatusException; @@ -79,10 +78,11 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable { * @exception SnmpStatusException The default implementation (if not * overridden) is to generate a SnmpStatusException. */ + @Override public void get(SnmpMibSubRequest req, int depth) throws SnmpStatusException { - for (Enumeration e= req.getElements(); e.hasMoreElements();) { - SnmpVarBind var= (SnmpVarBind) e.nextElement(); + for (Enumeration e= req.getElements(); e.hasMoreElements();) { + SnmpVarBind var= e.nextElement(); SnmpStatusException x = new SnmpStatusException(SnmpStatusException.noSuchObject); req.registerGetException(var,x); @@ -102,10 +102,11 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable { * @exception SnmpStatusException The default implementation (if not * overridden) is to generate a SnmpStatusException. */ + @Override public void set(SnmpMibSubRequest req, int depth) throws SnmpStatusException { - for (Enumeration e= req.getElements(); e.hasMoreElements();) { - SnmpVarBind var= (SnmpVarBind) e.nextElement(); + for (Enumeration e= req.getElements(); e.hasMoreElements();) { + SnmpVarBind var= e.nextElement(); SnmpStatusException x = new SnmpStatusException(SnmpStatusException.noAccess); req.registerSetException(var,x); @@ -123,12 +124,13 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable { * @param depth The depth reached in the OID tree. * * @exception SnmpStatusException The default implementation (if not - * overriden) is to generate a SnmpStatusException. + * overridden) is to generate a SnmpStatusException. */ + @Override public void check(SnmpMibSubRequest req, int depth) throws SnmpStatusException { - for (Enumeration e= req.getElements(); e.hasMoreElements();) { - SnmpVarBind var= (SnmpVarBind) e.nextElement(); + for (Enumeration e= req.getElements(); e.hasMoreElements();) { + SnmpVarBind var= e.nextElement(); SnmpStatusException x = new SnmpStatusException(SnmpStatusException.noAccess); req.registerCheckException(var,x); @@ -143,6 +145,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable { // // --------------------------------------------------------------------- // + @Override void findHandlingNode(SnmpVarBind varbind, long[] oid, int depth, SnmpRequestTree handlers) @@ -191,6 +194,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable { // // --------------------------------------------------------------------- // + @Override long[] findNextHandlingNode(SnmpVarBind varbind, long[] oid, int pos, int depth, SnmpRequestTree handlers, @@ -267,6 +271,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable { /** * Computes the root OID of the MIB. */ + @Override public void getRootOid(Vector result) { // If a node has several children, let assume that we are one step to @@ -359,7 +364,6 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable { // String.valueOf(var) + " position= " + cursor); children.insertElementAt(child, newPos); child.registerNode(oid, cursor + 1, node); - return; } else { // The node is already registered @@ -404,7 +408,6 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable { } } children.setElementAt(node,pos); - return; } else { if (child == null) throw new IllegalAccessException(); @@ -469,7 +472,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable { int max= varList.length -1 ; int curr= low + (max-low)/2; - int elmt= 0; + int elmt; while (low <= max) { elmt= varList[curr]; if (cursor == elmt) { @@ -494,7 +497,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable { if (varList == null) return -1; int max= varList.length -1 ; - int elmt=0; + int elmt; //final int[] v = varList; //if (index > a[max]) @@ -528,7 +531,7 @@ public class SnmpMibOid extends SnmpMibNode implements Serializable { /** * Contains the list of sub nodes. */ - private NonSyncVector children = new NonSyncVector(1); + private NonSyncVector children = new NonSyncVector<>(1); /** * The number of sub nodes. diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequest.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequest.java index b45a8bca877cf486e5d6aa0f83272156b8fb581d..e117bf2a8cdd0b6caef838f02f6f5e919c71fa9a 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequest.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequest.java @@ -50,7 +50,7 @@ public interface SnmpMibRequest { * @return The element of the enumeration are instances of * {@link com.sun.jmx.snmp.SnmpVarBind} */ - public Enumeration getElements(); + public Enumeration getElements(); /** * Returns the vector of varbind to be handled by the SNMP mib node. diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequestImpl.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequestImpl.java index dfd9f4645e94275e394c56067e5ed0644eaedd92..5f204bcba5808f8d860d72033d6ce5208b54a983 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequestImpl.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequestImpl.java @@ -87,6 +87,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest { * Returns the local engine. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned. * @return the local engine. */ + @Override public SnmpEngine getEngine() { return engine; } @@ -95,6 +96,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest { * Gets the incoming request principal. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned. * @return The request principal. **/ + @Override public String getPrincipal() { return principal; } @@ -103,6 +105,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest { * Gets the incoming request security level. This level is defined in {@link com.sun.jmx.snmp.SnmpEngine SnmpEngine}. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise -1 is returned. * @return The security level. */ + @Override public int getSecurityLevel() { return securityLevel; } @@ -110,6 +113,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest { * Gets the incoming request security model. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise -1 is returned. * @return The security model. */ + @Override public int getSecurityModel() { return securityModel; } @@ -117,6 +121,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest { * Gets the incoming request context name. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned. * @return The context name. */ + @Override public byte[] getContextName() { return contextName; } @@ -125,6 +130,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest { * Gets the incoming request context name used by Access Control Model in order to allow or deny the access to OIDs. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned. * @return The checked context. */ + @Override public byte[] getAccessContextName() { return accessContextName; } @@ -133,6 +139,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest { // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------------- + @Override public final SnmpPdu getPdu() { return reqPdu; } @@ -141,18 +148,21 @@ final class SnmpMibRequestImpl implements SnmpMibRequest { // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------------- - public final Enumeration getElements() {return varbinds.elements();} + @Override + public final Enumeration getElements() {return varbinds.elements();} // ------------------------------------------------------------------- // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------------- + @Override public final Vector getSubList() {return varbinds;} // ------------------------------------------------------------------- // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------------- + @Override public final int getSize() { if (varbinds == null) return 0; return varbinds.size(); @@ -162,24 +172,28 @@ final class SnmpMibRequestImpl implements SnmpMibRequest { // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------------- + @Override public final int getVersion() {return version;} // ------------------------------------------------------------------- // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------------- + @Override public final int getRequestPduVersion() {return reqPdu.version;} // ------------------------------------------------------------------- // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------------- + @Override public final Object getUserData() {return data;} // ------------------------------------------------------------------- // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------------- + @Override public final int getVarIndex(SnmpVarBind varbind) { return varbinds.indexOf(varbind); } @@ -188,6 +202,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest { // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------------- + @Override public void addVarBind(SnmpVarBind varbind) { varbinds.addElement(varbind); } @@ -218,7 +233,7 @@ final class SnmpMibRequestImpl implements SnmpMibRequest { // Returns the underlying vector of SNMP varbinds (used for algorithm // optimization). // ------------------------------------------------------------------- - final Vector getVarbinds() {return varbinds;} + final Vector getVarbinds() {return varbinds;} // ------------------------------------------------------------------- // Private variables diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibSubRequest.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibSubRequest.java index cd72847945ac1c997c108a3af3ef7bffa49e9280..76aa168b454bf072c95f3a00eacd970a7eb6a0f7 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibSubRequest.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibSubRequest.java @@ -65,7 +65,8 @@ public interface SnmpMibSubRequest extends SnmpMibRequest { * @return The elements of the enumeration are instances of * {@link com.sun.jmx.snmp.SnmpVarBind} */ - public Enumeration getElements(); + @Override + public Enumeration getElements(); /** * Return the list of varbind to be handled by the SNMP MIB node. @@ -85,6 +86,7 @@ public interface SnmpMibSubRequest extends SnmpMibRequest { * @return The elements of the vector are instances of * {@link com.sun.jmx.snmp.SnmpVarBind} */ + @Override public Vector getSubList(); /** diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java index 7b6631afc057849629692c7c1e30b1c018b29577..e0282c6cec06a8a171db0ce56c0c381e23d0fc1d 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java @@ -266,6 +266,7 @@ public abstract class SnmpMibTable extends SnmpMibNode *

* */ + @Override public void get(SnmpMibSubRequest req, int depth) throws SnmpStatusException { @@ -276,9 +277,9 @@ public abstract class SnmpMibTable extends SnmpMibNode // each varbind involved (nb: should not happen, the error // should have been registered earlier) if (isnew) { - SnmpVarBind var = null; - for (Enumeration e= r.getElements(); e.hasMoreElements();) { - var = (SnmpVarBind) e.nextElement(); + SnmpVarBind var; + for (Enumeration e= r.getElements(); e.hasMoreElements();) { + var = e.nextElement(); r.registerGetException(var,noSuchInstanceException); } } @@ -329,6 +330,7 @@ public abstract class SnmpMibTable extends SnmpMibNode *

* */ + @Override public void check(SnmpMibSubRequest req, int depth) throws SnmpStatusException { final SnmpOid oid = req.getEntryOid(); @@ -389,6 +391,7 @@ public abstract class SnmpMibTable extends SnmpMibNode *

* */ + @Override public void set(SnmpMibSubRequest req, int depth) throws SnmpStatusException { @@ -755,6 +758,7 @@ public abstract class SnmpMibTable extends SnmpMibNode * * @exception IllegalArgumentException Listener parameter is null. */ + @Override public synchronized void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) { @@ -768,13 +772,11 @@ public abstract class SnmpMibTable extends SnmpMibNode // looking for listener in handbackTable // - Vector handbackList = - handbackTable.get(listener) ; - Vector filterList = - filterTable.get(listener) ; + Vector handbackList = handbackTable.get(listener) ; + Vector filterList = filterTable.get(listener) ; if ( handbackList == null ) { - handbackList = new Vector() ; - filterList = new Vector() ; + handbackList = new Vector<>() ; + filterList = new Vector<>() ; handbackTable.put(listener, handbackList) ; filterTable.put(listener, filterList) ; } @@ -797,16 +799,14 @@ public abstract class SnmpMibTable extends SnmpMibNode * @exception ListenerNotFoundException The listener is not registered * in the MBean. */ + @Override public synchronized void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { // looking for listener in handbackTable // - java.util.Vector handbackList = - (java.util.Vector) handbackTable.get(listener) ; - java.util.Vector filterList = - (java.util.Vector) filterTable.get(listener) ; + java.util.Vector handbackList = handbackTable.get(listener) ; if ( handbackList == null ) { throw new ListenerNotFoundException("listener"); } @@ -822,6 +822,7 @@ public abstract class SnmpMibTable extends SnmpMibNode * notification class and the notification type sent by the * SnmpMibTable. */ + @Override public MBeanNotificationInfo[] getNotificationInfo() { String[] types = {SnmpTableEntryNotification.SNMP_ENTRY_ADDED, @@ -1813,9 +1814,9 @@ public abstract class SnmpMibTable extends SnmpMibNode // // --------------------------------------------------------------------- - final static void checkRowStatusFail(SnmpMibSubRequest req, - int errorStatus) + static void checkRowStatusFail(SnmpMibSubRequest req, int errorStatus) throws SnmpStatusException { + final SnmpVarBind statusvb = req.getRowStatusVarBind(); final SnmpStatusException x = new SnmpStatusException(errorStatus); req.registerCheckException(statusvb,x); @@ -1827,9 +1828,9 @@ public abstract class SnmpMibTable extends SnmpMibNode // // --------------------------------------------------------------------- - final static void setRowStatusFail(SnmpMibSubRequest req, - int errorStatus) + static void setRowStatusFail(SnmpMibSubRequest req, int errorStatus) throws SnmpStatusException { + final SnmpVarBind statusvb = req.getRowStatusVarBind(); final SnmpStatusException x = new SnmpStatusException(errorStatus); req.registerSetException(statusvb,x); @@ -1840,6 +1841,7 @@ public abstract class SnmpMibTable extends SnmpMibNode // Implements the method defined in SnmpMibNode. // // --------------------------------------------------------------------- + @Override final synchronized void findHandlingNode(SnmpVarBind varbind, long[] oid, int depth, SnmpRequestTree handlers) @@ -1909,11 +1911,15 @@ public abstract class SnmpMibTable extends SnmpMibNode // largely inspired from the original getNext() method. // // --------------------------------------------------------------------- + @Override final synchronized long[] findNextHandlingNode(SnmpVarBind varbind, - long[] oid, int pos, int depth, - SnmpRequestTree handlers, - AcmChecker checker) + long[] oid, + int pos, + int depth, + SnmpRequestTree handlers, + AcmChecker checker) throws SnmpStatusException { + int length = oid.length; if (handlers == null) @@ -1974,7 +1980,7 @@ public abstract class SnmpMibTable extends SnmpMibNode } // Now that we've got everything right we can begin. - SnmpOid entryoid = null ; + SnmpOid entryoid; if (pos == (length - 1)) { // pos points to the last arc in the oid, and this arc is @@ -2200,28 +2206,25 @@ public abstract class SnmpMibTable extends SnmpMibNode // loop on listener // - for(java.util.Enumeration k = handbackTable.keys(); + for(java.util.Enumeration k = handbackTable.keys(); k.hasMoreElements(); ) { - NotificationListener listener = - (NotificationListener) k.nextElement(); + NotificationListener listener = k.nextElement(); // Get the associated handback list and the associated filter list // - java.util.Vector handbackList = - (java.util.Vector) handbackTable.get(listener) ; - java.util.Vector filterList = - (java.util.Vector) filterTable.get(listener) ; + java.util.Vector handbackList = handbackTable.get(listener) ; + java.util.Vector filterList = + filterTable.get(listener) ; // loop on handback // - java.util.Enumeration f = filterList.elements(); - for(java.util.Enumeration h = handbackList.elements(); + java.util.Enumeration f = filterList.elements(); + for(java.util.Enumeration h = handbackList.elements(); h.hasMoreElements(); ) { Object handback = h.nextElement(); - NotificationFilter filter = - (NotificationFilter)f.nextElement(); + NotificationFilter filter = f.nextElement(); if ((filter == null) || (filter.isNotificationEnabled(notification))) { @@ -2300,7 +2303,7 @@ public abstract class SnmpMibTable extends SnmpMibNode * OID was not found. * **/ - private final int findObject(SnmpOid oid) { + private int findObject(SnmpOid oid) { int low= 0; int max= size - 1; SnmpOid pos; @@ -2332,25 +2335,6 @@ public abstract class SnmpMibTable extends SnmpMibNode return -1; } - /** - * Search the position at which the given oid should be inserted - * in the OID table (tableoids). - * - *

- * @param oid The OID we would like to insert. - * - * @return The position at which the OID should be inserted in - * the table. - * - * @exception SnmpStatusException if the OID is already present in the - * table. - * - **/ - private final int getInsertionPoint(SnmpOid oid) - throws SnmpStatusException { - return getInsertionPoint(oid, true); - } - /** * Search the position at which the given oid should be inserted * in the OID table (tableoids). @@ -2371,7 +2355,7 @@ public abstract class SnmpMibTable extends SnmpMibNode * table and fail is true. * **/ - private final int getInsertionPoint(SnmpOid oid, boolean fail) + private int getInsertionPoint(SnmpOid oid, boolean fail) throws SnmpStatusException { final int failStatus = SnmpStatusException.snmpRspNotWritable; @@ -2413,7 +2397,7 @@ public abstract class SnmpMibTable extends SnmpMibNode * @param pos The position at which the OID to be removed is located. * **/ - private final void removeOid(int pos) { + private void removeOid(int pos) { if (pos >= tablecount) return; if (pos < 0) return; final int l1 = --tablecount-pos; @@ -2431,7 +2415,7 @@ public abstract class SnmpMibTable extends SnmpMibNode * @param pos The position at which the OID to be added is located. * **/ - private final void insertOid(int pos, SnmpOid oid) { + private void insertOid(int pos, SnmpOid oid) { if (pos >= tablesize || tablecount == tablesize) { // Vector must be enlarged @@ -2534,13 +2518,13 @@ public abstract class SnmpMibTable extends SnmpMibNode * The list of entries. * @serial */ - private final Vector entries= new Vector(); + private final Vector entries= new Vector<>(); /** * The list of object names. * @serial */ - private final Vector entrynames= new Vector(); + private final Vector entrynames= new Vector<>(); /** * Callback handlers @@ -2548,17 +2532,16 @@ public abstract class SnmpMibTable extends SnmpMibNode // final Vector callbacks = new Vector(); /** - * Listener hastable containing the hand-back objects. + * Listener hashtable containing the hand-back objects. */ private Hashtable> handbackTable = - new Hashtable>(); + new Hashtable<>(); /** - * Listener hastable containing the filter objects. + * Listener hashtable containing the filter objects. */ private Hashtable> - filterTable = - new Hashtable>(); + filterTable = new Hashtable<>(); // PACKAGE VARIABLES //------------------ diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java index c401a73f77ecdff95b318398fe6a5846749aa8c1..dbcca12d9ef9b4dcce4b197a424b104e8476c2c4 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java @@ -25,11 +25,9 @@ package com.sun.jmx.snmp.agent; import java.util.Vector; -import java.util.ArrayList; import java.util.Hashtable; import java.util.Enumeration; import java.util.Iterator; -import java.util.List; import java.util.NoSuchElementException; import java.util.Arrays; import java.util.logging.Level; @@ -77,7 +75,7 @@ final class SnmpRequestTree { this.request = req; this.version = req.getVersion(); this.creationflag = creationflag; - this.hashtable = new Hashtable(); + this.hashtable = new Hashtable<>(); setPduType(pdutype); } @@ -191,7 +189,7 @@ final class SnmpRequestTree { // SnmSubRequest associated with an Handler node. //------------------------------------------------------------------- - static final class Enum implements Enumeration { + static final class Enum implements Enumeration { Enum(SnmpRequestTree hlist,Handler h) { handler = h; this.hlist = hlist; @@ -203,11 +201,13 @@ final class SnmpRequestTree { private int iter = 0; private int size = 0; + @Override public boolean hasMoreElements() { return iter < size; } - public Object nextElement() throws NoSuchElementException { + @Override + public SnmpMibSubRequest nextElement() throws NoSuchElementException { if (iter == 0) { if (handler.sublist != null) { iter++; @@ -216,7 +216,7 @@ final class SnmpRequestTree { } iter ++; if (iter > size) throw new NoSuchElementException(); - Object result = hlist.getSubRequest(handler,entry); + SnmpMibSubRequest result = hlist.getSubRequest(handler,entry); entry++; return result; } @@ -252,7 +252,8 @@ final class SnmpRequestTree { // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------- - public Enumeration getElements() { + @Override + public Enumeration getElements() { return varbinds.elements(); } @@ -260,6 +261,7 @@ final class SnmpRequestTree { // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------- + @Override public Vector getSubList() { return varbinds; } @@ -268,6 +270,7 @@ final class SnmpRequestTree { // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------- + @Override public final int getSize() { if (varbinds == null) return 0; return varbinds.size(); @@ -277,6 +280,7 @@ final class SnmpRequestTree { // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------- + @Override public void addVarBind(SnmpVarBind varbind) { // XXX not sure we must also add the varbind in the global // request? or whether we should raise an exception: @@ -289,6 +293,7 @@ final class SnmpRequestTree { // Implements the method defined in SnmpMibSubRequest interface. // See SnmpMibSubRequest for the java doc. // ------------------------------------------------------------- + @Override public boolean isNewEntry() { return isnew; } @@ -297,6 +302,7 @@ final class SnmpRequestTree { // Implements the method defined in SnmpMibSubRequest interface. // See SnmpMibSubRequest for the java doc. // ------------------------------------------------------------- + @Override public SnmpOid getEntryOid() { return entryoid; } @@ -305,6 +311,7 @@ final class SnmpRequestTree { // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------- + @Override public int getVarIndex(SnmpVarBind varbind) { if (varbind == null) return 0; return global.getVarIndex(varbind); @@ -314,6 +321,7 @@ final class SnmpRequestTree { // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------- + @Override public Object getUserData() { return global.getUserData(); } @@ -322,6 +330,7 @@ final class SnmpRequestTree { // See SnmpMibSubRequest for the java doc. // ------------------------------------------------------------- + @Override public void registerGetException(SnmpVarBind var, SnmpStatusException exception) throws SnmpStatusException { @@ -364,6 +373,7 @@ final class SnmpRequestTree { // Implements the method defined in SnmpMibSubRequest interface. // See SnmpMibSubRequest for the java doc. // ------------------------------------------------------------- + @Override public void registerSetException(SnmpVarBind var, SnmpStatusException exception) throws SnmpStatusException { @@ -387,6 +397,7 @@ final class SnmpRequestTree { // Implements the method defined in SnmpMibSubRequest interface. // See SnmpMibSubRequest for the java doc. // ------------------------------------------------------------- + @Override public void registerCheckException(SnmpVarBind var, SnmpStatusException exception) throws SnmpStatusException { @@ -410,42 +421,52 @@ final class SnmpRequestTree { // Implements the method defined in SnmpMibRequest interface. // See SnmpMibRequest for the java doc. // ------------------------------------------------------------- + @Override public int getVersion() { return version; } + @Override public SnmpVarBind getRowStatusVarBind() { return statusvb; } + @Override public SnmpPdu getPdu() { return global.getPdu(); } + @Override public int getRequestPduVersion() { return global.getRequestPduVersion(); } + @Override public SnmpEngine getEngine() { return global.getEngine(); } + @Override public String getPrincipal() { return global.getPrincipal(); } + @Override public int getSecurityLevel() { return global.getSecurityLevel(); } + @Override public int getSecurityModel() { return global.getSecurityModel(); } + @Override public byte[] getContextName() { return global.getContextName(); } + @Override public byte[] getAccessContextName() { return global.getAccessContextName(); } @@ -485,7 +506,7 @@ final class SnmpRequestTree { * Adds a varbind in this node sublist. */ public void addVarbind(SnmpVarBind varbind) { - if (sublist == null) sublist = new Vector(); + if (sublist == null) sublist = new Vector<>(); sublist.addElement(varbind); } @@ -503,7 +524,7 @@ final class SnmpRequestTree { // Vectors are null: Allocate new vectors entryoids = new SnmpOid[Delta]; - entrylists = new Vector[Delta]; + entrylists = (Vector[])new Vector[Delta]; isentrynew = new boolean[Delta]; rowstatus = new SnmpVarBind[Delta]; entrysize = Delta; @@ -521,7 +542,7 @@ final class SnmpRequestTree { // Allocate larger vectors entrysize += Delta; entryoids = new SnmpOid[entrysize]; - entrylists = new Vector[entrysize]; + entrylists = (Vector[])new Vector[entrysize]; isentrynew = new boolean[entrysize]; rowstatus = new SnmpVarBind[entrysize]; @@ -595,7 +616,7 @@ final class SnmpRequestTree { // entryoids = new ArrayList(); // entrylists = new ArrayList(); // isentrynew = new ArrayList(); - v = new Vector(); + v = new Vector<>(); // entryoids.add(entryoid); // entrylists.add(v); // isentrynew.add(new Boolean(isnew)); @@ -614,7 +635,7 @@ final class SnmpRequestTree { // if (pos == -1 || pos >= entrycount ) { // pos = getInsertionPoint(entryoids,entryoid); // pos = getInsertionPoint(entryoids,entrycount,entryoid); - v = new Vector(); + v = new Vector<>(); // entryoids.add(pos,entryoid); // entrylists.add(pos,v); // isentrynew.add(pos,new Boolean(isnew)); @@ -775,7 +796,7 @@ final class SnmpRequestTree { // If it is a table, there will be one subrequest per entry involved. //------------------------------------------------------------------- - public Enumeration getSubRequests(Handler handler) { + public Enumeration getSubRequests(Handler handler) { return new Enum(this,handler); } @@ -783,7 +804,7 @@ final class SnmpRequestTree { // returns an enumeration of the Handlers stored in the Hashtable. //------------------------------------------------------------------- - public Enumeration getHandlers() { + public Enumeration getHandlers() { return hashtable.elements(); } @@ -1048,7 +1069,6 @@ final class SnmpRequestTree { handler.addVarbind(varbind); else handler.addVarbind(varbind,entryoid,isnew,statusvb); - return ; } diff --git a/src/share/classes/com/sun/jmx/snmp/agent/SnmpStandardObjectServer.java b/src/share/classes/com/sun/jmx/snmp/agent/SnmpStandardObjectServer.java index 5b2fbcfbb04909df80df90b9d2e7c7d795275b64..f0369468126b0c636d2bad25afdc042edf123c3a 100644 --- a/src/share/classes/com/sun/jmx/snmp/agent/SnmpStandardObjectServer.java +++ b/src/share/classes/com/sun/jmx/snmp/agent/SnmpStandardObjectServer.java @@ -27,14 +27,7 @@ package com.sun.jmx.snmp.agent; // java imports // import java.io.Serializable; -import java.util.Hashtable; import java.util.Enumeration; -import java.util.Vector; - -// jmx imports -// -import com.sun.jmx.snmp.SnmpOid; -import com.sun.jmx.snmp.SnmpValue; import com.sun.jmx.snmp.SnmpVarBind; import com.sun.jmx.snmp.SnmpStatusException; @@ -121,8 +114,8 @@ public class SnmpStandardObjectServer implements Serializable { final Object data = req.getUserData(); - for (Enumeration e= req.getElements(); e.hasMoreElements();) { - final SnmpVarBind var= (SnmpVarBind) e.nextElement(); + for (Enumeration e= req.getElements(); e.hasMoreElements();) { + final SnmpVarBind var= e.nextElement(); try { final long id = var.oid.getOidArc(depth); var.value = meta.get(id, data); @@ -182,9 +175,8 @@ public class SnmpStandardObjectServer implements Serializable { final Object data = req.getUserData(); - for (Enumeration e= req.getElements(); e.hasMoreElements();) { - SnmpVarBind var = null; - var = (SnmpVarBind) e.nextElement(); + for (Enumeration e= req.getElements(); e.hasMoreElements();) { + SnmpVarBind var = e.nextElement(); try { // This method will generate a SnmpStatusException // if `depth' is out of bounds. @@ -248,8 +240,8 @@ public class SnmpStandardObjectServer implements Serializable { final Object data = req.getUserData(); - for (Enumeration e= req.getElements(); e.hasMoreElements();) { - final SnmpVarBind var = (SnmpVarBind) e.nextElement(); + for (Enumeration e= req.getElements(); e.hasMoreElements();) { + final SnmpVarBind var = e.nextElement(); try { // This method will generate a SnmpStatusException // if `depth' is out of bounds. diff --git a/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java b/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java index 4b576b60fa21a12b7192fd6a1820bbb0c8b6f339..b2634d8eee1ed281e89c94c3a37411f04c6b3364 100644 --- a/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java +++ b/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java @@ -33,7 +33,6 @@ package com.sun.jmx.snmp.daemon; import java.io.ObjectInputStream; import java.io.IOException; import java.net.InetAddress; -import java.util.Enumeration; import java.util.logging.Level; import java.util.Vector; import java.util.NoSuchElementException; @@ -50,8 +49,6 @@ import javax.management.NotificationBroadcasterSupport; import javax.management.MBeanNotificationInfo; import javax.management.AttributeChangeNotification; import javax.management.ListenerNotFoundException; -import javax.management.loading.ClassLoaderRepository; -import javax.management.MBeanServerFactory; import static com.sun.jmx.defaults.JmxProperties.SNMP_ADAPTOR_LOGGER; @@ -225,9 +222,8 @@ public abstract class CommunicatorServer private transient Object stateLock = new Object(); private transient Vector - clientHandlerVector = new Vector() ; + clientHandlerVector = new Vector<>() ; - private transient Thread fatherThread = Thread.currentThread() ; private transient Thread mainThread = null ; private volatile boolean stopRequested = false ; @@ -328,6 +324,7 @@ public abstract class CommunicatorServer * Has no effect if this CommunicatorServer is * ONLINE or STOPPING. */ + @Override public void start() { try { start(0); @@ -346,6 +343,7 @@ public abstract class CommunicatorServer * Has no effect if this CommunicatorServer is * OFFLINE or STOPPING. */ + @Override public void stop() { synchronized (stateLock) { if (state == OFFLINE || state == STOPPING) { @@ -393,6 +391,7 @@ public abstract class CommunicatorServer * * @return True if connector is ONLINE; false otherwise. */ + @Override public boolean isActive() { synchronized (stateLock) { return (state == ONLINE); @@ -431,6 +430,7 @@ public abstract class CommunicatorServer * @return true if the value of this MBean's State attribute is the * same as the wantedState parameter; false otherwise. */ + @Override public boolean waitState(int wantedState, long timeOut) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag, @@ -595,6 +595,7 @@ public abstract class CommunicatorServer * @return ONLINE, OFFLINE, * STARTING or STOPPING. */ + @Override public int getState() { synchronized (stateLock) { return state ; @@ -607,6 +608,7 @@ public abstract class CommunicatorServer * @return One of the strings "ONLINE", "OFFLINE", "STARTING" or * "STOPPING". */ + @Override public String getStateString() { return getStringForState(state) ; } @@ -616,6 +618,7 @@ public abstract class CommunicatorServer * * @return The host name used by this CommunicatorServer. */ + @Override public String getHost() { try { host = InetAddress.getLocalHost().getHostName(); @@ -630,6 +633,7 @@ public abstract class CommunicatorServer * * @return The port number used by this CommunicatorServer. */ + @Override public int getPort() { synchronized (stateLock) { return port ; @@ -645,6 +649,7 @@ public abstract class CommunicatorServer * @exception java.lang.IllegalStateException This method has been invoked * while the communicator was ONLINE or STARTING. */ + @Override public void setPort(int port) throws java.lang.IllegalStateException { synchronized (stateLock) { if ((state == ONLINE) || (state == STARTING)) @@ -659,7 +664,8 @@ public abstract class CommunicatorServer * Gets the protocol being used by this CommunicatorServer. * @return The protocol as a string. */ - public abstract String getProtocol() ; + @Override + public abstract String getProtocol(); /** * Gets the number of clients that have been processed by this @@ -754,6 +760,7 @@ public abstract class CommunicatorServer *

* The run method executed by this connector's main thread. */ + @Override public void run() { // Fix jaw.00667.B @@ -851,7 +858,7 @@ public abstract class CommunicatorServer } finally { synchronized (stateLock) { interrupted = true; - Thread.currentThread().interrupted(); + Thread.interrupted(); } // ---------------------- @@ -970,7 +977,7 @@ public abstract class CommunicatorServer "MBeanServer argument must be MBean server where this " + "server is registered, or an MBeanServerForwarder " + "leading to that server"; - Vector seenMBS = new Vector(); + Vector seenMBS = new Vector<>(); for (MBeanServer mbs = newMBS; mbs != bottomMBS; mbs = ((MBeanServerForwarder) mbs).getMBeanServer()) { @@ -1153,8 +1160,7 @@ public abstract class CommunicatorServer state = OFFLINE; stopRequested = false; servedClientCount = 0; - clientHandlerVector = new Vector(); - fatherThread = Thread.currentThread(); + clientHandlerVector = new Vector<>(); mainThread = null; notifCount = 0; notifInfos = null; @@ -1184,6 +1190,7 @@ public abstract class CommunicatorServer * * @exception IllegalArgumentException Listener parameter is null. */ + @Override public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) @@ -1207,6 +1214,7 @@ public abstract class CommunicatorServer * * @exception ListenerNotFoundException The listener is not registered. */ + @Override public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { @@ -1225,6 +1233,7 @@ public abstract class CommunicatorServer * sent when the State attribute of this CommunicatorServer * changes. */ + @Override public MBeanNotificationInfo[] getNotificationInfo() { // Initialize notifInfos on first call to getNotificationInfo() @@ -1304,6 +1313,7 @@ public abstract class CommunicatorServer * the MBeanServer and re-thrown * as an MBeanRegistrationException. */ + @Override public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception { objectName = name; @@ -1325,6 +1335,7 @@ public abstract class CommunicatorServer * successfully registered in the MBeanServer. * The value false means that the registration phase has failed. */ + @Override public void postRegister(Boolean registrationDone) { if (!registrationDone.booleanValue()) { synchronized (this) { @@ -1340,6 +1351,7 @@ public abstract class CommunicatorServer * the MBeanServer and re-thrown * as an MBeanRegistrationException. */ + @Override public void preDeregister() throws java.lang.Exception { synchronized (this) { topMBS = bottomMBS = null; @@ -1354,22 +1366,8 @@ public abstract class CommunicatorServer /** * Do nothing. */ + @Override public void postDeregister(){ } - /** - * Load a class using the default loader repository - **/ - Class loadClass(String className) - throws ClassNotFoundException { - try { - return Class.forName(className); - } catch (ClassNotFoundException e) { - final ClassLoaderRepository clr = - MBeanServerFactory.getClassLoaderRepository(bottomMBS); - if (clr == null) throw new ClassNotFoundException(className); - return clr.loadClass(className); - } - } - } diff --git a/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java b/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java index 03822a091fa341901375efefb9fdcb3fba8c9e71..612d4c57437968f3615a2487f6bac8b9a28984f5 100644 --- a/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java +++ b/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, 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 @@ -47,7 +47,6 @@ import java.io.InterruptedIOException; import javax.management.MBeanServer; import javax.management.MBeanRegistration; import javax.management.ObjectName; -import javax.management.InstanceAlreadyExistsException; import static com.sun.jmx.defaults.JmxProperties.SNMP_ADAPTOR_LOGGER; import com.sun.jmx.snmp.SnmpIpAddress; import com.sun.jmx.snmp.SnmpMessage; @@ -157,7 +156,7 @@ public class SnmpAdaptorServer extends CommunicatorServer /** * The IP address based ACL used by this SNMP protocol adaptor. */ - private Object ipacl = null; + private InetAddressAcl ipacl = null; /** * The factory object. @@ -199,7 +198,7 @@ public class SnmpAdaptorServer extends CommunicatorServer transient DatagramSocket trapSocket = null; private transient SnmpSession informSession = null; private transient DatagramPacket packet = null; - transient Vector mibs = new Vector(); + transient Vector mibs = new Vector<>(); private transient SnmpMibTree root; /** @@ -482,8 +481,7 @@ public class SnmpAdaptorServer extends CommunicatorServer // if (acl == null && forceAcl) { try { - acl = (InetAddressAcl) - new SnmpAcl("SNMP protocol adaptor IP ACL"); + acl = new SnmpAcl("SNMP protocol adaptor IP ACL"); } catch (UnknownHostException e) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag, @@ -508,6 +506,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * since its creation. This counter is not reset by the stop * method. */ + @Override public int getServedClientCount() { return super.getServedClientCount(); } @@ -519,6 +518,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @return The number of managers currently being processed by this * SNMP protocol adaptor. */ + @Override public int getActiveClientCount() { return super.getActiveClientCount(); } @@ -530,6 +530,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @return The maximum number of managers that this SNMP protocol adaptor * can process concurrently. */ + @Override public int getMaxActiveClientCount() { return super.getMaxActiveClientCount(); } @@ -543,6 +544,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @exception java.lang.IllegalStateException This method has been invoked * while the communicator was ONLINE or STARTING. */ + @Override public void setMaxActiveClientCount(int c) throws java.lang.IllegalStateException { super.setMaxActiveClientCount(c); @@ -554,8 +556,9 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public InetAddressAcl getInetAddressAcl() { - return (InetAddressAcl)ipacl; + return ipacl; } /** @@ -564,6 +567,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The port number for sending SNMP traps. */ + @Override public Integer getTrapPort() { return new Integer(trapPort) ; } @@ -573,6 +577,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @param port The port number for sending SNMP traps. */ + @Override public void setTrapPort(Integer port) { setTrapPort(port.intValue()); } @@ -595,6 +600,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The port number for sending SNMP inform requests. */ + @Override public int getInformPort() { return informPort; } @@ -605,6 +611,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @param port The port number for sending SNMP inform requests. */ + @Override public void setInformPort(int port) { if (port < 0) throw new IllegalArgumentException("Inform request port "+ @@ -617,6 +624,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The string "snmp". */ + @Override public String getProtocol() { return "snmp"; } @@ -629,6 +637,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The buffer size. */ + @Override public Integer getBufferSize() { return new Integer(bufferSize) ; } @@ -643,6 +652,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @exception java.lang.IllegalStateException This method has been invoked * while the communicator was ONLINE or STARTING. */ + @Override public void setBufferSize(Integer s) throws java.lang.IllegalStateException { if ((state == ONLINE) || (state == STARTING)) { @@ -658,6 +668,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * By default, a maximum of 3 tries is used. * @return The maximun number of tries. */ + @Override final public int getMaxTries() { return maxTries; } @@ -667,6 +678,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * request before giving up. * @param newMaxTries The maximun number of tries. */ + @Override final public synchronized void setMaxTries(int newMaxTries) { if (newMaxTries < 0) throw new IllegalArgumentException(); @@ -678,6 +690,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * By default, a timeout of 3 seconds is used. * @return The value of the timeout property. */ + @Override final public int getTimeout() { return timeout; } @@ -686,6 +699,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * Changes the timeout to wait for an inform response from the manager. * @param newTimeout The timeout (in milliseconds). */ + @Override final public synchronized void setTimeout(int newTimeout) { if (newTimeout < 0) throw new IllegalArgumentException(); @@ -697,6 +711,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The factory object. */ + @Override public SnmpPduFactory getPduFactory() { return pduFactory ; } @@ -706,6 +721,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @param factory The factory object (null means the default factory). */ + @Override public void setPduFactory(SnmpPduFactory factory) { if (factory == null) pduFactory = new SnmpPduFactoryBER() ; @@ -719,6 +735,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @param factory The factory object (null means no factory). * @see com.sun.jmx.snmp.agent.SnmpUserDataFactory */ + @Override public void setUserDataFactory(SnmpUserDataFactory factory) { userDataFactory = factory ; } @@ -729,6 +746,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @return The factory object (null means no factory). * @see com.sun.jmx.snmp.agent.SnmpUserDataFactory */ + @Override public SnmpUserDataFactory getUserDataFactory() { return userDataFactory; } @@ -745,6 +763,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @return true if authentication traps are enabled, * false otherwise. */ + @Override public boolean getAuthTrapEnabled() { return authTrapEnabled ; } @@ -755,6 +774,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @param enabled Flag indicating if traps need to be sent. */ + @Override public void setAuthTrapEnabled(boolean enabled) { authTrapEnabled = enabled ; } @@ -772,6 +792,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return true if responses are sent. */ + @Override public boolean getAuthRespEnabled() { return authRespEnabled ; } @@ -782,6 +803,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @param enabled Flag indicating if responses need to be sent. */ + @Override public void setAuthRespEnabled(boolean enabled) { authRespEnabled = enabled ; } @@ -793,6 +815,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The OID in string format "x.x.x.x". */ + @Override public String getEnterpriseOid() { return enterpriseOid.toString() ; } @@ -804,6 +827,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @exception IllegalArgumentException The string format is incorrect */ + @Override public void setEnterpriseOid(String oid) throws IllegalArgumentException { enterpriseOid = new SnmpOid(oid) ; } @@ -813,11 +837,12 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return An array of MIB names. */ + @Override public String[] getMibs() { String[] result = new String[mibs.size()] ; int i = 0 ; - for (Enumeration e = mibs.elements() ; e.hasMoreElements() ;) { - SnmpMibAgent mib = (SnmpMibAgent)e.nextElement() ; + for (Enumeration e = mibs.elements() ; e.hasMoreElements() ;) { + SnmpMibAgent mib = e.nextElement() ; result[i++] = mib.getMibName(); } return result ; @@ -831,6 +856,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpOutTraps value. */ + @Override public Long getSnmpOutTraps() { return new Long(snmpOutTraps); } @@ -840,6 +866,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpOutGetResponses value. */ + @Override public Long getSnmpOutGetResponses() { return new Long(snmpOutGetResponses); } @@ -849,6 +876,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpOutGenErrs value. */ + @Override public Long getSnmpOutGenErrs() { return new Long(snmpOutGenErrs); } @@ -858,6 +886,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpOutBadValues value. */ + @Override public Long getSnmpOutBadValues() { return new Long(snmpOutBadValues); } @@ -867,6 +896,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpOutNoSuchNames value. */ + @Override public Long getSnmpOutNoSuchNames() { return new Long(snmpOutNoSuchNames); } @@ -876,6 +906,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpOutTooBigs value. */ + @Override public Long getSnmpOutTooBigs() { return new Long(snmpOutTooBigs); } @@ -885,6 +916,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpInASNParseErrs value. */ + @Override public Long getSnmpInASNParseErrs() { return new Long(snmpInASNParseErrs); } @@ -894,6 +926,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpInBadCommunityUses value. */ + @Override public Long getSnmpInBadCommunityUses() { return new Long(snmpInBadCommunityUses); } @@ -904,6 +937,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpInBadCommunityNames value. */ + @Override public Long getSnmpInBadCommunityNames() { return new Long(snmpInBadCommunityNames); } @@ -913,6 +947,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpInBadVersions value. */ + @Override public Long getSnmpInBadVersions() { return new Long(snmpInBadVersions); } @@ -922,6 +957,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpOutPkts value. */ + @Override public Long getSnmpOutPkts() { return new Long(snmpOutPkts); } @@ -931,6 +967,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpInPkts value. */ + @Override public Long getSnmpInPkts() { return new Long(snmpInPkts); } @@ -940,6 +977,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpInGetRequests value. */ + @Override public Long getSnmpInGetRequests() { return new Long(snmpInGetRequests); } @@ -949,6 +987,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpInGetNexts value. */ + @Override public Long getSnmpInGetNexts() { return new Long(snmpInGetNexts); } @@ -958,6 +997,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpInSetRequests value. */ + @Override public Long getSnmpInSetRequests() { return new Long(snmpInSetRequests); } @@ -967,6 +1007,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpInTotalSetVars value. */ + @Override public Long getSnmpInTotalSetVars() { return new Long(snmpInTotalSetVars); } @@ -976,6 +1017,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @return The snmpInTotalReqVars value. */ + @Override public Long getSnmpInTotalReqVars() { return new Long(snmpInTotalReqVars); } @@ -988,6 +1030,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public Long getSnmpSilentDrops() { return new Long(snmpSilentDrops); } @@ -1000,6 +1043,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public Long getSnmpProxyDrops() { return new Long(0); } @@ -1027,6 +1071,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @exception java.lang.Exception */ + @Override public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception { @@ -1040,6 +1085,7 @@ public class SnmpAdaptorServer extends CommunicatorServer /** * Not used in this context. */ + @Override public void postRegister (Boolean registrationDone) { super.postRegister(registrationDone); } @@ -1047,6 +1093,7 @@ public class SnmpAdaptorServer extends CommunicatorServer /** * Not used in this context. */ + @Override public void preDeregister() throws java.lang.Exception { super.preDeregister(); } @@ -1054,6 +1101,7 @@ public class SnmpAdaptorServer extends CommunicatorServer /** * Not used in this context. */ + @Override public void postDeregister() { super.postDeregister(); } @@ -1067,6 +1115,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @exception IllegalArgumentException If the parameter is null. */ + @Override public SnmpMibHandler addMib(SnmpMibAgent mib) throws IllegalArgumentException { if (mib == null) { @@ -1097,6 +1146,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public SnmpMibHandler addMib(SnmpMibAgent mib, SnmpOid[] oids) throws IllegalArgumentException { if (mib == null) { @@ -1129,6 +1179,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public SnmpMibHandler addMib(SnmpMibAgent mib, String contextName) throws IllegalArgumentException { return addMib(mib); @@ -1150,10 +1201,12 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public SnmpMibHandler addMib(SnmpMibAgent mib, String contextName, SnmpOid[] oids) throws IllegalArgumentException { + return addMib(mib, oids); } @@ -1171,6 +1224,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public boolean removeMib(SnmpMibAgent mib, String contextName) { return removeMib(mib); } @@ -1183,6 +1237,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @return true if the specified mib was a MIB * included in the SNMP MIB handler, false otherwise. */ + @Override public boolean removeMib(SnmpMibAgent mib) { root.unregister(mib); return (mibs.removeElement(mib)) ; @@ -1199,6 +1254,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public boolean removeMib(SnmpMibAgent mib, SnmpOid[] oids) { root.unregister(mib, oids); return (mibs.removeElement(mib)) ; @@ -1216,6 +1272,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public boolean removeMib(SnmpMibAgent mib, String contextName, SnmpOid[] oids) { @@ -1228,6 +1285,7 @@ public class SnmpAdaptorServer extends CommunicatorServer /** * Creates the datagram socket. */ + @Override protected void doBind() throws CommunicationException, InterruptedException { @@ -1255,6 +1313,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * that port number was 0. * @return the actual port to which the adaptor is bound. **/ + @Override public int getPort() { synchronized (this) { if (socket != null) return socket.getLocalPort(); @@ -1265,6 +1324,7 @@ public class SnmpAdaptorServer extends CommunicatorServer /** * Closes the datagram socket. */ + @Override protected void doUnbind() throws CommunicationException, InterruptedException { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { @@ -1282,12 +1342,17 @@ public class SnmpAdaptorServer extends CommunicatorServer closeInformSocketIfNeeded() ; } - void createSnmpRequestHandler(SnmpAdaptorServer server, int id, - DatagramSocket s, DatagramPacket p, - SnmpMibTree tree, Vector m, Object a, - SnmpPduFactory factory, - SnmpUserDataFactory dataFactory, - MBeanServer f, ObjectName n) { + private void createSnmpRequestHandler(SnmpAdaptorServer server, + int id, + DatagramSocket s, + DatagramPacket p, + SnmpMibTree tree, + Vector m, + InetAddressAcl a, + SnmpPduFactory factory, + SnmpUserDataFactory dataFactory, + MBeanServer f, + ObjectName n) { final SnmpRequestHandler handler = new SnmpRequestHandler(this, id, s, p, tree, m, a, factory, dataFactory, f, n); @@ -1298,6 +1363,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * Reads a packet from the datagram socket and creates a request * handler which decodes and processes the request. */ + @Override protected void doReceive() throws CommunicationException, InterruptedException { @@ -1339,13 +1405,14 @@ public class SnmpAdaptorServer extends CommunicatorServer } } + @Override protected void doError(Exception e) throws CommunicationException { - return; } /** * Not used in this context. */ + @Override protected void doProcess() throws CommunicationException, InterruptedException { } @@ -1357,6 +1424,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * We attempt only once... * @return 1 **/ + @Override protected int getBindTries() { return 1; } @@ -1368,6 +1436,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * Has no effect if this SNMP protocol adaptor is OFFLINE or * STOPPING. */ + @Override public void stop(){ final int port = getPort(); @@ -1424,6 +1493,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @exception SnmpStatusException If the trap exceeds the limit defined * by bufferSize. */ + @Override public void snmpV1Trap(int generic, int specific, SnmpVarBindList varBindList) throws IOException, SnmpStatusException { @@ -1499,6 +1569,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @exception SnmpStatusException If the trap exceeds the limit defined * by bufferSize. */ + @Override public void snmpV1Trap(InetAddress addr, String cs, int generic, int specific, SnmpVarBindList varBindList) throws IOException, SnmpStatusException { @@ -1617,6 +1688,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public void snmpV1Trap(SnmpPeer peer, SnmpIpAddress agentAddr, SnmpOid enterpOid, @@ -1625,6 +1697,7 @@ public class SnmpAdaptorServer extends CommunicatorServer SnmpVarBindList varBindList, SnmpTimeticks time) throws IOException, SnmpStatusException { + SnmpParameters p = (SnmpParameters) peer.getParams(); snmpV1Trap(peer.getDestAddr(), peer.getDestPort(), @@ -1745,11 +1818,13 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public void snmpV2Trap(SnmpPeer peer, SnmpOid trapOid, SnmpVarBindList varBindList, SnmpTimeticks time) throws IOException, SnmpStatusException { + SnmpParameters p = (SnmpParameters) peer.getParams(); snmpV2Trap(peer.getDestAddr(), peer.getDestPort(), @@ -1781,6 +1856,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @exception SnmpStatusException If the trap exceeds the limit defined * by bufferSize. */ + @Override public void snmpV2Trap(SnmpOid trapOid, SnmpVarBindList varBindList) throws IOException, SnmpStatusException { @@ -1801,7 +1877,7 @@ public class SnmpAdaptorServer extends CommunicatorServer SnmpVarBindList fullVbl ; if (varBindList != null) - fullVbl = (SnmpVarBindList)varBindList.clone() ; + fullVbl = varBindList.clone() ; else fullVbl = new SnmpVarBindList(2) ; SnmpTimeticks sysUpTimeValue = new SnmpTimeticks(getSysUpTime()) ; @@ -1840,6 +1916,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @exception SnmpStatusException If the trap exceeds the limit * defined by bufferSize. */ + @Override public void snmpV2Trap(InetAddress addr, String cs, SnmpOid trapOid, SnmpVarBindList varBindList) throws IOException, SnmpStatusException { @@ -1865,7 +1942,7 @@ public class SnmpAdaptorServer extends CommunicatorServer SnmpVarBindList fullVbl ; if (varBindList != null) - fullVbl = (SnmpVarBindList)varBindList.clone() ; + fullVbl = varBindList.clone() ; else fullVbl = new SnmpVarBindList(2) ; SnmpTimeticks sysUpTimeValue = new SnmpTimeticks(getSysUpTime()) ; @@ -1964,12 +2041,12 @@ public class SnmpAdaptorServer extends CommunicatorServer SnmpVarBindList fullVbl ; if (varBindList != null) - fullVbl = (SnmpVarBindList)varBindList.clone() ; + fullVbl = varBindList.clone() ; else fullVbl = new SnmpVarBindList(2) ; // Only difference with other - SnmpTimeticks sysUpTimeValue = null; + SnmpTimeticks sysUpTimeValue; if(time != null) sysUpTimeValue = time; else @@ -2002,6 +2079,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public void snmpPduTrap(InetAddress address, SnmpPduPacket pdu) throws IOException, SnmpStatusException { @@ -2021,6 +2099,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * by bufferSize. * @since 1.5 */ + @Override public void snmpPduTrap(SnmpPeer peer, SnmpPduPacket pdu) throws IOException, SnmpStatusException { @@ -2066,13 +2145,12 @@ public class SnmpAdaptorServer extends CommunicatorServer int sendingCount = 0 ; openTrapSocketIfNeeded() ; if (ipacl != null) { - Enumeration ed = ((InetAddressAcl)ipacl).getTrapDestinations() ; + Enumeration ed = ipacl.getTrapDestinations() ; while (ed.hasMoreElements()) { - msg.address = (InetAddress)ed.nextElement() ; - Enumeration ec = ((InetAddressAcl)ipacl). - getTrapCommunities(msg.address) ; + msg.address = ed.nextElement() ; + Enumeration ec = ipacl.getTrapCommunities(msg.address) ; while (ec.hasMoreElements()) { - msg.community = ((String)ec.nextElement()).getBytes() ; + msg.community = ec.nextElement().getBytes() ; try { sendTrapMessage(msg) ; sendingCount++ ; @@ -2164,6 +2242,7 @@ public class SnmpAdaptorServer extends CommunicatorServer */ private void sendTrapMessage(SnmpMessage msg) throws IOException, SnmpTooBigException { + byte[] buffer = new byte[bufferSize] ; DatagramPacket packet = new DatagramPacket(buffer, buffer.length) ; int encodingLength = msg.encodeMessage(buffer) ; @@ -2245,8 +2324,10 @@ public class SnmpAdaptorServer extends CommunicatorServer * @exception SnmpStatusException If the inform request exceeds the * limit defined by bufferSize. */ - public Vector snmpInformRequest(SnmpInformHandler cb, SnmpOid trapOid, - SnmpVarBindList varBindList) + @Override + public Vector snmpInformRequest(SnmpInformHandler cb, + SnmpOid trapOid, + SnmpVarBindList varBindList) throws IllegalStateException, IOException, SnmpStatusException { if (!isActive()) { @@ -2263,7 +2344,7 @@ public class SnmpAdaptorServer extends CommunicatorServer // SnmpVarBindList fullVbl ; if (varBindList != null) - fullVbl = (SnmpVarBindList)varBindList.clone() ; + fullVbl = varBindList.clone() ; else fullVbl = new SnmpVarBindList(2) ; SnmpTimeticks sysUpTimeValue = new SnmpTimeticks(getSysUpTime()) ; @@ -2277,17 +2358,16 @@ public class SnmpAdaptorServer extends CommunicatorServer // Now send the SNMP message to each destination // - Vector informReqList = new Vector(); - InetAddress addr = null; - String cs = null; + Vector informReqList = new Vector<>(); + InetAddress addr; + String cs; if (ipacl != null) { - Enumeration ed = ((InetAddressAcl)ipacl).getInformDestinations() ; + Enumeration ed = ipacl.getInformDestinations() ; while (ed.hasMoreElements()) { - addr = (InetAddress)ed.nextElement() ; - Enumeration ec = ((InetAddressAcl)ipacl). - getInformCommunities(addr) ; + addr = ed.nextElement() ; + Enumeration ec = ipacl.getInformCommunities(addr) ; while (ec.hasMoreElements()) { - cs = (String)ec.nextElement() ; + cs = ec.nextElement() ; informReqList.addElement( informSession.makeAsyncRequest(addr, cs, cb, fullVbl,getInformPort())) ; @@ -2330,6 +2410,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * @exception SnmpStatusException If the inform request exceeds the * limit defined by bufferSize. */ + @Override public SnmpInformRequest snmpInformRequest(InetAddress addr, String cs, SnmpInformHandler cb, @@ -2380,11 +2461,13 @@ public class SnmpAdaptorServer extends CommunicatorServer * * @since 1.5 */ + @Override public SnmpInformRequest snmpInformRequest(SnmpPeer peer, SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList) throws IllegalStateException, IOException, SnmpStatusException { + SnmpParameters p = (SnmpParameters) peer.getParams(); return snmpInformRequest(peer.getDestAddr(), peer.getDestPort(), @@ -2401,9 +2484,9 @@ public class SnmpAdaptorServer extends CommunicatorServer * @param protocolVersion The protocol version. * @param reqPduType The pdu type. */ - public static final int mapErrorStatus(int errorStatus, - int protocolVersion, - int reqPduType) { + public static int mapErrorStatus(int errorStatus, + int protocolVersion, + int reqPduType) { return SnmpSubRequestHandler.mapErrorStatus(errorStatus, protocolVersion, reqPduType); @@ -2416,6 +2499,7 @@ public class SnmpAdaptorServer extends CommunicatorServer SnmpOid trapOid, SnmpVarBindList varBindList) throws IllegalStateException, IOException, SnmpStatusException { + if (!isActive()) { throw new IllegalStateException( "Start SNMP adaptor server before carrying out this operation"); @@ -2430,7 +2514,7 @@ public class SnmpAdaptorServer extends CommunicatorServer // SnmpVarBindList fullVbl ; if (varBindList != null) - fullVbl = (SnmpVarBindList)varBindList.clone() ; + fullVbl = varBindList.clone() ; else fullVbl = new SnmpVarBindList(2) ; SnmpTimeticks sysUpTimeValue = new SnmpTimeticks(getSysUpTime()) ; @@ -2489,6 +2573,7 @@ public class SnmpAdaptorServer extends CommunicatorServer * references to the object. *

Closes the datagram socket associated to this SNMP protocol adaptor. */ + @Override protected void finalize() { try { if (socket != null) { @@ -2511,6 +2596,7 @@ public class SnmpAdaptorServer extends CommunicatorServer /** * Returns the string used in debug traces. */ + @Override String makeDebugTag() { return "SnmpAdaptorServer["+ getProtocol() + ":" + getPort() + "]"; } @@ -2615,13 +2701,13 @@ public class SnmpAdaptorServer extends CommunicatorServer // This is for transient structures to be initialized to specific // default values. // - mibs = new Vector() ; + mibs = new Vector<>() ; } /** * Common initializations. */ - private void init(Object acl, int p, InetAddress a) { + private void init(InetAddressAcl acl, int p, InetAddress a) { root= new SnmpMibTree(); @@ -2650,6 +2736,7 @@ public class SnmpAdaptorServer extends CommunicatorServer return root.getAgentMib(oid); } + @Override protected Thread createMainThread() { final Thread t = super.createMainThread(); t.setDaemon(true); diff --git a/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java b/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java index e2d86b68a36cfdce851eca68d56457d1456cd4cd..1b42ed4f0432c69b2e594cc0970863c52f35857b 100644 --- a/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java +++ b/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java @@ -140,6 +140,7 @@ public interface SnmpAdaptorServerMBean extends CommunicatorServerMBean { * * @return The string "snmp". */ + @Override public String getProtocol(); /** @@ -636,7 +637,8 @@ public interface SnmpAdaptorServerMBean extends CommunicatorServerMBean { * @exception IOException An I/O error occurred while sending the inform request. * @exception SnmpStatusException If the inform request exceeds the limit defined by bufferSize. */ - public Vector snmpInformRequest(SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList) + public Vector snmpInformRequest(SnmpInformHandler cb, SnmpOid trapOid, + SnmpVarBindList varBindList) throws IllegalStateException, IOException, SnmpStatusException; /** diff --git a/src/share/classes/com/sun/jmx/snmp/daemon/SnmpMibTree.java b/src/share/classes/com/sun/jmx/snmp/daemon/SnmpMibTree.java index 66fe5f8a313776f865b5aea175ac353736a27d48..c6f67700f4863379899c294ecd5d3f4b5760834c 100644 --- a/src/share/classes/com/sun/jmx/snmp/daemon/SnmpMibTree.java +++ b/src/share/classes/com/sun/jmx/snmp/daemon/SnmpMibTree.java @@ -125,7 +125,7 @@ final class SnmpMibTree { TreeNode node= retrieveChild(oid, cursor); if (node == null) return this; - if (children.size() == 0) { + if (children.isEmpty()) { // In this case, the node does not have any children. So no point to // continue the search ... return node; @@ -149,24 +149,24 @@ final class SnmpMibTree { public void printTree(String ident) { - StringBuffer buff= new StringBuffer(); + StringBuilder buff= new StringBuilder(); if (agents == null) { return; } - for(Enumeration e= agents.elements(); e.hasMoreElements(); ) { - SnmpMibAgent mib= (SnmpMibAgent) e.nextElement(); + for(Enumeration e= agents.elements(); e.hasMoreElements(); ) { + SnmpMibAgent mib= e.nextElement(); if (mib == null) buff.append("empty "); else - buff.append(mib.getMibName() + " "); + buff.append(mib.getMibName()).append(" "); } ident+= " "; if (children == null) { return; } - for(Enumeration e= children.elements(); e.hasMoreElements(); ) { - TreeNode node= (TreeNode) e.nextElement(); + for(Enumeration e= children.elements(); e.hasMoreElements(); ) { + TreeNode node= e.nextElement(); node.printTree(ident); } } @@ -185,7 +185,7 @@ final class SnmpMibTree { } private void removeAgentFully(SnmpMibAgent agent) { - Vector v = new Vector(); + Vector v = new Vector<>(); for(Enumeration e= children.elements(); e.hasMoreElements(); ) { @@ -212,9 +212,9 @@ final class SnmpMibTree { } - private void setAgent(SnmpMibAgent agent) { - this.agent = agent; - } + private void setAgent(SnmpMibAgent agent) { + this.agent = agent; + } private void registerNode(long[] oid, int cursor, SnmpMibAgent agent) { @@ -247,20 +247,20 @@ final class SnmpMibTree { private TreeNode retrieveChild(long[] oid, int current) { long theValue= oid[current]; - for(Enumeration e= children.elements(); e.hasMoreElements(); ) { - TreeNode node= (TreeNode) e.nextElement(); + for(Enumeration e= children.elements(); e.hasMoreElements(); ) { + TreeNode node= e.nextElement(); if (node.match(theValue)) return node; } return null; } - final private boolean match(long value) { + private boolean match(long value) { return (nodeValue == value) ? true : false; } - private Vector children= new Vector(); - private Vector agents= new Vector(); + private Vector children= new Vector<>(); + private Vector agents= new Vector<>(); private long nodeValue; private SnmpMibAgent agent; private TreeNode parent; diff --git a/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java b/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java index f56b189b48ec429228083dc022ffce7c2e69dc36..0b60e8022706e9d52fd2eb89a15d00566a9dead4 100644 --- a/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java +++ b/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java @@ -71,9 +71,9 @@ import com.sun.jmx.snmp.InetAddressAcl; class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { - private transient DatagramSocket socket = null ; - private transient DatagramPacket packet = null ; - private transient Vector mibs = null ; + private transient DatagramSocket socket = null ; + private transient DatagramPacket packet = null ; + private transient Vector mibs = null ; /** * Contains the list of sub-requests associated to the current request. @@ -85,7 +85,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { */ private transient SnmpMibTree root; - private transient Object ipacl = null ; + private transient InetAddressAcl ipacl = null ; private transient SnmpPduFactory pduFactory = null ; private transient SnmpUserDataFactory userDataFactory = null ; private transient SnmpAdaptorServer adaptor = null; @@ -94,7 +94,8 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { */ public SnmpRequestHandler(SnmpAdaptorServer server, int id, DatagramSocket s, DatagramPacket p, - SnmpMibTree tree, Vector m, Object a, + SnmpMibTree tree, Vector m, + InetAddressAcl a, SnmpPduFactory factory, SnmpUserDataFactory dataFactory, MBeanServer f, ObjectName n) @@ -108,8 +109,8 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { socket = s; packet = p; root= tree; - mibs = (Vector) m.clone(); - subs= new Hashtable(mibs.size()); + mibs = new Vector<>(m); + subs= new Hashtable<>(mibs.size()); ipacl = a; pduFactory = factory ; userDataFactory = dataFactory ; @@ -121,6 +122,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { * back to the client. * Note: we overwrite 'packet' with the response bytes. */ + @Override public void doRun() { // Trace the input packet @@ -243,7 +245,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { // Transform the request message into a request pdu // - SnmpPduPacket reqPdu = null ; + SnmpPduPacket reqPdu; Object userData = null; try { reqPdu = (SnmpPduPacket)pduFactory.decodeSnmpPdu(reqMsg) ; @@ -306,7 +308,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag, "makeResponseMessage", "fail on element" + pos); } - int old= 0; + int old; while (true) { try { respPdu = reduceResponsePdu(reqPdu, respPdu, pos) ; @@ -580,20 +582,18 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { Object userData) { int errorStatus = SnmpDefinitions.snmpRspNoError ; - int nbSubRequest= subs.size(); - int i=0; + int i; // If it's a set request, we must first check any varBind // if (req.type == pduSetRequestPdu) { i=0; - for(Enumeration e= subs.elements(); e.hasMoreElements() ; i++) { + for(Enumeration e= subs.elements(); e.hasMoreElements() ; i++) { // Indicate to the sub request that a check must be invoked ... // OK we should have defined out own tag for that ! // - SnmpSubRequestHandler sub= (SnmpSubRequestHandler) - e.nextElement(); + SnmpSubRequestHandler sub= e.nextElement(); sub.setUserData(userData); sub.type= pduWalkRequest; @@ -618,8 +618,8 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { // Let's start the sub-requests. // i=0; - for(Enumeration e= subs.elements(); e.hasMoreElements() ;i++) { - SnmpSubRequestHandler sub= (SnmpSubRequestHandler) e.nextElement(); + for(Enumeration e= subs.elements(); e.hasMoreElements() ;i++) { + SnmpSubRequestHandler sub= e.nextElement(); /* NPCTE fix for bugId 4492741, esc 0, 16-August 2001 */ sub.setUserData(userData); /* end of NPCTE fix for bugId 4492741 */ @@ -650,7 +650,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { private SnmpPduPacket turboProcessingGetSet(SnmpPduRequest req, Object userData) { - int errorStatus = SnmpDefinitions.snmpRspNoError ; + int errorStatus; SnmpSubRequestHandler sub = subs.elements().nextElement(); sub.setUserData(userData); @@ -707,7 +707,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { private SnmpPduPacket makeGetBulkResponsePdu(SnmpPduBulk req, Object userData) { - SnmpVarBind[] respVarBindList = null ; + SnmpVarBind[] respVarBindList; // RFC 1905, Section 4.2.3, p14 int L = req.varBindList.length ; @@ -761,7 +761,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { */ private boolean checkPduType(SnmpPduPacket pdu) { - boolean result = true ; + boolean result; switch(pdu.type) { @@ -798,8 +798,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { // if (ipacl != null) { if (pdu.type == SnmpDefinitions.pduSetRequestPdu) { - if (!((InetAddressAcl)ipacl). - checkWritePermission(pdu.address, community)) { + if (!ipacl.checkWritePermission(pdu.address, community)) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag, "checkAcl", "sender is " + pdu.address + @@ -820,7 +819,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { } } else { - if (!((InetAddressAcl)ipacl).checkReadPermission(pdu.address, community)) { + if (!ipacl.checkReadPermission(pdu.address, community)) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag, "checkAcl", "sender is " + pdu.address + @@ -854,7 +853,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { if (response != null) { SnmpAdaptorServer snmpServer = (SnmpAdaptorServer)adaptorServer ; snmpServer.incSnmpInBadCommunityUses(1) ; - if (((InetAddressAcl)ipacl).checkCommunity(community) == false) + if (ipacl.checkCommunity(community) == false) snmpServer.incSnmpInBadCommunityNames(1) ; } @@ -873,7 +872,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { result.port = reqPdu.port ; result.version = reqPdu.version ; result.community = reqPdu.community ; - result.type = result.pduGetResponsePdu ; + result.type = SnmpPduRequest.pduGetResponsePdu ; result.requestId = reqPdu.requestId ; result.errorStatus = SnmpDefinitions.snmpRspNoError ; result.errorIndex = 0 ; @@ -904,7 +903,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { private SnmpMessage newTooBigMessage(SnmpMessage reqMsg) throws SnmpTooBigException { SnmpMessage result = null ; - SnmpPduPacket reqPdu = null ; + SnmpPduPacket reqPdu; try { reqPdu = (SnmpPduPacket)pduFactory.decodeSnmpPdu(reqMsg) ; @@ -941,7 +940,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { // Reduction can be attempted only on bulk response // - if (req.type != req.pduGetBulkRequestPdu) { + if (req.type != SnmpPduPacket.pduGetBulkRequestPdu) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag, "reduceResponsePdu", "cannot remove anything"); @@ -961,7 +960,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { // * when it is 0 (in fact, acceptedVbCount is not available), // we split the varbindlist by 2. // - int vbCount = resp.varBindList.length ; + int vbCount; if (acceptedVbCount >= 3) vbCount = Math.min(acceptedVbCount - 1, resp.varBindList.length) ; else if (acceptedVbCount == 1) @@ -998,7 +997,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { private void splitRequest(SnmpPduRequest req) { int nbAgents= mibs.size(); - SnmpMibAgent agent= (SnmpMibAgent) mibs.firstElement(); + SnmpMibAgent agent = mibs.firstElement(); if (nbAgents == 1) { // Take all the oids contained in the request and // @@ -1010,8 +1009,8 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { // to all agents // if (req.type == pduGetNextRequestPdu) { - for(Enumeration e= mibs.elements(); e.hasMoreElements(); ) { - SnmpMibAgent ag= (SnmpMibAgent) e.nextElement(); + for(Enumeration e= mibs.elements(); e.hasMoreElements(); ) { + final SnmpMibAgent ag= e.nextElement(); subs.put(ag, new SnmpSubNextRequestHandler(adaptor, ag, req)); } return; @@ -1047,8 +1046,8 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { int R) { // Send the getBulk to all agents // - for(Enumeration e= mibs.elements(); e.hasMoreElements(); ) { - SnmpMibAgent agent = (SnmpMibAgent) e.nextElement(); + for(Enumeration e= mibs.elements(); e.hasMoreElements(); ) { + final SnmpMibAgent agent = e.nextElement(); if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag, @@ -1064,7 +1063,6 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { maxRepetitions, R)); } - return; } private SnmpPduPacket mergeResponses(SnmpPduRequest req) { @@ -1078,8 +1076,8 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // - for(Enumeration e= subs.elements(); e.hasMoreElements();) { - SnmpSubRequestHandler sub= (SnmpSubRequestHandler) e.nextElement(); + for(Enumeration e= subs.elements(); e.hasMoreElements();) { + SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } return newValidResponsePdu(req,result); @@ -1092,8 +1090,8 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // - for(Enumeration e= subs.elements(); e.hasMoreElements();) { - SnmpSubRequestHandler sub= (SnmpSubRequestHandler) e.nextElement(); + for(Enumeration e= subs.elements(); e.hasMoreElements();) { + SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } @@ -1127,19 +1125,21 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // - for(Enumeration e= subs.elements(); e.hasMoreElements();) { - SnmpSubRequestHandler sub= (SnmpSubRequestHandler) e.nextElement(); + for(Enumeration e= subs.elements(); e.hasMoreElements();) { + SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } return result; } + @Override protected String makeDebugTag() { return "SnmpRequestHandler[" + adaptorServer.getProtocol() + ":" + adaptorServer.getPort() + "]"; } + @Override Thread createThread(Runnable r) { return null; } diff --git a/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java b/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java index f662e374fbede22f3b40f7fb5238876e42d6888a..2754975082f35a3a226e417606ce94d829615cbd 100644 --- a/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java +++ b/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java @@ -31,7 +31,6 @@ package com.sun.jmx.snmp.daemon; // java import // import java.util.Enumeration; -import java.util.Vector; import java.util.logging.Level; // jmx imports // @@ -46,9 +45,6 @@ import com.sun.jmx.snmp.SnmpEngine; // import static com.sun.jmx.defaults.JmxProperties.SNMP_ADAPTOR_LOGGER; import com.sun.jmx.snmp.agent.SnmpMibAgent; -import com.sun.jmx.snmp.agent.SnmpMibRequest; -import com.sun.jmx.snmp.ThreadContext; -import com.sun.jmx.snmp.daemon.SnmpAdaptorServer; import com.sun.jmx.snmp.internal.SnmpIncomingRequest; import com.sun.jmx.snmp.ThreadContext; @@ -85,6 +81,7 @@ class SnmpSubBulkRequestHandler extends SnmpSubRequestHandler { init(server, req, nonRepeat, maxRepeat, R); } + @Override public void run() { size= varBind.size(); @@ -259,11 +256,12 @@ class SnmpSubBulkRequestHandler extends SnmpSubRequestHandler { * successful. As such the method getErrorIndex or getErrorStatus should be * called. */ + @Override protected void updateResult(SnmpVarBind[] result) { // we can assume that the run method is over ... // - final Enumeration e= varBind.elements(); + final Enumeration e= varBind.elements(); final int max= result.length; // First go through all the values once ... @@ -284,7 +282,7 @@ class SnmpSubBulkRequestHandler extends SnmpSubRequestHandler { continue; } - final SnmpVarBind element= (SnmpVarBind) e.nextElement(); + final SnmpVarBind element= e.nextElement(); if (element == null) continue; if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { @@ -309,7 +307,7 @@ class SnmpSubBulkRequestHandler extends SnmpSubRequestHandler { return; if (e.hasMoreElements() ==false) return; - final SnmpVarBind element= (SnmpVarBind) e.nextElement(); + final SnmpVarBind element= e.nextElement(); if (element == null) continue; if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { diff --git a/src/share/classes/com/sun/jmx/snmp/defaults/SnmpProperties.java b/src/share/classes/com/sun/jmx/snmp/defaults/SnmpProperties.java index 675c15b32aa8be4fb642f754d4c28d0820e8dee4..f17c68208d55c7d82e86010bc58cf78143fbf497 100644 --- a/src/share/classes/com/sun/jmx/snmp/defaults/SnmpProperties.java +++ b/src/share/classes/com/sun/jmx/snmp/defaults/SnmpProperties.java @@ -60,7 +60,7 @@ public class SnmpProperties { InputStream is = new FileInputStream(file); props.load(is); is.close(); - for (final Enumeration e = props.keys(); e.hasMoreElements() ; ) { + for (final Enumeration e = props.keys(); e.hasMoreElements() ; ) { final String key = (String) e.nextElement(); System.setProperty(key,props.getProperty(key)); } diff --git a/src/share/classes/com/sun/jmx/snmp/tasks/ThreadService.java b/src/share/classes/com/sun/jmx/snmp/tasks/ThreadService.java index b1c053448bdfada6c699544162c254267a16a1b6..6b45ee36072b5e241a2f620ec40eb0d85b46413e 100644 --- a/src/share/classes/com/sun/jmx/snmp/tasks/ThreadService.java +++ b/src/share/classes/com/sun/jmx/snmp/tasks/ThreadService.java @@ -199,7 +199,7 @@ public class ThreadService implements TaskServer { // re-init this.setPriority(priority); - this.interrupted(); + Thread.interrupted(); this.setContextClassLoader(cloader); } } diff --git a/src/share/classes/com/sun/net/ssl/KeyManagerFactory.java b/src/share/classes/com/sun/net/ssl/KeyManagerFactory.java index 36041d804d1ce93d6ff2d54909a93b21a2b70eed..30e941a89d557429dd0aac1334d301d76ae931c9 100644 --- a/src/share/classes/com/sun/net/ssl/KeyManagerFactory.java +++ b/src/share/classes/com/sun/net/ssl/KeyManagerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -53,12 +53,13 @@ public class KeyManagerFactory { /** *

The default KeyManager can be changed by setting the value of the - * "sun.ssl.keymanager.type" security property (in the Java security - * properties file) to the desired name. + * {@code sun.ssl.keymanager.type} security property to the desired name. * - * @return the default type as specified in the - * Java security properties file, or an implementation-specific default - * if no such property exists. + * @return the default type as specified by the + * {@code sun.ssl.keymanager.type} security property, or an + * implementation-specific default if no such property exists. + * + * @see java.security.Security security properties */ public final static String getDefaultAlgorithm() { String type; diff --git a/src/share/classes/com/sun/net/ssl/SSLPermission.java b/src/share/classes/com/sun/net/ssl/SSLPermission.java index 101dcc7af6c377f15a3e0dad0954435e949d8dfa..2bf9233051bca9c753fd163fda83775cdfe28264 100644 --- a/src/share/classes/com/sun/net/ssl/SSLPermission.java +++ b/src/share/classes/com/sun/net/ssl/SSLPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -46,8 +46,8 @@ import java.lang.SecurityManager; * convention follows the hierarchical property naming convention. * Also, an asterisk * may appear at the end of the name, following a ".", or by itself, to - * signify a wildcard match. For example: "foo.*" or "*" is valid, - * "*foo" or "a*b" is not valid. + * signify a wildcard match. For example: "foo.*" and "*" signify a wildcard + * match, while "*foo" and "a*b" do not. *

* The following table lists all the possible SSLPermission target names, * and for each provides a description of what the permission allows diff --git a/src/share/classes/com/sun/net/ssl/TrustManagerFactory.java b/src/share/classes/com/sun/net/ssl/TrustManagerFactory.java index e3e9b64b6b5607db91314d8254ddd9408f3985d8..b9ef566a0e7f70acc44a2d2aff0e9bfa1f420167 100644 --- a/src/share/classes/com/sun/net/ssl/TrustManagerFactory.java +++ b/src/share/classes/com/sun/net/ssl/TrustManagerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -53,12 +53,13 @@ public class TrustManagerFactory { /** *

The default TrustManager can be changed by setting the value of the - * "sun.ssl.trustmanager.type" security property - * (in the Java security properties file) to the desired name. + * {@code sun.ssl.trustmanager.type} security property to the desired name. * - * @return the default type as specified in the - * Java security properties file, or an implementation-specific default - * if no such property exists. + * @return the default type as specified by the + * {@code sun.ssl.trustmanager.type} security property, or an + * implementation-specific default if no such property exists. + * + * @see java.security.Security security properties */ public final static String getDefaultAlgorithm() { String type; 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;j *

  • - * Loop through the java.security.Security properties, + * Loop through the security properties, * auth.policy.url.1, auth.policy.url.2, ..., - * auth.policy.url.X". These properties are set - * in the Java security properties file, which is located in the file named - * <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. + * auth.policy.url.X". * Each property value specifies a URL pointing to a * policy file to be loaded. Read in and load each policy. * @@ -235,6 +231,7 @@ import sun.security.util.PropertyExpander; * @see java.security.CodeSource * @see java.security.Permissions * @see java.security.ProtectionDomain + * @see java.security.Security security properties */ @Deprecated public class PolicyFile extends javax.security.auth.Policy { diff --git a/src/share/classes/com/sun/security/auth/login/ConfigFile.java b/src/share/classes/com/sun/security/auth/login/ConfigFile.java index c4b3acdc834791528095db2ed513041cdf10c069..8299b13f0bbb48eef090156cf7b1b99c900da8bb 100644 --- a/src/share/classes/com/sun/security/auth/login/ConfigFile.java +++ b/src/share/classes/com/sun/security/auth/login/ConfigFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -49,13 +49,9 @@ import sun.security.util.PropertyExpander; * *
      *
    1. - * Loop through the java.security.Security properties, + * Loop through the security properties, * login.config.url.1, login.config.url.2, ..., - * login.config.url.X. These properties are set - * in the Java security properties file, which is located in the file named - * <JAVA_HOME>/lib/security/java.security. - * <JAVA_HOME> refers to the value of the java.home system property, - * and specifies the directory where the JRE is installed. + * login.config.url.X. * Each property value specifies a URL pointing to a * login configuration file to be loaded. Read in and load * each configuration. @@ -87,6 +83,7 @@ import sun.security.util.PropertyExpander; * javax.security.auth.login.Configuration class. * * @see javax.security.auth.login.LoginContext + * @see java.security.Security security properties */ public class ConfigFile extends javax.security.auth.login.Configuration { diff --git a/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java b/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java index 5779da791e573a19fd702d368cfd1511fc838c81..3d1744ba172c1383966a49b3b97199375a052702 100644 --- a/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java +++ b/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java @@ -1067,10 +1067,6 @@ public class Krb5LoginModule implements LoginModule { if (ktab != null) { if (!privCredSet.contains(ktab)) { privCredSet.add(ktab); - // Compatibility; also add keys to privCredSet - for (KerberosKey key: ktab.getKeys(kerbClientPrinc)) { - privCredSet.add(new Krb5Util.KeysFromKeyTab(key)); - } } } else { succeeded = false; diff --git a/src/share/classes/java/awt/color/ICC_Profile.java b/src/share/classes/java/awt/color/ICC_Profile.java index 6a785805b5aa113ca181d1f194c3e87a669d5904..321db6ca664da35c2ccb59370fc694c526e29af1 100644 --- a/src/share/classes/java/awt/color/ICC_Profile.java +++ b/src/share/classes/java/awt/color/ICC_Profile.java @@ -1435,7 +1435,15 @@ public class ICC_Profile implements Serializable { int renderingIntent = intFromBigEndian(theHeader, icHdrRenderingIntent); /* set the rendering intent */ - return renderingIntent; + + /* According to ICC spec, only the least-significant 16 bits shall be + * used to encode the rendering intent. The most significant 16 bits + * shall be set to zero. Thus, we are ignoring two most significant + * bytes here. + * + * See http://www.color.org/ICC1v42_2006-05.pdf, section 7.2.15. + */ + return (0xffff & renderingIntent); } diff --git a/src/share/classes/java/awt/image/ColorConvertOp.java b/src/share/classes/java/awt/image/ColorConvertOp.java index 3f25ebbefde77d2030ac64cf2e4c1093b593c1ed..7ba11582be98595791bb9a93c61beccb7f20330c 100644 --- a/src/share/classes/java/awt/image/ColorConvertOp.java +++ b/src/share/classes/java/awt/image/ColorConvertOp.java @@ -732,10 +732,16 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp { private int getRenderingIntent (ICC_Profile profile) { byte[] header = profile.getData(ICC_Profile.icSigHead); int index = ICC_Profile.icHdrRenderingIntent; - return (((header[index] & 0xff) << 24) | - ((header[index+1] & 0xff) << 16) | - ((header[index+2] & 0xff) << 8) | - (header[index+3] & 0xff)); + + /* According to ICC spec, only the least-significant 16 bits shall be + * used to encode the rendering intent. The most significant 16 bits + * shall be set to zero. Thus, we are ignoring two most significant + * bytes here. + * + * See http://www.color.org/ICC1v42_2006-05.pdf, section 7.2.15. + */ + return ((header[index+2] & 0xff) << 8) | + (header[index+3] & 0xff); } /** diff --git a/src/share/classes/java/lang/AbstractStringBuilder.java b/src/share/classes/java/lang/AbstractStringBuilder.java index b87ebd73d9a2dd0329f986d659d2fbb418aad76e..fc513f55efe961811fabcccd4f9de270beb0184f 100644 --- a/src/share/classes/java/lang/AbstractStringBuilder.java +++ b/src/share/classes/java/lang/AbstractStringBuilder.java @@ -177,11 +177,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { ensureCapacityInternal(newLength); if (count < newLength) { - for (; count < newLength; count++) - value[count] = '\0'; - } else { - count = newLength; + Arrays.fill(value, count, newLength, '\0'); } + + count = newLength; } /** @@ -1308,8 +1307,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * {@code null}. */ public int indexOf(String str, int fromIndex) { - return String.indexOf(value, 0, count, - str.toCharArray(), 0, str.length(), fromIndex); + return String.indexOf(value, 0, count, str, fromIndex); } /** @@ -1352,8 +1350,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * {@code null}. */ public int lastIndexOf(String str, int fromIndex) { - return String.lastIndexOf(value, 0, count, - str.toCharArray(), 0, str.length(), fromIndex); + return String.lastIndexOf(value, 0, count, str, fromIndex); } /** diff --git a/src/share/classes/java/lang/Class.java b/src/share/classes/java/lang/Class.java index 2da316afbd3f22ca5d62dbd329baef436e2a08f4..17665ed7b28b55e643f549210da1ddd5ae0a4290 100644 --- a/src/share/classes/java/lang/Class.java +++ b/src/share/classes/java/lang/Class.java @@ -48,6 +48,7 @@ import java.util.List; import java.util.Set; import java.util.Map; import java.util.HashMap; +import java.util.Objects; import sun.misc.Unsafe; import sun.reflect.ConstantPool; import sun.reflect.Reflection; @@ -3044,34 +3045,62 @@ public final * @throws NullPointerException {@inheritDoc} * @since 1.5 */ - @SuppressWarnings("unchecked") public A getAnnotation(Class annotationClass) { - if (annotationClass == null) - throw new NullPointerException(); + Objects.requireNonNull(annotationClass); initAnnotationsIfNecessary(); - return (A) annotations.get(annotationClass); + return AnnotationSupport.getOneAnnotation(annotations, annotationClass); } /** * @throws NullPointerException {@inheritDoc} * @since 1.5 */ - public boolean isAnnotationPresent( - Class annotationClass) { - if (annotationClass == null) - throw new NullPointerException(); + public boolean isAnnotationPresent(Class annotationClass) { + Objects.requireNonNull(annotationClass); return getAnnotation(annotationClass) != null; } + /** + * @throws NullPointerException {@inheritDoc} + * @since 1.8 + */ + public A[] getAnnotations(Class annotationClass) { + Objects.requireNonNull(annotationClass); + + initAnnotationsIfNecessary(); + return AnnotationSupport.getMultipleAnnotations(annotations, annotationClass); + } /** * @since 1.5 */ public Annotation[] getAnnotations() { initAnnotationsIfNecessary(); - return AnnotationParser.toArray(annotations); + return AnnotationSupport.unpackToArray(annotations); + } + + /** + * @throws NullPointerException {@inheritDoc} + * @since 1.8 + */ + public A getDeclaredAnnotation(Class annotationClass) { + Objects.requireNonNull(annotationClass); + + initAnnotationsIfNecessary(); + return AnnotationSupport.getOneAnnotation(declaredAnnotations, annotationClass); + } + + /** + * @throws NullPointerException {@inheritDoc} + * @since 1.8 + */ + public A[] getDeclaredAnnotations(Class annotationClass) { + Objects.requireNonNull(annotationClass); + + initAnnotationsIfNecessary(); + return AnnotationSupport.getMultipleAnnotations(declaredAnnotations, annotationClass); } /** @@ -3079,7 +3108,17 @@ public final */ public Annotation[] getDeclaredAnnotations() { initAnnotationsIfNecessary(); - return AnnotationParser.toArray(declaredAnnotations); + return AnnotationSupport.unpackToArray(declaredAnnotations); + } + + /** Returns one "directly" present annotation or null */ + A getDirectDeclaredAnnotation(Class annotationClass) { + Objects.requireNonNull(annotationClass); + + initAnnotationsIfNecessary(); + @SuppressWarnings("unchecked") // TODO check safe + A ret = (A)declaredAnnotations.get(annotationClass); + return ret; } // Annotations cache diff --git a/src/share/classes/java/lang/Package.java b/src/share/classes/java/lang/Package.java index f1f31b7acbe6f5abcef4ae08bd58d50ecd256cd7..744a292d6ee18641ee60265cba0415958d782203 100644 --- a/src/share/classes/java/lang/Package.java +++ b/src/share/classes/java/lang/Package.java @@ -394,6 +394,14 @@ public class Package implements java.lang.reflect.AnnotatedElement { return getPackageInfo().isAnnotationPresent(annotationClass); } + /** + * @throws NullPointerException {@inheritDoc} + * @since 1.8 + */ + public A[] getAnnotations(Class annotationClass) { + return getPackageInfo().getAnnotations(annotationClass); + } + /** * @since 1.5 */ @@ -401,6 +409,22 @@ public class Package implements java.lang.reflect.AnnotatedElement { return getPackageInfo().getAnnotations(); } + /** + * @throws NullPointerException {@inheritDoc} + * @since 1.8 + */ + public A getDeclaredAnnotation(Class annotationClass) { + return getPackageInfo().getDeclaredAnnotation(annotationClass); + } + + /** + * @throws NullPointerException {@inheritDoc} + * @since 1.8 + */ + public A[] getDeclaredAnnotations(Class annotationClass) { + return getPackageInfo().getDeclaredAnnotations(annotationClass); + } + /** * @since 1.5 */ diff --git a/src/share/classes/java/lang/RuntimePermission.java b/src/share/classes/java/lang/RuntimePermission.java index eeef0b5244b152850a9f07be27c27ccb4c8cb420..6dcbc275e9e4f96631684499de52fa3138847247 100644 --- a/src/share/classes/java/lang/RuntimePermission.java +++ b/src/share/classes/java/lang/RuntimePermission.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 @@ -41,8 +41,8 @@ import java.util.StringTokenizer; * naming convention follows the hierarchical property naming convention. * Also, an asterisk * may appear at the end of the name, following a ".", or by itself, to - * signify a wildcard match. For example: "loadLibrary.*" or "*" is valid, - * "*loadLibrary" or "a*b" is not valid. + * signify a wildcard match. For example: "loadLibrary.*" and "*" signify a + * wildcard match, while "*loadLibrary" and "a*b" do not. *

      * The following table lists all the possible RuntimePermission target names, * and for each provides a description of what the permission allows diff --git a/src/share/classes/java/lang/String.java b/src/share/classes/java/lang/String.java index f9550874c9ee525a64f224d50779eee959ebbc2d..d73a2f7c2e9c8d4f53ad26c5a8041971ef460685 100644 --- a/src/share/classes/java/lang/String.java +++ b/src/share/classes/java/lang/String.java @@ -1705,6 +1705,24 @@ public final class String str.value, 0, str.value.length, fromIndex); } + /** + * Code shared by String and AbstractStringBuilder to do searches. The + * source is the character array being searched, and the target + * is the string being searched for. + * + * @param source the characters being searched. + * @param sourceOffset offset of the source string. + * @param sourceCount count of the source string. + * @param target the characters being searched for. + * @param fromIndex the index to begin searching from. + */ + static int indexOf(char[] source, int sourceOffset, int sourceCount, + String target, int fromIndex) { + return indexOf(source, sourceOffset, sourceCount, + target.value, 0, target.value.length, + fromIndex); + } + /** * Code shared by String and StringBuffer to do searches. The * source is the character array being searched, and the target @@ -1796,6 +1814,24 @@ public final class String str.value, 0, str.value.length, fromIndex); } + /** + * Code shared by String and AbstractStringBuilder to do searches. The + * source is the character array being searched, and the target + * is the string being searched for. + * + * @param source the characters being searched. + * @param sourceOffset offset of the source string. + * @param sourceCount count of the source string. + * @param target the characters being searched for. + * @param fromIndex the index to begin searching from. + */ + static int lastIndexOf(char[] source, int sourceOffset, int sourceCount, + String target, int fromIndex) { + return lastIndexOf(source, sourceOffset, sourceCount, + target.value, 0, target.value.length, + fromIndex); + } + /** * Code shared by String and StringBuffer to do searches. The * source is the character array being searched, and the target diff --git a/src/share/classes/java/lang/System.java b/src/share/classes/java/lang/System.java index fde6aa36e6c0aa112345fcaa505da3f59a63561e..a6206e603915188d74907d41f8e50fec65308b8e 100644 --- a/src/share/classes/java/lang/System.java +++ b/src/share/classes/java/lang/System.java @@ -25,6 +25,7 @@ package java.lang; import java.io.*; +import java.lang.annotation.Annotation; import java.util.Properties; import java.util.PropertyPermission; import java.util.StringTokenizer; @@ -1195,6 +1196,9 @@ public final class System { public AnnotationType getAnnotationType(Class klass) { return klass.getAnnotationType(); } + public A getDirectDeclaredAnnotation(Class klass, Class anno) { + return klass.getDirectDeclaredAnnotation(anno); + } public > E[] getEnumConstantsShared(Class klass) { return klass.getEnumConstantsShared(); diff --git a/src/share/classes/java/lang/ThreadLocal.java b/src/share/classes/java/lang/ThreadLocal.java index ac2254f88dcbf3f92b8794812fab2e9081fa0d27..b337fc5f2e6eb7eb3670e58972fb91b4712259c5 100644 --- a/src/share/classes/java/lang/ThreadLocal.java +++ b/src/share/classes/java/lang/ThreadLocal.java @@ -25,19 +25,21 @@ package java.lang; import java.lang.ref.*; +import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; /** * This class provides thread-local variables. These variables differ from * their normal counterparts in that each thread that accesses one (via its - * get 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/annotation/ContainedBy.java b/src/share/classes/java/lang/annotation/ContainedBy.java index 2449519d9ca7a2dc887195a1972d4a6df7426e14..4f0328637916c748ea6bda3cb996498a8781c1a7 100644 --- a/src/share/classes/java/lang/annotation/ContainedBy.java +++ b/src/share/classes/java/lang/annotation/ContainedBy.java @@ -26,10 +26,35 @@ package java.lang.annotation; /** - * A meta-annotation to indicate which annotation type should be used - * as a container for repeated values of the annotation type modified - * by the {@code ContainedBy} annotation. + * The annotation type {@code java.lang.annotation.ContainedBy} is + * used to indicate that the annotation type whose declaration it + * (meta-)annotates is repeatable. The value of + * {@code @ContainedBy} indicates the containing annotation + * type for the repeatable annotation type. * + *

      The pair of annotation types {@code @ContainedBy} and + * {@link java.lang.annotation.ContainerFor @ContainerFor} are used to + * indicate that annotation types are repeatable. Specifically: + * + *

        + *
      • The annotation type {@code @ContainedBy} is used on the + * declaration of a repeatable annotation type (JLS 9.6) to indicate + * its containing annotation type. + * + *
      • The annotation type {@code @ContainerFor} is used on the + * declaration of a containing annotation type (JLS 9.6) to indicate + * the repeatable annotation type for which it serves as the + * containing annotation type. + *
      + * + *

      + * An inconsistent pair of {@code @ContainedBy} and + * {@code @ContainerFor} annotations on a repeatable annotation type + * and its containing annotation type (JLS 9.6) will lead to + * compile-time errors and runtime exceptions when using reflection to + * read annotations of a repeatable type. + * + * @see java.lang.annotation.ContainerFor * @since 1.8 * @jls 9.6 Annotation Types * @jls 9.7 Annotations @@ -39,8 +64,8 @@ package java.lang.annotation; @Target(ElementType.ANNOTATION_TYPE) public @interface ContainedBy { /** - * The annotation type to use to store repeated values of another - * annotation. + * Indicates the containing annotation type for the + * repeatable annotation type. */ Class value(); } diff --git a/src/share/classes/java/lang/annotation/ContainerFor.java b/src/share/classes/java/lang/annotation/ContainerFor.java index dd13bf99fcb80b8bae01d38c6f8de9761bfe86cc..62f3446e021ff476d3e79a4b41fd4a5b6ba9b482 100644 --- a/src/share/classes/java/lang/annotation/ContainerFor.java +++ b/src/share/classes/java/lang/annotation/ContainerFor.java @@ -26,10 +26,36 @@ package java.lang.annotation; /** - * Indicates that an annotation type is a container for repeated - * instances of annotations of the type of the value of the - * {@code ContainerFor}'s value element. + * The annotation type {@code java.lang.annotation.ContainerFor} is + * used to indicate that the annotation type whose declaration it + * (meta-)annotates is a containing annotation type. The + * value of {@code @ContainerFor} indicates the repeatable + * annotation type for the containing annotation type. * + *

      The pair of annotation types {@link + * java.lang.annotation.ContainedBy @ContainedBy} and + * {@code @ContainerFor} are used to indicate that annotation types + * are repeatable. Specifically: + * + *

        + *
      • The annotation type {@code @ContainedBy} is used on the + * declaration of a repeatable annotation type (JLS 9.6) to indicate + * its containing annotation type. + * + *
      • The annotation type {@code @ContainerFor} is used on the + * declaration of a containing annotation type (JLS 9.6) to indicate + * the repeatable annotation type for which it serves as the + * containing annotation type. + *
      + * + *

      + * An inconsistent pair of {@code @ContainedBy} and + * {@code @ContainerFor} annotations on a repeatable annotation type + * and its containing annotation type (JLS 9.6) will lead to + * compile-time errors and runtime exceptions when using reflection to + * read annotations of a repeatable type. + * + * @see java.lang.annotation.ContainedBy * @since 1.8 * @jls 9.6 Annotation Types * @jls 9.7 Annotations @@ -38,9 +64,10 @@ package java.lang.annotation; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.ANNOTATION_TYPE) public @interface ContainerFor { + /** - * The repeating annotation type that the annotation type - * annotated with this annotation is a container for. + * Indicates the repeatable annotation type for the containing + * annotation type. */ Class value(); } diff --git a/src/share/classes/java/lang/annotation/InvalidContainerAnnotationError.java b/src/share/classes/java/lang/annotation/InvalidContainerAnnotationError.java new file mode 100644 index 0000000000000000000000000000000000000000..b24e3034179ae7c417c42f3586a11e6e87454d6f --- /dev/null +++ b/src/share/classes/java/lang/annotation/InvalidContainerAnnotationError.java @@ -0,0 +1,129 @@ +/* + * 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 java.lang.annotation; + +import java.util.Objects; + +/** + * Thrown to indicate that an annotation type whose declaration is + * (meta-)annotated with a {@link ContainerFor} annotation is not, in + * fact, the containing annotation type of the type named by {@link + * ContainerFor}. + * + * @see java.lang.reflect.AnnotatedElement + * @since 1.8 + * @jls 9.6 Annotation Types + * @jls 9.7 Annotations + */ +public class InvalidContainerAnnotationError extends AnnotationFormatError { + private static final long serialVersionUID = 5023L; + + /** + * The instance of the erroneous container. + */ + private transient Annotation container; + + /** + * The type of the annotation that should be contained in the + * container. + */ + private transient Class annotationType; + + /** + * Constructs a new InvalidContainerAnnotationError with the + * specified detail message. + * + * @param message the detail message. + */ + public InvalidContainerAnnotationError(String message) { + super(message); + } + + /** + * Constructs a new InvalidContainerAnnotationError with the specified + * detail message and cause. Note that the detail message associated + * with {@code cause} is not automatically incorporated in + * this error's detail message. + * + * @param message the detail message + * @param cause the cause, may be {@code null} + */ + public InvalidContainerAnnotationError(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new InvalidContainerAnnotationError with the + * specified cause and a detail message of {@code (cause == null ? + * null : cause.toString())} (which typically contains the class + * and detail message of {@code cause}). + * + * @param cause the cause, may be {@code null} + */ + public InvalidContainerAnnotationError(Throwable cause) { + super(cause); + } + + /** + * Constructs InvalidContainerAnnotationError for the specified + * container instance and contained annotation type. + * + * @param message the detail message + * @param cause the cause, may be {@code null} + * @param container the erroneous container instance, may be + * {@code null} + * @param annotationType the annotation type intended to be + * contained, may be {@code null} + */ + public InvalidContainerAnnotationError(String message, + Throwable cause, + Annotation container, + Class annotationType) { + super(message, cause); + this.container = container; + this.annotationType = annotationType; + } + + /** + * Returns the erroneous container. + * + * @return the erroneous container, may return {@code null} + */ + public Annotation getContainer() { + return container; + } + + /** + * Returns the annotation type intended to be contained. Returns + * {@code null} if the annotation type intended to be contained + * could not be determined. + * + * @return the annotation type intended to be contained, or {@code + * null} if unknown + */ + public Class getAnnotationType() { + return annotationType; + } +} diff --git a/src/share/classes/java/lang/invoke/BoundMethodHandle.java b/src/share/classes/java/lang/invoke/BoundMethodHandle.java index dfc6e9d41fe407a3cad7b9153cea2536369aab16..9bbc09c32ce60a042e7eb1d3b03e3f989fff2bd3 100644 --- a/src/share/classes/java/lang/invoke/BoundMethodHandle.java +++ b/src/share/classes/java/lang/invoke/BoundMethodHandle.java @@ -25,7 +25,7 @@ package java.lang.invoke; -import static com.sun.xml.internal.ws.org.objectweb.asm.Opcodes.*; +import static jdk.internal.org.objectweb.asm.Opcodes.*; import static java.lang.invoke.LambdaForm.basicTypes; import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic; import static java.lang.invoke.MethodHandleStatics.*; @@ -40,9 +40,9 @@ import java.util.HashMap; import sun.invoke.util.ValueConversions; import sun.invoke.util.Wrapper; -import com.sun.xml.internal.ws.org.objectweb.asm.ClassWriter; -import com.sun.xml.internal.ws.org.objectweb.asm.MethodVisitor; -import com.sun.xml.internal.ws.org.objectweb.asm.Type; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.org.objectweb.asm.Type; /** * The flavor of method handle which emulates an invoke instruction diff --git a/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java b/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java index d41a62d395269a8f21b567e68ed0e2cc919898a9..13999001cdc259c3adf9ee83a76beea77e8ac3e9 100644 --- a/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java +++ b/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java @@ -25,16 +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 java.util.logging.Level; -import java.util.logging.Logger; 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 @@ -121,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 @@ -145,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 @@ -187,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) { 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); } @@ -206,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/lang/invoke/InvokerBytecodeGenerator.java b/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java index 0def847d38cfe17a1fd84436e2ccfb88dcdcf6fa..b669b6e2d95aba39433a1cfcf378ef3a70e1373d 100644 --- a/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java +++ b/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java @@ -34,7 +34,7 @@ import sun.invoke.util.Wrapper; import java.io.*; import java.util.*; -import com.sun.xml.internal.ws.org.objectweb.asm.*; +import jdk.internal.org.objectweb.asm.*; import java.lang.reflect.*; import static java.lang.invoke.MethodHandleStatics.*; diff --git a/src/share/classes/java/lang/invoke/MethodHandleNatives.java b/src/share/classes/java/lang/invoke/MethodHandleNatives.java index 06a9ba20e697e60d573f4deaef9f424fc1659a11..fcc928a327d874e86ce575da71745df1eebaf47b 100644 --- a/src/share/classes/java/lang/invoke/MethodHandleNatives.java +++ b/src/share/classes/java/lang/invoke/MethodHandleNatives.java @@ -448,7 +448,7 @@ class MethodHandleNatives { case "getDriver": case "getDrivers": case "deregisterDriver": - return defc == java.sql.DriverManager.class; + return defc == getClass("java.sql.DriverManager"); case "newUpdater": if (defc == java.util.concurrent.atomic.AtomicIntegerFieldUpdater.class) return true; if (defc == java.util.concurrent.atomic.AtomicLongFieldUpdater.class) return true; @@ -482,4 +482,14 @@ class MethodHandleNatives { } return false; } + + // avoid static dependency to a class in other modules + private static Class getClass(String cn) { + try { + return Class.forName(cn, false, + MethodHandleNatives.class.getClassLoader()); + } catch (ClassNotFoundException e) { + throw new InternalError(e); + } + } } diff --git a/src/share/classes/java/lang/reflect/AccessibleObject.java b/src/share/classes/java/lang/reflect/AccessibleObject.java index adbf8dbe76be1aff2f02fea9cf3a478056e6175d..baaec298a8555f4ee160a0d9d87af87667783866 100644 --- a/src/share/classes/java/lang/reflect/AccessibleObject.java +++ b/src/share/classes/java/lang/reflect/AccessibleObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -184,11 +184,18 @@ public class AccessibleObject implements AnnotatedElement { * @throws NullPointerException {@inheritDoc} * @since 1.5 */ - public boolean isAnnotationPresent( - Class annotationClass) { + public boolean isAnnotationPresent(Class annotationClass) { return getAnnotation(annotationClass) != null; } + /** + * @throws NullPointerException {@inheritDoc} + * @since 1.8 + */ + public T[] getAnnotations(Class annotationClass) { + throw new AssertionError("All subclasses should override this method"); + } + /** * @since 1.5 */ @@ -196,6 +203,28 @@ public class AccessibleObject implements AnnotatedElement { return getDeclaredAnnotations(); } + /** + * @throws NullPointerException {@inheritDoc} + * @since 1.8 + */ + public T getDeclaredAnnotation(Class annotationClass) { + // Only annotations on classes are inherited, for all other + // objects getDeclaredAnnotation is the same as + // getAnnotation. + return getAnnotation(annotationClass); + } + + /** + * @throws NullPointerException {@inheritDoc} + * @since 1.8 + */ + public T[] getDeclaredAnnotations(Class annotationClass) { + // Only annotations on classes are inherited, for all other + // objects getDeclaredAnnotations is the same as + // getAnnotations. + return getAnnotations(annotationClass); + } + /** * @since 1.5 */ diff --git a/src/share/classes/java/lang/reflect/AnnotatedElement.java b/src/share/classes/java/lang/reflect/AnnotatedElement.java index dc24483167661ad1f90b14eb36bf3775302b34ba..58a07350f363951307c9b8b8793250488893249c 100644 --- a/src/share/classes/java/lang/reflect/AnnotatedElement.java +++ b/src/share/classes/java/lang/reflect/AnnotatedElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, 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 @@ -45,6 +45,11 @@ import java.lang.annotation.Annotation; * a {@link EnumConstantNotPresentException} if the enum constant in the * annotation is no longer present in the enum type. * + *

      Attempting to read annotations of a repeatable annotation type T + * that are contained in an annotation whose type is not, in fact, the + * containing annotation type of T will result in an + * InvalidContainerAnnotationError. + * *

      Finally, Attempting to read a member whose definition has evolved * incompatibly will result in a {@link * java.lang.annotation.AnnotationTypeMismatchException} or an @@ -55,6 +60,7 @@ import java.lang.annotation.Annotation; * @see java.lang.annotation.AnnotationFormatError * @see java.lang.annotation.AnnotationTypeMismatchException * @see java.lang.annotation.IncompleteAnnotationException + * @see java.lang.annotation.InvalidContainerAnnotationError * @since 1.5 * @author Josh Bloch */ @@ -86,6 +92,23 @@ public interface AnnotatedElement { */ T getAnnotation(Class annotationClass); + /** + * Returns an array of all this element's annotations for the + * specified type if one or more of such annotation is present, + * else an array of length zero. + * + * The caller of this method is free to modify the returned array; + * it will have no effect on the arrays returned to other callers. + * + * @param annotationClass the Class object corresponding to the + * annotation type + * @return all this element's annotations for the specified annotation type if + * present on this element, else an array of length zero + * @throws NullPointerException if the given annotation class is null + * @since 1.8 + */ + T[] getAnnotations(Class annotationClass); + /** * Returns all annotations present on this element. (Returns an array * of length zero if this element has no annotations.) The caller of @@ -97,13 +120,49 @@ public interface AnnotatedElement { */ Annotation[] getAnnotations(); + /** + * Returns this element's annotation for the specified type if + * such an annotation is present, else null. + * + * This method ignores inherited annotations. (Returns null if no + * annotations are directly present on this element.) + * + * @param annotationClass the Class object corresponding to the + * annotation type + * @return this element's annotation for the specified annotation type if + * present on this element, else null + * @throws NullPointerException if the given annotation class is null + * @since 1.8 + */ + T getDeclaredAnnotation(Class annotationClass); + + /** + * Returns an array of all this element's annotations for the + * specified type if one or more of such annotation is directly + * present, else an array of length zero. + * + * This method ignores inherited annotations. (Returns + * an array of length zero if no annotations are directly present + * on this element.) The caller of this method is free to modify + * the returned array; it will have no effect on the arrays + * returned to other callers. + * + * @param annotationClass the Class object corresponding to the + * annotation type + * @return all this element's annotations for the specified annotation type if + * present on this element, else an array of length zero + * @throws NullPointerException if the given annotation class is null + * @since 1.8 + */ + T[] getDeclaredAnnotations(Class annotationClass); + /** * Returns all annotations that are directly present on this - * element. Unlike the other methods in this interface, this method - * ignores inherited annotations. (Returns an array of length zero if - * no annotations are directly present on this element.) The caller of - * this method is free to modify the returned array; it will have no - * effect on the arrays returned to other callers. + * element. This method ignores inherited annotations. (Returns + * an array of length zero if no annotations are directly present + * on this element.) The caller of this method is free to modify + * the returned array; it will have no effect on the arrays + * returned to other callers. * * @return All annotations directly present on this element * @since 1.5 diff --git a/src/share/classes/java/lang/reflect/Executable.java b/src/share/classes/java/lang/reflect/Executable.java index bec1a72a1e7a94cd995d08a9870d812c91e6e840..6948d96e8a0077a0b8d423cb0c3a9db364096002 100644 --- a/src/share/classes/java/lang/reflect/Executable.java +++ b/src/share/classes/java/lang/reflect/Executable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -26,8 +26,11 @@ package java.lang.reflect; import java.lang.annotation.*; +import java.util.Collections; import java.util.Map; +import java.util.Objects; import sun.reflect.annotation.AnnotationParser; +import sun.reflect.annotation.AnnotationSupport; import sun.reflect.generics.repository.ConstructorRepository; /** @@ -363,19 +366,28 @@ public abstract class Executable extends AccessibleObject * {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ - @SuppressWarnings("unchecked") public T getAnnotation(Class annotationClass) { - if (annotationClass == null) - throw new NullPointerException(); + Objects.requireNonNull(annotationClass); - return (T) declaredAnnotations().get(annotationClass); + return AnnotationSupport.getOneAnnotation(declaredAnnotations(), annotationClass); + } + + /** + * {@inheritDoc} + * @throws NullPointerException {@inheritDoc} + * @since 1.8 + */ + public T[] getAnnotations(Class annotationClass) { + Objects.requireNonNull(annotationClass); + + return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass); } /** * {@inheritDoc} */ public Annotation[] getDeclaredAnnotations() { - return AnnotationParser.toArray(declaredAnnotations()); + return AnnotationSupport.unpackToArray(declaredAnnotations()); } private transient Map, Annotation> declaredAnnotations; diff --git a/src/share/classes/java/lang/reflect/Field.java b/src/share/classes/java/lang/reflect/Field.java index 5e24f228f841a64962dcb3248cdac5208bbb3754..ded3689c419672424a126b483ee0c4fb96dd4e3a 100644 --- a/src/share/classes/java/lang/reflect/Field.java +++ b/src/share/classes/java/lang/reflect/Field.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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,7 +33,9 @@ import sun.reflect.generics.factory.GenericsFactory; import sun.reflect.generics.scope.ClassScope; import java.lang.annotation.Annotation; import java.util.Map; +import java.util.Objects; import sun.reflect.annotation.AnnotationParser; +import sun.reflect.annotation.AnnotationSupport; /** @@ -1012,19 +1014,28 @@ class Field extends AccessibleObject implements Member { * @throws NullPointerException {@inheritDoc} * @since 1.5 */ - @SuppressWarnings("unchecked") public T getAnnotation(Class annotationClass) { - if (annotationClass == null) - throw new NullPointerException(); + Objects.requireNonNull(annotationClass); - return (T) declaredAnnotations().get(annotationClass); + return AnnotationSupport.getOneAnnotation(declaredAnnotations(), annotationClass); } /** - * @since 1.5 + * {@inheritDoc} + * @throws NullPointerException {@inheritDoc} + * @since 1.8 + */ + public T[] getAnnotations(Class annotationClass) { + Objects.requireNonNull(annotationClass); + + return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass); + } + + /** + * {@inheritDoc} */ public Annotation[] getDeclaredAnnotations() { - return AnnotationParser.toArray(declaredAnnotations()); + return AnnotationSupport.unpackToArray(declaredAnnotations()); } private transient Map, Annotation> declaredAnnotations; diff --git a/src/share/classes/java/net/AbstractPlainSocketImpl.java b/src/share/classes/java/net/AbstractPlainSocketImpl.java index b649b18ae907b654ceb25d750e8cb4d17d5a959e..be9ac509731725f43449e0392f5fc49d4b625ae7 100644 --- a/src/share/classes/java/net/AbstractPlainSocketImpl.java +++ b/src/share/classes/java/net/AbstractPlainSocketImpl.java @@ -411,14 +411,13 @@ abstract class AbstractPlainSocketImpl extends SocketImpl * Gets an InputStream for this socket. */ protected synchronized InputStream getInputStream() throws IOException { - if (isClosedOrPending()) { - throw new IOException("Socket Closed"); - } - if (shut_rd) { - throw new IOException("Socket input is shutdown"); - } - if (socketInputStream == null) { - socketInputStream = new SocketInputStream(this); + synchronized (fdLock) { + if (isClosedOrPending()) + throw new IOException("Socket Closed"); + if (shut_rd) + throw new IOException("Socket input is shutdown"); + if (socketInputStream == null) + socketInputStream = new SocketInputStream(this); } return socketInputStream; } @@ -431,14 +430,13 @@ abstract class AbstractPlainSocketImpl extends SocketImpl * Gets an OutputStream for this socket. */ protected synchronized OutputStream getOutputStream() throws IOException { - if (isClosedOrPending()) { - throw new IOException("Socket Closed"); - } - if (shut_wr) { - throw new IOException("Socket output is shutdown"); - } - if (socketOutputStream == null) { - socketOutputStream = new SocketOutputStream(this); + synchronized (fdLock) { + if (isClosedOrPending()) + throw new IOException("Socket Closed"); + if (shut_wr) + throw new IOException("Socket output is shutdown"); + if (socketOutputStream == null) + socketOutputStream = new SocketOutputStream(this); } return socketOutputStream; } diff --git a/src/share/classes/java/net/HttpCookie.java b/src/share/classes/java/net/HttpCookie.java index fe4edc6ac12e52b5807f08839273ddd6d8a1da1e..d5a36df507f890a3713212c0a769da63913dd1e3 100644 --- a/src/share/classes/java/net/HttpCookie.java +++ b/src/share/classes/java/net/HttpCookie.java @@ -30,6 +30,8 @@ import java.util.StringTokenizer; import java.util.NoSuchElementException; import java.text.SimpleDateFormat; import java.util.TimeZone; +import java.util.Calendar; +import java.util.GregorianCalendar; import java.util.Date; import java.util.Locale; import java.util.Objects; @@ -89,7 +91,10 @@ public final class HttpCookie implements Cloneable { private final static String[] COOKIE_DATE_FORMATS = { "EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'", "EEE',' dd MMM yyyy HH:mm:ss 'GMT'", - "EEE MMM dd yyyy HH:mm:ss 'GMT'Z" + "EEE MMM dd yyyy HH:mm:ss 'GMT'Z", + "EEE',' dd-MMM-yy HH:mm:ss 'GMT'", + "EEE',' dd MMM yy HH:mm:ss 'GMT'", + "EEE MMM dd yy HH:mm:ss 'GMT'Z" }; // constant strings represent set-cookie header token @@ -1025,13 +1030,29 @@ public final class HttpCookie implements Cloneable { * specified by dateString */ private long expiryDate2DeltaSeconds(String dateString) { + Calendar cal = new GregorianCalendar(GMT); for (int i = 0; i < COOKIE_DATE_FORMATS.length; i++) { SimpleDateFormat df = new SimpleDateFormat(COOKIE_DATE_FORMATS[i], Locale.US); + cal.set(1970, 0, 1, 0, 0, 0); df.setTimeZone(GMT); + df.setLenient(false); + df.set2DigitYearStart(cal.getTime()); try { - Date date = df.parse(dateString); - return (date.getTime() - whenCreated) / 1000; + cal.setTime(df.parse(dateString)); + if (!COOKIE_DATE_FORMATS[i].contains("yyyy")) { + // 2-digit years following the standard set + // out it rfc 6265 + int year = cal.get(Calendar.YEAR); + year %= 100; + if (year < 70) { + year += 2000; + } else { + year += 1900; + } + cal.set(Calendar.YEAR, year); + } + return (cal.getTimeInMillis() - whenCreated) / 1000; } catch (Exception e) { // Ignore, try the next date format } diff --git a/src/share/classes/java/net/Inet6Address.java b/src/share/classes/java/net/Inet6Address.java index 77e7cf803142aae1ec3a47d8eb799815aba3d78e..7329b2de687df5f34222274ec25e5aafa46f4b2a 100644 --- a/src/share/classes/java/net/Inet6Address.java +++ b/src/share/classes/java/net/Inet6Address.java @@ -25,9 +25,9 @@ package java.net; -import java.io.ObjectInputStream; import java.io.IOException; import java.io.InvalidObjectException; +import java.io.ObjectInputStream; import java.util.Enumeration; /** @@ -116,7 +116,8 @@ import java.util.Enumeration; *

      Special IPv6 address

      * *
      - * + *
      IPv4-mapped address
      + * * *
      IPv4-mapped addressOf the form::ffff:w.x.y.z, this IPv6 address is used to * represent an IPv4 address. It allows the native program to * use the same address data structure and also the same @@ -130,35 +131,40 @@ import java.util.Enumeration; * address.
      *

      - *

      Textual representation of IPv6 scoped addresses

      - *

      - * The textual representation of IPv6 addresses as described above can be extended - * to specify IPv6 scoped addresses. This extension to the basic addressing architecture - * is described in [draft-ietf-ipngwg-scoping-arch-04.txt]. - *

      - * Because link-local and site-local addresses are non-global, it is possible that different hosts - * may have the same destination address and may be reachable through different interfaces on the - * same originating system. In this case, the originating system is said to be connected - * to multiple zones of the same scope. In order to disambiguate which is the intended destination - * zone, it is possible to append a zone identifier (or scope_id) to an IPv6 address. - *

      - * The general format for specifying the scope_id is the following: + *

      Textual representation of IPv6 scoped addresses

      + * + *

      The textual representation of IPv6 addresses as described above can be + * extended to specify IPv6 scoped addresses. This extension to the basic + * addressing architecture is described in [draft-ietf-ipngwg-scoping-arch-04.txt]. + * + *

      Because link-local and site-local addresses are non-global, it is possible + * that different hosts may have the same destination address and may be + * reachable through different interfaces on the same originating system. In + * this case, the originating system is said to be connected to multiple zones + * of the same scope. In order to disambiguate which is the intended destination + * zone, it is possible to append a zone identifier (or scope_id) to an + * IPv6 address. + * + *

      The general format for specifying the scope_id is the following: + * *

      IPv6-address%scope_id
      *

      The IPv6-address is a literal IPv6 address as described above. - * The scope_id refers to an interface on the local system, and it can be specified - * in two ways. - *

      1. As a numeric identifier. This must be a positive integer that identifies the - * particular interface and scope as understood by the system. Usually, the numeric - * values can be determined through administration tools on the system. Each interface may - * have multiple values, one for each scope. If the scope is unspecified, then the default value - * used is zero.
      2. - *

      3. As a string. This must be the exact string that is returned by - * {@link java.net.NetworkInterface#getName()} for the particular interface in question. - * When an Inet6Address is created in this way, the numeric scope-id is determined at the time - * the object is created by querying the relevant NetworkInterface.
      4. - *

      - * Note also, that the numeric scope_id can be retrieved from Inet6Address instances returned from the - * NetworkInterface class. This can be used to find out the current scope ids configured on the system. + * The scope_id refers to an interface on the local system, and it can be + * specified in two ways. + *

      1. As a numeric identifier. This must be a positive integer + * that identifies the particular interface and scope as understood by the + * system. Usually, the numeric values can be determined through administration + * tools on the system. Each interface may have multiple values, one for each + * scope. If the scope is unspecified, then the default value used is zero.
      2. + *

      3. As a string. This must be the exact string that is returned by + * {@link java.net.NetworkInterface#getName()} for the particular interface in + * question. When an Inet6Address is created in this way, the numeric scope-id + * is determined at the time the object is created by querying the relevant + * NetworkInterface.
      + * + *

      Note also, that the numeric scope_id can be retrieved from + * Inet6Address instances returned from the NetworkInterface class. This can be + * used to find out the current scope ids configured on the system. * @since 1.4 */ @@ -169,7 +175,7 @@ class Inet6Address extends InetAddress { /* * cached scope_id - for link-local address use only. */ - private transient int cached_scope_id = 0; + private transient int cached_scope_id; // 0 /** * Holds a 128-bit (16 bytes) IPv6 address. @@ -179,37 +185,28 @@ class Inet6Address extends InetAddress { byte[] ipaddress; /** - * scope_id. The scope specified when the object is created. If the object is created - * with an interface name, then the scope_id is not determined until the time it is needed. + * scope_id. The scope specified when the object is created. If the object + * is created with an interface name, then the scope_id is not determined + * until the time it is needed. */ - private int scope_id = 0; + private int scope_id; // 0 /** * This will be set to true when the scope_id field contains a valid * integer scope_id. */ - private boolean scope_id_set = false; + private boolean scope_id_set; // false /** * scoped interface. scope_id is derived from this as the scope_id of the first * address whose scope is the same as this address for the named interface. */ - private transient NetworkInterface scope_ifname = null; - - /** - * set if the object is constructed with a scoped interface instead of a - * numeric scope id. - */ - private boolean scope_ifname_set = false; + private transient NetworkInterface scope_ifname; // null private static final long serialVersionUID = 6880410070516793377L; - /* - * Perform initializations. - */ - static { - init(); - } + // Perform native initialization + static { init(); } Inet6Address() { super(); @@ -239,19 +236,24 @@ class Inet6Address extends InetAddress { } catch (UnknownHostException e) {} /* cant happen if ifname is null */ } - Inet6Address (String hostName, byte addr[], NetworkInterface nif) throws UnknownHostException { + Inet6Address (String hostName, byte addr[], NetworkInterface nif) + throws UnknownHostException + { initif (hostName, addr, nif); } - Inet6Address (String hostName, byte addr[], String ifname) throws UnknownHostException { + Inet6Address (String hostName, byte addr[], String ifname) + throws UnknownHostException + { initstr (hostName, addr, ifname); } /** - * Create an Inet6Address in the exact manner of {@link InetAddress#getByAddress(String,byte[])} - * except that the IPv6 scope_id is set to the value corresponding to the given interface - * for the address type specified in addr. - * The call will fail with an UnknownHostException if the given interface does not have a numeric + * Create an Inet6Address in the exact manner of {@link + * InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is + * set to the value corresponding to the given interface for the address + * type specified in addr. The call will fail with an + * UnknownHostException if the given interface does not have a numeric * scope_id assigned for the given address type (eg. link-local or site-local). * See here for a description of IPv6 * scoped addresses. @@ -260,14 +262,16 @@ class Inet6Address extends InetAddress { * @param addr the raw IP address in network byte order * @param nif an interface this address must be associated with. * @return an Inet6Address object created from the raw IP address. - * @exception UnknownHostException if IP address is of illegal length, or if the interface - * does not have a numeric scope_id assigned for the given address type. + * @throws UnknownHostException + * if IP address is of illegal length, or if the interface does not + * have a numeric scope_id assigned for the given address type. * * @since 1.5 */ - - public static Inet6Address getByAddress(String host, byte[] addr, NetworkInterface nif) - throws UnknownHostException { + public static Inet6Address getByAddress(String host, byte[] addr, + NetworkInterface nif) + throws UnknownHostException + { if (host != null && host.length() > 0 && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); @@ -282,9 +286,10 @@ class Inet6Address extends InetAddress { } /** - * Create an Inet6Address in the exact manner of {@link InetAddress#getByAddress(String,byte[])} - * except that the IPv6 scope_id is set to the given numeric value. - * The scope_id is not checked to determine if it corresponds to any interface on the system. + * Create an Inet6Address in the exact manner of {@link + * InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is + * set to the given numeric value. The scope_id is not checked to determine + * if it corresponds to any interface on the system. * See here for a description of IPv6 * scoped addresses. * @@ -292,13 +297,14 @@ class Inet6Address extends InetAddress { * @param addr the raw IP address in network byte order * @param scope_id the numeric scope_id for the address. * @return an Inet6Address object created from the raw IP address. - * @exception UnknownHostException if IP address is of illegal length. + * @throws UnknownHostException if IP address is of illegal length. * * @since 1.5 */ - - public static Inet6Address getByAddress(String host, byte[] addr, int scope_id) - throws UnknownHostException { + public static Inet6Address getByAddress(String host, byte[] addr, + int scope_id) + throws UnknownHostException + { if (host != null && host.length() > 0 && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); @@ -312,7 +318,9 @@ class Inet6Address extends InetAddress { throw new UnknownHostException("addr is of illegal length"); } - private void initstr (String hostName, byte addr[], String ifname) throws UnknownHostException { + private void initstr(String hostName, byte addr[], String ifname) + throws UnknownHostException + { try { NetworkInterface nif = NetworkInterface.getByName (ifname); if (nif == null) { @@ -324,16 +332,17 @@ class Inet6Address extends InetAddress { } } - private void initif(String hostName, byte addr[],NetworkInterface nif) throws UnknownHostException { + private void initif(String hostName, byte addr[],NetworkInterface nif) + throws UnknownHostException + { this.hostName = hostName; if (addr.length == INADDRSZ) { // normal IPv6 address family = IPv6; ipaddress = addr.clone(); } if (nif != null) { - this.scope_ifname = nif; - scope_ifname_set = true; - scope_id = deriveNumericScope (nif); + scope_ifname = nif; + scope_id = deriveNumericScope(nif); scope_id_set = true; } } @@ -344,17 +353,16 @@ class Inet6Address extends InetAddress { * return true otherwise. */ private boolean differentLocalAddressTypes(Inet6Address other) { - - if (isLinkLocalAddress() && !other.isLinkLocalAddress()) { + if (isLinkLocalAddress() && !other.isLinkLocalAddress()) return false; - } - if (isSiteLocalAddress() && !other.isSiteLocalAddress()) { + if (isSiteLocalAddress() && !other.isSiteLocalAddress()) return false; - } return true; } - private int deriveNumericScope (NetworkInterface ifc) throws UnknownHostException { + private int deriveNumericScope(NetworkInterface ifc) + throws UnknownHostException + { Enumeration addresses = ifc.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress addr = addresses.nextElement(); @@ -373,16 +381,17 @@ class Inet6Address extends InetAddress { throw new UnknownHostException ("no scope_id found"); } - private int deriveNumericScope (String ifname) throws UnknownHostException { + private int deriveNumericScope(String ifname) throws UnknownHostException { Enumeration en; try { en = NetworkInterface.getNetworkInterfaces(); } catch (SocketException e) { - throw new UnknownHostException ("could not enumerate local network interfaces"); + throw new UnknownHostException( + "could not enumerate local network interfaces"); } while (en.hasMoreElements()) { NetworkInterface ifc = en.nextElement(); - if (ifc.getName().equals (ifname)) { + if (ifc.getName().equals(ifname)) { Enumeration addresses = ifc.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress addr = addresses.nextElement(); @@ -400,7 +409,8 @@ class Inet6Address extends InetAddress { } } } - throw new UnknownHostException ("No matching address found for interface : " +ifname); + throw new UnknownHostException( + "No matching address found for interface : " +ifname); } /** @@ -410,22 +420,14 @@ class Inet6Address extends InetAddress { */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { - scope_ifname = null; - scope_ifname_set = false; s.defaultReadObject(); - if (ifname != null && !"".equals (ifname)) { + if (ifname != null && !ifname.equals("")) { try { scope_ifname = NetworkInterface.getByName(ifname); - if (scope_ifname == null) { - /* the interface does not exist on this system, so we clear - * the scope information completely */ - scope_id_set = false; - scope_ifname_set = false; - scope_id = 0; - } else { + if (scope_ifname != null) { try { - scope_id = deriveNumericScope (scope_ifname); + scope_id = deriveNumericScope(scope_ifname); } catch (UnknownHostException e) { // typically should not happen, but it may be that // the machine being used for deserialization has @@ -455,8 +457,9 @@ class Inet6Address extends InetAddress { * address. 11111111 at the start of the address identifies the * address as being a multicast address. * - * @return a boolean indicating if the InetAddress is - * an IP multicast address + * @return a {@code boolean} indicating if the InetAddress is an IP + * multicast address + * * @since JDK1.1 */ @Override @@ -466,8 +469,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the InetAddress in a wildcard address. - * @return a boolean indicating if the Inetaddress is + * + * @return a {@code boolean} indicating if the Inetaddress is * a wildcard address. + * * @since 1.4 */ @Override @@ -482,8 +487,9 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the InetAddress is a loopback address. * - * @return a boolean indicating if the InetAddress is - * a loopback address; or false otherwise. + * @return a {@code boolean} indicating if the InetAddress is a loopback + * address; or false otherwise. + * * @since 1.4 */ @Override @@ -498,8 +504,9 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the InetAddress is an link local address. * - * @return a boolean indicating if the InetAddress is - * a link local address; or false if address is not a link local unicast address. + * @return a {@code boolean} indicating if the InetAddress is a link local + * address; or false if address is not a link local unicast address. + * * @since 1.4 */ @Override @@ -511,8 +518,9 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the InetAddress is a site local address. * - * @return a boolean indicating if the InetAddress is - * a site local address; or false if address is not a site local unicast address. + * @return a {@code boolean} indicating if the InetAddress is a site local + * address; or false if address is not a site local unicast address. + * * @since 1.4 */ @Override @@ -524,9 +532,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the multicast address has global scope. * - * @return a boolean indicating if the address has - * is a multicast address of global scope, false if it is not - * of global scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of global scope, false if it is not of global scope or + * it is not a multicast address + * * @since 1.4 */ @Override @@ -538,9 +547,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the multicast address has node scope. * - * @return a boolean indicating if the address has - * is a multicast address of node-local scope, false if it is not - * of node-local scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of node-local scope, false if it is not of node-local + * scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -552,9 +562,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the multicast address has link scope. * - * @return a boolean indicating if the address has - * is a multicast address of link-local scope, false if it is not - * of link-local scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of link-local scope, false if it is not of link-local + * scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -566,9 +577,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the multicast address has site scope. * - * @return a boolean indicating if the address has - * is a multicast address of site-local scope, false if it is not - * of site-local scope or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of site-local scope, false if it is not of site-local + * scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -580,10 +592,10 @@ class Inet6Address extends InetAddress { /** * Utility routine to check if the multicast address has organization scope. * - * @return a boolean indicating if the address has - * is a multicast address of organization-local scope, - * false if it is not of organization-local scope - * or it is not a multicast address + * @return a {@code boolean} indicating if the address has is a multicast + * address of organization-local scope, false if it is not of + * organization-local scope or it is not a multicast address + * * @since 1.4 */ @Override @@ -593,9 +605,9 @@ class Inet6Address extends InetAddress { } /** - * Returns the raw IP address of this InetAddress - * object. The result is in network byte order: the highest order - * byte of the address is in getAddress()[0]. + * Returns the raw IP address of this {@code InetAddress} object. The result + * is in network byte order: the highest order byte of the address is in + * {@code getAddress()[0]}. * * @return the raw IP address of this object. */ @@ -609,9 +621,10 @@ class Inet6Address extends InetAddress { * an interface. If no scoped_id is set, the returned value is zero. * * @return the scopeId, or zero if not set. + * * @since 1.5 */ - public int getScopeId () { + public int getScopeId() { return scope_id; } @@ -622,22 +635,23 @@ class Inet6Address extends InetAddress { * @return the scoped interface, or null if not set. * @since 1.5 */ - public NetworkInterface getScopedInterface () { + public NetworkInterface getScopedInterface() { return scope_ifname; } /** - * Returns the IP address string in textual presentation. If the instance was created - * specifying a scope identifier then the scope id is appended to the IP address preceded by - * a "%" (per-cent) character. This can be either a numeric value or a string, depending on which - * was used to createthe instance. + * Returns the IP address string in textual presentation. If the instance + * was created specifying a scope identifier then the scope id is appended + * to the IP address preceded by a "%" (per-cent) character. This can be + * either a numeric value or a string, depending on which was used to create + * the instance. * * @return the raw IP address in a string format. */ @Override public String getHostAddress() { String s = numericToTextFormat(ipaddress); - if (scope_ifname_set) { /* must check this first */ + if (scope_ifname != null) { /* must check this first */ s = s + "%" + scope_ifname.getName(); } else if (scope_id_set) { s = s + "%" + scope_id; @@ -674,29 +688,27 @@ class Inet6Address extends InetAddress { } /** - * Compares this object against the specified object. - * The result is true if and only if the argument is - * not null and it represents the same IP address as - * this object. - *

      - * Two instances of InetAddress represent the same IP - * address if the length of the byte arrays returned by - * getAddress is the same for both, and each of the - * array components is the same for the byte arrays. + * Compares this object against the specified object. The result is {@code + * true} if and only if the argument is not {@code null} and it represents + * the same IP address as this object. + * + *

      Two instances of {@code InetAddress} represent the same IP address + * if the length of the byte arrays returned by {@code getAddress} is the + * same for both, and each of the array components is the same for the byte + * arrays. * * @param obj the object to compare against. - * @return true if the objects are the same; - * false otherwise. + * + * @return {@code true} if the objects are the same; {@code false} otherwise. + * * @see java.net.InetAddress#getAddress() */ @Override public boolean equals(Object obj) { - if (obj == null || - !(obj instanceof Inet6Address)) + if (obj == null || !(obj instanceof Inet6Address)) return false; Inet6Address inetAddr = (Inet6Address)obj; - for (int i = 0; i < INADDRSZ; i++) { if (ipaddress[i] != inetAddr.ipaddress[i]) return false; @@ -709,8 +721,9 @@ class Inet6Address extends InetAddress { * Utility routine to check if the InetAddress is an * IPv4 compatible IPv6 address. * - * @return a boolean indicating if the InetAddress is - * an IPv4 compatible IPv6 address; or false if address is IPv4 address. + * @return a {@code boolean} indicating if the InetAddress is an IPv4 + * compatible IPv6 address; or false if address is IPv4 address. + * * @since 1.4 */ public boolean isIPv4CompatibleAddress() { @@ -727,6 +740,7 @@ class Inet6Address extends InetAddress { // Utilities private final static int INT16SZ = 2; + /* * Convert IPv6 binary address into presentation (printable) format. * @@ -735,9 +749,8 @@ class Inet6Address extends InetAddress { * textual representation format * @since 1.4 */ - static String numericToTextFormat(byte[] src) - { - StringBuffer sb = new StringBuffer(39); + static String numericToTextFormat(byte[] src) { + StringBuilder sb = new StringBuilder(39); for (int i = 0; i < (INADDRSZ / INT16SZ); i++) { sb.append(Integer.toHexString(((src[i<<1]<<8) & 0xff00) | (src[(i<<1)+1] & 0xff))); @@ -766,9 +779,8 @@ class Inet6Address extends InetAddress { private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException { - if (scope_ifname_set) { + if (scope_ifname != null) ifname = scope_ifname.getName(); - } s.defaultWriteObject(); } } diff --git a/src/share/classes/java/net/NetPermission.java b/src/share/classes/java/net/NetPermission.java index f22e04f717adddf27f7cd6a7adad8cac50342bf7..f11337e5b9ef76fa92474384e02a54239cdcb63c 100644 --- a/src/share/classes/java/net/NetPermission.java +++ b/src/share/classes/java/net/NetPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -40,8 +40,8 @@ import java.util.StringTokenizer; * convention follows the hierarchical property naming convention. * Also, an asterisk * may appear at the end of the name, following a ".", or by itself, to - * signify a wildcard match. For example: "foo.*" or "*" is valid, - * "*foo" or "a*b" is not valid. + * signify a wildcard match. For example: "foo.*" and "*" signify a wildcard + * match, while "*foo" and "a*b" do not. *

      * The following table lists all the possible NetPermission target names, * and for each provides a description of what the permission allows diff --git a/src/share/classes/java/net/doc-files/net-properties.html b/src/share/classes/java/net/doc-files/net-properties.html index 37cbc930a1206ae72174ea0c5709eb18fb367835..5aac0c8e3bd0c17d3d92031dcfb775e49ff09cdb 100644 --- a/src/share/classes/java/net/doc-files/net-properties.html +++ b/src/share/classes/java/net/doc-files/net-properties.html @@ -1,5 +1,5 @@ $ADDR" # IPv4 reverse lookup echo '' -OUT1=`$JAVA -Djava.net.preferIPv4Stack=true Lookup -q=PTR $ADDR` +OUT1=`$JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true Lookup -q=PTR $ADDR` echo "(IPv4) $ADDR --> $OUT1" # reverse lookup (default) echo '' -OUT2=`$JAVA Lookup -q=PTR $ADDR` +OUT2=`$JAVA ${TESTVMOPTS} Lookup -q=PTR $ADDR` echo "(default) $ADDR --> $OUT2" diff --git a/test/java/net/ResponseCache/Test.java b/test/java/net/ResponseCache/Test.java new file mode 100644 index 0000000000000000000000000000000000000000..59951a49897f383d910cdd3c50e9bb14e19df16f --- /dev/null +++ b/test/java/net/ResponseCache/Test.java @@ -0,0 +1,80 @@ +/* + * 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 + * @summary Fixed a potential NullPointerException when setting a ResponseCache that returns a null CacheRequest + * @bug 4837267 + * @author Michael McMahon + */ + +import com.sun.net.httpserver.*; +import java.net.*; +import java.io.*; +import java.util.*; + +public class Test +{ + + static class MyHandler implements HttpHandler { + public void handle(HttpExchange t) throws IOException { + byte[] b = new byte[1024]; + int r = 0; + InputStream is = t.getRequestBody(); + while (is.read(b) != -1) ; + String response = "This is the response"; + t.sendResponseHeaders(200, response.length()); + OutputStream os = t.getResponseBody(); + os.write(response.getBytes()); + os.close(); + } + } + + public static void main(String args[]) throws Exception { + HttpServer server = HttpServer.create(new InetSocketAddress(0), 0); + server.createContext("/", new MyHandler()); + server.start(); + ResponseCache bak = ResponseCache.getDefault(); + + try { + ResponseCache.setDefault (new ResponseCache() { + public CacheResponse get (URI uri, String rqstMethod, Map> rqstHeaders) + throws IOException { + return null; + } + public CacheRequest put(URI uri, URLConnection conn) throws IOException + { + return null; + } + }); + + URL url = new URL ("http://localhost:" + server.getAddress().getPort() + "/"); + URLConnection urlc = url.openConnection (); + InputStream is = urlc.getInputStream(); + while (is.read() != -1) ; + is.close(); + } finally { + ResponseCache.setDefault(bak); + server.stop(0); + } + } +} diff --git a/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh b/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh index 5b039487286c024d6b1a11c03cd3224f2a546a0e..df85f49feb7ada700454eaec5fe4ec4e48339350 100644 --- a/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh +++ b/test/java/net/ServerSocket/AcceptCauseFileDescriptorLeak.sh @@ -45,4 +45,4 @@ if [ "$NOFILES" = "unlimited" ] || [ $NOFILES -ge 1024 ]; then ulimit -n 1024 fi -${TESTJAVA}/bin/java AcceptCauseFileDescriptorLeak +${TESTJAVA}/bin/java ${TESTVMOPTS} AcceptCauseFileDescriptorLeak diff --git a/test/java/net/Socket/B6210227.java b/test/java/net/Socket/B6210227.java new file mode 100644 index 0000000000000000000000000000000000000000..d8f4909604ef03d6372d01a4c5d5309de48f5e28 --- /dev/null +++ b/test/java/net/Socket/B6210227.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. + */ + +/** + * @test + * @bug 6210227 + * @summary REGRESSION: Socket.getLocalAddress() returns address of 0.0.0.0 on outbound TCP + */ + +import java.util.*; +import java.net.*; + +public class B6210227 { + public static void main(String[] args) throws Exception + { + ServerSocket ss = new ServerSocket(0); + int port = ss.getLocalPort(); + + byte[] bad = {0,0,0,0}; + try { + InetSocketAddress isa = new InetSocketAddress(InetAddress.getLocalHost(), port); + Socket s = new Socket(); + s.connect( isa, 1000 ); + InetAddress iaLocal = s.getLocalAddress(); // if this comes back as 0.0. 0.0 this would demonstrate issue + String sLocalHostname = iaLocal.getHostName(); + if (Arrays.equals (iaLocal.getAddress(), bad)) { + throw new RuntimeException ("0.0.0.0 returned"); + } + System.out.println("local hostname is "+sLocalHostname ); + } catch(Exception e) { + System.out.println("Exception happened"); + throw e; + } finally { + ss.close(); + } + } +} + diff --git a/test/java/net/Socket/OldSocketImpl.sh b/test/java/net/Socket/OldSocketImpl.sh index 5f429d1e4eea0bc68fd63b3f44fb086c54bd684f..bbe055fa2eadc8c603e6787a9d00a304822bdeb4 100644 --- a/test/java/net/Socket/OldSocketImpl.sh +++ b/test/java/net/Socket/OldSocketImpl.sh @@ -50,7 +50,7 @@ esac # with 1.3 and in OldStyleImpl.jar # run -${TESTJAVA}${FS}bin${FS}java -cp ${TESTSRC}${FS}OldSocketImpl.jar OldSocketImpl +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTSRC}${FS}OldSocketImpl.jar OldSocketImpl result=$? if [ "$result" -ne "0" ]; then exit 1 diff --git a/test/java/net/Socket/Streams.java b/test/java/net/Socket/Streams.java new file mode 100644 index 0000000000000000000000000000000000000000..e3cae93c34128f69ea5a68cbf1f70f62e9b47abb --- /dev/null +++ b/test/java/net/Socket/Streams.java @@ -0,0 +1,113 @@ +/* + * 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 8003833 + * @summary Spurious NPE from Socket.getIn/OutputStream + */ + +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.net.ServerSocket; +import java.net.Socket; +import java.util.concurrent.Phaser; + +// Racey test, will not always fail, but if it does then there is a problem. + +public class Streams { + static final int NUM_THREADS = 100; + static volatile boolean failed; + static final Phaser startingGate = new Phaser(NUM_THREADS + 1); + + public static void main(String[] args) throws Exception { + + try (ServerSocket ss = new ServerSocket(0)) { + runTest(OutputStreamGetter.class, ss); + runTest(InputStreamGetter.class, ss); + } + + if (failed) + throw new RuntimeException("Failed, check output"); + } + + static void runTest(Class klass, ServerSocket ss) + throws Exception + { + final int port = ss.getLocalPort(); + Socket[] sockets = new Socket[NUM_THREADS]; + for (int i=0; i ctr = klass.getConstructor(Socket.class); + + Thread[] threads = new Thread[NUM_THREADS]; + for (int i=0; i ${TMP1} 2>&1 cat ${TMP1} cat ${TMP1} | grep -s "Unrecognized VM option: \'MaxDirectMemorySize=" diff --git a/test/java/nio/channels/AsynchronousChannelGroup/run_any_task.sh b/test/java/nio/channels/AsynchronousChannelGroup/run_any_task.sh index 6849315e69aa7139435f1101e575d2568abbbe8d..8136634d205d25c438701f608465a1e7d6eb67cf 100644 --- a/test/java/nio/channels/AsynchronousChannelGroup/run_any_task.sh +++ b/test/java/nio/channels/AsynchronousChannelGroup/run_any_task.sh @@ -46,7 +46,7 @@ $JAR -cf "${TESTCLASSES}/Privileged.jar" \ -C "${TESTCLASSES}" Attack.class echo "Running test ..." -$JAVA -XX:-UseVMInterruptibleIO \ - -Xbootclasspath/a:"${TESTCLASSES}/Privileged.jar" \ - -classpath "${TESTCLASSES}" \ - AsExecutor +$JAVA ${TESTVMOPTS} \ + -Xbootclasspath/a:"${TESTCLASSES}/Privileged.jar" \ + -classpath "${TESTCLASSES}" \ + AsExecutor diff --git a/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh b/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh index c334192a231f55f1fb9401069ddd6679d676f840..bf8246501e9fa7219d407f179095b1495caaa685 100644 --- a/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh +++ b/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh @@ -51,7 +51,7 @@ failures=0 go() { echo '' - $JAVA $1 $2 $3 2>&1 + $JAVA ${TESTVMOPTS} $1 $2 $3 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } diff --git a/test/java/nio/charset/Charset/default.sh b/test/java/nio/charset/Charset/default.sh index 5a91ea10c18eb3604b78af3c98ee1d0445871178..c93aa71bdefa639543e639bcc99e229782d2d11a 100644 --- a/test/java/nio/charset/Charset/default.sh +++ b/test/java/nio/charset/Charset/default.sh @@ -64,7 +64,7 @@ go() { ecs="$1"; shift echo -n "$L: " - cs="`LC_ALL=$L $JAVA -cp $TESTCLASSES Default`" + cs="`LC_ALL=$L $JAVA ${TESTVMOPTS} -cp $TESTCLASSES Default`" if [ $? != 0 ]; then exit 1 elif [ "`tolower $cs`" != "`tolower $ecs`" ]; then diff --git a/test/java/nio/charset/coders/CheckSJISMappingProp.sh b/test/java/nio/charset/coders/CheckSJISMappingProp.sh index 49caa0dfebb6df2e7d9800016d08176a74cac88d..fd76d5a5031d3df6f40ad7c4659c6566f10c3a8d 100644 --- a/test/java/nio/charset/coders/CheckSJISMappingProp.sh +++ b/test/java/nio/charset/coders/CheckSJISMappingProp.sh @@ -51,7 +51,7 @@ expectPass() { } -JAVA="${TESTJAVA}/bin/java -cp ${TESTCLASSES}" +JAVA="${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES}" runTest() { echo "Testing:" ${1} LC_ALL="$1" ; export LC_ALL diff --git a/test/java/nio/charset/spi/basic.sh b/test/java/nio/charset/spi/basic.sh index c1bdd45dd0207ef49606be18387a29d8724a0ab5..e4f89c5823c28718ff8444b637868bca2899aefa 100644 --- a/test/java/nio/charset/spi/basic.sh +++ b/test/java/nio/charset/spi/basic.sh @@ -116,7 +116,7 @@ for where in ext app; do av="$av -Djava.security.manager -Djava.security.policy==$TESTSRC/charsetProvider.sp";; esac - if (set -x; $JAVA $av Test $css) 2>&1; then + if (set -x; $JAVA ${TESTVMOPTS} $av Test $css) 2>&1; then continue; else failures=`expr $failures + 1` diff --git a/test/java/nio/file/Files/delete_on_close.sh b/test/java/nio/file/Files/delete_on_close.sh index 7ffa009a8172a875f79937fce0041054c549021b..f6a58683be674793ed1becdc25f752621f8566b1 100644 --- a/test/java/nio/file/Files/delete_on_close.sh +++ b/test/java/nio/file/Files/delete_on_close.sh @@ -51,7 +51,7 @@ export CLASSPATH TMPFILE="$$.tmp" touch $TMPFILE -$JAVA DeleteOnClose $TMPFILE 2>&1 +$JAVA ${TESTVMOPTS} DeleteOnClose $TMPFILE 2>&1 if [ $? != 0 ]; then exit 1; fi if [ -f $TMPFILE ]; then echo "$TMPFILE was not deleted" diff --git a/test/java/nio/file/Files/walkFileTree/walk_file_tree.sh b/test/java/nio/file/Files/walkFileTree/walk_file_tree.sh index dee0dd06f7113b5aeaffbf209ba9c216d6adbb65..6c9d7dc89d3dfe754b39d93d2d6a7fb304c8011c 100644 --- a/test/java/nio/file/Files/walkFileTree/walk_file_tree.sh +++ b/test/java/nio/file/Files/walkFileTree/walk_file_tree.sh @@ -56,7 +56,7 @@ if [ $? != 0 ]; then exit 1; fi failures=0 # print the file tree and compare output with find(1) -$JAVA PrintFileTree "$ROOT" > out1 +$JAVA ${TESTVMOPTS} PrintFileTree "$ROOT" > out1 find "$ROOT" > out2 diff out1 out2 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi @@ -66,26 +66,26 @@ if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # not. For that reason we run PrintFileTree with the -printCycles # option when the output without this option differs to find(1). find "$ROOT" -follow > out1 -$JAVA PrintFileTree -follow "$ROOT" > out2 +$JAVA ${TESTVMOPTS} PrintFileTree -follow "$ROOT" > out2 diff out1 out2 if [ $? != 0 ]; then # re-run printing cycles to stdout - $JAVA PrintFileTree -follow -printCycles "$ROOT" > out2 + $JAVA ${TESTVMOPTS} PrintFileTree -follow -printCycles "$ROOT" > out2 diff out1 out2 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi fi # test SKIP_SIBLINGS -$JAVA SkipSiblings "$ROOT" +$JAVA ${TESTVMOPTS} SkipSiblings "$ROOT" if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # test TERMINATE -$JAVA TerminateWalk "$ROOT" +$JAVA ${TESTVMOPTS} TerminateWalk "$ROOT" if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # test maxDepth -$JAVA MaxDepth "$ROOT" +$JAVA ${TESTVMOPTS} MaxDepth "$ROOT" if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # clean-up diff --git a/test/java/nio/file/Path/MacPathTest.sh b/test/java/nio/file/Path/MacPathTest.sh index e81c62ae90689180813f34ee3c4e2b847d648d92..e5d410bd112c988dd783e85946a9f57c4d81a749 100644 --- a/test/java/nio/file/Path/MacPathTest.sh +++ b/test/java/nio/file/Path/MacPathTest.sh @@ -36,4 +36,4 @@ if [ "x$TESTJAVA" = x ]; then TESTCLASSES=. fi -export LC_ALL=en_US.UTF-8; ${TESTJAVA}/bin/java -cp ${TESTCLASSES} MacPathTest +export LC_ALL=en_US.UTF-8; ${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} MacPathTest diff --git a/test/java/rmi/MarshalledObject/compare/Compare.java b/test/java/rmi/MarshalledObject/compare/Compare.java index 96ea46f76db42cce3459971e82dd32524792e383..2032264692036478128c317546050a5fcdcb474c 100644 --- a/test/java/rmi/MarshalledObject/compare/Compare.java +++ b/test/java/rmi/MarshalledObject/compare/Compare.java @@ -29,7 +29,6 @@ * not involved in location should be compared. * @author Ken Arnold * - * @build Compare * @run main Compare 11 annotatedRef */ diff --git a/test/java/rmi/MarshalledObject/compare/HashCode.java b/test/java/rmi/MarshalledObject/compare/HashCode.java index 6a0266b927b62b7a55840e3e73d6ead7bcab1b8d..768e418ae5b223c5a606befd1c284c7780961a93 100644 --- a/test/java/rmi/MarshalledObject/compare/HashCode.java +++ b/test/java/rmi/MarshalledObject/compare/HashCode.java @@ -27,7 +27,6 @@ * @summary MarshalledObject with null throws NullPointerException * @author Ken Arnold * - * @build HashCode * @run main HashCode 11 annotatedRef */ diff --git a/test/java/rmi/MarshalledObject/compare/NullReference.java b/test/java/rmi/MarshalledObject/compare/NullReference.java index f8ff9a1a4fa0ca609c95a63a060afbac2822e1ec..5210e948b5179d3e5872f3f07f5be37714af7454 100644 --- a/test/java/rmi/MarshalledObject/compare/NullReference.java +++ b/test/java/rmi/MarshalledObject/compare/NullReference.java @@ -27,7 +27,6 @@ * @summary MarshalledObject with null throws NullPointerException * @author Ken Arnold * - * @build NullReference * @run main NullReference */ diff --git a/test/java/rmi/Naming/DefaultRegistryPort.java b/test/java/rmi/Naming/DefaultRegistryPort.java index 4290bf563be96382c29d25738984edce5367ffab..a4c49792536b6234838f78ad7eeb94b4985567ab 100644 --- a/test/java/rmi/Naming/DefaultRegistryPort.java +++ b/test/java/rmi/Naming/DefaultRegistryPort.java @@ -28,7 +28,6 @@ * @author Dana Burns * @library ../testlibrary * @build TestLibrary - * @build DefaultRegistryPort * @run main DefaultRegistryPort */ diff --git a/test/java/rmi/Naming/LookupIPv6.java b/test/java/rmi/Naming/LookupIPv6.java index ebdd9f3efae963b832b164525f4a6a9d258d4084..da6c62cbc83d7c38daf18a04f5ee1d1a27993613 100644 --- a/test/java/rmi/Naming/LookupIPv6.java +++ b/test/java/rmi/Naming/LookupIPv6.java @@ -22,12 +22,11 @@ */ /* @test + * @summary Ensure that java.rmi.Naming.lookup can handle URLs containing + * IPv6 addresses. * @bug 4402708 * * @run main/othervm -Djava.net.preferIPv6Addresses=true LookupIPv6 - * - * @summary Ensure that java.rmi.Naming.lookup can handle URLs containing - * IPv6 addresses. */ import java.net.InetAddress; diff --git a/test/java/rmi/Naming/RmiIsNoScheme.java b/test/java/rmi/Naming/RmiIsNoScheme.java index 865a07c995d4cd0e9ca68e247a78ed9efc69a03e..fe6d1ab4031c83da93668da53e7386fe2e5d79ff 100644 --- a/test/java/rmi/Naming/RmiIsNoScheme.java +++ b/test/java/rmi/Naming/RmiIsNoScheme.java @@ -30,7 +30,6 @@ * * @library ../testlibrary * @build TestLibrary - * @build RmiIsNoScheme * @run main/othervm RmiIsNoScheme */ diff --git a/test/java/rmi/Naming/UnderscoreHost.java b/test/java/rmi/Naming/UnderscoreHost.java index 0d7375693c44df3d038d5f7ef9cbe1140b4c25b5..b88ca628e9a89f7f4399d44e317948fc6d0d158a 100644 --- a/test/java/rmi/Naming/UnderscoreHost.java +++ b/test/java/rmi/Naming/UnderscoreHost.java @@ -29,8 +29,7 @@ * @author Vinod Johnson * * @library ../testlibrary - * @build TestLibrary - * @build UnderscoreHost UnderscoreHost_Stub + * @build TestLibrary UnderscoreHost_Stub * @run main/othervm UnderscoreHost */ diff --git a/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java b/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java index 0d367974b2e241cd5200f5f46a99f248e3225ad6..725d9ca6c7afe5a03c9f7c0b28d67de8494cdaed 100644 --- a/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java +++ b/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java @@ -21,14 +21,13 @@ * questions. */ -/** +/* * @test * @bug 4254808 * @summary Naming assumes '/' is present in relative URL; change in URL causes regression * @author Dana Burns * @library ../../testlibrary - * @build TestLibrary - * @build Legal LegalRegistryNames LegalRegistryNames_Stub + * @build TestLibrary Legal LegalRegistryNames_Stub * @run main LegalRegistryNames */ diff --git a/test/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java b/test/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java index 648708869ada84e63c1e2707e6f2270d3a8596bf..32cbe5ff481274f9a8ba6ccb56e51cbcffa2f4b0 100644 --- a/test/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java +++ b/test/java/rmi/RMISecurityManager/checkPackageAccess/CheckPackageAccess.java @@ -28,10 +28,9 @@ * as when the default java.lang.SecurityManager is set, which with the * default "java.security" file in the JDK means that access to packages in * the sun.* package hierarchy is denied (without explicit runtime permission - * "accessClassInPackge.*"). + * "accessClassInPackage.*"). * @author Peter Jones * - * @build CheckPackageAccess * @run main/othervm CheckPackageAccess */ diff --git a/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java b/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java index 9bd8475a44bc42b7f4b8953cf9ec27bf800c922b..fce32f9f06aada3eca2d7b28a6ff4555362bdda2 100644 --- a/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java +++ b/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java @@ -36,8 +36,7 @@ * functionality is in place * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build ActivateMe CheckActivateRef_Stub CheckActivateRef + * @build TestLibrary RMID ActivateMe CheckActivateRef_Stub * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=true CheckActivateRef * @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=false CheckActivateRef */ diff --git a/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java b/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java index ae7b843b1a95c5f2b187b1030daddaa49aed9e1f..b6e4abd433c16544d54212e66be816124f7a02a6 100644 --- a/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java +++ b/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java @@ -28,10 +28,7 @@ * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build MyRMI - * @build CheckAnnotations - * @build CheckAnnotations_Stub + * @build TestLibrary RMID MyRMI CheckAnnotations_Stub * @run main/othervm/policy=security.policy/timeout=480 CheckAnnotations */ diff --git a/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java b/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java index e3a1467ceeef196e0d033c96af9f89d622da220f..3d0694107e943fdf4cf3e7eb21514168cf77ae44 100644 --- a/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java +++ b/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java @@ -24,14 +24,11 @@ /* @test * @bug 4289544 * @summary ActivationGroupImpl.newInstance does not set context classloader for impl - * * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build MyRMI - * @build CheckImplClassLoader ActivatableImpl - * @build ActivatableImpl ActivatableImpl_Stub + * @build TestLibrary RMID + * MyRMI ActivatableImpl ActivatableImpl ActivatableImpl_Stub * @run main/othervm/policy=security.policy/timeout=150 CheckImplClassLoader */ diff --git a/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java b/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java index 59f5c99dc77cea25e480f4731427aadf8f8a39d6..b46142f1a2a73d7c9963d14a8cccba1e1fb2afdf 100644 --- a/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java +++ b/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java @@ -27,8 +27,8 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build RMID ActivationLibrary TestLibrary - * @build ActivateMe CheckRegisterInLog CheckRegisterInLog_Stub + * @build TestLibrary RMID ActivationLibrary + * ActivateMe CheckRegisterInLog_Stub * @run main/othervm/policy=security.policy/timeout=240 CheckRegisterInLog */ diff --git a/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java b/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java index 4d4d07367222879519b19607f13af4681ec5dff3..41a28868ecdc64d905943128ca1275f396807d81 100644 --- a/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java +++ b/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java @@ -22,14 +22,12 @@ */ /* @test - * @author Laird Dornin * @bug 4164971 * @summary allow non-public activatable class and/or constructor + * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build ActivateMe - * @build CreatePrivateActivatable + * @build TestLibrary RMID ActivateMe * @run main/othervm/policy=security.policy/timeout=240 CreatePrivateActivatable */ diff --git a/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java b/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java index 1bb909a79bffe839c570d53c0b56af807aaa2bae..42d309b34d9dcf8d3fc160951fc295986adf6328 100644 --- a/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java +++ b/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java @@ -32,11 +32,7 @@ * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build DownloadParameterClass - * @build Foo - * @build FooReceiverImpl - * @build FooReceiverImpl_Stub - * @build Bar + * Foo FooReceiverImpl FooReceiverImpl_Stub Bar * @run main/othervm/policy=security.policy/timeout=240 DownloadParameterClass */ diff --git a/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java b/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java index 3d82bfb86afba4de45ff56ecbf3f9e55b34d8e93..7ee451d73288ef1d331987f1a81a50285153a11d 100644 --- a/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java +++ b/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java @@ -23,14 +23,11 @@ /* @test * @bug 4128620 - * * @summary synopsis: NoSuchMethodError should be elucidated - * * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build ActivateMe ElucidateNoSuchMethod ElucidateNoSuchMethod_Stub + * @build TestLibrary RMID ActivateMe ElucidateNoSuchMethod_Stub * @run main/othervm/policy=security.policy/timeout=240 ElucidateNoSuchMethod */ diff --git a/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh b/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh index 7d15638cdb13e2bff1a79d8c50edc9fb5d784961..4f758b410c4d02d5d99fb2239a861c7995ae8be6 100644 --- a/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh +++ b/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh @@ -51,5 +51,5 @@ rm classes/ExtLoadedImpl.class classes/ExtLoadedImpl_Stub.class classes/CheckLoa mkdir -p ext $TESTJAVA/bin/jar cf ext/ext.jar -C $TESTCLASSES ExtLoadedImpl.class -C $TESTCLASSES ExtLoadedImpl_Stub.class -C $TESTCLASSES CheckLoader.class -$TESTJAVA/bin/java -cp classes -Dtest.src=$TESTSRC -Dtest.classes=$TESTCLASSES -Djava.security.policy=$TESTSRC/security.policy -Djava.ext.dirs=ext ExtLoadedImplTest +$TESTJAVA/bin/java ${TESTVMOPTS} -cp classes -Dtest.src=$TESTSRC -Dtest.classes=$TESTCLASSES -Djava.security.policy=$TESTSRC/security.policy -Djava.ext.dirs=ext ExtLoadedImplTest diff --git a/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java b/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java index 679114806ff2821e940994d92ad1c28883d14923..9af0bf316001f66f868f602b2da70fc2f92ed931 100644 --- a/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java +++ b/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java @@ -27,9 +27,8 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build ActivateMe - * @build ForceLogSnapshot - * @build ForceLogSnapshot_Stub + * @build TestLibrary RMID ActivationLibrary + * ActivateMe ForceLogSnapshot_Stub * @run main/othervm/policy=security.policy/timeout=640 ForceLogSnapshot */ diff --git a/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java b/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java index a1b02b1eab441aaf3482927ad1b6ed28e331d63c..238d3473a9e85375b55399851cb25e93cd90d056 100644 --- a/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java +++ b/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java @@ -29,10 +29,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build InactiveGroup - * @build InactiveGroup_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe InactiveGroup_Stub * @run main/othervm/policy=security.policy/timeout=240 InactiveGroup */ diff --git a/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java b/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java index eee264f2985f8cb032d59bdcd53b446bef101eac..ce154c4ca9962c0969aba8ace5aedd86fbe89787 100644 --- a/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java +++ b/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java @@ -24,14 +24,12 @@ /* * @test * @bug 6245733 - * * @summary synopsis: rmid's registry's list operation doesn't include * activation system * @author Ann Wollrath * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build LookupActivationSystem * @run main/othervm/timeout=240 LookupActivationSystem */ diff --git a/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java b/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java index 9ad2d5482dc18d32029a46e87dc6800c467e81ba..2cd5a634534cb981bc92221cfba229a405c3491c 100644 --- a/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java +++ b/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java @@ -23,15 +23,11 @@ /* @test * @bug 4138056 - * * @summary synopsis: Activating objects from an Activatable constructor causes deadlock * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build NestedActivate - * @build NestedActivate_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe NestedActivate_Stub * @run main/othervm/policy=security.policy/timeout=240 NestedActivate */ diff --git a/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java b/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java index 76d68e9970a6c86bf46f06e11ff6789e755b56e4..625661ba432d332b67715c5e95a2ac3e69d153bc 100644 --- a/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java +++ b/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java @@ -23,16 +23,13 @@ /* @test * @bug 4115296 - * * @summary synopsis: NoSuchObjectException not thrown for non-existent * activatable objects * @author Ann Wollrath * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build NonExistentActivatable - * @build NonExistentActivatable_Stub + * ActivateMe NonExistentActivatable_Stub * @run main/othervm/policy=security.policy/timeout=240 NonExistentActivatable */ diff --git a/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java b/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java index 164a84209bba9b7c44df378fe644bd40d8c3fcc7..b403c28441b5f3d963792f5155fa3de5f3d41d1e 100644 --- a/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java +++ b/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java @@ -28,10 +28,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build ActivateMe - * @build RestartCrashedService - * @build RestartCrashedService_Stub + * @build TestLibrary RMID ActivateMe RestartCrashedService_Stub * @run main/othervm/policy=security.policy/timeout=240 RestartCrashedService */ diff --git a/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java b/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java index 31750985e6d40c58e9969ffb80cbb7d487dd1c3e..c53053e7315b46c5b236d818d60f4f923ea72d27 100644 --- a/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java +++ b/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java @@ -28,8 +28,7 @@ * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build RestartLatecomer - * @build RestartLatecomer_Stub + * RestartLatecomer RestartLatecomer_Stub * @run main/othervm/policy=security.policy/timeout=240 RestartLatecomer */ diff --git a/test/java/rmi/activation/Activatable/restartService/RestartService.java b/test/java/rmi/activation/Activatable/restartService/RestartService.java index a98ce832a2bb470b8f91107d74598b23daa445f9..973916f083ee3f1529d630e5b500f841c3c8650f 100644 --- a/test/java/rmi/activation/Activatable/restartService/RestartService.java +++ b/test/java/rmi/activation/Activatable/restartService/RestartService.java @@ -23,15 +23,11 @@ /* @test * @bug 4095165 4321151 - * @summary synopsis: activator should restart daemon services * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build RestartService - * @build RestartService_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe RestartService_Stub * @run main/othervm/policy=security.policy/timeout=240 RestartService */ diff --git a/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java b/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java index 162eb3861e481c9da4dd4e2976bf0a11ccf722b6..64233bfd6f1b446b3f283c53e11fd7a026a98464 100644 --- a/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java +++ b/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java @@ -28,11 +28,8 @@ * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build TestSecurityManager - * @build RegisteringActivatable - * @build ShutdownGracefully - * @build ShutdownGracefully_Stub + * @build TestLibrary RMID + * TestSecurityManager RegisteringActivatable ShutdownGracefully_Stub * @run main/othervm/policy=security.policy/timeout=700 ShutdownGracefully */ diff --git a/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java b/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java index 5d8c50c56417f3568bdc06916613bd58bdecbd37..412901ea7425a60067a01eaf7705eda9fa3c0fcd 100644 --- a/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java +++ b/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java @@ -23,16 +23,12 @@ /* @test * @bug 4115331 - * @summary synopsis: activatable object fails to go inactive after * unregister/inactive sequence. * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID ActivationLibrary - * @build ActivateMe - * @build UnregisterInactive - * @build UnregisterInactive_Stub + * @build TestLibrary RMID ActivationLibrary ActivateMe UnregisterInactive_Stub * @run main/othervm/policy=security.policy/timeout=240 UnregisterInactive */ diff --git a/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java b/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java index a5a5b0d374d32c59a10e0f2300b03215a4eeb843..a7d7643977b9119afe2789a0e53d41e31dc51016 100644 --- a/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java +++ b/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java @@ -31,11 +31,8 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build ActivateMe - * @build ActivateFails - * @build ActivateFails_Stub - * @build ShutdownThread + * @build TestLibrary RMID ActivationLibrary + * ActivateMe ActivateFails_Stub ShutdownThread * @run main/othervm/policy=security.policy/timeout=240 ActivateFails */ diff --git a/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java b/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java index f7f8643333c4805d9d65bb56e1e75ea4b891c6c1..880f1e8a8a6ac4c1427f24ed23b138568198f5df 100644 --- a/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java +++ b/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java @@ -33,9 +33,7 @@ * * @library ../../../testlibrary * @build TestLibrary RMID ActivationLibrary - * @build MyActivationGroupImpl - * @build DownloadActivationGroup - * @build DownloadActivationGroup_Stub + * DownloadActivationGroup MyActivationGroupImpl DownloadActivationGroup_Stub * @run main/othervm/policy=security.policy/timeout=240 DownloadActivationGroup */ diff --git a/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java b/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java index bd475029687db7ed5bb92838b03ec3e5b49e6e46..f37cbaeb79f477f26872f1f4ad5282b3821bf327 100644 --- a/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java +++ b/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java @@ -21,16 +21,15 @@ * questions. */ -/** +/* * @test * @bug 4252236 * @summary ActivationGroupDesc should not do early binding of default classname - * @library ../../../testlibrary - * - * @build CheckDefaultGroupName + * @author Laird Dornin * + * @library ../../../testlibrary + * @build TestLibrary * @run main CheckDefaultGroupName - * @author Laird Dornin */ import java.rmi.activation.*; diff --git a/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java b/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java index 41670ee1eb20fb0fd5fe59a66436d16f9ded7dc2..391a86273b16a098f37f37a71898dafe63bd7bbf 100644 --- a/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java +++ b/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java @@ -23,15 +23,13 @@ /* @test * @bug 4720528 - * * @summary synopsis: (spec) ActivationSystem.activeGroup spec should be * relaxed (duplicate call to activeGroup with same instantiator and * incarnation should not throw ActivationException; it should succeed) * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID - * @build IdempotentActiveGroup + * @build TestLibrary RMID ActivationLibrary * @run main/othervm/policy=security.policy/timeout=480 IdempotentActiveGroup */ diff --git a/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java b/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java index 4f3d51e4646f334b9f9730d7e71762b49741dde5..19034e511a6f552b2a675991efb90b2b2ad294bc 100644 --- a/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java +++ b/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java @@ -29,9 +29,8 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build ActivateMe - * @build ModifyDescriptor - * @build ModifyDescriptor_Stub + * @build TestLibrary RMID ActivationLibrary + * ActivateMe ModifyDescriptor_Stub * @run main/othervm/policy=security.policy/timeout=240 ModifyDescriptor */ diff --git a/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java b/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java index cc7810407eb3d0610fca4a8553a83f174706c5da..d987f93b238685dd38171c3ce0b084652d6fc5ba 100644 --- a/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java +++ b/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java @@ -24,14 +24,11 @@ /* @test * @bug 4179055 * @summary Some java apps need to have access to read "accessClassInPackage.sun.rmi.server" - * * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe ActivationLibrary - * @build CanCreateStubs - * @build StubClassesPermitted - * @build StubClassesPermitted_Stub + * @build TestLibrary RMID ActivationLibrary + * CanCreateStubs StubClassesPermitted_Stub * @run main/othervm/policy=security.policy/secure=java.lang.SecurityManager/timeout=240 StubClassesPermitted */ diff --git a/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java b/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java index a2b4076495aef273e2dbe7452aa92af90d3b6434..59fee9da723beb8b1eeda5fdc673ce2c036fa8d4 100644 --- a/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java +++ b/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java @@ -24,16 +24,12 @@ /* @test * @bug 4134233 * @bug 4213186 - * * @summary synopsis: ActivationSystem.unregisterGroup should unregister objects in group * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build ActivateMe CallbackInterface - * @build UnregisterGroup - * @build UnregisterGroup_Stub - * @build Callback_Stub + * @build TestLibrary RMID ActivationLibrary + * ActivateMe CallbackInterface UnregisterGroup_Stub Callback_Stub * @run main/othervm/policy=security.policy/timeout=480 UnregisterGroup */ diff --git a/test/java/rmi/activation/CommandEnvironment/NullOptions.java b/test/java/rmi/activation/CommandEnvironment/NullOptions.java index 3ef97e8d77ce66a701dc41f5d0617bb2dd238b46..a1ec946c21b4b505c5c15c695ef266c87274ddeb 100644 --- a/test/java/rmi/activation/CommandEnvironment/NullOptions.java +++ b/test/java/rmi/activation/CommandEnvironment/NullOptions.java @@ -27,7 +27,6 @@ * ActivationGroupDesc.CommandEnvironment * @author Ann Wollrath * - * @build NullOptions * @run main/othervm/timeout=240 NullOptions */ diff --git a/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java b/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java index d89450d615178363fc98945996863fa63b94344d..7b1a9688ad44ffd119f7065f0fd800cbce633a83 100644 --- a/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java +++ b/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java @@ -35,9 +35,10 @@ * @author Adrian Colley * * @library ../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build Eliza Retireable Doctor Doctor_Stub SetChildEnv - * @run main/othervm/timeout=240/policy=security.policy -Djava.compiler=NONE SetChildEnv + * @build TestLibrary RMID ActivationLibrary + * Eliza Retireable Doctor Doctor_Stub + * @run main/othervm/timeout=240/policy=security.policy + * -Djava.compiler=NONE SetChildEnv */ import java.rmi.*; import java.util.Properties; diff --git a/test/java/rmi/activation/checkusage/CheckUsage.java b/test/java/rmi/activation/checkusage/CheckUsage.java index 66ff7ad944551995434378c98820a5133099dfc1..2b514e1f37076ed77f8645b7050df8734d337ac8 100644 --- a/test/java/rmi/activation/checkusage/CheckUsage.java +++ b/test/java/rmi/activation/checkusage/CheckUsage.java @@ -25,7 +25,7 @@ * @bug 4259564 * * @library ../../testlibrary - * @build TestLibrary JavaVM CheckUsage + * @build TestLibrary JavaVM * @run main/othervm CheckUsage */ diff --git a/test/java/rmi/activation/log/LogTest.java b/test/java/rmi/activation/log/LogTest.java index 2e503b916a40f046c00c201d769ccd8c7e621165..53efeb49cedcdf5a81e1ac9b9aa4f58e2e5068ae 100644 --- a/test/java/rmi/activation/log/LogTest.java +++ b/test/java/rmi/activation/log/LogTest.java @@ -29,7 +29,6 @@ * boundaries * @author Ann Wollrath * - * @build LogTest * @run main/othervm/timeout=240 LogTest */ diff --git a/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java b/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java index 345aca33a608c4e5587fb29a032e2ab566780414..4611a83bda51f57c2effac507b9054df696f4cc8 100644 --- a/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java +++ b/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java @@ -29,8 +29,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build RMID ActivationLibrary - * @build InheritedChannelNotServerSocket + * @build TestLibrary RMID ActivationLibrary * @run main/othervm/timeout=240 InheritedChannelNotServerSocket */ diff --git a/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java b/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java index 008b391acc4859a7afdd49e6a2e4f7939504ca95..be9234d2fb96e8ac248e8ad4f0251875af2a8f2b 100644 --- a/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java +++ b/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java @@ -27,9 +27,7 @@ * @author Ann Wollrath * * @library ../../testlibrary - * @build RMID ActivationLibrary - * @build RmidViaInheritedChannel - * @build TestLibrary + * @build TestLibrary RMID ActivationLibrary * @run main/othervm/timeout=240 RmidViaInheritedChannel */ diff --git a/test/java/rmi/dgc/VMID/CheckVMID.java b/test/java/rmi/dgc/VMID/CheckVMID.java index dcdc9fd2ccff17404a8b4c347149cc3192e9a4cb..0b69ff4cc30d6acef7f060aaced2e6311038d609 100644 --- a/test/java/rmi/dgc/VMID/CheckVMID.java +++ b/test/java/rmi/dgc/VMID/CheckVMID.java @@ -30,7 +30,7 @@ * @author Ann Wollrath * * @library ../../testlibrary - * @build CheckVMID + * @build TestLibrary * @run main/othervm/policy=security.policy CheckVMID */ diff --git a/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java b/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java index c416063113a728f29c6c93781aa7792c68ffc390..6a47245dec9050757a69919825088b36084ea343 100644 --- a/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java +++ b/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java @@ -30,8 +30,7 @@ * rather than pinning it indefinitely. * @author Peter Jones * - * @build DGCAckFailure - * @build DGCAckFailure_Stub + * @build DGCAckFailure DGCAckFailure_Stub * @run main/othervm DGCAckFailure */ diff --git a/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java b/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java index 246c2b541a390f86722fc2168cf6438e3ce4275c..4043268838d1b52908356be17786959f15d2ff61 100644 --- a/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java +++ b/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java @@ -31,9 +31,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build TestLibrary - * @build DGCImplInsulation - * @build DGCImplInsulation_Stub + * @build TestLibrary DGCImplInsulation_Stub * @run main/othervm/policy=security.policy DGCImplInsulation */ diff --git a/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java b/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java index 10cb15f30eb2fedd98e8a69dca7b5cf18055caed..b2f0af6506b8d00d4daaa1cf3f834ad9be3eb74b 100644 --- a/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java +++ b/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java @@ -29,8 +29,7 @@ * renewing that lease at all after the first failure. * @author Peter Jones (inspired by Adrian Colley's test case in 4268258) * - * @build RetryDirtyCalls - * @build RetryDirtyCalls_Stub + * @build RetryDirtyCalls RetryDirtyCalls_Stub * @run main/othervm RetryDirtyCalls */ diff --git a/test/java/rmi/invalidName/InvalidName.java b/test/java/rmi/invalidName/InvalidName.java index 8d522f51592c1573af4703c061b66830db9844f2..74da1a5d53d28b5329840c12dce709ca9049f58c 100644 --- a/test/java/rmi/invalidName/InvalidName.java +++ b/test/java/rmi/invalidName/InvalidName.java @@ -32,7 +32,7 @@ * @author Laird Dornin * * @library ../testlibrary - * @build InvalidName + * @build TestLibrary * @run main/othervm InvalidName */ diff --git a/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java b/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java index 15b98fc851bec6d54c6b954c44a6eab98c47834e..08d030ec876ec8bf9ef4329e58edc4043b3d17cb 100644 --- a/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java +++ b/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java @@ -27,8 +27,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build StreamPipe TestParams TestLibrary JavaVM RMID - * @build AltSecurityManager TestSecurityManager + * @build TestLibrary JavaVM RMID TestSecurityManager * @run main/othervm AltSecurityManager */ diff --git a/test/java/rmi/registry/checkusage/CheckUsage.java b/test/java/rmi/registry/checkusage/CheckUsage.java index 71deb55ad9929a6735f78fd3000efe1f07b11802..19dac5b600ab3a1db2b4df42dd2a808ef538cf9f 100644 --- a/test/java/rmi/registry/checkusage/CheckUsage.java +++ b/test/java/rmi/registry/checkusage/CheckUsage.java @@ -27,7 +27,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build TestLibrary JavaVM CheckUsage + * @build TestLibrary JavaVM * @run main/othervm CheckUsage */ diff --git a/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java b/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java index 9e8cbba8bf68c37962f036b52f457a957c154d26..99ac5f091a6a59b159dc3331e674fa4671bc909b 100644 --- a/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java +++ b/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java @@ -30,7 +30,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build ClassPathCodebase Dummy TestLibrary + * @build TestLibrary Dummy * @run main/othervm/policy=security.policy ClassPathCodebase */ diff --git a/test/java/rmi/registry/interfaceHash/InterfaceHash.java b/test/java/rmi/registry/interfaceHash/InterfaceHash.java index 7782412571993e808c8bf9283717b0e4e78128ca..2eba1d6ac1a73707040a59b005ee99e811b1689b 100644 --- a/test/java/rmi/registry/interfaceHash/InterfaceHash.java +++ b/test/java/rmi/registry/interfaceHash/InterfaceHash.java @@ -36,9 +36,7 @@ * * @author Peter Jones * @library ../../testlibrary - * @build InterfaceHash - * @build ReferenceRegistryStub - * @build TestLibrary + * @build TestLibrary ReferenceRegistryStub * @run main/othervm InterfaceHash */ diff --git a/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java b/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java index e75a60989d7fe1f38297efadeec8a3eadf5f079d..1945ebe8db353bdfefcabe8be509e5826b2a66a6 100644 --- a/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java +++ b/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java @@ -28,7 +28,6 @@ * * @library ../../testlibrary * @build TestLibrary - * @build MultipleRegistries * @run main/othervm/timeout=240 MultipleRegistries */ diff --git a/test/java/rmi/registry/readTest/readTest.sh b/test/java/rmi/registry/readTest/readTest.sh index d7f1568f62c8bc3443b392c3c764ccec69882ba6..5fda0a5a314276b1229dbd314d20f079861439e0 100644 --- a/test/java/rmi/registry/readTest/readTest.sh +++ b/test/java/rmi/registry/readTest/readTest.sh @@ -76,7 +76,7 @@ case "$OS" in ;; esac # trailing / after code base is important for rmi codebase property. -${TESTJAVA}${FS}bin${FS}java -cp $TEST_CLASSPATH -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 & +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp $TEST_CLASSPATH -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 & TEST_PID=$! #bulk of testcase - let it run for a while sleep 5 diff --git a/test/java/rmi/registry/reexport/Reexport.java b/test/java/rmi/registry/reexport/Reexport.java index 042088e65af93a6bf5991e96584b84012be36460..c209f7c55b85eda6be22d64d3fa6a3b75f7652f0 100644 --- a/test/java/rmi/registry/reexport/Reexport.java +++ b/test/java/rmi/registry/reexport/Reexport.java @@ -25,9 +25,7 @@ * @bug 4120329 * @summary RMI registry creation is impossible if first attempt fails. * @library ../../testlibrary - * @build StreamPipe TestParams TestLibrary JavaVM - * @build RegistryRunner RegistryRunner_Stub - * @build Reexport + * @build TestLibrary JavaVM RegistryRunner RegistryRunner_Stub * @run main/othervm Reexport */ diff --git a/test/java/rmi/reliability/benchmark/runRmiBench.sh b/test/java/rmi/reliability/benchmark/runRmiBench.sh index cfa23f7781158fbc24b9148142436a97d509d447..98a31d1ddd19eadeb2a775d57b2a85a29f9e5d7d 100644 --- a/test/java/rmi/reliability/benchmark/runRmiBench.sh +++ b/test/java/rmi/reliability/benchmark/runRmiBench.sh @@ -27,20 +27,20 @@ # used to run the test under JTREG. # # @build bench.BenchInfo bench.HtmlReporter bench.Util bench.Benchmark -# @build bench.Reporter bench.XmlReporter bench.ConfigFormatException -# @build bench.Harness bench.TextReporter bench.rmi.BenchServer -# @build bench.rmi.DoubleArrayCalls bench.rmi.LongCalls bench.rmi.ShortCalls -# @build bench.rmi.BenchServerImpl bench.rmi.DoubleCalls -# @build bench.rmi.Main bench.rmi.SmallObjTreeCalls -# @build bench.rmi.BooleanArrayCalls bench.rmi.ExceptionCalls -# @build bench.rmi.NullCalls bench.rmi.BooleanCalls bench.rmi.ExportObjs -# @build bench.rmi.ObjArrayCalls bench.rmi.ByteArrayCalls -# @build bench.rmi.FloatArrayCalls bench.rmi.ObjTreeCalls -# @build bench.rmi.ByteCalls bench.rmi.FloatCalls bench.rmi.ProxyArrayCalls -# @build bench.rmi.CharArrayCalls bench.rmi.IntArrayCalls -# @build bench.rmi.RemoteObjArrayCalls bench.rmi.CharCalls bench.rmi.IntCalls -# @build bench.rmi.ClassLoading bench.rmi.LongArrayCalls -# @build bench.rmi.ShortArrayCalls bench.rmi.altroot.Node +# bench.Reporter bench.XmlReporter bench.ConfigFormatException +# bench.Harness bench.TextReporter bench.rmi.BenchServer +# bench.rmi.DoubleArrayCalls bench.rmi.LongCalls bench.rmi.ShortCalls +# bench.rmi.BenchServerImpl bench.rmi.DoubleCalls +# bench.rmi.Main bench.rmi.SmallObjTreeCalls +# bench.rmi.BooleanArrayCalls bench.rmi.ExceptionCalls +# bench.rmi.NullCalls bench.rmi.BooleanCalls bench.rmi.ExportObjs +# bench.rmi.ObjArrayCalls bench.rmi.ByteArrayCalls +# bench.rmi.FloatArrayCalls bench.rmi.ObjTreeCalls +# bench.rmi.ByteCalls bench.rmi.FloatCalls bench.rmi.ProxyArrayCalls +# bench.rmi.CharArrayCalls bench.rmi.IntArrayCalls +# bench.rmi.RemoteObjArrayCalls bench.rmi.CharCalls bench.rmi.IntCalls +# bench.rmi.ClassLoading bench.rmi.LongArrayCalls +# bench.rmi.ShortArrayCalls bench.rmi.altroot.Node # # @run shell/timeout=1800 runRmiBench.sh # diff --git a/test/java/rmi/reliability/benchmark/runSerialBench.sh b/test/java/rmi/reliability/benchmark/runSerialBench.sh index aac0d3ff7681509e3020a122d7b50bb90ead9381..82a2837bcff56709e9d3af2bc22a82dd772c1d16 100644 --- a/test/java/rmi/reliability/benchmark/runSerialBench.sh +++ b/test/java/rmi/reliability/benchmark/runSerialBench.sh @@ -51,7 +51,7 @@ echo "Starting serialization benchmark " $TESTJAVA/bin/java \ - -server \ + ${TESTVMOPTS} \ -cp $TESTCLASSES \ bench.serial.Main \ -c $TESTSRC/bench/serial/jtreg-config & diff --git a/test/java/rmi/reliability/juicer/AppleUserImpl.java b/test/java/rmi/reliability/juicer/AppleUserImpl.java index 2ed30c65ab802ff98b4569d96679926da32ae164..70b187e25bc115488ac57b1e46ac80e585cef028 100644 --- a/test/java/rmi/reliability/juicer/AppleUserImpl.java +++ b/test/java/rmi/reliability/juicer/AppleUserImpl.java @@ -55,11 +55,10 @@ * has been reached. * * @library ../../testlibrary - * - * @build Apple AppleEvent AppleImpl AppleUserImpl - * @build Orange OrangeEcho OrangeEchoImpl OrangeImpl - * @build ApplicationServer * @build TestLibrary + * Apple AppleEvent AppleImpl + * Orange OrangeEcho OrangeEchoImpl OrangeImpl + * ApplicationServer * * @run main/othervm/policy=security.policy AppleUserImpl -seconds 30 * diff --git a/test/java/rmi/server/ObjID/randomIDs/RandomIDs.java b/test/java/rmi/server/ObjID/randomIDs/RandomIDs.java index 9c20ab40dfbbd4c3fb3dc9fbde894166ab52c9b6..ebe7192f38242f7761d67adba4138e346219b328 100644 --- a/test/java/rmi/server/ObjID/randomIDs/RandomIDs.java +++ b/test/java/rmi/server/ObjID/randomIDs/RandomIDs.java @@ -30,7 +30,6 @@ * ObjID() should still generate sequential object numbers. * @author Peter Jones * - * @build RandomIDs * @run main/othervm RandomIDs random * @run main/othervm -Djava.rmi.server.randomIDs=true RandomIDs random * @run main/othervm -Djava.rmi.server.randomIDs=false RandomIDs sequential diff --git a/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java b/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java index fba4939a35c3c6d934bc05cbb130cc75be7f0b84..6187f0cb17e0a0920902e6b622618215f284da0b 100644 --- a/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java +++ b/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java @@ -33,9 +33,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build DelegateBeforePermissionCheck - * @build Foo + * @build TestLibrary Foo * @run main/othervm DelegateBeforePermissionCheck */ diff --git a/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java b/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java index 51b5bd4f88f7f6dec37132ce0000886432906b8f..7ae4c5ee9ba29cc5acc14eebb081f1bf998ccf63 100644 --- a/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java +++ b/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java @@ -29,7 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build DelegateToContextLoader Dummy + * @build TestLibrary Dummy * @run main/othervm/policy=security.policy/timeout=120 DelegateToContextLoader */ diff --git a/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java b/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java index 34a21bd465151c23d5ff77b81ef79ab845760fda..9df187ab3a34ab5b868d3519e940ce0131790049 100644 --- a/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java +++ b/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java @@ -31,11 +31,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Receiver - * @build DownloadArrayClass - * @build DownloadArrayClass_Stub - * @build Foo + * @build TestLibrary Receiver DownloadArrayClass_Stub Foo * @run main/othervm/policy=security.policy DownloadArrayClass */ diff --git a/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java b/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java index 0a0cfb70e6768f8c1c4e205a26162e8cb9c11089..5167fc40c2b67f997b740da686a7de026660be08 100644 --- a/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java +++ b/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java @@ -29,7 +29,6 @@ * * @library ../../../testlibrary * @build TestLibrary - * @build NullClass * @run main/othervm NullClass */ diff --git a/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java b/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java index f54a5cf0b9ed7f724a0936b5152e147512f43d6f..10a9cc9b4ac9bff8a3f845d974ca0007a860454f 100644 --- a/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java +++ b/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java @@ -29,9 +29,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build TestLibrary - * @build GetClassLoader - * @build Foo + * @build TestLibrary Foo * @run main/othervm/policy=security.policy GetClassLoader */ diff --git a/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java b/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java index 4feed266e96049d1a06a31e88ed06e9e07547ac7..6d29cb2468f4ea1945c0a2aa9cbfe7ae3c466e05 100644 --- a/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java +++ b/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java @@ -30,8 +30,8 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary FnnClass FnnUnmarshal LoadProxyClasses NonpublicInterface - * @build NonpublicInterface1 PublicInterface PublicInterface1 + * @build TestLibrary FnnClass FnnUnmarshal NonpublicInterface + * NonpublicInterface1 PublicInterface PublicInterface1 * @run main/othervm/policy=security.policy LoadProxyClasses */ diff --git a/test/java/rmi/server/RMIClassLoader/noSecurityManager/NoSecurityManager.java b/test/java/rmi/server/RMIClassLoader/noSecurityManager/NoSecurityManager.java index 182db1c69cbcfd1efa1975a91b8e4d2d48b34bc2..93a33b91dd26898eca6166028e53ab035c56a20c 100644 --- a/test/java/rmi/server/RMIClassLoader/noSecurityManager/NoSecurityManager.java +++ b/test/java/rmi/server/RMIClassLoader/noSecurityManager/NoSecurityManager.java @@ -30,7 +30,7 @@ * been used for the RMI class loader instance. * @author Peter Jones * - * @build NoSecurityManager Dummy LocalDummy + * @build Dummy LocalDummy * @run main/othervm/timeout=120 NoSecurityManager */ diff --git a/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java b/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java index 56cd08d2bc1fa717333edb1bca06114d943713c7..de3d79b60f64bd864e11eafba3891f977a06667d 100644 --- a/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java +++ b/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java @@ -30,11 +30,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build ContextInsulation - * @build ServiceConfiguration - * @build TestProvider - * @build TestProvider2 + * @build TestLibrary ServiceConfiguration TestProvider TestProvider2 * @run main/othervm/policy=security.policy ContextInsulation */ diff --git a/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java b/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java index 4cb8169ab8a8e6ad50913a4ace432b640e00ee56..f91ef3d1893d1f4bd9a2a9701b28a4284e87c220 100644 --- a/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java +++ b/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java @@ -29,10 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build DefaultProperty - * @build ServiceConfiguration - * @build Foo + * @build TestLibrary ServiceConfiguration Foo * @run main/othervm/policy=security.policy DefaultProperty */ diff --git a/test/java/rmi/server/RMIClassLoader/spi/Installed.java b/test/java/rmi/server/RMIClassLoader/spi/Installed.java index 23ce956b334249e3eae6e5caba2093d60d76616e..d32a8af596d960caa12805c159223aed6c84d35b 100644 --- a/test/java/rmi/server/RMIClassLoader/spi/Installed.java +++ b/test/java/rmi/server/RMIClassLoader/spi/Installed.java @@ -29,11 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Installed - * @build ServiceConfiguration - * @build TestProvider - * @build TestProvider2 + * @build TestLibrary ServiceConfiguration TestProvider TestProvider2 * @run main/othervm/policy=security.policy Installed */ diff --git a/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java b/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java index e7b157c64801e7e9fbff478f3d6a61f0dd47da5b..d41cef1d924a8f36288da71dd2e542974b49d758 100644 --- a/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java +++ b/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java @@ -29,9 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build InvalidProperty - * @build ServiceConfiguration + * @build TestLibrary ServiceConfiguration * @run main/othervm/policy=security.policy InvalidProperty */ diff --git a/test/java/rmi/server/RMIClassLoader/spi/Property.java b/test/java/rmi/server/RMIClassLoader/spi/Property.java index 427e5a3160e1f8fdaabf1fe9979675fc4462cf1d..6113a6ecb7bd090d3bd4cf22141d37b3bef83a30 100644 --- a/test/java/rmi/server/RMIClassLoader/spi/Property.java +++ b/test/java/rmi/server/RMIClassLoader/spi/Property.java @@ -29,10 +29,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Property - * @build ServiceConfiguration - * @build TestProvider + * @build TestLibrary ServiceConfiguration TestProvider * @run main/othervm/policy=security.policy Property */ diff --git a/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java b/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java index cd79782c46e5791fd41a9932a26179c6a23f9295..dc8083705266a824651b06439a730e61f568f7e3 100644 --- a/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java +++ b/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java @@ -31,12 +31,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build Receiver - * @build UseCodebaseOnly - * @build UseCodebaseOnly_Stub - * @build Foo - * @build Bar + * @build TestLibrary Receiver UseCodebaseOnly_Stub Foo Bar * @run main/othervm/policy=security.policy UseCodebaseOnly */ diff --git a/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java b/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java index 295b9944a771c1db5cffab20b5552965cd1e81be..d80907e0a2b8e262973a48fdea6d5dec96698e0b 100644 --- a/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java +++ b/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java @@ -30,8 +30,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build UseGetURLs Dummy + * @build TestLibrary Dummy * @run main/othervm/policy=security.policy/timeout=120 UseGetURLs */ diff --git a/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java b/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java index 5868c583b28d688641b56efec28d93691ac96970..5f032ec58cf759b0c59ff758aee60edbe13a3fa4 100644 --- a/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java +++ b/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java @@ -28,11 +28,7 @@ * @author Ann Wollrath * * @library ../../../../testlibrary - * @build Echo - * @build EchoImpl - * @build EchoImpl_Stub - * @build UseCustomSocketFactory - * @build TestLibrary + * @build TestLibrary Echo EchoImpl EchoImpl_Stub * @run main/othervm/policy=security.policy/timeout=360 UseCustomSocketFactory */ diff --git a/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java b/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java index ba6106883696ab3a65d059d838e12d909b435c45..774e823e8571cfbeb8513b1c84b2a956e28571e2 100644 --- a/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java +++ b/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java @@ -29,12 +29,7 @@ * @author Laird Dornin; code borrowed from Ann Wollrath * * @library ../../../../testlibrary - * @build Hello - * @build HelloImpl - * @build HelloImpl_Stub - * @build TestLibrary - * @build UseCustomSocketFactory - * @build Compress + * @build TestLibrary Compress Hello HelloImpl HelloImpl_Stub * @run main/othervm/policy=security.policy/timeout=240 UseCustomSocketFactory */ diff --git a/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java b/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java index 13766abd848f7af63309ffea239b00ca6ca26f15..06571df79c11507d1c406dc04b2a74bd4dc2d594 100644 --- a/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java +++ b/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java @@ -29,11 +29,7 @@ * @author Ann Wollrath * * @library ../../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build Echo - * @build EchoImpl - * @build EchoImpl_Stub - * @build UseCustomSocketFactory + * @build TestLibrary RMID JavaVM Echo EchoImpl EchoImpl_Stub * @run main/othervm/policy=security.policy/timeout=120 UseCustomSocketFactory */ diff --git a/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java b/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java index 0023fc5f0c1bed176e9823f6ba1ce3eba42aa52f..ef524a4dd8a000760ead798d8750fa6de99635d9 100644 --- a/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java +++ b/test/java/rmi/server/RemoteObject/notExtending/NotExtending.java @@ -29,9 +29,7 @@ * (specifically: stubs) that contain the instance's RemoteRef. * @author Peter Jones * - * @build NotExtending - * @build NotExtending_Stub - * @build NotExtending_Skel + * @build NotExtending_Stub NotExtending_Skel * @run main/othervm/timeout=240 NotExtending */ diff --git a/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java b/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java index 8b6bccab9a800a1427d89a393fbbce5ecc73c927..b89e3625e3d1497a96d9d6503134e424a63a3fd2 100644 --- a/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java +++ b/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java @@ -21,16 +21,16 @@ * questions. */ -/** +/* * @test * @bug 4251010 * @summary equals does not works on stub objects created with * custom socket AndFactory - * @library ../../../testlibrary + * @author Laird Dornin * - * @build VerifyRemoteEquals + * @library ../../../testlibrary + * @build TestLibrary * @run main/othervm/timeout=40 VerifyRemoteEquals - * @author Laird Dornin */ import java.io.*; diff --git a/test/java/rmi/server/RemoteServer/AddrInUse.java b/test/java/rmi/server/RemoteServer/AddrInUse.java index 9ab8e50d65b1142869c719f73e8b5c4eaf9d801e..34e343b61932b9261183e489aa01741a5d834fb3 100644 --- a/test/java/rmi/server/RemoteServer/AddrInUse.java +++ b/test/java/rmi/server/RemoteServer/AddrInUse.java @@ -26,8 +26,6 @@ * @summary retryServerSocket should not retry on BindException * @author Ann Wollrath * - * @library ../../testlibrary - * @build AddrInUse * @run main/othervm AddrInUse */ diff --git a/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java b/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java index 0716c1a9b1ed4f0197c633f4733f7190124e385a..523c3a08f4ae6c532bd691717278c920f03e1d51 100644 --- a/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java +++ b/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java @@ -31,8 +31,7 @@ * * @author Ann Wollrath * - * @build ChangeHostName - * @build ChangeHostName_Stub + * @build ChangeHostName ChangeHostName_Stub * @run main/othervm ChangeHostName */ diff --git a/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java b/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java index 59663db7dea99cb087096565999c7d46e9a78a54..def2806964dc1333126220c4df8a08d442537403 100644 --- a/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java +++ b/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java @@ -30,6 +30,7 @@ * @bug 6597112 * @summary GC'ing objects whilst being exported to RMI should not cause exceptions * @author Neil Richards , + * @run main GcDuringExport */ import java.rmi.Remote; diff --git a/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java b/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java index dbe2ffe2157e6c4f51381c628e521d61963b9e6b..780e7e5c7f17c6f46fabda2859e50447ba467793 100644 --- a/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java +++ b/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java @@ -32,14 +32,8 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build JavaVM - * @build KeepAliveDuringCall - * @build KeepAliveDuringCall_Stub - * @build ShutdownMonitor - * @build Shutdown - * @build ShutdownImpl - * @build ShutdownImpl_Stub + * @build TestLibrary JavaVM KeepAliveDuringCall_Stub + * ShutdownMonitor Shutdown ShutdownImpl ShutdownImpl_Stub * @run main/othervm KeepAliveDuringCall */ diff --git a/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java b/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java index 743d4611f5f0d7a49d4104b5342fe1dca305d9b3..a165dd81783a582875bca04107d222c8382f3562 100644 --- a/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java +++ b/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java @@ -31,8 +31,7 @@ * IOException (see fix for bugid 4017232). * @author Peter Jones * - * @build MarshalAfterUnexport - * @build MarshalAfterUnexport_Stub + * @build MarshalAfterUnexport MarshalAfterUnexport_Stub * @run main/othervm MarshalAfterUnexport */ diff --git a/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java b/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java index ea1e482fc39db4821ab217a638a4d1ac053f8d10..b72efa456cf55217b7d21edd466890c48ad3da61 100644 --- a/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java +++ b/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java @@ -33,8 +33,7 @@ * @author Peter Jones * @author Ann Wollrath * - * @build MarshalAfterUnexport2 - * @build MarshalAfterUnexport2_Stub + * @build MarshalAfterUnexport2 MarshalAfterUnexport2_Stub * @run main/othervm MarshalAfterUnexport2 */ diff --git a/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java b/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java index 60325dcaa1ed7dcf79ed8abdb49dddf972feebc8..62804feb6e013447a61b5a7cce1964b80530a6a6 100644 --- a/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java +++ b/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java @@ -29,10 +29,7 @@ * @author Ann Wollrath * * @library ../../../testlibrary - * @build UnexportLeak - * @build UnexportLeak_Stub - * @build TestLibrary - * @build Ping + * @build TestLibrary UnexportLeak_Stub Ping * @run main/othervm UnexportLeak */ diff --git a/test/java/rmi/server/Unmarshal/PrimitiveClasses.java b/test/java/rmi/server/Unmarshal/PrimitiveClasses.java index 8d7b30dbf668be37e0693facf32cd157c7f94f64..b9dfb0c300ecfd5794d5925c46c553511e850200 100644 --- a/test/java/rmi/server/Unmarshal/PrimitiveClasses.java +++ b/test/java/rmi/server/Unmarshal/PrimitiveClasses.java @@ -25,6 +25,7 @@ * @bug 4442373 * @summary Verify that RMI can successfully unmarshal Class objects for * primitive types. + * @run main PrimitiveClasses */ import java.rmi.MarshalledObject; diff --git a/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshall.java b/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshal.java similarity index 100% rename from test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshall.java rename to test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshal.java diff --git a/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java b/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java index 60dce669c51365a75f8ae1104c4c3407ed7f7ecc..95dee537d21516013e94456e7dbbc6c410debc47 100644 --- a/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java +++ b/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java @@ -31,10 +31,8 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build TestLibrary RMID JavaVM StreamPipe - * @build CheckUnmarshall PoisonPill RuntimeExceptionParameter - * @build CheckUnmarshalOnStopThread - * @build CheckUnmarshalOnStopThread_Stub + * @build TestLibrary CheckUnmarshal CheckUnmarshalOnStopThread_Stub + * PoisonPill RuntimeExceptionParameter * @run main/othervm/timeout=480 CheckUnmarshalOnStopThread */ diff --git a/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java b/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java index 7b7317a8d9b8d3dd52ebe8ae94e6b5aa383deb22..f15883ca8066d43c195128f53c6c90377ad9a147 100644 --- a/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java +++ b/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java @@ -35,9 +35,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build FiniteGCLatency - * @build FiniteGCLatency_Stub - * @build TestLibrary + * @build TestLibrary FiniteGCLatency_Stub * @run main/othervm/timeout=120 FiniteGCLatency */ diff --git a/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java b/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java index c1d5c5796246cbcf97ea26ceb0b526ecd21e5843..b488e762f9aecdd6f5be4bf4fab90534b8b56f9a 100644 --- a/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java +++ b/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java @@ -37,11 +37,7 @@ * @author Peter Jones * * @library ../../../testlibrary - * @build TestLibrary - * @build JavaVM - * @build LeaseCheckInterval - * @build LeaseCheckInterval_Stub - * @build SelfTerminator + * @build TestLibrary JavaVM LeaseCheckInterval_Stub SelfTerminator * @run main/othervm LeaseCheckInterval */ diff --git a/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java b/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java index 8170168d9d8090bd694b2549cccc31ef569a7249..0ae059b95b2a4afa8b62789d0b3da7917c3286bb 100644 --- a/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java +++ b/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java @@ -30,8 +30,6 @@ * invoked. * @author Peter Jones * - * @library ../../../testlibrary - * @build MarshalledObjectGet * @build MarshalledObjectGet_Stub * @run main/othervm/timeout=120 MarshalledObjectGet */ diff --git a/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java b/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java index eb9d19287730ee74cbe16d49100ca1ba99b70d21..05be7aed087a6b19e391b830ef54b6b4c4e8c1c9 100644 --- a/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java +++ b/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java @@ -39,9 +39,7 @@ * @author Laird Dornin * * @library ../../../testlibrary - * @build UnreferencedContext - * @build UnreferencedContext_Stub - * @build TestLibrary + * @build TestLibrary UnreferencedContext_Stub * @run main/othervm/timeout=120 UnreferencedContext */ diff --git a/test/java/rmi/server/clientStackTrace/ClientStackTrace.java b/test/java/rmi/server/clientStackTrace/ClientStackTrace.java index 41a2103be30063aaf05d941704305dee74b690d8..d68555759420e2a555e6b60afc7c6a350b0b28c3 100644 --- a/test/java/rmi/server/clientStackTrace/ClientStackTrace.java +++ b/test/java/rmi/server/clientStackTrace/ClientStackTrace.java @@ -28,7 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build ClientStackTrace MyRemoteObject_Stub TestLibrary TestParams + * @build TestLibrary ClientStackTrace MyRemoteObject_Stub * @run main/othervm/policy=security.policy/timeout=120 ClientStackTrace */ diff --git a/test/java/rmi/server/getRemoteClass/GetRemoteClass.java b/test/java/rmi/server/getRemoteClass/GetRemoteClass.java index 8fa471006cc4387ab6c845b7caa8a95d1fdf5d68..b6f21b46ef5f42cb8ad4af9fdd7db4c07ba29365 100644 --- a/test/java/rmi/server/getRemoteClass/GetRemoteClass.java +++ b/test/java/rmi/server/getRemoteClass/GetRemoteClass.java @@ -28,7 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build GetRemoteClass TestLibrary TestParams + * @build TestLibrary * @run main/othervm GetRemoteClass */ diff --git a/test/java/rmi/server/serverStackTrace/ServerStackTrace.java b/test/java/rmi/server/serverStackTrace/ServerStackTrace.java index 6cc9b2da119b71f176d0bdd40594d8207007c991..43504affe283d214f33b65c867408e0e23eb4ff7 100644 --- a/test/java/rmi/server/serverStackTrace/ServerStackTrace.java +++ b/test/java/rmi/server/serverStackTrace/ServerStackTrace.java @@ -29,8 +29,7 @@ * serialized with the Throwable from the server. * @author Peter Jones * - * @build ServerStackTrace - * @build ServerStackTrace_Stub + * @build ServerStackTrace ServerStackTrace_Stub * @run main/othervm ServerStackTrace */ diff --git a/test/java/rmi/server/serverStackTrace/SuppressStackTraces.java b/test/java/rmi/server/serverStackTrace/SuppressStackTraces.java index 243d3223f0a4b72ef251fb71c645a348fc7e09ee..9606d12f9d8a2b302c52e7bfd48c1fd43fd85f4c 100644 --- a/test/java/rmi/server/serverStackTrace/SuppressStackTraces.java +++ b/test/java/rmi/server/serverStackTrace/SuppressStackTraces.java @@ -36,10 +36,7 @@ * for reasons of performance or confidentiality requirements. * @author Peter Jones * - * @build SuppressStackTraces - * @build Impl2_Stub - * @build Impl1_Stub - * @build Impl1_Skel + * @build SuppressStackTraces Impl2_Stub Impl1_Stub Impl1_Skel * @run main/othervm SuppressStackTraces */ diff --git a/test/java/rmi/server/useCustomRef/UseCustomRef.java b/test/java/rmi/server/useCustomRef/UseCustomRef.java index 059c9a849c3db6aaa3283353f34ba3e09080658e..23d784706ca41bfbac1df2e74f54a1b13afe60ea 100644 --- a/test/java/rmi/server/useCustomRef/UseCustomRef.java +++ b/test/java/rmi/server/useCustomRef/UseCustomRef.java @@ -31,11 +31,7 @@ * 4180392 * * @library ../../testlibrary - * @build UseCustomRef - * @build Ping - * @build UseCustomRef_Stub - * @build UseCustomRef_Skel - * @build TestLibrary + * @build TestLibrary Ping UseCustomRef_Stub UseCustomRef_Skel * @run main/othervm/policy=security.policy/secure=java.rmi.RMISecurityManager/timeout=120 UseCustomRef * * This test was failing to run because the synthetic access 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/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java b/test/java/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java index a2361373644d3bd8f30583c9ed6f1839a1fc7da3..b4d86c4ccd22e566a954b69d844cd096f9629376 100644 --- a/test/java/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java +++ b/test/java/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java @@ -31,7 +31,6 @@ * exception for which it doesn't even consult the RMIFailureHandler. * @author Peter Jones * - * @build CloseServerSocketOnTermination * @run main/othervm CloseServerSocketOnTermination */ diff --git a/test/java/rmi/transport/checkFQDN/CheckFQDN.java b/test/java/rmi/transport/checkFQDN/CheckFQDN.java index 006de5b6c89544e88d89b7cccc6957a9d9cdff23..9660f532c39905179d9b1ea4246b0f36bc846a45 100644 --- a/test/java/rmi/transport/checkFQDN/CheckFQDN.java +++ b/test/java/rmi/transport/checkFQDN/CheckFQDN.java @@ -33,8 +33,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build CheckFQDN CheckFQDNClient CheckFQDN_Stub TellServerName - * @build TestLibrary + * @build TestLibrary CheckFQDNClient CheckFQDN_Stub TellServerName * @run main/othervm/timeout=120 CheckFQDN */ diff --git a/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java b/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java index 0ab00577dc83fca54722397938b484af17d180b8..52fd7df9295d86d64d5be82f868b444e711da28a 100644 --- a/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java +++ b/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java @@ -28,8 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build CheckLeaseLeak CheckLeaseLeak_Stub LeaseLeakClient LeaseLeak - * @build TestLibrary + * @build TestLibrary CheckLeaseLeak_Stub LeaseLeakClient LeaseLeak * @run main/othervm/timeout=240 CheckLeaseLeak * */ diff --git a/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java b/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java index 69c51de80744ab7f23f2026004a3f43126ffdfda..2b1f1eeba992a42aa2b4daecb8263367eceab03d 100644 --- a/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java +++ b/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java @@ -31,7 +31,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build CloseServerSocket TestLibrary + * @build TestLibrary * @run main/othervm CloseServerSocket */ diff --git a/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java b/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java index 97ad31dc99db23429fb1485acda4b74c6581db20..bcd58a0a6a5a5218d700db69a63230e4b5ce5ecf 100644 --- a/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java +++ b/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java @@ -28,11 +28,7 @@ * @author Laird Dornin * * @library ../../testlibrary - * @build DGCDeadLock - * @build Test - * @build TestImpl - * @build TestImpl_Stub - * @build TestLibrary + * @build TestLibrary Test TestImpl TestImpl_Stub * @run main/othervm/policy=security.policy/timeout=360 DGCDeadLock */ diff --git a/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java b/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java index df04070f138b1a4840865da2dd20ba2cbc50fda7..ed1ba8e0715479100c487d79819f6b13eb5ed958 100644 --- a/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java +++ b/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java @@ -31,7 +31,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build HandshakeFailure TestLibrary + * @build TestLibrary * @run main/othervm HandshakeFailure */ diff --git a/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java b/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java index 304c175772bac2c4418981dcaa22c9bf3513aee8..ba492f4194dea73ef7186edd85b5671af31fa591 100644 --- a/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java +++ b/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java @@ -34,7 +34,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build HandshakeTimeout TestLibrary + * @build TestLibrary * @run main/othervm HandshakeTimeout */ diff --git a/test/java/rmi/transport/httpSocket/HttpSocketTest.java b/test/java/rmi/transport/httpSocket/HttpSocketTest.java index 1004bfb86ed5a620e31d42876f655d163736bad1..032c4cdc532172cf5738df835a88603efa608665 100644 --- a/test/java/rmi/transport/httpSocket/HttpSocketTest.java +++ b/test/java/rmi/transport/httpSocket/HttpSocketTest.java @@ -27,7 +27,7 @@ * @author Dana Burns * * @library ../../testlibrary - * @build HttpSocketTest HttpSocketTest_Stub TestLibrary + * @build TestLibrary HttpSocketTest HttpSocketTest_Stub * @run main/othervm/policy=security.policy HttpSocketTest */ diff --git a/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java b/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java index 5b21da8680a44377c38a413d43eafda7b436dbab..4080bfa7e74b5d13ed445918fbc798fa8d70d303 100644 --- a/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java +++ b/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java @@ -32,7 +32,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build TestLibrary RapidExportUnexport + * @build TestLibrary * @run main/othervm RapidExportUnexport */ diff --git a/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java b/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java index f72fea3164a03e2e951f35d651c7c35e0d64cef4..3a0bfa1cafa1ec7f7cc97ec0e8b8ced7000818fc 100644 --- a/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java +++ b/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java @@ -27,12 +27,9 @@ * @summary Incoming connections should be subject to timeout * @author Adrian Colley * - * @library ../../testlibrary - * @build TestIface - * @build TestImpl - * @build TestImpl_Stub - * @build ReadTimeoutTest - * @run main/othervm/policy=security.policy/timeout=60 -Dsun.rmi.transport.tcp.readTimeout=5000 ReadTimeoutTest + * @build TestIface TestImpl TestImpl_Stub + * @run main/othervm/policy=security.policy/timeout=60 + * -Dsun.rmi.transport.tcp.readTimeout=5000 ReadTimeoutTest */ /* This test sets a very short read timeout, exports an object, and then diff --git a/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java b/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java index decec588d01b17f2a378c7d3393041c5cb61ede1..e5e7d80b49f5b89012b3b375da912ef23af4df73 100644 --- a/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java +++ b/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java @@ -34,7 +34,7 @@ * @author Peter Jones * * @library ../../testlibrary - * @build ReuseDefaultPort TestLibrary + * @build TestLibrary * @run main/othervm ReuseDefaultPort */ diff --git a/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java b/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java index 04a931daf9b3657bb64f34ac5b20c663d54ffc06..ac480776229ab18e70a99cc35efe46d47175aa78 100644 --- a/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java +++ b/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java @@ -38,7 +38,6 @@ * subsystems also not holding on to the loader in their daemon threads.] * @author Peter Jones * - * @build RuntimeThreadInheritanceLeak * @build RuntimeThreadInheritanceLeak_Stub * @run main/othervm RuntimeThreadInheritanceLeak */ diff --git a/test/java/security/BasicPermission/Wildcard.java b/test/java/security/BasicPermission/Wildcard.java new file mode 100644 index 0000000000000000000000000000000000000000..3b6d1c58eead9ed5e83ec8e6f41854c55a4ba1c3 --- /dev/null +++ b/test/java/security/BasicPermission/Wildcard.java @@ -0,0 +1,54 @@ +/* + * 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.lang.RuntimePermission; +import java.net.NetPermission; +import java.sql.SQLPermission; +import java.util.PropertyPermission; +import javax.net.ssl.SSLPermission; + +/* + * @test + * @bug 7167056 + * @summary Check that BasicPermission subclasses don't throw exception if name + * contains wildcard character ("*") but does not signify a + * wildcard match + */ + +public class Wildcard { + + public static void main(String[] args) throws Exception { + wildcard("*java"); + wildcard("java*"); + wildcard("ja*va"); + } + + private static void wildcard(String wildcard) throws Exception { + new RuntimePermission(wildcard); + new NetPermission(wildcard); + new SQLPermission(wildcard); + new PropertyPermission(wildcard, "read"); + new SSLPermission(wildcard); + new com.sun.net.ssl.SSLPermission(wildcard); + } +} diff --git a/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh b/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh index a503697dc73603ab3c8c76739b69b07655e37ab8..a62cba4ec3a80b8ed6e7e91681ece34cfe31bfd2 100644 --- a/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh +++ b/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh @@ -87,7 +87,7 @@ ${TESTJAVA}${FILESEP}bin${FILESEP}javac \ ${TESTSRC}${FILESEP}provider${FILESEP}HashProvider.java # run the test -${TESTJAVA}${FILESEP}bin${FILESEP}java \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" \ -Djava.awt.headless=true \ ClassLoaderDeadlock diff --git a/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh b/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh index 53555ee26ffdb9594f48a1b36a6dc2c35ddc0b9c..e1ed14425fa5c4c0e6008cfa935e5f1551b1317f 100644 --- a/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh +++ b/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh @@ -62,5 +62,5 @@ esac JAVA="${TESTJAVA}${FILESEP}bin${FILESEP}java" -${JAVA} -cp "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" Deadlock +${JAVA} ${TESTVMOPTS} -cp "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" Deadlock diff --git a/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh b/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh index 1109496c723a28fe766814a23e078e852b2c4f4a..acf8ff21033b21f1e96c54c60efae91a35f14bae 100644 --- a/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh +++ b/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh @@ -100,8 +100,8 @@ ${TESTJAVA}${FILESEP}bin${FILESEP}jar \ rm Deadlock2*.class # create serialized object and run the test -${TESTJAVA}${FILESEP}bin${FILESEP}java CreateSerialized -${TESTJAVA}${FILESEP}bin${FILESEP}java -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib Deadlock2 +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} CreateSerialized +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib Deadlock2 STATUS=$? # clean up diff --git a/test/java/security/Security/signedfirst/Dyn.sh b/test/java/security/Security/signedfirst/Dyn.sh index d87e5ff01391b82332c6645eace37b3e6362a089..64d0dd3f77512dfdb899fbfbfdf299be3f85af4b 100644 --- a/test/java/security/Security/signedfirst/Dyn.sh +++ b/test/java/security/Security/signedfirst/Dyn.sh @@ -83,7 +83,7 @@ ${TESTJAVA}${FILESEP}bin${FILESEP}javac \ ${TESTSRC}${FILESEP}DynSignedProvFirst.java # run the test -${TESTJAVA}${FILESEP}bin${FILESEP}java \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \ DynSignedProvFirst diff --git a/test/java/security/Security/signedfirst/Static.sh b/test/java/security/Security/signedfirst/Static.sh index 6b41adf31adbf94d8ccdea28765b72c1c09b1d37..544a3b1a3ffd87d1e3a01034405c06b6548f9497 100644 --- a/test/java/security/Security/signedfirst/Static.sh +++ b/test/java/security/Security/signedfirst/Static.sh @@ -84,7 +84,7 @@ ${TESTJAVA}${FILESEP}bin${FILESEP}javac \ # run the test cd ${TESTSRC}${FILESEP} -${TESTJAVA}${FILESEP}bin${FILESEP}java \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \ -Djava.security.properties=file:${TESTSRC}${FILESEP}Static.props \ StaticSignedProvFirst diff --git a/test/java/security/cert/CertificateFactory/slowstream.sh b/test/java/security/cert/CertificateFactory/slowstream.sh index fbca87e46a3a7161b0b235b52498aa11bc5c52ee..72d3fcf6c8c04de25823a15457b2e3e55f5f9e3a 100644 --- a/test/java/security/cert/CertificateFactory/slowstream.sh +++ b/test/java/security/cert/CertificateFactory/slowstream.sh @@ -46,5 +46,5 @@ case "$OS" in esac ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}SlowStream.java -${TESTJAVA}${FS}bin${FS}java -Dtest.src=${TESTSRC} SlowStreamWriter | \ - ${TESTJAVA}${FS}bin${FS}java SlowStreamReader +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dtest.src=${TESTSRC} SlowStreamWriter | \ + ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} SlowStreamReader diff --git a/test/java/util/Base64/TestBase64.java b/test/java/util/Base64/TestBase64.java new file mode 100644 index 0000000000000000000000000000000000000000..6b37772d7f623da3e60cfa7741afbe60957b526d --- /dev/null +++ b/test/java/util/Base64/TestBase64.java @@ -0,0 +1,532 @@ +/* + * 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 4235519 8004212 + * @summary tests java.util.Base64 + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.Base64; +import java.util.Random; + +public class TestBase64 { + + public static void main(String args[]) throws Throwable { + int numRuns = 10; + int numBytes = 200; + if (args.length > 1) { + numRuns = Integer.parseInt(args[0]); + numBytes = Integer.parseInt(args[1]); + } + + test(Base64.getEncoder(), Base64.getDecoder(), + numRuns, numBytes); + test(Base64.getUrlEncoder(), Base64.getUrlDecoder(), + numRuns, numBytes); + test(Base64.getMimeEncoder(), Base64.getMimeDecoder(), + numRuns, numBytes); + + Random rnd = new java.util.Random(); + byte[] nl_1 = new byte[] {'\n'}; + byte[] nl_2 = new byte[] {'\n', '\r'}; + byte[] nl_3 = new byte[] {'\n', '\r', '\n'}; + for (int i = 0; i < 10; i++) { + int len = rnd.nextInt(200) + 4; + test(Base64.getEncoder(len, nl_1), + Base64.getMimeDecoder(), + numRuns, numBytes); + test(Base64.getEncoder(len, nl_2), + Base64.getMimeDecoder(), + numRuns, numBytes); + test(Base64.getEncoder(len, nl_3), + Base64.getMimeDecoder(), + numRuns, numBytes); + } + + testNull(Base64.getEncoder()); + testNull(Base64.getUrlEncoder()); + testNull(Base64.getMimeEncoder()); + testNull(Base64.getEncoder(10, new byte[]{'\n'})); + testNull(Base64.getDecoder()); + testNull(Base64.getUrlDecoder()); + testNull(Base64.getMimeDecoder()); + checkNull(new Runnable() { public void run() { Base64.getEncoder(10, null); }}); + + testIOE(Base64.getEncoder()); + testIOE(Base64.getUrlEncoder()); + testIOE(Base64.getMimeEncoder()); + testIOE(Base64.getEncoder(10, new byte[]{'\n'})); + + byte[] src = new byte[1024]; + new Random().nextBytes(src); + final byte[] decoded = Base64.getEncoder().encode(src); + testIOE(Base64.getDecoder(), decoded); + testIOE(Base64.getMimeDecoder(), decoded); + testIOE(Base64.getUrlDecoder(), Base64.getUrlEncoder().encode(src)); + + // illegal line separator + checkIAE(new Runnable() { public void run() { Base64.getEncoder(10, new byte[]{'\r', 'N'}); }}); + + // illegal base64 character + decoded[2] = (byte)0xe0; + checkIAE(new Runnable() { + public void run() { Base64.getDecoder().decode(decoded); }}); + checkIAE(new Runnable() { + public void run() { Base64.getDecoder().decode(decoded, new byte[1024]); }}); + checkIAE(new Runnable() { public void run() { + Base64.getDecoder().decode(ByteBuffer.wrap(decoded)); }}); + checkIAE(new Runnable() { public void run() { + 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(); + + private static void test(Base64.Encoder enc, Base64.Decoder dec, + int numRuns, int numBytes) throws Throwable { + Random rnd = new java.util.Random(); + + enc.encode(new byte[0]); + dec.decode(new byte[0]); + + for (int i=0; i + * @summary tests java.util.Base64 + */ + +import java.io.BufferedReader; +import java.io.FileReader; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Base64; +import java.util.Base64.Decoder; +import java.util.Base64.Encoder; +import java.util.Objects; +import java.util.Random; + +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +public class TestBase64Golden { + + public static void main(String[] args) throws Exception { + test0(Base64Type.BASIC, Base64.getEncoder(), Base64.getDecoder(), + "plain.txt", "baseEncode.txt"); + + test0(Base64Type.URLSAFE, Base64.getUrlEncoder(), Base64.getUrlDecoder(), + "plain.txt", "urlEncode.txt"); + + test0(Base64Type.MIME, Base64.getMimeEncoder(), Base64.getMimeDecoder(), + "plain.txt", "mimeEncode.txt"); + test1(); + test2(); + } + + public static void test0(Base64Type type, Encoder encoder, Decoder decoder, + String srcFile, String encodedFile) throws Exception { + + String[] srcLns = Files.readAllLines(Paths.get(SRCDIR, srcFile), DEF_CHARSET) + .toArray(new String[0]); + String[] encodedLns = Files.readAllLines(Paths.get(SRCDIR, encodedFile), + DEF_CHARSET) + .toArray(new String[0]); + int lns = 0; + for (String srcStr : srcLns) { + String encodedStr = null; + if (type != Base64Type.MIME) { + encodedStr = encodedLns[lns++]; + } else { + while (lns < encodedLns.length) { + String s = encodedLns[lns++]; + if (s.length() == 0) + break; + if (encodedStr != null) { + encodedStr += DEFAULT_CRLF + s; + } else { + encodedStr = s; + } + } + if (encodedStr == null && srcStr.length() == 0) { + encodedStr = ""; + } + } + System.out.printf("%n src[%d]: %s%n", srcStr.length(), srcStr); + System.out.printf("encoded[%d]: %s%n", encodedStr.length(), encodedStr); + + byte[] srcArr = srcStr.getBytes(DEF_CHARSET); + byte[] encodedArr = encodedStr.getBytes(DEF_CHARSET); + + ByteBuffer srcBuf = ByteBuffer.wrap(srcArr); + ByteBuffer encodedBuf = ByteBuffer.wrap(encodedArr); + byte[] resArr = new byte[encodedArr.length]; + + // test int encode(byte[], byte[]) + int len = encoder.encode(srcArr, resArr); + assertEqual(len, encodedArr.length); + assertEqual(resArr, encodedArr); + + // test byte[] encode(byte[]) + resArr = encoder.encode(srcArr); + assertEqual(resArr, encodedArr); + + // test ByteBuffer encode(ByteBuffer) + int limit = srcBuf.limit(); + ByteBuffer resBuf = encoder.encode(srcBuf); + assertEqual(srcBuf.position(), limit); + assertEqual(srcBuf.limit(), limit); + assertEqual(resBuf, encodedBuf); + srcBuf.rewind(); // reset for next test + + // test encode(ByteBuffer, ByteBuffer, bytesOut) + resBuf.clear(); + len = encoder.encode(srcBuf, resBuf, 0); + assertEqual(len, encodedArr.length); + assertEqual(srcBuf.position(), limit); + assertEqual(srcBuf.limit(), limit); + assertEqual(resBuf.position(), len); + resBuf.flip(); + assertEqual(resBuf, encodedBuf); + srcBuf.rewind(); + + // test encode(ByteBuffer, ByteBuffer, bytesOut)[direct] + ByteBuffer resBuf_d = ByteBuffer.allocateDirect(encodedArr.length); + len = encoder.encode(srcBuf, resBuf_d, 0); + assertEqual(len, encodedArr.length); + assertEqual(srcBuf.position(), limit); + assertEqual(srcBuf.limit(), limit); + assertEqual(resBuf_d.position(), len); + resBuf_d.flip(); + assertEqual(resBuf_d, encodedBuf); + srcBuf.rewind(); + + // test String encodeToString(byte[]) + String resEncodeStr = encoder.encodeToString(srcArr); + assertEqual(resEncodeStr, encodedStr); + + // test int decode(byte[], byte[]) + resArr = new byte[srcArr.length]; + len = decoder.decode(encodedArr, resArr); + assertEqual(len, srcArr.length); + assertEqual(resArr, srcArr); + + // test byte[] decode(byte[]) + resArr = decoder.decode(encodedArr); + assertEqual(resArr, srcArr); + + // test ByteBuffer decode(ByteBuffer) + limit = encodedBuf.limit(); + resBuf = decoder.decode(encodedBuf); + assertEqual(encodedBuf.position(), limit); + assertEqual(encodedBuf.limit(), limit); + assertEqual(resBuf, srcBuf); + encodedBuf.rewind(); // reset for next test + + // test int decode(ByteBuffer, ByteBuffer) + resBuf.clear(); + len = decoder.decode(encodedBuf, resBuf); + assertEqual(len, srcArr.length); + assertEqual(encodedBuf.position(), limit); + assertEqual(encodedBuf.limit(), limit); + assertEqual(resBuf.position(), len); + resBuf.flip(); + assertEqual(resBuf, srcBuf); + encodedBuf.rewind(); // reset for next test + + // test int decode(ByteBuffer, ByteBuffer)[direct] + resBuf_d = ByteBuffer.allocateDirect(srcArr.length); + len = decoder.decode(encodedBuf, resBuf_d); + assertEqual(len, srcArr.length); + assertEqual(encodedBuf.position(), limit); + assertEqual(encodedBuf.limit(), limit); + assertEqual(resBuf_d.position(), len); + resBuf_d.flip(); + assertEqual(resBuf_d, srcBuf); + encodedBuf.rewind(); // reset for next test + + // test byte[] decode(String) + resArr = decoder.decode(encodedStr); + assertEqual(resArr, srcArr); + + // test compatible with sun.misc.Base64Encoder + if (type == Base64Type.MIME) { + sun.misc.BASE64Encoder miscEncoder = new BASE64Encoder(); + sun.misc.BASE64Decoder miscDecoder = new BASE64Decoder(); + resArr = decoder.decode(miscEncoder.encode(srcArr)); + assertEqual(resArr, srcArr); + + resArr = encoder.encode(miscDecoder.decodeBuffer(encodedStr)); + assertEqual(new String(resArr, DEF_CHARSET), encodedStr); + } + } + } + + private static void test1() throws Exception { + byte[] src = new byte[6]; + new Random().nextBytes(src); + + ByteBuffer srcBuf = ByteBuffer.allocate(10); + srcBuf.position(2); + srcBuf.mark(); + srcBuf.limit(8); + srcBuf.put(src); + srcBuf.reset(); + + ByteBuffer dstBuf = ByteBuffer.allocate((src.length + 2) / 3 * 4); + Base64.getEncoder().encode(srcBuf, dstBuf, 0); + dstBuf.rewind(); + byte[] dst = new byte[dstBuf.limit()]; + dstBuf.get(dst); + System.out.printf("%n src[%d]: %s%n", src.length, new String(src)); + System.out.printf("encoded[%d]: %s%n", dst.length, new String(dst)); + assertEqual(src, Base64.getDecoder().decode(dst)); + + dstBuf = ByteBuffer.allocateDirect((src.length + 2) / 3 * 4); + srcBuf.reset(); + Base64.getEncoder().encode(srcBuf, dstBuf, 0); + dstBuf.rewind(); + dst = new byte[dstBuf.limit()]; + dstBuf.get(dst); + assertEqual(src, Base64.getDecoder().decode(dst)); + } + + private static void test2() throws Exception { + byte[] src = new byte[] { + 46, -97, -35, -44, 127, -60, -39, -4, -112, 34, -57, 47, -14, 67, + 40, 18, 90, -59, 68, 112, 23, 121, -91, 94, 35, 49, 104, 17, 30, + -80, -104, -3, -53, 27, 38, -72, -47, 113, -52, 18, 5, -126 }; + Encoder encoder = Base64.getEncoder(49, new byte[] { 0x7e }); + byte[] encoded = encoder.encode(src); + Decoder decoder = Base64.getMimeDecoder(); + byte[] decoded = decoder.decode(encoded); + if (!Objects.deepEquals(src, decoded)) { + throw new RuntimeException(); + } + } + + // helper + enum Base64Type { + BASIC, URLSAFE, MIME + } + + private static final String SRCDIR = System.getProperty("test.src", "."); + private static final Charset DEF_CHARSET = StandardCharsets.US_ASCII; + private static final String DEF_EXCEPTION_MSG = + "Assertion failed! The result is not same as expected"; + private static final String DEFAULT_CRLF = "\r\n"; + + private static void assertEqual(Object result, Object expect) { + if (!Objects.deepEquals(result, expect)) { + String resultStr = result.toString(); + String expectStr = expect.toString(); + if (result instanceof byte[]) { + resultStr = new String((byte[]) result, DEF_CHARSET); + } + if (expect instanceof byte[]) { + expectStr = new String((byte[]) expect, DEF_CHARSET); + } + throw new RuntimeException(DEF_EXCEPTION_MSG + + " result: " + resultStr + " expected: " + expectStr); + } + } +} diff --git a/test/java/util/Base64/baseEncode.txt b/test/java/util/Base64/baseEncode.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f71ef0d92699ba0b69a090e7a7f1145088571b4 --- /dev/null +++ b/test/java/util/Base64/baseEncode.txt @@ -0,0 +1,183 @@ +VGhpcyB0ZXN0IGRhdGEgaXMgcGFydCBvZiByZmMyMDQ1IHdoaWNoIGluY2x1ZGVzIGFsbCBjaGFyYWN0ZXJzIGF+eiBBflosIDB+OSBhbmQgYWxsIHN5bWJvbHMs +SXQgaXMgdXNlZCB0byB0ZXN0IGphdmEudXRpbC5CYXNlNjQuRW5jb2RlciwgYW5kIHdpbGwgYmUgZW5jb2RlZCBieSBvcmcuYXBhY2hlLmNvbW1vbnMuY29kZWMuYmluYXJ5LkJhc2U2NC5qYXZh +dG8gdGVzdCBqYXZhLnV0aWwuQmFzZTY0LkRlY29kZXI7 + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAgICAgICAgIFtQYWdlIDFd +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAgICBOb3ZlbWJlciAxOTk2 + +ICAgVGhlc2UgZG9jdW1lbnRzIGFyZSByZXZpc2lvbnMgb2YgUkZDcyAxNTIxLCAxNTIyLCBhbmQgMTU5MCwgd2hpY2g= +ICAgdGhlbXNlbHZlcyB3ZXJlIHJldmlzaW9ucyBvZiBSRkNzIDEzNDEgYW5kIDEzNDIuICBBbiBhcHBlbmRpeCBpbiBSRkM= +ICAgMjA0OSBkZXNjcmliZXMgZGlmZmVyZW5jZXMgYW5kIGNoYW5nZXMgZnJvbSBwcmV2aW91cyB2ZXJzaW9ucy4= + +VGFibGUgb2YgQ29udGVudHM= + +ICAgMS4gSW50cm9kdWN0aW9uIC4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgIDM= +ICAgMi4gRGVmaW5pdGlvbnMsIENvbnZlbnRpb25zLCBhbmQgR2VuZXJpYyBCTkYgR3JhbW1hciAuLi4uICAgIDU= +ICAgMy4gTUlNRSBIZWFkZXIgRmllbGRzIC4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgIDg= +ICAgNC4gTUlNRS1WZXJzaW9uIEhlYWRlciBGaWVsZCAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgIDg= +ICAgNS4gQ29udGVudC1UeXBlIEhlYWRlciBGaWVsZCAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMTA= +ICAgNi4gQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZyBIZWFkZXIgRmllbGQgLi4uLi4uLi4uLi4uLi4uICAgMTQ= +ICAgNy4gQ29udGVudC1JRCBIZWFkZXIgRmllbGQgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjY= +ICAgOC4gQ29udGVudC1EZXNjcmlwdGlvbiBIZWFkZXIgRmllbGQgLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjc= +ICAgOS4gQWRkaXRpb25hbCBNSU1FIEhlYWRlciBGaWVsZHMgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjc= +ICAgMTAuIFN1bW1hcnkgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjc= +ICAgMTEuIFNlY3VyaXR5IENvbnNpZGVyYXRpb25zIC4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjc= +ICAgMTIuIEF1dGhvcnMnIEFkZHJlc3NlcyAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjg= +ICAgQS4gQ29sbGVjdGVkIEdyYW1tYXIgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjk= + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAgICAgICAgIFtQYWdlIDdd +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAgICBOb3ZlbWJlciAxOTk2 + +My4gIE1JTUUgSGVhZGVyIEZpZWxkcw== + +ICAgTUlNRSBkZWZpbmVzIGEgbnVtYmVyIG9mIG5ldyBSRkMgODIyIGhlYWRlciBmaWVsZHMgdGhhdCBhcmUgdXNlZCB0bw== +ICAgZGVzY3JpYmUgdGhlIGNvbnRlbnQgb2YgYSBNSU1FIGVudGl0eS4gIFRoZXNlIGhlYWRlciBmaWVsZHMgb2NjdXIgaW4= +ICAgYXQgbGVhc3QgdHdvIGNvbnRleHRzOg== + +ICAgICgxKSAgIEFzIHBhcnQgb2YgYSByZWd1bGFyIFJGQyA4MjIgbWVzc2FnZSBoZWFkZXIu + +ICAgICgyKSAgIEluIGEgTUlNRSBib2R5IHBhcnQgaGVhZGVyIHdpdGhpbiBhIG11bHRpcGFydA== +ICAgICAgICAgIGNvbnN0cnVjdC4= + +ICAgVGhlIGZvcm1hbCBkZWZpbml0aW9uIG9mIHRoZXNlIGhlYWRlciBmaWVsZHMgaXMgYXMgZm9sbG93czo= + +ICAgICBNSU1FLW1lc3NhZ2UtaGVhZGVycyA6PSBlbnRpdHktaGVhZGVycw== +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZHM= +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uIENSTEY= +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICA7IFRoZSBvcmRlcmluZyBvZiB0aGUgaGVhZGVy +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICA7IGZpZWxkcyBpbXBsaWVkIGJ5IHRoaXMgQk5G +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICA7IGRlZmluaXRpb24gc2hvdWxkIGJlIGlnbm9yZWQu + +ICAgICBNSU1FLXBhcnQtaGVhZGVycyA6PSBlbnRpdHktaGVhZGVycw== +ICAgICAgICAgICAgICAgICAgICAgICAgICBbIGZpZWxkcyBd +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IEFueSBmaWVsZCBub3QgYmVnaW5uaW5nIHdpdGg= +ICAgICAgICAgICAgICAgICAgICAgICAgICA7ICJjb250ZW50LSIgY2FuIGhhdmUgbm8gZGVmaW5lZA== +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IG1lYW5pbmcgYW5kIG1heSBiZSBpZ25vcmVkLg== +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IFRoZSBvcmRlcmluZyBvZiB0aGUgaGVhZGVy +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IGZpZWxkcyBpbXBsaWVkIGJ5IHRoaXMgQk5G +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IGRlZmluaXRpb24gc2hvdWxkIGJlIGlnbm9yZWQu + +ICAgVGhlIHN5bnRheCBvZiB0aGUgdmFyaW91cyBzcGVjaWZpYyBNSU1FIGhlYWRlciBmaWVsZHMgd2lsbCBiZQ== +ICAgZGVzY3JpYmVkIGluIHRoZSBmb2xsb3dpbmcgc2VjdGlvbnMu + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAgICAgICAgW1BhZ2UgMTFd +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAgICBOb3ZlbWJlciAxOTk2 + +NS4xLiAgU3ludGF4IG9mIHRoZSBDb250ZW50LVR5cGUgSGVhZGVyIEZpZWxk + +ICAgSW4gdGhlIEF1Z21lbnRlZCBCTkYgbm90YXRpb24gb2YgUkZDIDgyMiwgYSBDb250ZW50LVR5cGUgaGVhZGVyIGZpZWxk +ICAgdmFsdWUgaXMgZGVmaW5lZCBhcyBmb2xsb3dzOg== + +ICAgICBjb250ZW50IDo9ICJDb250ZW50LVR5cGUiICI6IiB0eXBlICIvIiBzdWJ0eXBl +ICAgICAgICAgICAgICAgICooIjsiIHBhcmFtZXRlcik= +ICAgICAgICAgICAgICAgIDsgTWF0Y2hpbmcgb2YgbWVkaWEgdHlwZSBhbmQgc3VidHlwZQ== +ICAgICAgICAgICAgICAgIDsgaXMgQUxXQVlTIGNhc2UtaW5zZW5zaXRpdmUu + +ICAgICB0eXBlIDo9IGRpc2NyZXRlLXR5cGUgLyBjb21wb3NpdGUtdHlwZQ== + +ICAgICBkaXNjcmV0ZS10eXBlIDo9ICJ0ZXh0IiAvICJpbWFnZSIgLyAiYXVkaW8iIC8gInZpZGVvIiAv +ICAgICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbiIgLyBleHRlbnNpb24tdG9rZW4= + +ICAgICBjb21wb3NpdGUtdHlwZSA6PSAibWVzc2FnZSIgLyAibXVsdGlwYXJ0IiAvIGV4dGVuc2lvbi10b2tlbg== + +ICAgICBleHRlbnNpb24tdG9rZW4gOj0gaWV0Zi10b2tlbiAvIHgtdG9rZW4= + +ICAgICBpZXRmLXRva2VuIDo9IDxBbiBleHRlbnNpb24gdG9rZW4gZGVmaW5lZCBieSBh +ICAgICAgICAgICAgICAgICAgICBzdGFuZGFyZHMtdHJhY2sgUkZDIGFuZCByZWdpc3RlcmVk +ICAgICAgICAgICAgICAgICAgICB3aXRoIElBTkEuPg== + +ICAgICB4LXRva2VuIDo9IDxUaGUgdHdvIGNoYXJhY3RlcnMgIlgtIiBvciAieC0iIGZvbGxvd2VkLCB3aXRo +ICAgICAgICAgICAgICAgICBubyBpbnRlcnZlbmluZyB3aGl0ZSBzcGFjZSwgYnkgYW55IHRva2VuPg== + +ICAgICBzdWJ0eXBlIDo9IGV4dGVuc2lvbi10b2tlbiAvIGlhbmEtdG9rZW4= + +ICAgICBpYW5hLXRva2VuIDo9IDxBIHB1YmxpY2x5LWRlZmluZWQgZXh0ZW5zaW9uIHRva2VuLiBUb2tlbnM= +ICAgICAgICAgICAgICAgICAgICBvZiB0aGlzIGZvcm0gbXVzdCBiZSByZWdpc3RlcmVkIHdpdGggSUFOQQ== +ICAgICAgICAgICAgICAgICAgICBhcyBzcGVjaWZpZWQgaW4gUkZDIDIwNDguPg== + +ICAgICBwYXJhbWV0ZXIgOj0gYXR0cmlidXRlICI9IiB2YWx1ZQ== + +ICAgICBhdHRyaWJ1dGUgOj0gdG9rZW4= +ICAgICAgICAgICAgICAgICAgOyBNYXRjaGluZyBvZiBhdHRyaWJ1dGVz +ICAgICAgICAgICAgICAgICAgOyBpcyBBTFdBWVMgY2FzZS1pbnNlbnNpdGl2ZS4= + +ICAgICB2YWx1ZSA6PSB0b2tlbiAvIHF1b3RlZC1zdHJpbmc= + +ICAgICB0b2tlbiA6PSAxKjxhbnkgKFVTLUFTQ0lJKSBDSEFSIGV4Y2VwdCBTUEFDRSwgQ1RMcyw= +ICAgICAgICAgICAgICAgICBvciB0c3BlY2lhbHM+ + +ICAgICB0c3BlY2lhbHMgOj0gICIoIiAvICIpIiAvICI8IiAvICI+IiAvICJAIiAv +ICAgICAgICAgICAgICAgICAgICIsIiAvICI7IiAvICI6IiAvICJcIiAvIDwiPg== +ICAgICAgICAgICAgICAgICAgICIvIiAvICJbIiAvICJdIiAvICI/IiAvICI9Ig== +ICAgICAgICAgICAgICAgICAgIDsgTXVzdCBiZSBpbiBxdW90ZWQtc3RyaW5nLA== +ICAgICAgICAgICAgICAgICAgIDsgdG8gdXNlIHdpdGhpbiBwYXJhbWV0ZXIgdmFsdWVz + +ICAgICBkZXNjcmlwdGlvbiA6PSAiQ29udGVudC1EZXNjcmlwdGlvbiIgIjoiICp0ZXh0 + +ICAgICBlbmNvZGluZyA6PSAiQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZyIgIjoiIG1lY2hhbmlzbQ== + +ICAgICBlbnRpdHktaGVhZGVycyA6PSBbIGNvbnRlbnQgQ1JMRiBd +ICAgICAgICAgICAgICAgICAgICBbIGVuY29kaW5nIENSTEYgXQ== +ICAgICAgICAgICAgICAgICAgICBbIGlkIENSTEYgXQ== +ICAgICAgICAgICAgICAgICAgICBbIGRlc2NyaXB0aW9uIENSTEYgXQ== +ICAgICAgICAgICAgICAgICAgICAqKCBNSU1FLWV4dGVuc2lvbi1maWVsZCBDUkxGICk= + +ICAgICBoZXgtb2N0ZXQgOj0gIj0iIDIoRElHSVQgLyAiQSIgLyAiQiIgLyAiQyIgLyAiRCIgLyAiRSIgLyAiRiIp +ICAgICAgICAgICAgICAgOyBPY3RldCBtdXN0IGJlIHVzZWQgZm9yIGNoYXJhY3RlcnMgPiAxMjcsID0s +ICAgICAgICAgICAgICAgOyBTUEFDRXMgb3IgVEFCcyBhdCB0aGUgZW5kcyBvZiBsaW5lcywgYW5kIGlz +ICAgICAgICAgICAgICAgOyByZWNvbW1lbmRlZCBmb3IgYW55IGNoYXJhY3RlciBub3QgbGlzdGVkIGlu +ICAgICAgICAgICAgICAgOyBSRkMgMjA0OSBhcyAibWFpbC1zYWZlIi4= + +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAgICBOb3ZlbWJlciAxOTk2 + +ICAgICAgICAgIG11c3QgYmUgdXNlZC4gIEFuIGVxdWFsIHNpZ24gYXMgdGhlIGxhc3QgY2hhcmFjdGVyIG9uIGE= +ICAgICAgICAgIGVuY29kZWQgbGluZSBpbmRpY2F0ZXMgc3VjaCBhIG5vbi1zaWduaWZpY2FudCAoInNvZnQiKQ== +ICAgICAgICAgIGxpbmUgYnJlYWsgaW4gdGhlIGVuY29kZWQgdGV4dC4= + +ICAgVGh1cyBpZiB0aGUgInJhdyIgZm9ybSBvZiB0aGUgbGluZSBpcyBhIHNpbmdsZSB1bmVuY29kZWQgbGluZSB0aGF0 +ICAgc2F5czo= + +ICAgICBOb3cncyB0aGUgdGltZSBmb3IgYWxsIGZvbGsgdG8gY29tZSB0byB0aGUgYWlkIG9mIHRoZWlyIGNvdW50cnku + +ICAgVGhpcyBjYW4gYmUgcmVwcmVzZW50ZWQsIGluIHRoZSBRdW90ZWQtUHJpbnRhYmxlIGVuY29kaW5nLCBhczo= + +ICAgICBOb3cncyB0aGUgdGltZSA9 +ICAgICBmb3IgYWxsIGZvbGsgdG8gY29tZT0= +ICAgICAgdG8gdGhlIGFpZCBvZiB0aGVpciBjb3VudHJ5Lg== + +ICAgU2luY2UgdGhlIGh5cGhlbiBjaGFyYWN0ZXIgKCItIikgbWF5IGJlIHJlcHJlc2VudGVkIGFzIGl0c2VsZiBpbiB0aGU= +ICAgUXVvdGVkLVByaW50YWJsZSBlbmNvZGluZywgY2FyZSBtdXN0IGJlIHRha2VuLCB3aGVuIGVuY2Fwc3VsYXRpbmcgYQ== +ICAgcXVvdGVkLXByaW50YWJsZSBlbmNvZGVkIGJvZHkgaW5zaWRlIG9uZSBvciBtb3JlIG11bHRpcGFydCBlbnRpdGllcyw= +ICAgdG8gZW5zdXJlIHRoYXQgdGhlIGJvdW5kYXJ5IGRlbGltaXRlciBkb2VzIG5vdCBhcHBlYXIgYW55d2hlcmUgaW4gdGhl +ICAgZW5jb2RlZCBib2R5LiAgKEEgZ29vZCBzdHJhdGVneSBpcyB0byBjaG9vc2UgYSBib3VuZGFyeSB0aGF0IGluY2x1ZGVz +ICAgYSBjaGFyYWN0ZXIgc2VxdWVuY2Ugc3VjaCBhcyAiPV8iIHdoaWNoIGNhbiBuZXZlciBhcHBlYXIgaW4gYQ== +ICAgcXVvdGVkLXByaW50YWJsZSBib2R5LiAgU2VlIHRoZSBkZWZpbml0aW9uIG9mIG11bHRpcGFydCBtZXNzYWdlcyBpbg== +ICAgUkZDIDIwNDYuKQ== + +ICAgICAhIiMkQFtcXV5ge3x9fiU= + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAgICAgICAgW1BhZ2UgMjRd + +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAgICBOb3ZlbWJlciAxOTk2 + + +ICAgICAgICAgICAgICAgICAgICBUYWJsZSAxOiBUaGUgQmFzZTY0IEFscGhhYmV0 + +ICAgICBWYWx1ZSBFbmNvZGluZyAgVmFsdWUgRW5jb2RpbmcgIFZhbHVlIEVuY29kaW5nICBWYWx1ZSBFbmNvZGluZw== +ICAgICAgICAgMCBBICAgICAgICAgICAgMTcgUiAgICAgICAgICAgIDM0IGkgICAgICAgICAgICA1MSB6 +ICAgICAgICAgMSBCICAgICAgICAgICAgMTggUyAgICAgICAgICAgIDM1IGogICAgICAgICAgICA1MiAw +ICAgICAgICAgMiBDICAgICAgICAgICAgMTkgVCAgICAgICAgICAgIDM2IGsgICAgICAgICAgICA1MyAx +ICAgICAgICAgMyBEICAgICAgICAgICAgMjAgVSAgICAgICAgICAgIDM3IGwgICAgICAgICAgICA1NCAy +ICAgICAgICAgNCBFICAgICAgICAgICAgMjEgViAgICAgICAgICAgIDM4IG0gICAgICAgICAgICA1NSAz +ICAgICAgICAgNSBGICAgICAgICAgICAgMjIgVyAgICAgICAgICAgIDM5IG4gICAgICAgICAgICA1NiA0 +ICAgICAgICAgNiBHICAgICAgICAgICAgMjMgWCAgICAgICAgICAgIDQwIG8gICAgICAgICAgICA1NyA1 +ICAgICAgICAgNyBIICAgICAgICAgICAgMjQgWSAgICAgICAgICAgIDQxIHAgICAgICAgICAgICA1OCA2 +ICAgICAgICAgOCBJICAgICAgICAgICAgMjUgWiAgICAgICAgICAgIDQyIHEgICAgICAgICAgICA1OSA3 +ICAgICAgICAgOSBKICAgICAgICAgICAgMjYgYSAgICAgICAgICAgIDQzIHIgICAgICAgICAgICA2MCA4 +ICAgICAgICAxMCBLICAgICAgICAgICAgMjcgYiAgICAgICAgICAgIDQ0IHMgICAgICAgICAgICA2MSA5 +ICAgICAgICAxMSBMICAgICAgICAgICAgMjggYyAgICAgICAgICAgIDQ1IHQgICAgICAgICAgICA2MiAr +ICAgICAgICAxMiBNICAgICAgICAgICAgMjkgZCAgICAgICAgICAgIDQ2IHUgICAgICAgICAgICA2MyAv +ICAgICAgICAxMyBOICAgICAgICAgICAgMzAgZSAgICAgICAgICAgIDQ3IHY= +ICAgICAgICAxNCBPICAgICAgICAgICAgMzEgZiAgICAgICAgICAgIDQ4IHcgICAgICAgICAocGFkKSA9 +ICAgICAgICAxNSBQICAgICAgICAgICAgMzIgZyAgICAgICAgICAgIDQ5IHg= +ICAgICAgICAxNiBRICAgICAgICAgICAgMzMgaCAgICAgICAgICAgIDUwIHk= diff --git a/test/java/util/Base64/mimeEncode.txt b/test/java/util/Base64/mimeEncode.txt new file mode 100644 index 0000000000000000000000000000000000000000..b107fa82a9eab0ced01c72ab15b2def27bb37d2e --- /dev/null +++ b/test/java/util/Base64/mimeEncode.txt @@ -0,0 +1,391 @@ +VGhpcyB0ZXN0IGRhdGEgaXMgcGFydCBvZiByZmMyMDQ1IHdoaWNoIGluY2x1ZGVzIGFsbCBjaGFy +YWN0ZXJzIGF+eiBBflosIDB+OSBhbmQgYWxsIHN5bWJvbHMs + +SXQgaXMgdXNlZCB0byB0ZXN0IGphdmEudXRpbC5CYXNlNjQuRW5jb2RlciwgYW5kIHdpbGwgYmUg +ZW5jb2RlZCBieSBvcmcuYXBhY2hlLmNvbW1vbnMuY29kZWMuYmluYXJ5LkJhc2U2NC5qYXZh + +dG8gdGVzdCBqYXZhLnV0aWwuQmFzZTY0LkRlY29kZXI7 + + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAg +ICAgICAgIFtQYWdlIDFd + +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAg +ICBOb3ZlbWJlciAxOTk2 + + +ICAgVGhlc2UgZG9jdW1lbnRzIGFyZSByZXZpc2lvbnMgb2YgUkZDcyAxNTIxLCAxNTIyLCBhbmQg +MTU5MCwgd2hpY2g= + +ICAgdGhlbXNlbHZlcyB3ZXJlIHJldmlzaW9ucyBvZiBSRkNzIDEzNDEgYW5kIDEzNDIuICBBbiBh +cHBlbmRpeCBpbiBSRkM= + +ICAgMjA0OSBkZXNjcmliZXMgZGlmZmVyZW5jZXMgYW5kIGNoYW5nZXMgZnJvbSBwcmV2aW91cyB2 +ZXJzaW9ucy4= + + +VGFibGUgb2YgQ29udGVudHM= + + +ICAgMS4gSW50cm9kdWN0aW9uIC4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u +Li4uICAgIDM= + +ICAgMi4gRGVmaW5pdGlvbnMsIENvbnZlbnRpb25zLCBhbmQgR2VuZXJpYyBCTkYgR3JhbW1hciAu +Li4uICAgIDU= + +ICAgMy4gTUlNRSBIZWFkZXIgRmllbGRzIC4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u +Li4uICAgIDg= + +ICAgNC4gTUlNRS1WZXJzaW9uIEhlYWRlciBGaWVsZCAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u +Li4uICAgIDg= + +ICAgNS4gQ29udGVudC1UeXBlIEhlYWRlciBGaWVsZCAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u +Li4uICAgMTA= + +ICAgNi4gQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZyBIZWFkZXIgRmllbGQgLi4uLi4uLi4uLi4u +Li4uICAgMTQ= + +ICAgNy4gQ29udGVudC1JRCBIZWFkZXIgRmllbGQgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u +Li4uICAgMjY= + +ICAgOC4gQ29udGVudC1EZXNjcmlwdGlvbiBIZWFkZXIgRmllbGQgLi4uLi4uLi4uLi4uLi4uLi4u +Li4uICAgMjc= + +ICAgOS4gQWRkaXRpb25hbCBNSU1FIEhlYWRlciBGaWVsZHMgLi4uLi4uLi4uLi4uLi4uLi4uLi4u +Li4uICAgMjc= + +ICAgMTAuIFN1bW1hcnkgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u +Li4uICAgMjc= + +ICAgMTEuIFNlY3VyaXR5IENvbnNpZGVyYXRpb25zIC4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u +Li4uICAgMjc= + +ICAgMTIuIEF1dGhvcnMnIEFkZHJlc3NlcyAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u +Li4uICAgMjg= + +ICAgQS4gQ29sbGVjdGVkIEdyYW1tYXIgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u +Li4uICAgMjk= + + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAg +ICAgICAgIFtQYWdlIDdd + +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAg +ICBOb3ZlbWJlciAxOTk2 + + +My4gIE1JTUUgSGVhZGVyIEZpZWxkcw== + + +ICAgTUlNRSBkZWZpbmVzIGEgbnVtYmVyIG9mIG5ldyBSRkMgODIyIGhlYWRlciBmaWVsZHMgdGhh +dCBhcmUgdXNlZCB0bw== + +ICAgZGVzY3JpYmUgdGhlIGNvbnRlbnQgb2YgYSBNSU1FIGVudGl0eS4gIFRoZXNlIGhlYWRlciBm +aWVsZHMgb2NjdXIgaW4= + +ICAgYXQgbGVhc3QgdHdvIGNvbnRleHRzOg== + + +ICAgICgxKSAgIEFzIHBhcnQgb2YgYSByZWd1bGFyIFJGQyA4MjIgbWVzc2FnZSBoZWFkZXIu + + +ICAgICgyKSAgIEluIGEgTUlNRSBib2R5IHBhcnQgaGVhZGVyIHdpdGhpbiBhIG11bHRpcGFydA== + +ICAgICAgICAgIGNvbnN0cnVjdC4= + + +ICAgVGhlIGZvcm1hbCBkZWZpbml0aW9uIG9mIHRoZXNlIGhlYWRlciBmaWVsZHMgaXMgYXMgZm9s +bG93czo= + + +ICAgICBNSU1FLW1lc3NhZ2UtaGVhZGVycyA6PSBlbnRpdHktaGVhZGVycw== + +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZHM= + +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uIENSTEY= + +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICA7IFRoZSBvcmRlcmluZyBvZiB0aGUgaGVhZGVy + +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICA7IGZpZWxkcyBpbXBsaWVkIGJ5IHRoaXMgQk5G + +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICA7IGRlZmluaXRpb24gc2hvdWxkIGJlIGlnbm9y +ZWQu + + +ICAgICBNSU1FLXBhcnQtaGVhZGVycyA6PSBlbnRpdHktaGVhZGVycw== + +ICAgICAgICAgICAgICAgICAgICAgICAgICBbIGZpZWxkcyBd + +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IEFueSBmaWVsZCBub3QgYmVnaW5uaW5nIHdpdGg= + +ICAgICAgICAgICAgICAgICAgICAgICAgICA7ICJjb250ZW50LSIgY2FuIGhhdmUgbm8gZGVmaW5l +ZA== + +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IG1lYW5pbmcgYW5kIG1heSBiZSBpZ25vcmVkLg== + +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IFRoZSBvcmRlcmluZyBvZiB0aGUgaGVhZGVy + +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IGZpZWxkcyBpbXBsaWVkIGJ5IHRoaXMgQk5G + +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IGRlZmluaXRpb24gc2hvdWxkIGJlIGlnbm9yZWQu + + +ICAgVGhlIHN5bnRheCBvZiB0aGUgdmFyaW91cyBzcGVjaWZpYyBNSU1FIGhlYWRlciBmaWVsZHMg +d2lsbCBiZQ== + +ICAgZGVzY3JpYmVkIGluIHRoZSBmb2xsb3dpbmcgc2VjdGlvbnMu + + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAg +ICAgICAgW1BhZ2UgMTFd + +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAg +ICBOb3ZlbWJlciAxOTk2 + + +NS4xLiAgU3ludGF4IG9mIHRoZSBDb250ZW50LVR5cGUgSGVhZGVyIEZpZWxk + + +ICAgSW4gdGhlIEF1Z21lbnRlZCBCTkYgbm90YXRpb24gb2YgUkZDIDgyMiwgYSBDb250ZW50LVR5 +cGUgaGVhZGVyIGZpZWxk + +ICAgdmFsdWUgaXMgZGVmaW5lZCBhcyBmb2xsb3dzOg== + + +ICAgICBjb250ZW50IDo9ICJDb250ZW50LVR5cGUiICI6IiB0eXBlICIvIiBzdWJ0eXBl + +ICAgICAgICAgICAgICAgICooIjsiIHBhcmFtZXRlcik= + +ICAgICAgICAgICAgICAgIDsgTWF0Y2hpbmcgb2YgbWVkaWEgdHlwZSBhbmQgc3VidHlwZQ== + +ICAgICAgICAgICAgICAgIDsgaXMgQUxXQVlTIGNhc2UtaW5zZW5zaXRpdmUu + + +ICAgICB0eXBlIDo9IGRpc2NyZXRlLXR5cGUgLyBjb21wb3NpdGUtdHlwZQ== + + +ICAgICBkaXNjcmV0ZS10eXBlIDo9ICJ0ZXh0IiAvICJpbWFnZSIgLyAiYXVkaW8iIC8gInZpZGVv +IiAv + +ICAgICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbiIgLyBleHRlbnNpb24tdG9rZW4= + + +ICAgICBjb21wb3NpdGUtdHlwZSA6PSAibWVzc2FnZSIgLyAibXVsdGlwYXJ0IiAvIGV4dGVuc2lv +bi10b2tlbg== + + +ICAgICBleHRlbnNpb24tdG9rZW4gOj0gaWV0Zi10b2tlbiAvIHgtdG9rZW4= + + +ICAgICBpZXRmLXRva2VuIDo9IDxBbiBleHRlbnNpb24gdG9rZW4gZGVmaW5lZCBieSBh + +ICAgICAgICAgICAgICAgICAgICBzdGFuZGFyZHMtdHJhY2sgUkZDIGFuZCByZWdpc3RlcmVk + +ICAgICAgICAgICAgICAgICAgICB3aXRoIElBTkEuPg== + + +ICAgICB4LXRva2VuIDo9IDxUaGUgdHdvIGNoYXJhY3RlcnMgIlgtIiBvciAieC0iIGZvbGxvd2Vk +LCB3aXRo + +ICAgICAgICAgICAgICAgICBubyBpbnRlcnZlbmluZyB3aGl0ZSBzcGFjZSwgYnkgYW55IHRva2Vu +Pg== + + +ICAgICBzdWJ0eXBlIDo9IGV4dGVuc2lvbi10b2tlbiAvIGlhbmEtdG9rZW4= + + +ICAgICBpYW5hLXRva2VuIDo9IDxBIHB1YmxpY2x5LWRlZmluZWQgZXh0ZW5zaW9uIHRva2VuLiBU +b2tlbnM= + +ICAgICAgICAgICAgICAgICAgICBvZiB0aGlzIGZvcm0gbXVzdCBiZSByZWdpc3RlcmVkIHdpdGgg +SUFOQQ== + +ICAgICAgICAgICAgICAgICAgICBhcyBzcGVjaWZpZWQgaW4gUkZDIDIwNDguPg== + + +ICAgICBwYXJhbWV0ZXIgOj0gYXR0cmlidXRlICI9IiB2YWx1ZQ== + + +ICAgICBhdHRyaWJ1dGUgOj0gdG9rZW4= + +ICAgICAgICAgICAgICAgICAgOyBNYXRjaGluZyBvZiBhdHRyaWJ1dGVz + +ICAgICAgICAgICAgICAgICAgOyBpcyBBTFdBWVMgY2FzZS1pbnNlbnNpdGl2ZS4= + + +ICAgICB2YWx1ZSA6PSB0b2tlbiAvIHF1b3RlZC1zdHJpbmc= + + +ICAgICB0b2tlbiA6PSAxKjxhbnkgKFVTLUFTQ0lJKSBDSEFSIGV4Y2VwdCBTUEFDRSwgQ1RMcyw= + +ICAgICAgICAgICAgICAgICBvciB0c3BlY2lhbHM+ + + +ICAgICB0c3BlY2lhbHMgOj0gICIoIiAvICIpIiAvICI8IiAvICI+IiAvICJAIiAv + +ICAgICAgICAgICAgICAgICAgICIsIiAvICI7IiAvICI6IiAvICJcIiAvIDwiPg== + +ICAgICAgICAgICAgICAgICAgICIvIiAvICJbIiAvICJdIiAvICI/IiAvICI9Ig== + +ICAgICAgICAgICAgICAgICAgIDsgTXVzdCBiZSBpbiBxdW90ZWQtc3RyaW5nLA== + +ICAgICAgICAgICAgICAgICAgIDsgdG8gdXNlIHdpdGhpbiBwYXJhbWV0ZXIgdmFsdWVz + + +ICAgICBkZXNjcmlwdGlvbiA6PSAiQ29udGVudC1EZXNjcmlwdGlvbiIgIjoiICp0ZXh0 + + +ICAgICBlbmNvZGluZyA6PSAiQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZyIgIjoiIG1lY2hhbmlz +bQ== + + +ICAgICBlbnRpdHktaGVhZGVycyA6PSBbIGNvbnRlbnQgQ1JMRiBd + +ICAgICAgICAgICAgICAgICAgICBbIGVuY29kaW5nIENSTEYgXQ== + +ICAgICAgICAgICAgICAgICAgICBbIGlkIENSTEYgXQ== + +ICAgICAgICAgICAgICAgICAgICBbIGRlc2NyaXB0aW9uIENSTEYgXQ== + +ICAgICAgICAgICAgICAgICAgICAqKCBNSU1FLWV4dGVuc2lvbi1maWVsZCBDUkxGICk= + + +ICAgICBoZXgtb2N0ZXQgOj0gIj0iIDIoRElHSVQgLyAiQSIgLyAiQiIgLyAiQyIgLyAiRCIgLyAi +RSIgLyAiRiIp + +ICAgICAgICAgICAgICAgOyBPY3RldCBtdXN0IGJlIHVzZWQgZm9yIGNoYXJhY3RlcnMgPiAxMjcs +ID0s + +ICAgICAgICAgICAgICAgOyBTUEFDRXMgb3IgVEFCcyBhdCB0aGUgZW5kcyBvZiBsaW5lcywgYW5k +IGlz + +ICAgICAgICAgICAgICAgOyByZWNvbW1lbmRlZCBmb3IgYW55IGNoYXJhY3RlciBub3QgbGlzdGVk +IGlu + +ICAgICAgICAgICAgICAgOyBSRkMgMjA0OSBhcyAibWFpbC1zYWZlIi4= + + +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAg +ICBOb3ZlbWJlciAxOTk2 + + +ICAgICAgICAgIG11c3QgYmUgdXNlZC4gIEFuIGVxdWFsIHNpZ24gYXMgdGhlIGxhc3QgY2hhcmFj +dGVyIG9uIGE= + +ICAgICAgICAgIGVuY29kZWQgbGluZSBpbmRpY2F0ZXMgc3VjaCBhIG5vbi1zaWduaWZpY2FudCAo +InNvZnQiKQ== + +ICAgICAgICAgIGxpbmUgYnJlYWsgaW4gdGhlIGVuY29kZWQgdGV4dC4= + + +ICAgVGh1cyBpZiB0aGUgInJhdyIgZm9ybSBvZiB0aGUgbGluZSBpcyBhIHNpbmdsZSB1bmVuY29k +ZWQgbGluZSB0aGF0 + +ICAgc2F5czo= + + +ICAgICBOb3cncyB0aGUgdGltZSBmb3IgYWxsIGZvbGsgdG8gY29tZSB0byB0aGUgYWlkIG9mIHRo +ZWlyIGNvdW50cnku + + +ICAgVGhpcyBjYW4gYmUgcmVwcmVzZW50ZWQsIGluIHRoZSBRdW90ZWQtUHJpbnRhYmxlIGVuY29k +aW5nLCBhczo= + + +ICAgICBOb3cncyB0aGUgdGltZSA9 + +ICAgICBmb3IgYWxsIGZvbGsgdG8gY29tZT0= + +ICAgICAgdG8gdGhlIGFpZCBvZiB0aGVpciBjb3VudHJ5Lg== + + +ICAgU2luY2UgdGhlIGh5cGhlbiBjaGFyYWN0ZXIgKCItIikgbWF5IGJlIHJlcHJlc2VudGVkIGFz +IGl0c2VsZiBpbiB0aGU= + +ICAgUXVvdGVkLVByaW50YWJsZSBlbmNvZGluZywgY2FyZSBtdXN0IGJlIHRha2VuLCB3aGVuIGVu +Y2Fwc3VsYXRpbmcgYQ== + +ICAgcXVvdGVkLXByaW50YWJsZSBlbmNvZGVkIGJvZHkgaW5zaWRlIG9uZSBvciBtb3JlIG11bHRp +cGFydCBlbnRpdGllcyw= + +ICAgdG8gZW5zdXJlIHRoYXQgdGhlIGJvdW5kYXJ5IGRlbGltaXRlciBkb2VzIG5vdCBhcHBlYXIg +YW55d2hlcmUgaW4gdGhl + +ICAgZW5jb2RlZCBib2R5LiAgKEEgZ29vZCBzdHJhdGVneSBpcyB0byBjaG9vc2UgYSBib3VuZGFy +eSB0aGF0IGluY2x1ZGVz + +ICAgYSBjaGFyYWN0ZXIgc2VxdWVuY2Ugc3VjaCBhcyAiPV8iIHdoaWNoIGNhbiBuZXZlciBhcHBl +YXIgaW4gYQ== + +ICAgcXVvdGVkLXByaW50YWJsZSBib2R5LiAgU2VlIHRoZSBkZWZpbml0aW9uIG9mIG11bHRpcGFy +dCBtZXNzYWdlcyBpbg== + +ICAgUkZDIDIwNDYuKQ== + + +ICAgICAhIiMkQFtcXV5ge3x9fiU= + + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAg +ICAgICAgW1BhZ2UgMjRd + + +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAg +ICBOb3ZlbWJlciAxOTk2 + + + +ICAgICAgICAgICAgICAgICAgICBUYWJsZSAxOiBUaGUgQmFzZTY0IEFscGhhYmV0 + + +ICAgICBWYWx1ZSBFbmNvZGluZyAgVmFsdWUgRW5jb2RpbmcgIFZhbHVlIEVuY29kaW5nICBWYWx1 +ZSBFbmNvZGluZw== + +ICAgICAgICAgMCBBICAgICAgICAgICAgMTcgUiAgICAgICAgICAgIDM0IGkgICAgICAgICAgICA1 +MSB6 + +ICAgICAgICAgMSBCICAgICAgICAgICAgMTggUyAgICAgICAgICAgIDM1IGogICAgICAgICAgICA1 +MiAw + +ICAgICAgICAgMiBDICAgICAgICAgICAgMTkgVCAgICAgICAgICAgIDM2IGsgICAgICAgICAgICA1 +MyAx + +ICAgICAgICAgMyBEICAgICAgICAgICAgMjAgVSAgICAgICAgICAgIDM3IGwgICAgICAgICAgICA1 +NCAy + +ICAgICAgICAgNCBFICAgICAgICAgICAgMjEgViAgICAgICAgICAgIDM4IG0gICAgICAgICAgICA1 +NSAz + +ICAgICAgICAgNSBGICAgICAgICAgICAgMjIgVyAgICAgICAgICAgIDM5IG4gICAgICAgICAgICA1 +NiA0 + +ICAgICAgICAgNiBHICAgICAgICAgICAgMjMgWCAgICAgICAgICAgIDQwIG8gICAgICAgICAgICA1 +NyA1 + +ICAgICAgICAgNyBIICAgICAgICAgICAgMjQgWSAgICAgICAgICAgIDQxIHAgICAgICAgICAgICA1 +OCA2 + +ICAgICAgICAgOCBJICAgICAgICAgICAgMjUgWiAgICAgICAgICAgIDQyIHEgICAgICAgICAgICA1 +OSA3 + +ICAgICAgICAgOSBKICAgICAgICAgICAgMjYgYSAgICAgICAgICAgIDQzIHIgICAgICAgICAgICA2 +MCA4 + +ICAgICAgICAxMCBLICAgICAgICAgICAgMjcgYiAgICAgICAgICAgIDQ0IHMgICAgICAgICAgICA2 +MSA5 + +ICAgICAgICAxMSBMICAgICAgICAgICAgMjggYyAgICAgICAgICAgIDQ1IHQgICAgICAgICAgICA2 +MiAr + +ICAgICAgICAxMiBNICAgICAgICAgICAgMjkgZCAgICAgICAgICAgIDQ2IHUgICAgICAgICAgICA2 +MyAv + +ICAgICAgICAxMyBOICAgICAgICAgICAgMzAgZSAgICAgICAgICAgIDQ3IHY= + +ICAgICAgICAxNCBPICAgICAgICAgICAgMzEgZiAgICAgICAgICAgIDQ4IHcgICAgICAgICAocGFk +KSA9 + +ICAgICAgICAxNSBQICAgICAgICAgICAgMzIgZyAgICAgICAgICAgIDQ5IHg= + +ICAgICAgICAxNiBRICAgICAgICAgICAgMzMgaCAgICAgICAgICAgIDUwIHk= + diff --git a/test/java/util/Base64/plain.txt b/test/java/util/Base64/plain.txt new file mode 100644 index 0000000000000000000000000000000000000000..804a19a50c90d1f72e882b3adc9eb4ad153053ae --- /dev/null +++ b/test/java/util/Base64/plain.txt @@ -0,0 +1,183 @@ +This test data is part of rfc2045 which includes all characters a~z A~Z, 0~9 and all symbols, +It is used to test java.util.Base64.Encoder, and will be encoded by org.apache.commons.codec.binary.Base64.java +to test java.util.Base64.Decoder; + +Freed & Borenstein Standards Track [Page 1] +RFC 2045 Internet Message Bodies November 1996 + + These documents are revisions of RFCs 1521, 1522, and 1590, which + themselves were revisions of RFCs 1341 and 1342. An appendix in RFC + 2049 describes differences and changes from previous versions. + +Table of Contents + + 1. Introduction ......................................... 3 + 2. Definitions, Conventions, and Generic BNF Grammar .... 5 + 3. MIME Header Fields ................................... 8 + 4. MIME-Version Header Field ............................ 8 + 5. Content-Type Header Field ............................ 10 + 6. Content-Transfer-Encoding Header Field ............... 14 + 7. Content-ID Header Field .............................. 26 + 8. Content-Description Header Field ..................... 27 + 9. Additional MIME Header Fields ........................ 27 + 10. Summary ............................................. 27 + 11. Security Considerations ............................. 27 + 12. Authors' Addresses .................................. 28 + A. Collected Grammar .................................... 29 + +Freed & Borenstein Standards Track [Page 7] +RFC 2045 Internet Message Bodies November 1996 + +3. MIME Header Fields + + MIME defines a number of new RFC 822 header fields that are used to + describe the content of a MIME entity. These header fields occur in + at least two contexts: + + (1) As part of a regular RFC 822 message header. + + (2) In a MIME body part header within a multipart + construct. + + The formal definition of these header fields is as follows: + + MIME-message-headers := entity-headers + fields + version CRLF + ; The ordering of the header + ; fields implied by this BNF + ; definition should be ignored. + + MIME-part-headers := entity-headers + [ fields ] + ; Any field not beginning with + ; "content-" can have no defined + ; meaning and may be ignored. + ; The ordering of the header + ; fields implied by this BNF + ; definition should be ignored. + + The syntax of the various specific MIME header fields will be + described in the following sections. + +Freed & Borenstein Standards Track [Page 11] +RFC 2045 Internet Message Bodies November 1996 + +5.1. Syntax of the Content-Type Header Field + + In the Augmented BNF notation of RFC 822, a Content-Type header field + value is defined as follows: + + content := "Content-Type" ":" type "/" subtype + *(";" parameter) + ; Matching of media type and subtype + ; is ALWAYS case-insensitive. + + type := discrete-type / composite-type + + discrete-type := "text" / "image" / "audio" / "video" / + "application" / extension-token + + composite-type := "message" / "multipart" / extension-token + + extension-token := ietf-token / x-token + + ietf-token := + + x-token := + + subtype := extension-token / iana-token + + iana-token := + + parameter := attribute "=" value + + attribute := token + ; Matching of attributes + ; is ALWAYS case-insensitive. + + value := token / quoted-string + + token := 1* + + tspecials := "(" / ")" / "<" / ">" / "@" / + "," / ";" / ":" / "\" / <"> + "/" / "[" / "]" / "?" / "=" + ; Must be in quoted-string, + ; to use within parameter values + + description := "Content-Description" ":" *text + + encoding := "Content-Transfer-Encoding" ":" mechanism + + entity-headers := [ content CRLF ] + [ encoding CRLF ] + [ id CRLF ] + [ description CRLF ] + *( MIME-extension-field CRLF ) + + hex-octet := "=" 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F") + ; Octet must be used for characters > 127, =, + ; SPACEs or TABs at the ends of lines, and is + ; recommended for any character not listed in + ; RFC 2049 as "mail-safe". + +RFC 2045 Internet Message Bodies November 1996 + + must be used. An equal sign as the last character on a + encoded line indicates such a non-significant ("soft") + line break in the encoded text. + + Thus if the "raw" form of the line is a single unencoded line that + says: + + Now's the time for all folk to come to the aid of their country. + + This can be represented, in the Quoted-Printable encoding, as: + + Now's the time = + for all folk to come= + to the aid of their country. + + Since the hyphen character ("-") may be represented as itself in the + Quoted-Printable encoding, care must be taken, when encapsulating a + quoted-printable encoded body inside one or more multipart entities, + to ensure that the boundary delimiter does not appear anywhere in the + encoded body. (A good strategy is to choose a boundary that includes + a character sequence such as "=_" which can never appear in a + quoted-printable body. See the definition of multipart messages in + RFC 2046.) + + !"#$@[\]^`{|}~% + +Freed & Borenstein Standards Track [Page 24] + +RFC 2045 Internet Message Bodies November 1996 + + + Table 1: The Base64 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 A 17 R 34 i 51 z + 1 B 18 S 35 j 52 0 + 2 C 19 T 36 k 53 1 + 3 D 20 U 37 l 54 2 + 4 E 21 V 38 m 55 3 + 5 F 22 W 39 n 56 4 + 6 G 23 X 40 o 57 5 + 7 H 24 Y 41 p 58 6 + 8 I 25 Z 42 q 59 7 + 9 J 26 a 43 r 60 8 + 10 K 27 b 44 s 61 9 + 11 L 28 c 45 t 62 + + 12 M 29 d 46 u 63 / + 13 N 30 e 47 v + 14 O 31 f 48 w (pad) = + 15 P 32 g 49 x + 16 Q 33 h 50 y diff --git a/test/java/util/Base64/urlEncode.txt b/test/java/util/Base64/urlEncode.txt new file mode 100644 index 0000000000000000000000000000000000000000..a55c4ddf1947ebeb113ebeb24c70645360b28a48 --- /dev/null +++ b/test/java/util/Base64/urlEncode.txt @@ -0,0 +1,183 @@ +VGhpcyB0ZXN0IGRhdGEgaXMgcGFydCBvZiByZmMyMDQ1IHdoaWNoIGluY2x1ZGVzIGFsbCBjaGFyYWN0ZXJzIGF-eiBBflosIDB-OSBhbmQgYWxsIHN5bWJvbHMs +SXQgaXMgdXNlZCB0byB0ZXN0IGphdmEudXRpbC5CYXNlNjQuRW5jb2RlciwgYW5kIHdpbGwgYmUgZW5jb2RlZCBieSBvcmcuYXBhY2hlLmNvbW1vbnMuY29kZWMuYmluYXJ5LkJhc2U2NC5qYXZh +dG8gdGVzdCBqYXZhLnV0aWwuQmFzZTY0LkRlY29kZXI7 + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAgICAgICAgIFtQYWdlIDFd +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAgICBOb3ZlbWJlciAxOTk2 + +ICAgVGhlc2UgZG9jdW1lbnRzIGFyZSByZXZpc2lvbnMgb2YgUkZDcyAxNTIxLCAxNTIyLCBhbmQgMTU5MCwgd2hpY2g= +ICAgdGhlbXNlbHZlcyB3ZXJlIHJldmlzaW9ucyBvZiBSRkNzIDEzNDEgYW5kIDEzNDIuICBBbiBhcHBlbmRpeCBpbiBSRkM= +ICAgMjA0OSBkZXNjcmliZXMgZGlmZmVyZW5jZXMgYW5kIGNoYW5nZXMgZnJvbSBwcmV2aW91cyB2ZXJzaW9ucy4= + +VGFibGUgb2YgQ29udGVudHM= + +ICAgMS4gSW50cm9kdWN0aW9uIC4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgIDM= +ICAgMi4gRGVmaW5pdGlvbnMsIENvbnZlbnRpb25zLCBhbmQgR2VuZXJpYyBCTkYgR3JhbW1hciAuLi4uICAgIDU= +ICAgMy4gTUlNRSBIZWFkZXIgRmllbGRzIC4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgIDg= +ICAgNC4gTUlNRS1WZXJzaW9uIEhlYWRlciBGaWVsZCAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgIDg= +ICAgNS4gQ29udGVudC1UeXBlIEhlYWRlciBGaWVsZCAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMTA= +ICAgNi4gQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZyBIZWFkZXIgRmllbGQgLi4uLi4uLi4uLi4uLi4uICAgMTQ= +ICAgNy4gQ29udGVudC1JRCBIZWFkZXIgRmllbGQgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjY= +ICAgOC4gQ29udGVudC1EZXNjcmlwdGlvbiBIZWFkZXIgRmllbGQgLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjc= +ICAgOS4gQWRkaXRpb25hbCBNSU1FIEhlYWRlciBGaWVsZHMgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjc= +ICAgMTAuIFN1bW1hcnkgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjc= +ICAgMTEuIFNlY3VyaXR5IENvbnNpZGVyYXRpb25zIC4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjc= +ICAgMTIuIEF1dGhvcnMnIEFkZHJlc3NlcyAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjg= +ICAgQS4gQ29sbGVjdGVkIEdyYW1tYXIgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uICAgMjk= + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAgICAgICAgIFtQYWdlIDdd +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAgICBOb3ZlbWJlciAxOTk2 + +My4gIE1JTUUgSGVhZGVyIEZpZWxkcw== + +ICAgTUlNRSBkZWZpbmVzIGEgbnVtYmVyIG9mIG5ldyBSRkMgODIyIGhlYWRlciBmaWVsZHMgdGhhdCBhcmUgdXNlZCB0bw== +ICAgZGVzY3JpYmUgdGhlIGNvbnRlbnQgb2YgYSBNSU1FIGVudGl0eS4gIFRoZXNlIGhlYWRlciBmaWVsZHMgb2NjdXIgaW4= +ICAgYXQgbGVhc3QgdHdvIGNvbnRleHRzOg== + +ICAgICgxKSAgIEFzIHBhcnQgb2YgYSByZWd1bGFyIFJGQyA4MjIgbWVzc2FnZSBoZWFkZXIu + +ICAgICgyKSAgIEluIGEgTUlNRSBib2R5IHBhcnQgaGVhZGVyIHdpdGhpbiBhIG11bHRpcGFydA== +ICAgICAgICAgIGNvbnN0cnVjdC4= + +ICAgVGhlIGZvcm1hbCBkZWZpbml0aW9uIG9mIHRoZXNlIGhlYWRlciBmaWVsZHMgaXMgYXMgZm9sbG93czo= + +ICAgICBNSU1FLW1lc3NhZ2UtaGVhZGVycyA6PSBlbnRpdHktaGVhZGVycw== +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZHM= +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uIENSTEY= +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICA7IFRoZSBvcmRlcmluZyBvZiB0aGUgaGVhZGVy +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICA7IGZpZWxkcyBpbXBsaWVkIGJ5IHRoaXMgQk5G +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICA7IGRlZmluaXRpb24gc2hvdWxkIGJlIGlnbm9yZWQu + +ICAgICBNSU1FLXBhcnQtaGVhZGVycyA6PSBlbnRpdHktaGVhZGVycw== +ICAgICAgICAgICAgICAgICAgICAgICAgICBbIGZpZWxkcyBd +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IEFueSBmaWVsZCBub3QgYmVnaW5uaW5nIHdpdGg= +ICAgICAgICAgICAgICAgICAgICAgICAgICA7ICJjb250ZW50LSIgY2FuIGhhdmUgbm8gZGVmaW5lZA== +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IG1lYW5pbmcgYW5kIG1heSBiZSBpZ25vcmVkLg== +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IFRoZSBvcmRlcmluZyBvZiB0aGUgaGVhZGVy +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IGZpZWxkcyBpbXBsaWVkIGJ5IHRoaXMgQk5G +ICAgICAgICAgICAgICAgICAgICAgICAgICA7IGRlZmluaXRpb24gc2hvdWxkIGJlIGlnbm9yZWQu + +ICAgVGhlIHN5bnRheCBvZiB0aGUgdmFyaW91cyBzcGVjaWZpYyBNSU1FIGhlYWRlciBmaWVsZHMgd2lsbCBiZQ== +ICAgZGVzY3JpYmVkIGluIHRoZSBmb2xsb3dpbmcgc2VjdGlvbnMu + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAgICAgICAgW1BhZ2UgMTFd +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAgICBOb3ZlbWJlciAxOTk2 + +NS4xLiAgU3ludGF4IG9mIHRoZSBDb250ZW50LVR5cGUgSGVhZGVyIEZpZWxk + +ICAgSW4gdGhlIEF1Z21lbnRlZCBCTkYgbm90YXRpb24gb2YgUkZDIDgyMiwgYSBDb250ZW50LVR5cGUgaGVhZGVyIGZpZWxk +ICAgdmFsdWUgaXMgZGVmaW5lZCBhcyBmb2xsb3dzOg== + +ICAgICBjb250ZW50IDo9ICJDb250ZW50LVR5cGUiICI6IiB0eXBlICIvIiBzdWJ0eXBl +ICAgICAgICAgICAgICAgICooIjsiIHBhcmFtZXRlcik= +ICAgICAgICAgICAgICAgIDsgTWF0Y2hpbmcgb2YgbWVkaWEgdHlwZSBhbmQgc3VidHlwZQ== +ICAgICAgICAgICAgICAgIDsgaXMgQUxXQVlTIGNhc2UtaW5zZW5zaXRpdmUu + +ICAgICB0eXBlIDo9IGRpc2NyZXRlLXR5cGUgLyBjb21wb3NpdGUtdHlwZQ== + +ICAgICBkaXNjcmV0ZS10eXBlIDo9ICJ0ZXh0IiAvICJpbWFnZSIgLyAiYXVkaW8iIC8gInZpZGVvIiAv +ICAgICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbiIgLyBleHRlbnNpb24tdG9rZW4= + +ICAgICBjb21wb3NpdGUtdHlwZSA6PSAibWVzc2FnZSIgLyAibXVsdGlwYXJ0IiAvIGV4dGVuc2lvbi10b2tlbg== + +ICAgICBleHRlbnNpb24tdG9rZW4gOj0gaWV0Zi10b2tlbiAvIHgtdG9rZW4= + +ICAgICBpZXRmLXRva2VuIDo9IDxBbiBleHRlbnNpb24gdG9rZW4gZGVmaW5lZCBieSBh +ICAgICAgICAgICAgICAgICAgICBzdGFuZGFyZHMtdHJhY2sgUkZDIGFuZCByZWdpc3RlcmVk +ICAgICAgICAgICAgICAgICAgICB3aXRoIElBTkEuPg== + +ICAgICB4LXRva2VuIDo9IDxUaGUgdHdvIGNoYXJhY3RlcnMgIlgtIiBvciAieC0iIGZvbGxvd2VkLCB3aXRo +ICAgICAgICAgICAgICAgICBubyBpbnRlcnZlbmluZyB3aGl0ZSBzcGFjZSwgYnkgYW55IHRva2VuPg== + +ICAgICBzdWJ0eXBlIDo9IGV4dGVuc2lvbi10b2tlbiAvIGlhbmEtdG9rZW4= + +ICAgICBpYW5hLXRva2VuIDo9IDxBIHB1YmxpY2x5LWRlZmluZWQgZXh0ZW5zaW9uIHRva2VuLiBUb2tlbnM= +ICAgICAgICAgICAgICAgICAgICBvZiB0aGlzIGZvcm0gbXVzdCBiZSByZWdpc3RlcmVkIHdpdGggSUFOQQ== +ICAgICAgICAgICAgICAgICAgICBhcyBzcGVjaWZpZWQgaW4gUkZDIDIwNDguPg== + +ICAgICBwYXJhbWV0ZXIgOj0gYXR0cmlidXRlICI9IiB2YWx1ZQ== + +ICAgICBhdHRyaWJ1dGUgOj0gdG9rZW4= +ICAgICAgICAgICAgICAgICAgOyBNYXRjaGluZyBvZiBhdHRyaWJ1dGVz +ICAgICAgICAgICAgICAgICAgOyBpcyBBTFdBWVMgY2FzZS1pbnNlbnNpdGl2ZS4= + +ICAgICB2YWx1ZSA6PSB0b2tlbiAvIHF1b3RlZC1zdHJpbmc= + +ICAgICB0b2tlbiA6PSAxKjxhbnkgKFVTLUFTQ0lJKSBDSEFSIGV4Y2VwdCBTUEFDRSwgQ1RMcyw= +ICAgICAgICAgICAgICAgICBvciB0c3BlY2lhbHM- + +ICAgICB0c3BlY2lhbHMgOj0gICIoIiAvICIpIiAvICI8IiAvICI-IiAvICJAIiAv +ICAgICAgICAgICAgICAgICAgICIsIiAvICI7IiAvICI6IiAvICJcIiAvIDwiPg== +ICAgICAgICAgICAgICAgICAgICIvIiAvICJbIiAvICJdIiAvICI_IiAvICI9Ig== +ICAgICAgICAgICAgICAgICAgIDsgTXVzdCBiZSBpbiBxdW90ZWQtc3RyaW5nLA== +ICAgICAgICAgICAgICAgICAgIDsgdG8gdXNlIHdpdGhpbiBwYXJhbWV0ZXIgdmFsdWVz + +ICAgICBkZXNjcmlwdGlvbiA6PSAiQ29udGVudC1EZXNjcmlwdGlvbiIgIjoiICp0ZXh0 + +ICAgICBlbmNvZGluZyA6PSAiQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZyIgIjoiIG1lY2hhbmlzbQ== + +ICAgICBlbnRpdHktaGVhZGVycyA6PSBbIGNvbnRlbnQgQ1JMRiBd +ICAgICAgICAgICAgICAgICAgICBbIGVuY29kaW5nIENSTEYgXQ== +ICAgICAgICAgICAgICAgICAgICBbIGlkIENSTEYgXQ== +ICAgICAgICAgICAgICAgICAgICBbIGRlc2NyaXB0aW9uIENSTEYgXQ== +ICAgICAgICAgICAgICAgICAgICAqKCBNSU1FLWV4dGVuc2lvbi1maWVsZCBDUkxGICk= + +ICAgICBoZXgtb2N0ZXQgOj0gIj0iIDIoRElHSVQgLyAiQSIgLyAiQiIgLyAiQyIgLyAiRCIgLyAiRSIgLyAiRiIp +ICAgICAgICAgICAgICAgOyBPY3RldCBtdXN0IGJlIHVzZWQgZm9yIGNoYXJhY3RlcnMgPiAxMjcsID0s +ICAgICAgICAgICAgICAgOyBTUEFDRXMgb3IgVEFCcyBhdCB0aGUgZW5kcyBvZiBsaW5lcywgYW5kIGlz +ICAgICAgICAgICAgICAgOyByZWNvbW1lbmRlZCBmb3IgYW55IGNoYXJhY3RlciBub3QgbGlzdGVkIGlu +ICAgICAgICAgICAgICAgOyBSRkMgMjA0OSBhcyAibWFpbC1zYWZlIi4= + +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAgICBOb3ZlbWJlciAxOTk2 + +ICAgICAgICAgIG11c3QgYmUgdXNlZC4gIEFuIGVxdWFsIHNpZ24gYXMgdGhlIGxhc3QgY2hhcmFjdGVyIG9uIGE= +ICAgICAgICAgIGVuY29kZWQgbGluZSBpbmRpY2F0ZXMgc3VjaCBhIG5vbi1zaWduaWZpY2FudCAoInNvZnQiKQ== +ICAgICAgICAgIGxpbmUgYnJlYWsgaW4gdGhlIGVuY29kZWQgdGV4dC4= + +ICAgVGh1cyBpZiB0aGUgInJhdyIgZm9ybSBvZiB0aGUgbGluZSBpcyBhIHNpbmdsZSB1bmVuY29kZWQgbGluZSB0aGF0 +ICAgc2F5czo= + +ICAgICBOb3cncyB0aGUgdGltZSBmb3IgYWxsIGZvbGsgdG8gY29tZSB0byB0aGUgYWlkIG9mIHRoZWlyIGNvdW50cnku + +ICAgVGhpcyBjYW4gYmUgcmVwcmVzZW50ZWQsIGluIHRoZSBRdW90ZWQtUHJpbnRhYmxlIGVuY29kaW5nLCBhczo= + +ICAgICBOb3cncyB0aGUgdGltZSA9 +ICAgICBmb3IgYWxsIGZvbGsgdG8gY29tZT0= +ICAgICAgdG8gdGhlIGFpZCBvZiB0aGVpciBjb3VudHJ5Lg== + +ICAgU2luY2UgdGhlIGh5cGhlbiBjaGFyYWN0ZXIgKCItIikgbWF5IGJlIHJlcHJlc2VudGVkIGFzIGl0c2VsZiBpbiB0aGU= +ICAgUXVvdGVkLVByaW50YWJsZSBlbmNvZGluZywgY2FyZSBtdXN0IGJlIHRha2VuLCB3aGVuIGVuY2Fwc3VsYXRpbmcgYQ== +ICAgcXVvdGVkLXByaW50YWJsZSBlbmNvZGVkIGJvZHkgaW5zaWRlIG9uZSBvciBtb3JlIG11bHRpcGFydCBlbnRpdGllcyw= +ICAgdG8gZW5zdXJlIHRoYXQgdGhlIGJvdW5kYXJ5IGRlbGltaXRlciBkb2VzIG5vdCBhcHBlYXIgYW55d2hlcmUgaW4gdGhl +ICAgZW5jb2RlZCBib2R5LiAgKEEgZ29vZCBzdHJhdGVneSBpcyB0byBjaG9vc2UgYSBib3VuZGFyeSB0aGF0IGluY2x1ZGVz +ICAgYSBjaGFyYWN0ZXIgc2VxdWVuY2Ugc3VjaCBhcyAiPV8iIHdoaWNoIGNhbiBuZXZlciBhcHBlYXIgaW4gYQ== +ICAgcXVvdGVkLXByaW50YWJsZSBib2R5LiAgU2VlIHRoZSBkZWZpbml0aW9uIG9mIG11bHRpcGFydCBtZXNzYWdlcyBpbg== +ICAgUkZDIDIwNDYuKQ== + +ICAgICAhIiMkQFtcXV5ge3x9fiU= + +RnJlZWQgJiBCb3JlbnN0ZWluICAgICAgICAgIFN0YW5kYXJkcyBUcmFjayAgICAgICAgICAgICAgICAgICAgW1BhZ2UgMjRd + +UkZDIDIwNDUgICAgICAgICAgICAgICAgSW50ZXJuZXQgTWVzc2FnZSBCb2RpZXMgICAgICAgICAgICBOb3ZlbWJlciAxOTk2 + + +ICAgICAgICAgICAgICAgICAgICBUYWJsZSAxOiBUaGUgQmFzZTY0IEFscGhhYmV0 + +ICAgICBWYWx1ZSBFbmNvZGluZyAgVmFsdWUgRW5jb2RpbmcgIFZhbHVlIEVuY29kaW5nICBWYWx1ZSBFbmNvZGluZw== +ICAgICAgICAgMCBBICAgICAgICAgICAgMTcgUiAgICAgICAgICAgIDM0IGkgICAgICAgICAgICA1MSB6 +ICAgICAgICAgMSBCICAgICAgICAgICAgMTggUyAgICAgICAgICAgIDM1IGogICAgICAgICAgICA1MiAw +ICAgICAgICAgMiBDICAgICAgICAgICAgMTkgVCAgICAgICAgICAgIDM2IGsgICAgICAgICAgICA1MyAx +ICAgICAgICAgMyBEICAgICAgICAgICAgMjAgVSAgICAgICAgICAgIDM3IGwgICAgICAgICAgICA1NCAy +ICAgICAgICAgNCBFICAgICAgICAgICAgMjEgViAgICAgICAgICAgIDM4IG0gICAgICAgICAgICA1NSAz +ICAgICAgICAgNSBGICAgICAgICAgICAgMjIgVyAgICAgICAgICAgIDM5IG4gICAgICAgICAgICA1NiA0 +ICAgICAgICAgNiBHICAgICAgICAgICAgMjMgWCAgICAgICAgICAgIDQwIG8gICAgICAgICAgICA1NyA1 +ICAgICAgICAgNyBIICAgICAgICAgICAgMjQgWSAgICAgICAgICAgIDQxIHAgICAgICAgICAgICA1OCA2 +ICAgICAgICAgOCBJICAgICAgICAgICAgMjUgWiAgICAgICAgICAgIDQyIHEgICAgICAgICAgICA1OSA3 +ICAgICAgICAgOSBKICAgICAgICAgICAgMjYgYSAgICAgICAgICAgIDQzIHIgICAgICAgICAgICA2MCA4 +ICAgICAgICAxMCBLICAgICAgICAgICAgMjcgYiAgICAgICAgICAgIDQ0IHMgICAgICAgICAgICA2MSA5 +ICAgICAgICAxMSBMICAgICAgICAgICAgMjggYyAgICAgICAgICAgIDQ1IHQgICAgICAgICAgICA2MiAr +ICAgICAgICAxMiBNICAgICAgICAgICAgMjkgZCAgICAgICAgICAgIDQ2IHUgICAgICAgICAgICA2MyAv +ICAgICAgICAxMyBOICAgICAgICAgICAgMzAgZSAgICAgICAgICAgIDQ3IHY= +ICAgICAgICAxNCBPICAgICAgICAgICAgMzEgZiAgICAgICAgICAgIDQ4IHcgICAgICAgICAocGFkKSA9 +ICAgICAgICAxNSBQICAgICAgICAgICAgMzIgZyAgICAgICAgICAgIDQ5IHg= +ICAgICAgICAxNiBRICAgICAgICAgICAgMzMgaCAgICAgICAgICAgIDUwIHk= 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..6c16851062e3284c84871165d47b96b3b2e90b6b 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 ${TESTVMOPTS} -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 ${TESTVMOPTS} -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/Locale/LocaleCategory.sh b/test/java/util/Locale/LocaleCategory.sh index 34becd35a988274e27381b4fdf8932f7e1e1dcb7..84b6119ec3de53711b6ec7057bcd5ea9faeb21c1 100644 --- a/test/java/util/Locale/LocaleCategory.sh +++ b/test/java/util/Locale/LocaleCategory.sh @@ -69,7 +69,7 @@ esac # test user.xxx.display user.xxx.format properties # run -RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" +RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" echo ${RUNCMD} ${RUNCMD} @@ -85,7 +85,7 @@ fi # test user.xxx properties overriding user.xxx.display/format # run -RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} -Duser.language=en -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" +RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Duser.language=en -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" echo ${RUNCMD} ${RUNCMD} diff --git a/test/java/util/Locale/LocaleProviders.sh b/test/java/util/Locale/LocaleProviders.sh index 59e43fcff76433a02e665117f1ddc78d70262915..3cf0d4e7c6910fb954d37fd72b9760b8198f3758 100644 --- a/test/java/util/Locale/LocaleProviders.sh +++ b/test/java/util/Locale/LocaleProviders.sh @@ -96,12 +96,12 @@ ${TESTJAVA}${FS}bin${FS}javac -d ${SPIDIR}${FS}dest ${SPIDIR}${FS}src${FS}tznp.j ${TESTJAVA}${FS}bin${FS}jar cvf ${SPIDIR}${FS}tznp.jar -C ${SPIDIR}${FS}dest . # get the platform default locales -PLATDEF=`${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale display` +PLATDEF=`${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale display` DEFLANG=`echo ${PLATDEF} | sed -e "s/,.*//"` DEFCTRY=`echo ${PLATDEF} | sed -e "s/.*,//"` echo "DEFLANG=${DEFLANG}" echo "DEFCTRY=${DEFCTRY}" -PLATDEF=`${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale format` +PLATDEF=`${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale format` DEFFMTLANG=`echo ${PLATDEF} | sed -e "s/,.*//"` DEFFMTCTRY=`echo ${PLATDEF} | sed -e "s/.*,//"` echo "DEFFMTLANG=${DEFFMTLANG}" @@ -109,7 +109,7 @@ echo "DEFFMTCTRY=${DEFFMTCTRY}" runTest() { - RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $METHODNAME $PARAM1 $PARAM2 $PARAM3" + RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $METHODNAME $PARAM1 $PARAM2 $PARAM3" echo ${RUNCMD} ${RUNCMD} result=$? diff --git a/test/java/util/PluggableLocale/ExecTest.sh b/test/java/util/PluggableLocale/ExecTest.sh index 18bd8d16f61f44766ec2cdc8f54014780f3bb914..c01e9e82742f01631182e3a50f514de46e5a3916 100644 --- a/test/java/util/PluggableLocale/ExecTest.sh +++ b/test/java/util/PluggableLocale/ExecTest.sh @@ -119,9 +119,9 @@ fi # run if [ "$3" = "true" ] then - RUNCMD="${TESTJAVA}${FS}bin${FS}java -Djava.ext.dirs=${EXTDIRS} $2 " + RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Djava.ext.dirs=${EXTDIRS} $2 " else - RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${CLASSPATHARG} $2 " + RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${CLASSPATHARG} $2 " fi echo ${RUNCMD} 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/ResourceBundle/Bug6299235Test.sh b/test/java/util/ResourceBundle/Bug6299235Test.sh index ef17b412172ab69c030e68bdb561fb9568d5eb32..8bcb74f102ddad2fd429a5da032df38279a54f62 100644 --- a/test/java/util/ResourceBundle/Bug6299235Test.sh +++ b/test/java/util/ResourceBundle/Bug6299235Test.sh @@ -75,7 +75,7 @@ echo "NEW_EXT_DIR=${NEW_EXT_DIR}" cd ${TESTSRC} -${TESTJAVA}/bin/java -cp ${TESTCLASSES} -Djava.ext.dirs=${NEW_EXT_DIR} Bug6299235Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} -Djava.ext.dirs=${NEW_EXT_DIR} Bug6299235Test if [ $? -ne 0 ] then diff --git a/test/java/util/ResourceBundle/Control/MissingResourceCauseTest.sh b/test/java/util/ResourceBundle/Control/MissingResourceCauseTest.sh index 7bb77326a78cea88239455f79d0485c9618e4485..d23ada5c9b6323e79f1c395b30efbf691ee30dd7 100644 --- a/test/java/util/ResourceBundle/Control/MissingResourceCauseTest.sh +++ b/test/java/util/ResourceBundle/Control/MissingResourceCauseTest.sh @@ -50,7 +50,7 @@ chmod 000 $UNREADABLE : ${TESTCLASS:=.} : ${TESTSRC:=.} -${TESTJAVA}/bin/java -esa -cp ${TESTCLASS}${DEL}${TESTSRC} MissingResourceCauseTest +${TESTJAVA}/bin/java ${TESTVMOPTS} -esa -cp ${TESTCLASS}${DEL}${TESTSRC} MissingResourceCauseTest STATUS=$? chmod 666 $UNREADABLE rm -f $UNREADABLE diff --git a/test/java/util/ServiceLoader/basic.sh b/test/java/util/ServiceLoader/basic.sh index 259b2e156363c6b42a966118f0cb2736138c4182..72d68fab7ae76be51e735e1a044e7a569bcb37cf 100644 --- a/test/java/util/ServiceLoader/basic.sh +++ b/test/java/util/ServiceLoader/basic.sh @@ -94,7 +94,7 @@ go() { cp="$1"; shift if [ -z "$cp" ]; then cp="$TESTCLASSES"; else cp="$TESTCLASSES$SEP$cp"; fi vmargs="$1"; shift - sh -xc "'$JAVA' -cp $cp $vmargs $T $*" 2>&1 + sh -xc "'$JAVA' ${TESTVMOPTS} -cp $cp $vmargs $T $*" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } 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/TimeZone/OldIDMappingTest.sh b/test/java/util/TimeZone/OldIDMappingTest.sh index 0f776e4e1fe05d8eeeae8a6d0145a63d80c47d67..f7d67ba17e4e92d7c00334e054cd0e66eb5dc002 100644 --- a/test/java/util/TimeZone/OldIDMappingTest.sh +++ b/test/java/util/TimeZone/OldIDMappingTest.sh @@ -40,7 +40,7 @@ do if [ x"$I" != x ]; then D="-Dsun.timezone.ids.oldmapping=${I}" fi - if ! ${JAVA} ${D} -cp ${TESTCLASSES} OldIDMappingTest -new; then + if ! ${JAVA} ${D} ${TESTVMOPTS} -cp ${TESTCLASSES} OldIDMappingTest -new; then STATUS=1 fi done @@ -51,7 +51,7 @@ do if [ "x$I" != x ]; then D="-Dsun.timezone.ids.oldmapping=${I}" fi - if ! ${JAVA} ${D} -cp ${TESTCLASSES} OldIDMappingTest -old; then + if ! ${JAVA} ${D} ${TESTVMOPTS} -cp ${TESTCLASSES} OldIDMappingTest -old; then STATUS=1 fi done diff --git a/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh b/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh index 226228f175424caced478008c48311a85eee98ba..4a295ce532fb25ed36af3f28dbfe936fad2e58e3 100644 --- a/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh +++ b/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh @@ -53,6 +53,6 @@ ${TESTJAVA}/bin/jarsigner \ # run it with the security manager on, plus accesscontroller debugging # will go into infinite recursion trying to get enough permissions for # printing Date of failing certificate unless fix is applied. -${TESTJAVA}/bin/java -Djava.security.manager \ +${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.manager \ -Djava.security.debug=access,failure,policy \ -cp ${TESTCLASSES}/timezonedatetest.jar TimeZoneDatePermissionCheck diff --git a/test/java/util/TreeMap/Clone.java b/test/java/util/TreeMap/Clone.java new file mode 100644 index 0000000000000000000000000000000000000000..efffa6a9633048206e9682d99985efb1bb763aae --- /dev/null +++ b/test/java/util/TreeMap/Clone.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. + */ + +/** + * @test + * @bug 7198904 + * @summary Verify that cloned TreeMap gets new keyset + * @author david.buck@oracle.com + * @run main/othervm Clone + * @run main/othervm -XX:+AggressiveOpts Clone + */ + +import java.util.TreeMap; + +public class Clone { + + public static void main(String[] args) throws Exception { + TreeMap m1 = new TreeMap(); + m1.put( "one", 1 ); + m1.keySet(); + TreeMap m2 = (TreeMap)m1.clone(); + m1.put( "two", 2 ); + m2.put( "three", 3 ); + // iterate over the clone (m2) and we should get "one" and "three" + for( final String key : m2.keySet() ) { + if( !"one".equals( key ) && !"three".equals( key ) ) { + throw new IllegalStateException( "Unexpected key: " + key ); + } + } + // iterate over the original (m1) and we should get "one" and "two" + for( final String key : m1.keySet() ) { + if( !"one".equals( key ) && !"two".equals( key ) ) { + throw new IllegalStateException( "Unexpected key: " + key ); + } + } + } + +} diff --git a/test/java/util/logging/CheckLockLocationTest.java b/test/java/util/logging/CheckLockLocationTest.java index 0eb98c0d4a0f07c1f6c33fc153454cd415576dfe..956621ae6e4040ecd33c9523b6b42586071c2ac2 100644 --- a/test/java/util/logging/CheckLockLocationTest.java +++ b/test/java/util/logging/CheckLockLocationTest.java @@ -30,7 +30,6 @@ * @run main/othervm CheckLockLocationTest */ import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.AccessDeniedException; import java.nio.file.FileSystemException; @@ -42,17 +41,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 +83,18 @@ 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 (AccessDeniedException ex) { + // the right exception was thrown, so continue. + } catch (IOException ex) { + throw new RuntimeException( + "Test failed: Expected exception was not an " + + "AccessDeniedException", ex); } } @@ -97,11 +104,11 @@ public class CheckLockLocationTest { throw new RuntimeException("Test failed: should not have been able" + " to create FileHandler for " + "%t/" + NOT_A_DIR + "/log.log in non-directory."); + } catch (FileSystemException ex) { + // the right exception was thrown, so continue. } 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); - } + throw new RuntimeException("Test failed: exception thrown was not a " + + "FileSystemException", ex); } // Test 4: make sure we can't create a FileHandler in a non-existent dir @@ -110,11 +117,11 @@ public class CheckLockLocationTest { throw new RuntimeException("Test failed: should not have been able" + " to create FileHandler for " + "%t/" + NON_EXISTENT_DIR + "/log.log in a non-existent directory."); + } catch (NoSuchFileException ex) { + // the right exception was thrown, so continue. } 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 +169,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 @@ -199,12 +210,14 @@ public class CheckLockLocationTest { /* * Recursively delete all files starting at specified file */ - private static void delete(File f) throws IOException { + private static void delete(File f) { if (f != null && f.isDirectory()) { for (File c : f.listFiles()) delete(c); } if (!f.delete()) - throw new FileNotFoundException("Failed to delete file: " + f); - } + System.err.println( + "WARNING: unable to delete/cleanup writable test directory: " + + f ); + } } diff --git a/test/java/util/logging/ClassLoaderLeakTest.java b/test/java/util/logging/ClassLoaderLeakTest.java index a1c56fa6abe69d8064c1b07b48d6f8439e471190..f2957dba7b849fa28a32d0f20b4d4f27466c94ce 100644 --- a/test/java/util/logging/ClassLoaderLeakTest.java +++ b/test/java/util/logging/ClassLoaderLeakTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -40,7 +40,6 @@ import java.net.URL; import java.net.URLClassLoader; import java.util.concurrent.CountDownLatch; import java.util.logging.Logger; -import java.util.logging.Logger; public class ClassLoaderLeakTest { @@ -59,11 +58,11 @@ public class ClassLoaderLeakTest { try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); - Class appMain = cl.loadClass("AppTest"); + Class appMain = cl.loadClass("AppTest"); Method launch = appMain.getDeclaredMethod("launch", doneSignal.getClass()); - Constructor c = appMain.getConstructor(); + Constructor c = appMain.getConstructor(); Object o = c.newInstance(); @@ -80,8 +79,7 @@ public class ClassLoaderLeakTest { /* prepare test class loader */ URL pwd = null; try { - - pwd = new File(System.getProperty("test.classes",".")).toURL(); + pwd = new File(System.getProperty("test.classes",".")).toURI().toURL(); } catch (MalformedURLException e) { throw new RuntimeException("Test failed.", e); } @@ -139,7 +137,7 @@ public class ClassLoaderLeakTest { uniqClassName = uniq; } - public Class loadClass(String name) throws ClassNotFoundException { + public Class loadClass(String name) throws ClassNotFoundException { if (verbose) { System.out.printf("%s: load class %s\n", uniqClassName, name); } diff --git a/test/java/util/logging/Listeners.java b/test/java/util/logging/Listeners.java index 265fdced588fd670aa54adf41f0a0edbd678697c..86383ef065b3f08ffac7d09bfffe9ef23d777863 100644 --- a/test/java/util/logging/Listeners.java +++ b/test/java/util/logging/Listeners.java @@ -88,6 +88,7 @@ public class Listeners { } } + @SuppressWarnings("deprecation") public static void main(String[] args) throws Exception { LogManager logman = LogManager.getLogManager(); diff --git a/test/java/util/logging/ListenersWithSM.java b/test/java/util/logging/ListenersWithSM.java index 41af3299bd187c93d74fad417eac1d5c6431fec3..49eba235dc698821f0cc3ba32fe2939f722561e0 100644 --- a/test/java/util/logging/ListenersWithSM.java +++ b/test/java/util/logging/ListenersWithSM.java @@ -35,6 +35,7 @@ import java.beans.PropertyChangeEvent; public class ListenersWithSM { + @SuppressWarnings("deprecation") public static void main(String[] args) throws Exception { boolean granted = args[0].equals("grant"); diff --git a/test/java/util/logging/LoggerResourceBundleRace.java b/test/java/util/logging/LoggerResourceBundleRace.java index c7976d7cced0d0d109d5d2148072f7d288848404..e159a2ddeb9e9d0bfea90f5435d97c94e11c37d2 100644 --- a/test/java/util/logging/LoggerResourceBundleRace.java +++ b/test/java/util/logging/LoggerResourceBundleRace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -30,11 +30,10 @@ * @run main LoggerResourceBundleRace */ -import java.util.concurrent.atomic.AtomicInteger; import java.util.ListResourceBundle; -import java.util.logging.Logger; import java.util.MissingResourceException; -import java.util.ResourceBundle; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Logger; public class LoggerResourceBundleRace extends RacingThreadsTest { diff --git a/test/java/util/logging/LoggingDeadlock2.java b/test/java/util/logging/LoggingDeadlock2.java index 611ec2ae8da334f8753b7c532e3aa628819b55eb..8c83ae90cee3822c6d562bac5da06b935dad9274 100644 --- a/test/java/util/logging/LoggingDeadlock2.java +++ b/test/java/util/logging/LoggingDeadlock2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -103,7 +103,7 @@ public class LoggingDeadlock2 { // This may or may not result in a first call to // Runtime.addShutdownHook after shutdown has already // commenced. - LogManager log = LogManager.getLogManager(); + LogManager.getLogManager(); if (dojoin) { exiter.join(); @@ -148,7 +148,6 @@ public class LoggingDeadlock2 { public String out() { return out; } public String err() { return err; } public int exitValue() { return exitValue; } - public Throwable throwable() { return throwable; } public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/test/java/util/logging/LoggingDeadlock3.java b/test/java/util/logging/LoggingDeadlock3.java index 1b94d0316d07e0b137eb1d5b4aae6e674f458dc3..73162d58b6b136e03f450105f8fd90b190ea23dd 100644 --- a/test/java/util/logging/LoggingDeadlock3.java +++ b/test/java/util/logging/LoggingDeadlock3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -61,7 +61,7 @@ public class LoggingDeadlock3 { public static class GetLogger implements Runnable { public void run() { for (int cnt = 0; cnt < ITER_CNT * 8; cnt++) { - Logger logger = Logger.getLogger("com.sun.Hello"+cnt/10); + Logger.getLogger("com.sun.Hello"+cnt/10); if (cnt % 1000 == 0) out.print("1"); if (cnt % 10000 == 0) out.println(); } diff --git a/test/java/util/logging/LoggingDeadlock4.java b/test/java/util/logging/LoggingDeadlock4.java index f52d74b127788b53437f6147a0560b9d1acbd2c3..65846979fb987f019592fe54bce7800184c1f9c6 100644 --- a/test/java/util/logging/LoggingDeadlock4.java +++ b/test/java/util/logging/LoggingDeadlock4.java @@ -30,7 +30,6 @@ * @run main/othervm/timeout=15 -Djava.awt.headless=true LoggingDeadlock4 */ -import java.awt.Container; import java.util.concurrent.CountDownLatch; import java.util.logging.LogManager; import java.util.logging.Logger; @@ -68,7 +67,7 @@ public class LoggingDeadlock4 { } catch (InterruptedException e) { } - LogManager manager = LogManager.getLogManager(); + LogManager.getLogManager(); } }; lmThread.start(); @@ -86,7 +85,7 @@ public class LoggingDeadlock4 { } catch (InterruptedException e) { } - Logger foo = Logger.getLogger("foo logger"); + Logger.getLogger("foo logger"); } }; logThread.start(); diff --git a/test/java/util/logging/LoggingMXBeanTest.java b/test/java/util/logging/LoggingMXBeanTest.java index a01e57c13574817b59be422ca72305bc37233296..a023aeeb0e70e2c742c949419e31eb50862d82e2 100644 --- a/test/java/util/logging/LoggingMXBeanTest.java +++ b/test/java/util/logging/LoggingMXBeanTest.java @@ -208,7 +208,7 @@ public class LoggingMXBeanTest String levelName = (String) mbs.invoke( objectName, "getLoggerLevel", params, signature ); l = Level.parse(levelName); System.out.print(" Logger1: " ); - if ( l.equals( l.ALL ) ) { + if ( l.equals( Level.ALL ) ) { System.out.println("Level Set to ALL: PASSED" ); log1 = true; } @@ -226,7 +226,7 @@ public class LoggingMXBeanTest levelName = (String) mbs.invoke( objectName, "getLoggerLevel", params, signature ); l = Level.parse(levelName); System.out.print(" Logger2: " ); - if ( l.equals( l.FINER ) ) { + if ( l.equals( Level.FINER ) ) { System.out.println("Level Set to FINER: PASSED" ); log2 = true; } @@ -247,6 +247,6 @@ public class LoggingMXBeanTest } public static void main(String[] argv) throws Exception { - LoggingMXBeanTest p = new LoggingMXBeanTest(); + new LoggingMXBeanTest(); } } diff --git a/test/java/util/logging/LoggingMXBeanTest2.java b/test/java/util/logging/LoggingMXBeanTest2.java index 005ed72e03a14db025bacc5b3c3474a3493c92fe..3791e80b242003ea8e51666a03a60c942e3f9c63 100644 --- a/test/java/util/logging/LoggingMXBeanTest2.java +++ b/test/java/util/logging/LoggingMXBeanTest2.java @@ -37,7 +37,6 @@ import java.util.ListIterator; public class LoggingMXBeanTest2 { - static LoggingMXBean mbean = LogManager.getLoggingMXBean(); static String LOGGER_NAME_1 = "com.sun.management.Logger"; static String LOGGER_NAME_2 = "com.sun.management.Logger.Logger2"; @@ -57,14 +56,14 @@ public class LoggingMXBeanTest2 */ System.out.println("Test Logger Name retrieval (getLoggerNames)"); boolean log1 = false, log2 = false; - List loggers = mbean.getLoggerNames(); + List loggers = mbean.getLoggerNames(); if (loggers == null || loggers.size() < 2) { throw new RuntimeException( "Could not Detect the presense of the new Loggers"); } - for (ListIterator iter = loggers.listIterator(); iter.hasNext(); ) { - String logger = (String) iter.next(); + for (ListIterator iter = loggers.listIterator(); iter.hasNext(); ) { + String logger = iter.next(); if (logger.equals(LOGGER_NAME_1)) { log1 = true; System.out.println(" : Found new Logger : " + logger); @@ -187,6 +186,6 @@ public class LoggingMXBeanTest2 } public static void main(String[] argv) throws Exception { - LoggingMXBeanTest2 p = new LoggingMXBeanTest2(); + new LoggingMXBeanTest2(); } } diff --git a/test/java/util/logging/MemoryHandlerTest.java b/test/java/util/logging/MemoryHandlerTest.java index 026e571859f26f662682ce993ca507e432af712a..ee80ef7864be62b11f809ee152037377dde0ea7e 100644 --- a/test/java/util/logging/MemoryHandlerTest.java +++ b/test/java/util/logging/MemoryHandlerTest.java @@ -48,7 +48,7 @@ public class MemoryHandlerTest { File fname = new File(tstSrc, LM_PROP_FNAME); String prop = fname.getCanonicalPath(); System.setProperty(CFG_FILE_PROP, prop); - LogManager logMgr = LogManager.getLogManager(); + LogManager.getLogManager(); // create a logger logger = Logger.getLogger(MemoryHandlerTest.class.getName()); // don't have parent handlers get log messages diff --git a/test/java/util/logging/ParentLoggersTest.java b/test/java/util/logging/ParentLoggersTest.java index 3dc4bfcc25b69f6264be0c848fe051c4581ae75d..72d5ddadc0ffdb8ab76e94af2d8cb928991396e6 100644 --- a/test/java/util/logging/ParentLoggersTest.java +++ b/test/java/util/logging/ParentLoggersTest.java @@ -1,3 +1,26 @@ +/* + * 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 6498300 @@ -86,12 +109,12 @@ public class ParentLoggersTest { Vector expectedLoggerNames = new Vector(getDefaultLoggerNames()); // Create the logger LOGGER_NAME_1 - Logger logger1 = Logger.getLogger(LOGGER_NAME_1); + Logger.getLogger(LOGGER_NAME_1); expectedLoggerNames.addElement(PARENT_NAME_1); expectedLoggerNames.addElement(LOGGER_NAME_1); // Create the logger LOGGER_NAME_2 - Logger logger2 = Logger.getLogger(LOGGER_NAME_2); + Logger.getLogger(LOGGER_NAME_2); expectedLoggerNames.addElement(PARENT_NAME_2); expectedLoggerNames.addElement(LOGGER_NAME_2); diff --git a/test/java/util/logging/SimpleFormatterFormat.java b/test/java/util/logging/SimpleFormatterFormat.java index fc786a0f092d7a7972e2ed68e8f96e05794d62b2..4fafba3b7786454b87691d075a3fe388c4083789 100644 --- a/test/java/util/logging/SimpleFormatterFormat.java +++ b/test/java/util/logging/SimpleFormatterFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -92,8 +92,9 @@ public class SimpleFormatterFormat { System.out.println("Checking log records in file: " + log); Pattern p = Pattern.compile("([\\.a-zA-Z:]+) (.*) \\[.*\\] source: (.*)"); - try (FileInputStream in = new FileInputStream(log)) { - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + try (FileInputStream in = new FileInputStream(log); + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + ) { String line; int i = 0; while (i < messages.length && 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..28210696b3935d8ffdf69975e8e8f784841fc31a 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 ${TESTVMOPTS} -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 ${TESTVMOPTS} -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..877522e3f919ab4d9435080b88635121981a8c0f 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 @@ -87,14 +87,18 @@ Sys "$javac" -d jarDir StubPreferencesFactory.java StubPreferences.java case "`uname`" in Windows*|CYGWIN* ) CPS=';';; *) CPS=':';; esac -Sys "$java" "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \ +Sys "$java" "${TESTVMOPTS}" "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \ -Djava.util.prefs.PreferencesFactory=StubPreferencesFactory \ + -Djava.util.prefs.userRoot=. \ PrefsSpi "StubPreferences" -Sys "$java" "-cp" "$TESTCLASSES" \ +Sys "$java" "${TESTVMOPTS}" "-cp" "$TESTCLASSES" \ + -Djava.util.prefs.userRoot=. \ PrefsSpi "java.util.prefs.*" -Sys "$java" "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \ +Sys "$java" "${TESTVMOPTS}" "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \ + -Djava.util.prefs.userRoot=. \ PrefsSpi "StubPreferences" -Sys "$java" "-cp" "$TESTCLASSES" "-Djava.ext.dirs=extDir" \ +Sys "$java" "${TESTVMOPTS}" "-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/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.sh b/test/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.sh index c6b912356097c3f029557d19ee3dbe3963e05c73..538142606a067933e24eaa1f49cc818b14654da5 100644 --- a/test/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.sh +++ b/test/java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.sh @@ -21,4 +21,5 @@ # questions. # -${TESTJAVA}/bin/java -Djava.ext.dirs=${TESTSRC} -cp ${TESTCLASSES} UserDefaultControlTest \ No newline at end of file +${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.ext.dirs=${TESTSRC} -cp ${TESTCLASSES} UserDefaultControlTest + diff --git a/test/java/util/zip/3GBZipFiles.sh b/test/java/util/zip/3GBZipFiles.sh index 9caf109000cbf5575ebb66ad383939e0bd30ac10..65db4e296ea39baf99363873628ee9c91344f309 100644 --- a/test/java/util/zip/3GBZipFiles.sh +++ b/test/java/util/zip/3GBZipFiles.sh @@ -1,4 +1,3 @@ -# # Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -83,7 +82,7 @@ buildFile () huge-*) filesize_="$hugeSize" ;; tiny-*) filesize_="$tinySize" ;; esac - sys "$JAVA" "-cp" "$TESTCLASSES" "FileBuilder" \ + sys "$JAVA" ${TESTVMOPTS} "-cp" "$TESTCLASSES" "FileBuilder" \ "$filetype_" "$filename_" "$filesize_" } diff --git a/test/java/util/zip/ZipFile/deletetempjar.sh b/test/java/util/zip/ZipFile/deletetempjar.sh index afa47feb91d89979e22f8a54a1567a2c7b271eaf..bad1a0f1e4bdb8c96b4acfe68a63f382ed56ab85 100644 --- a/test/java/util/zip/ZipFile/deletetempjar.sh +++ b/test/java/util/zip/ZipFile/deletetempjar.sh @@ -30,7 +30,7 @@ if [ "x$TESTJAVA" = x ]; then TESTCLASSES=. fi -tmpfile=`$TESTJAVA/bin/java -classpath $TESTCLASSES DeleteTempJar` +tmpfile=`$TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES DeleteTempJar` rc=$? if [ $rc != 0 ]; then echo Unexpected failure with exit status $rc diff --git a/test/javax/crypto/SecretKeyFactory/FailOverTest.sh b/test/javax/crypto/SecretKeyFactory/FailOverTest.sh index b23e2bd99a2ffa576a6ee0f7fc3fc9b1148f5d93..ab8bb0ed8c9290c8280a87dca9268a7727500507 100644 --- a/test/javax/crypto/SecretKeyFactory/FailOverTest.sh +++ b/test/javax/crypto/SecretKeyFactory/FailOverTest.sh @@ -82,6 +82,7 @@ if [ $? -ne 0 ]; then fi ${TESTJAVA}${FS}bin${FS}java \ + ${TESTVMOPTS} \ -classpath "${TESTSRC}${FS}P1.jar${PS}${TESTSRC}${FS}P2.jar${PS}." \ FailOverTest result=$? diff --git a/test/javax/print/applet/AppletPrintLookup.sh b/test/javax/print/applet/AppletPrintLookup.sh index c49b9f09c1f7ba3de2280b0c519d946142690ede..06afe6ffd54f7003ba2e7f8ed03172e11e407892 100644 --- a/test/javax/print/applet/AppletPrintLookup.sh +++ b/test/javax/print/applet/AppletPrintLookup.sh @@ -82,7 +82,7 @@ cp ${TESTSRC}${SEP}AppletPrintLookup.html ${TESTCLASSES} ${TESTJAVA}${SEP}bin${SEP}appletviewer ${TESTCLASSES}${SEP}AppletPrintLookup.html & cd ${TESTCLASSES} -${TESTJAVA}${SEP}bin${SEP}java YesNo +${TESTJAVA}${SEP}bin${SEP}java ${TESTVMOPTS} YesNo if [ $? -ne 0 ] then echo "Test fails!" diff --git a/test/javax/rmi/ssl/SocketFactoryTest.java b/test/javax/rmi/ssl/SocketFactoryTest.java index cf88fd746a088baa7aba1b19c06a61d60cf73048..76bf51a1c77c927345cac929c737df4dea8edd33 100644 --- a/test/javax/rmi/ssl/SocketFactoryTest.java +++ b/test/javax/rmi/ssl/SocketFactoryTest.java @@ -26,8 +26,7 @@ * @bug 4932837 6582235 * @summary Test SslRMI[Client|Server]SocketFactory equals() and hashCode(). * @author Daniel Fuchs - * @run clean SocketFactoryTest - * @run build SocketFactoryTest + * * @run main SocketFactoryTest */ diff --git a/test/javax/script/ProviderTest.sh b/test/javax/script/ProviderTest.sh index 5221d00d5fd79f07a4be4e6430b48ee855cfb9bc..c39a9333914ee96d540445b9b02606505290d2e6 100644 --- a/test/javax/script/ProviderTest.sh +++ b/test/javax/script/ProviderTest.sh @@ -45,6 +45,6 @@ $JAR -cf ${TESTCLASSES}/dummy.jar \ echo "Running test ..." -$JAVA -classpath \ +$JAVA ${TESTVMOPTS} -classpath \ "${TESTCLASSES}${PS}${TESTCLASSES}/dummy.jar" \ ProviderTest diff --git a/test/javax/security/auth/Subject/doAs/Test.sh b/test/javax/security/auth/Subject/doAs/Test.sh index cbf94e031f0e47b5e490c37b70d4e97b242ad2c3..65ef4531e26cebfad3ff5ad0a7e8ccee10000b44 100644 --- a/test/javax/security/auth/Subject/doAs/Test.sh +++ b/test/javax/security/auth/Subject/doAs/Test.sh @@ -71,7 +71,7 @@ WD=`pwd` cd ${TESTSRC}${FS} cd $WD echo $WD -${TESTJAVA}${FS}bin${FS}java -classpath "${TESTCLASSES}${FS}" \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath "${TESTCLASSES}${FS}" \ -Djava.security.manager \ -Djava.security.policy=${TESTSRC}${FS}policy \ Test diff --git a/test/lib/security/java.policy/Ext_AllPolicy.sh b/test/lib/security/java.policy/Ext_AllPolicy.sh index e4184062a5fd639ce3f00d2b63790fa799513095..3efcce9b4e02e82b66f5af5ed2e3f33f54ae2d43 100644 --- a/test/lib/security/java.policy/Ext_AllPolicy.sh +++ b/test/lib/security/java.policy/Ext_AllPolicy.sh @@ -77,7 +77,7 @@ cd ${TESTCLASSES} ${TESTJAVA}${FS}bin${FS}jar -cvf Ext_AllPolicy.jar Ext_AllPolicy.class rm Ext_AllPolicy.class -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -Djava.security.manager -Djava.ext.dirs="${TESTCLASSES}" Ext_AllPolicy exit $? diff --git a/test/sun/java2d/OpenGL/CustomCompositeTest.java b/test/sun/java2d/OpenGL/CustomCompositeTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3977270d45774b65a6943e0ad133f716e71b18ec --- /dev/null +++ b/test/sun/java2d/OpenGL/CustomCompositeTest.java @@ -0,0 +1,266 @@ +/* + * 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 7124347 + * @summary Verifies that rendering with XOR composite, and arbitraty + * custom composite doesn not cause internal errors. + * + * @run main/othervm -Dsun.java2d.opengl=True CustomCompositeTest + */ + +import java.awt.AWTException; +import java.awt.Color; +import java.awt.Composite; +import java.awt.CompositeContext; +import java.awt.Dimension; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.ImageCapabilities; +import java.awt.RenderingHints; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.DataBufferInt; +import java.awt.image.Raster; +import java.awt.image.SinglePixelPackedSampleModel; +import java.awt.image.VolatileImage; +import java.awt.image.WritableRaster; +import java.util.concurrent.CountDownLatch; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class CustomCompositeTest { + + private static JFrame frame; + private static CountDownLatch paintLatch; + private static Throwable paintError; + + public static void main(String[] args) { + + paintLatch = new CountDownLatch(1); + paintError = null; + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + initGUI(); + } + }); + + try { + paintLatch.await(); + } catch (InterruptedException e) { + }; + System.out.println("Paint is done!"); + if (paintError != null) { + frame.dispose(); + throw new RuntimeException("Test FAILED.", paintError); + } + + System.out.println("Phase 1: PASSED."); + + // now resise the frame in order to cause re-paint with accelerated + // source images. + paintError = null; + paintLatch = new CountDownLatch(1); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + Dimension size = frame.getSize(); + size.width += 50; + size.height += 50; + + frame.setSize(size); + } + }); + + try { + paintLatch.await(); + } catch (InterruptedException e) { + }; + if (paintError != null) { + frame.dispose(); + throw new RuntimeException("Resize test FAILED.", paintError); + } + frame.dispose(); + System.out.println("Phase 2: PASSED."); + + GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsConfiguration cfg = env.getDefaultScreenDevice().getDefaultConfiguration(); + // test rendering to accelerated volatile image + testVolatileImage(cfg, true); + System.out.println("Phase 3: PASSED."); + + // test rendering to unaccelerated volatile image + testVolatileImage(cfg, false); + System.out.println("Phase 4: PASSED."); + } + + private static void testVolatileImage(GraphicsConfiguration cfg, + boolean accelerated) + { + VolatileImage dst = null; + try { + dst = cfg.createCompatibleVolatileImage(640, 480, + new ImageCapabilities(accelerated)); + } catch (AWTException e) { + System.out.println("Unable to create volatile image, skip the test."); + return; + } + renderToVolatileImage(dst); + } + + private static void renderToVolatileImage(VolatileImage dst) { + Graphics2D g = dst.createGraphics(); + do { + System.out.println("Render to volatile image.."); + try { + MyComp.renderTest(g, dst.getHeight(), dst.getHeight()); + } catch (Throwable e) { + throw new RuntimeException("Test FAILED.", e); + } + } while (dst.contentsLost()); + System.out.println("Done."); + } + + private static void initGUI() { + frame = new JFrame("Silly composite"); + frame.getContentPane().add(new MyComp()); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.pack(); + frame.setVisible(true); + } + + private static class MyComp extends JComponent { + + private static BufferedImage theImage; + + public MyComp() { + } + + private static BufferedImage getTestImage() { + if (theImage == null) { + theImage = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = theImage.createGraphics(); + g2d.setColor(Color.red); + g2d.fillRect(0, 0, 256, 256); + + g2d.setPaint(new GradientPaint(0, 0, Color.red, 256, 256, Color.blue)); + g2d.fillRect(0, 100, 256, 256); + g2d.dispose(); + } + return theImage; + } + + public Dimension getPreferredSize() { + return new Dimension(640, 375); + } + + public void paintComponent(Graphics g) { + + + Graphics2D g2d = (Graphics2D) g; + try { + renderTest(g2d, getWidth(), getHeight()); + } catch (Throwable e) { + paintError = e; + } + if (paintLatch != null) { + paintLatch.countDown(); + } + } + + public static void renderTest(Graphics2D g2d, int w, int h) { + g2d.setColor(Color.yellow); + g2d.fillRect(0, 0, w, h); + + BufferedImage image = getTestImage(); + // draw original image + g2d.drawRenderedImage(image, null); + + // draw image with custom composite + g2d.translate(175, 25); + Composite currentComposite = g2d.getComposite(); + g2d.setComposite(new TestComposite()); + g2d.drawRenderedImage(image, null); + g2d.setComposite(currentComposite); + + // draw image with XOR + g2d.translate(175, 25); + g2d.setXORMode(Color.red); + g2d.drawRenderedImage(image, null); + + + System.out.println("Painting is done..."); + } + } + + // A silly custom Composite to demonstrate the problem - just inverts the RGB + private static class TestComposite implements Composite { + + public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) { + return new TestCompositeContext(); + } + } + + private static class TestCompositeContext implements CompositeContext { + + public void dispose() { + } + + public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { + int w = src.getWidth(); + int h = src.getHeight(); + + DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); + DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); + int srcRGB[] = srcDB.getBankData()[0]; + int dstOutRGB[] = dstOutDB.getBankData()[0]; + int srcOffset = srcDB.getOffset(); + int dstOutOffset = dstOutDB.getOffset(); + int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); + int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); + int srcAdjust = srcScanStride - w; + int dstOutAdjust = dstOutScanStride - w; + + int si = srcOffset; + int doi = dstOutOffset; + + for (int i = 0; i < h; i++) { + for (int j = 0; j < w; j++) { + dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; + si++; + doi++; + } + + si += srcAdjust; + doi += dstOutAdjust; + } + } + } +} diff --git a/test/sun/java2d/cmm/ColorConvertOp/InvalidRenderIntentTest.java b/test/sun/java2d/cmm/ColorConvertOp/InvalidRenderIntentTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9140e3c4c1baf5506d8bfabddd7e3a8ea59be0d6 --- /dev/null +++ b/test/sun/java2d/cmm/ColorConvertOp/InvalidRenderIntentTest.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011, 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 7064516 + * @summary Test verifies that incorrect profile rendering intent + * does not cause an failure of color conversion op. + * @run main InvalidRenderIntentTest + */ + +import java.awt.color.CMMException; +import java.awt.color.ColorSpace; +import java.awt.color.ICC_ColorSpace; +import java.awt.color.ICC_Profile; +import java.awt.image.ColorConvertOp; +import java.awt.image.BufferedImage; + +import static java.awt.color.ColorSpace.CS_sRGB; +import static java.awt.image.BufferedImage.TYPE_3BYTE_BGR; + +public class InvalidRenderIntentTest { + + public static void main(String[] args) { + ICC_Profile pSRGB = ICC_Profile.getInstance(CS_sRGB); + + byte[] raw_data = pSRGB.getData(); + + setRenderingIntent(0x1000000, raw_data); + + ICC_Profile p = ICC_Profile.getInstance(raw_data); + + ICC_ColorSpace cs = new ICC_ColorSpace(p); + + // perfrom test color conversion + ColorConvertOp op = new ColorConvertOp(cs, + ColorSpace.getInstance(CS_sRGB), null); + BufferedImage src = new BufferedImage(1, 1, TYPE_3BYTE_BGR); + BufferedImage dst = new BufferedImage(1, 1, TYPE_3BYTE_BGR); + + try { + op.filter(src.getRaster(), dst.getRaster()); + } catch (CMMException e) { + throw new RuntimeException("Test failed.", e); + } + System.out.println("Test passed."); + } + + private static void setRenderingIntent(int intent, byte[] data) { + final int pos = ICC_Profile.icHdrRenderingIntent; + + data[pos + 0] = (byte) (0xff & (intent >> 24)); + data[pos + 1] = (byte) (0xff & (intent >> 16)); + data[pos + 2] = (byte) (0xff & (intent >> 8)); + data[pos + 3] = (byte) (0xff & (intent)); + } +} diff --git a/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh b/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh index c4b4756e4b31d6d00ab78c75ce6fd94190c42649..558ac9cf10912938c6ce8c0544a61bd05a4eeba6 100644 --- a/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh +++ b/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh @@ -41,4 +41,4 @@ verify_os JAVA="${TESTJAVA}/bin/java" CP=${TESTJAVA}${FS}lib${FS}tools.jar${PS}${TESTCLASSES} -${JAVA} -classpath ${CP} MonitorVmStartTerminate +${JAVA} ${TESTVMOPTS} -classpath ${CP} MonitorVmStartTerminate diff --git a/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.sh b/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.sh index 0cc4afade614f70362267ecb5402c0ac44125fe3..8622fba94a0fa17f26a2db9124689c0eac684642 100644 --- a/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.sh +++ b/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.sh @@ -150,7 +150,7 @@ while true; do done # Start the manager - this should connect to VM -${TESTJAVA}/bin/java -classpath ${TESTCLASSES}:${TESTJAVA}/lib/tools.jar \ +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES}:${TESTJAVA}/lib/tools.jar \ TestManager $pid $port true if [ $? != 0 ]; then echo "Test failed" diff --git a/test/sun/management/jmxremote/bootstrap/LocalManagementTest.sh b/test/sun/management/jmxremote/bootstrap/LocalManagementTest.sh index 426e5d4ba76e4240f70b1e712851799c5530272d..7338cbe8600fb9326bb9177ff84e6b66f99b7c0b 100644 --- a/test/sun/management/jmxremote/bootstrap/LocalManagementTest.sh +++ b/test/sun/management/jmxremote/bootstrap/LocalManagementTest.sh @@ -43,8 +43,8 @@ doTest() rm -f ${outputfile} # Start VM with given options - echo "+ $JAVA $1 Test" - $JAVA $1 TestApplication > ${outputfile}& + echo "+ $JAVA ${TESTVMOPTS} $1 Test" + $JAVA ${TESTVMOPTS} $1 TestApplication > ${outputfile}& pid=$! # Wait for managed VM to startup @@ -64,7 +64,7 @@ doTest() done # Start the manager - this should connect to VM - sh -xc "$JAVA -classpath ${TESTCLASSES}:${TESTJAVA}/lib/tools.jar \ + sh -xc "$JAVA ${TESTVMOPTS} -classpath ${TESTCLASSES}:${TESTJAVA}/lib/tools.jar \ TestManager $pid $port" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } @@ -112,7 +112,7 @@ doTest " " # Test 4 - sanity check arguments to management-agent.jar echo ' ' -sh -xc "${JAVA} -javaagent:${AGENT}=com.sun.management.jmxremote.port=7775,\ +sh -xc "${JAVA} ${TESTVMOPTS} -javaagent:${AGENT}=com.sun.management.jmxremote.port=7775,\ com.sun.management.jmxremote.authenticate=false,com.sun.management.jmxremote.ssl=false \ TestApplication -exit" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi diff --git a/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh b/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh index 700a2b188ed924012974159d8833656ff75c2539..dfc4a85ad5c95b53dbba1a3e28a9304c3ef0249e 100644 --- a/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh +++ b/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh @@ -104,18 +104,18 @@ pp=-Dcom.sun.management.jmxremote.port=4888 go() { echo '' - sh -xc "$JAVA $1 $2 $3 $4 $5 $6 $7 $8" 2>&1 + sh -xc "$JAVA ${TESTVMOPTS} $1 $2 $3 $4 $5 $6 $7 $8" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } # Test 1 - password file is secure - VM should start chmod 700 ${PASSWD} -sh -xc "$JAVA $mp $pp Null" 2>&1 +sh -xc "$JAVA ${TESTVMOPTS} $mp $pp Null" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # Test 2 - password file is not secure - VM should fail to start chmod o+rx ${PASSWD} -sh -xc "$JAVA $mp $pp Null" 2>&1 +sh -xc "$JAVA ${TESTVMOPTS} $mp $pp Null" 2>&1 if [ $? = 0 ]; then failures=`expr $failures + 1`; fi # Reset the file permissions on the generated password file diff --git a/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh b/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh index 46927ec83357424582434217a96fa88a19923647..0fa765409b68d1c84ab9e9fdeea1812ebee50781 100644 --- a/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh +++ b/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh @@ -101,18 +101,18 @@ pp=-Dcom.sun.management.jmxremote.port=4999 go() { echo '' - sh -xc "$JAVA $1 $2 $3 $4 $5 $6 $7 $8" 2>&1 + sh -xc "$JAVA ${TESTVMOPTS} $1 $2 $3 $4 $5 $6 $7 $8" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } # Test 1 - SSL config file is secure - VM should start chmod 700 ${SSL} -sh -xc "$JAVA $mp $pp Dummy" 2>&1 +sh -xc "$JAVA ${TESTVMOPTS} $mp $pp Dummy" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # Test 2 - SSL config file is not secure - VM should fail to start chmod o+rx ${SSL} -sh -xc "$JAVA $mp $pp Dummy" 2>&1 +sh -xc "$JAVA ${TESTVMOPTS} $mp $pp Dummy" 2>&1 if [ $? = 0 ]; then failures=`expr $failures + 1`; fi # Reset the file permissions on the generated SSL config file diff --git a/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh b/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh index f52146b3bedc4bcec755f2e8f363c27e7dcc0469..6d48e17202aa21d3dc83293b88751ab82aa6dddb 100644 --- a/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh +++ b/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh @@ -61,7 +61,7 @@ _compile(){ } _app_start(){ - ${TESTJAVA}/bin/java -server $* -cp ${_testclasses} JMXStartStopDoSomething >> ${_logname} 2>&1 & + ${TESTJAVA}/bin/java ${TESTVMOPTS} $* -cp ${_testclasses} JMXStartStopDoSomething >> ${_logname} 2>&1 & npid=`_get_pid` if [ "${npid}" = "" ] @@ -103,7 +103,7 @@ _exit_on_jtreg(){ } _testme(){ - ${TESTJAVA}/bin/java -cp ${_testclasses} JMXStartStopTest $* + ${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${_testclasses} JMXStartStopTest $* } diff --git a/test/sun/misc/Cleaner/exitOnThrow.sh b/test/sun/misc/Cleaner/exitOnThrow.sh index f6090cd42ec1653f60987c10fc379a745a001ae7..7506ce4403ffee42e257a2c756bb11e5199adb5e 100644 --- a/test/sun/misc/Cleaner/exitOnThrow.sh +++ b/test/sun/misc/Cleaner/exitOnThrow.sh @@ -39,7 +39,7 @@ if [ -z "$TESTJAVA" ]; then TESTCLASSES=`pwd` fi -if $TESTJAVA/bin/java -cp $TESTCLASSES ExitOnThrow; then +if $TESTJAVA/bin/java ${TESTVMOPTS} -cp $TESTCLASSES ExitOnThrow; then echo Failed: VM exited normally exit 1 else diff --git a/test/sun/net/InetAddress/nameservice/dns/cname.sh b/test/sun/net/InetAddress/nameservice/dns/cname.sh index 9587d6af50443d19cd39f36a6157cd341a7c9930..13c922aed4dff222d595fc05b6854643585dd424 100644 --- a/test/sun/net/InetAddress/nameservice/dns/cname.sh +++ b/test/sun/net/InetAddress/nameservice/dns/cname.sh @@ -42,7 +42,7 @@ CLASSPATH=${TESTCLASSES} export CLASSPATH JAVA="${TESTJAVA}/bin/java" -sh -xc "$JAVA CanonicalName $HOST" 2>&1 +sh -xc "$JAVA ${TESTVMOPTS} CanonicalName $HOST" 2>&1 if [ $? != 0 ]; then echo "DNS not configured or host doesn't resolve to CNAME record" exit 0 @@ -52,7 +52,7 @@ failures=0 go() { echo '' - sh -xc "$JAVA $1 Lookup $2" 2>&1 + sh -xc "$JAVA ${TESTVMOPTS} $1 Lookup $2" 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi } diff --git a/test/sun/net/sdp/sanity.sh b/test/sun/net/sdp/sanity.sh index 0de27095d1c29dee3c497f2e06d38146b9941a22..88d80e0163e4e6db6958e486a96a53d0feafeb15 100644 --- a/test/sun/net/sdp/sanity.sh +++ b/test/sun/net/sdp/sanity.sh @@ -57,7 +57,7 @@ CLASSPATH=${TESTCLASSES}:${TESTSRC} export CLASSPATH # Probe for IP addresses plumbed to IB interfaces -$JAVA -Djava.net.preferIPv4Stack=true ProbeIB ${IB_LINKS} > ${IB_ADDRS} +$JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true ProbeIB ${IB_LINKS} > ${IB_ADDRS} # Create sdp.conf SDPCONF=sdp.conf @@ -70,4 +70,4 @@ do done # Sanity check -$JAVA -Djava.net.preferIPv4Stack=true -Dcom.sun.sdp.conf=${SDPCONF} -Dcom.sun.sdp.debug Sanity +$JAVA ${TESTVMOPTS} -Djava.net.preferIPv4Stack=true -Dcom.sun.sdp.conf=${SDPCONF} -Dcom.sun.sdp.debug Sanity diff --git a/test/sun/net/www/MarkResetTest.sh b/test/sun/net/www/MarkResetTest.sh index c3eb53a56d50d2926669da1f893420e66e4603d8..542bfe4b17927be432508b7c6fa21ca5563e531a 100644 --- a/test/sun/net/www/MarkResetTest.sh +++ b/test/sun/net/www/MarkResetTest.sh @@ -52,4 +52,4 @@ ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}MarkResetTest.java # in this directory cp ${TESTSRC}${FS}EncDec.doc . -${TESTJAVA}${FS}bin${FS}java MarkResetTest +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} MarkResetTest 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/net/www/http/HttpClient/RetryPost.sh b/test/sun/net/www/http/HttpClient/RetryPost.sh index 314a007c64f6d496a5b0200065afd72224273513..fc563c83b16a9ebd8b72b296dabe609bc5d3e5bd 100644 --- a/test/sun/net/www/http/HttpClient/RetryPost.sh +++ b/test/sun/net/www/http/HttpClient/RetryPost.sh @@ -50,14 +50,14 @@ esac ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}RetryPost.java # run with no option specified. Should retry POST request. -${TESTJAVA}${FS}bin${FS}java RetryPost +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} RetryPost result=$? if [ "$result" -ne "0" ]; then exit 1 fi # run with option specified. Should not retry POST request. -${TESTJAVA}${FS}bin${FS}java -Dsun.net.http.retryPost=false RetryPost noRetry +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dsun.net.http.retryPost=false RetryPost noRetry result=$? if [ "$result" -ne "0" ]; then exit 1 diff --git a/test/sun/net/www/protocol/file/DirPermissionDenied.sh b/test/sun/net/www/protocol/file/DirPermissionDenied.sh index a85f4d53a99fa0a3a85cffea9a3f29fb3e00dbf3..7606b3dd9acf455c8ca775a23b43c5fd1216ad05 100644 --- a/test/sun/net/www/protocol/file/DirPermissionDenied.sh +++ b/test/sun/net/www/protocol/file/DirPermissionDenied.sh @@ -35,7 +35,7 @@ rm -rf ${TESTDIR} mkdir -p ${TESTDIR} chmod 333 ${TESTDIR} -$TESTJAVA/bin/java -classpath $TESTCLASSES DirPermissionDenied ${TESTDIR} +$TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES DirPermissionDenied ${TESTDIR} result=$? # Add back read access for user, otherwise not removable on some systems diff --git a/test/sun/net/www/protocol/jar/B5105410.sh b/test/sun/net/www/protocol/jar/B5105410.sh index 3dbce7f3f773b5bb5219436930436aebf071694b..1fdbdd58ff8f6a52e092bf19e023b03122c2b547 100644 --- a/test/sun/net/www/protocol/jar/B5105410.sh +++ b/test/sun/net/www/protocol/jar/B5105410.sh @@ -51,5 +51,5 @@ esac cp ${TESTSRC}${FS}foo2.jar . ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}B5105410.java -${TESTJAVA}${FS}bin${FS}java B5105410 +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} B5105410 diff --git a/test/sun/net/www/protocol/jar/getcontenttype.sh b/test/sun/net/www/protocol/jar/getcontenttype.sh index da3563db5c6b2f1eec26aaad0a5bbc1fcc23e662..a3a1a2a13103c5ccb6c2c6b3640d41593dd7bb46 100644 --- a/test/sun/net/www/protocol/jar/getcontenttype.sh +++ b/test/sun/net/www/protocol/jar/getcontenttype.sh @@ -33,5 +33,5 @@ if [ x"$TESTCLASSES" = x ]; then TESTCLASSES=.; fi if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi # now start the test -${TESTJAVA}/bin/java -Djava.ext.dirs=$TESTSRC -cp $TESTCLASSES GetContentType +${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.ext.dirs=$TESTSRC -cp $TESTCLASSES GetContentType diff --git a/test/sun/net/www/protocol/jar/jarbug/run.sh b/test/sun/net/www/protocol/jar/jarbug/run.sh index 31cfbe86158b833fdb1b59ffe4acff00b1e525d1..72a11681d1cee99a713c3674bc39a30cbe26c80c 100644 --- a/test/sun/net/www/protocol/jar/jarbug/run.sh +++ b/test/sun/net/www/protocol/jar/jarbug/run.sh @@ -71,7 +71,7 @@ mv jar1.jar .. # ${TESTJAVA}${FS}bin${FS}javac -d ${DEST} ${TESTSRC}${FS}src${FS}test${FS}*.java cd ${DEST} -${TESTJAVA}${FS}bin${FS}java RunAllTests +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} RunAllTests result=$? if [ "$result" -ne "0" ]; then exit 1 diff --git a/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java b/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java index 04d2fd9fe0311e0491981847f17bc404c36ae38a..012c0b8cab91b19d8bcd451438fc4ea17a15f301 100644 --- a/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java +++ b/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java @@ -22,8 +22,10 @@ */ /* @test - @bug 4094889 - @summary rmid can have a corrupted log + * @bug 4094889 + * @summary rmid can have a corrupted log + * + * @run main LogAlignmentTest */ /* Fault: ReliableLog used RandomAccessFile.skipBytes() to seek past the end diff --git a/test/sun/rmi/log/ReliableLog/SnapshotSize.java b/test/sun/rmi/log/ReliableLog/SnapshotSize.java index f1febfc1fc2415b312f4152ec794482ddc288b89..592ef5eaba9658614bf0bfa50d96d20b87a7c66a 100644 --- a/test/sun/rmi/log/ReliableLog/SnapshotSize.java +++ b/test/sun/rmi/log/ReliableLog/SnapshotSize.java @@ -25,6 +25,8 @@ * @bug 4319866 * @summary Verify that ReliableLog.snapshotSize() returns correct snapshot * file size even if LogHandler doesn't flush. + * + * @run main SnapshotSize */ import java.io.ByteArrayOutputStream; diff --git a/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java b/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java index ad2484168eabab6d485d42010b21d51fc8a46fc9..5f4587ecdfb5401ccd92d1b9a0e750ea65b3d20c 100644 --- a/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java +++ b/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java @@ -28,7 +28,6 @@ * @library ../../../../java/rmi/testlibrary * * @build StreamPipe - * @build RmicDefault * @run main RmicDefault */ diff --git a/test/sun/rmi/rmic/manifestClassPath/run.sh b/test/sun/rmi/rmic/manifestClassPath/run.sh index 4faf141ff91872d152fff38537712d98b8465f0e..f20ab75527e465b9ff9996e75cd5777c231853dc 100644 --- a/test/sun/rmi/rmic/manifestClassPath/run.sh +++ b/test/sun/rmi/rmic/manifestClassPath/run.sh @@ -114,26 +114,26 @@ EOF Success "$javac" -classpath "jars/A.jar" Main.java MainI.java Success "$rmic" -classpath "jars/A.jar${PS}." Main -Success "$java" -classpath "jars/A.jar${PS}." Main +Success "$java" ${TESTVMOPTS} -classpath "jars/A.jar${PS}." Main Sys rm -f Main.class MainI.class Main_Stub.class Success "$javac" -classpath "jars/sub/B.zip" Main.java MainI.java Success "$rmic" -classpath "jars/sub/B.zip${PS}." Main -Success "$java" -classpath "jars/sub/B.zip${PS}." Main +Success "$java" ${TESTVMOPTS} -classpath "jars/sub/B.zip${PS}." Main #Sys rm -f Main.class MainI.class Main_Stub.class Sys rm -f Main_Stub.class # javac -extdirs workaround #Success "$javac" -extdirs "jars" -classpath None Main.java MainI.java Success "$rmic" -extdirs "jars" -classpath . Main -Success "$java" -Djava.ext.dirs="jars" -cp . Main +Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars" -cp . Main Sys rm -f Main_Stub.class #Success "$javac" -extdirs "jars/sub" -classpath None Main.java MainI.java Success "$rmic" -extdirs "jars/sub" -classpath . Main -Success "$java" -Djava.ext.dirs="jars/sub" -cp . Main +Success "$java" ${TESTVMOPTS} -Djava.ext.dirs="jars/sub" -cp . Main Cleanup diff --git a/test/sun/rmi/rmic/minimizeWrapperInstances/run.sh b/test/sun/rmi/rmic/minimizeWrapperInstances/run.sh index 204947dcea6b5be415ff827b0da5a58ca8843491..3c8e831e31158103bb1e39ca8ce83709e9429859 100644 --- a/test/sun/rmi/rmic/minimizeWrapperInstances/run.sh +++ b/test/sun/rmi/rmic/minimizeWrapperInstances/run.sh @@ -41,13 +41,13 @@ fi set -ex ${TESTJAVA}/bin/rmic -classpath ${TESTCLASSES:-.} -d ${TESTCLASSES:-.} PImpl -${TESTJAVA}/bin/java -classpath ${TESTCLASSES:-.} Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES:-.} Test ${TESTJAVA}/bin/rmic -classpath ${TESTCLASSES:-.} -d ${TESTCLASSES:-.} -vcompat PImpl -${TESTJAVA}/bin/java -classpath ${TESTCLASSES:-.} Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES:-.} Test ${TESTJAVA}/bin/rmic -Xnew -classpath ${TESTCLASSES:-.} -d ${TESTCLASSES:-.} PImpl -${TESTJAVA}/bin/java -classpath ${TESTCLASSES:-.} Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES:-.} Test ${TESTJAVA}/bin/rmic -Xnew -classpath ${TESTCLASSES:-.} -d ${TESTCLASSES:-.} -vcompat PImpl -${TESTJAVA}/bin/java -classpath ${TESTCLASSES:-.} Test +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES:-.} Test diff --git a/test/sun/rmi/rmic/newrmic/equivalence/run.sh b/test/sun/rmi/rmic/newrmic/equivalence/run.sh index 8d4f419d346bd2ec541322605dbc7f08930b8f55..27c86041414d8e0dda8a114ba0db1becaccd2c9d 100644 --- a/test/sun/rmi/rmic/newrmic/equivalence/run.sh +++ b/test/sun/rmi/rmic/newrmic/equivalence/run.sh @@ -26,22 +26,24 @@ # @summary This test verifies that the new implementation of rmic # generates equivalent classes as the old implementation, for a set # of sample input classes. +# @author Peter Jones +# # @library ../../../../../java/rmi/testlibrary +# # @build TestLibrary -# @author Peter Jones +# AgentServerImpl +# AppleImpl +# AppleUserImpl +# ComputeServerImpl +# CountServerImpl +# DayTimeServerImpl +# G1Impl +# MyObjectImpl +# NotActivatableServerImpl +# OrangeEchoImpl +# OrangeImpl +# ServerImpl # -# @build AgentServerImpl -# @build AppleImpl -# @build AppleUserImpl -# @build ComputeServerImpl -# @build CountServerImpl -# @build DayTimeServerImpl -# @build G1Impl -# @build MyObjectImpl -# @build NotActivatableServerImpl -# @build OrangeEchoImpl -# @build OrangeImpl -# @build ServerImpl # @run shell run.sh if [ "${TESTJAVA}" = "" ] diff --git a/test/sun/rmi/rmic/oldjavacRemoved/sunToolsJavacMain.sh b/test/sun/rmi/rmic/oldjavacRemoved/sunToolsJavacMain.sh index fbb55817582b52d809b1e9433e5414bf8bca1ac4..11840fa50371b0a5d7efb79b57c86616160d8179 100644 --- a/test/sun/rmi/rmic/oldjavacRemoved/sunToolsJavacMain.sh +++ b/test/sun/rmi/rmic/oldjavacRemoved/sunToolsJavacMain.sh @@ -37,7 +37,7 @@ fi set -x -${TESTJAVA}/bin/java -classpath ${TESTJAVA}/lib/tools.jar sun.tools.javac.Main -d ${TESTCLASSES:-.} ${TESTSRC:-.}/Foo.java +${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTJAVA}/lib/tools.jar sun.tools.javac.Main -d ${TESTCLASSES:-.} ${TESTSRC:-.}/Foo.java result=$? if [ $result -eq 0 ] diff --git a/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java b/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java index e5e19fe12dd50a3b1bbf41e3c15d57b17f6cb115..afcc13571e54147c73d50a16d4ff6b00d49fc232 100644 --- a/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java +++ b/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java @@ -31,8 +31,7 @@ * @author Peter Jones * * @library ../../../../../java/rmi/testlibrary - * @build JavaVM - * @build NoConsoleOutput + * @build TestLibrary JavaVM * @run main/othervm NoConsoleOutput */ diff --git a/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java b/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java index 34cfc485d1eb739b198ea3271d782b87af4af119..1e959536c228ba1e3566e6cd133e688f9d7b9a2b 100644 --- a/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java +++ b/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java @@ -28,11 +28,7 @@ * @author Laird Dornin * * @library ../../../../../java/rmi/testlibrary - * @build TestLibrary - * @build TestParams - * @build TestFailedException - * @build CheckLogging - * @build CheckLogStreams + * @build TestLibrary CheckLogging * @run main/othervm -Dsun.rmi.log.useOld=true CheckLogStreams */ diff --git a/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java b/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java index 77c236d437112f6fc482e6d93dae0406f9e37caf..347725a3d6d56285bec0cd8141395067101b96ea 100644 --- a/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java +++ b/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java @@ -29,9 +29,6 @@ * * @library ../../../../../java/rmi/testlibrary * @build TestLibrary - * @build TestParams - * @build TestFailedException - * @build CheckLogging * @run main/othervm CheckLogging */ diff --git a/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java b/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java index 165dfbe1cf9b6ef96ca5cfe0ecc343a0c6ceb5da..bf1eb11372fbab0de18c1afddf9c114026b093ff 100644 --- a/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java +++ b/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java @@ -31,11 +31,7 @@ * @author Ann Wollrath * * @library ../../../../../java/rmi/testlibrary - * @build TestLibrary - * @build TestFailedException - * @build MarshalForeignStub - * @build Receiver - * @build MarshalForeignStub_Stub + * @build TestLibrary Receiver MarshalForeignStub_Stub * @run main/othervm/policy=security.policy MarshalForeignStub */ diff --git a/test/sun/rmi/transport/proxy/EagerHttpFallback.java b/test/sun/rmi/transport/proxy/EagerHttpFallback.java index 1f54e2cb845883bfc4aeb51f8a657a3b6a11bb32..3879c665d14d1c0b28e43d157568f0b427b895af 100644 --- a/test/sun/rmi/transport/proxy/EagerHttpFallback.java +++ b/test/sun/rmi/transport/proxy/EagerHttpFallback.java @@ -25,6 +25,7 @@ * @bug 4290727 * @summary Verify that ConnectException will trigger HTTP fallback if * sun.rmi.transport.proxy.eagerHttpFallback system property is set. + * * @library ../../../../java/rmi/testlibrary * @build TestLibrary * @run main/othervm EagerHttpFallback diff --git a/test/sun/rmi/transport/tcp/DeadCachedConnection.java b/test/sun/rmi/transport/tcp/DeadCachedConnection.java index 1372b03feab8bf05a516b6d36680158e815ae211..7bcd5a71024e50da1bdd9f8ac1583ed6d564c43e 100644 --- a/test/sun/rmi/transport/tcp/DeadCachedConnection.java +++ b/test/sun/rmi/transport/tcp/DeadCachedConnection.java @@ -25,9 +25,7 @@ * @bug 4094891 * @summary unable to retry call if cached connection to server is used * @library ../../../../java/rmi/testlibrary - * @build DeadCachedConnection - * @build JavaVM - * @build TestLibrary + * @build TestLibrary JavaVM * @run main/othervm DeadCachedConnection */ diff --git a/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java b/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java index af41bf0a7af4243399143d3439a375707a83c05c..1624f68ee8cb59c5a6c29c110bd3132984b26029 100644 --- a/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java +++ b/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java @@ -27,11 +27,8 @@ * @summary RMI blocks in HttpAwareServerSocket.accept() if you telnet to it * @author Adrian Colley * - * @library ../../../../../java/rmi/testlibrary/ - * @build TestIface - * @build TestImpl - * @build TestImpl_Stub - * @build BlockAcceptTest + * @library ../../../../../java/rmi/testlibrary + * @build TestIface TestImpl TestImpl_Stub * @run main/othervm/policy=security.policy/timeout=60 BlockAcceptTest */ diff --git a/test/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java b/test/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java index 51dbeec1060e80e68e827cb9f7b4d01a51b85f3f..805c798ae4588c4a946974f8018fd520a5d1f98a 100644 --- a/test/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java +++ b/test/sun/rmi/transport/tcp/disableMultiplexing/DisableMultiplexing.java @@ -28,7 +28,6 @@ * on that port, rather than engage in the deprecated "multiplexing protocol". * @author Peter Jones * - * @build DisableMultiplexing * @build DisableMultiplexing_Stub * @run main/othervm DisableMultiplexing */ 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/krb5/runNameEquals.sh b/test/sun/security/krb5/runNameEquals.sh index 15096cc99deac93c755083f6dd4999f7eabe95ff..1fea3620e190e8eeb1aff280c8f308113dc6d878 100644 --- a/test/sun/security/krb5/runNameEquals.sh +++ b/test/sun/security/krb5/runNameEquals.sh @@ -81,7 +81,7 @@ EXIT_STATUS=0 if [ "${NATIVE}" = "true" ] ; then echo "Testing native provider" - ${TESTJAVA}${FILESEP}bin${FILESEP}java \ + ${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES} \ -Dsun.security.jgss.native=true \ ${TEST} @@ -92,7 +92,7 @@ if [ "${NATIVE}" = "true" ] ; then fi echo "Testing java provider" -${TESTJAVA}${FILESEP}bin${FILESEP}java \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES} \ -Djava.security.krb5.realm=R \ -Djava.security.krb5.kdc=127.0.0.1 \ diff --git a/test/sun/security/krb5/tools/ktcheck.sh b/test/sun/security/krb5/tools/ktcheck.sh index 383de8fc4f98ab0976afd1878b982ddf617c7443..b1b3743076dec0ea17c569b1a7d216ab5f6a8a3b 100644 --- a/test/sun/security/krb5/tools/ktcheck.sh +++ b/test/sun/security/krb5/tools/ktcheck.sh @@ -58,7 +58,7 @@ ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}KtabCheck.java EXTRA_OPTIONS="-Djava.security.krb5.conf=${TESTSRC}${FS}onlythree.conf" KTAB="${TESTJAVA}${FS}bin${FS}ktab -J${EXTRA_OPTIONS} -k $KEYTAB -f" -CHECK="${TESTJAVA}${FS}bin${FS}java ${EXTRA_OPTIONS} KtabCheck $KEYTAB" +CHECK="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRA_OPTIONS} KtabCheck $KEYTAB" echo ${EXTRA_OPTIONS} diff --git a/test/sun/security/mscapi/AccessKeyStore.sh b/test/sun/security/mscapi/AccessKeyStore.sh index 6706aa3ff399494259304adff387abeac9709f77..0998de4821f6c95ef54b3ab1d3be2ac95d809764 100644 --- a/test/sun/security/mscapi/AccessKeyStore.sh +++ b/test/sun/security/mscapi/AccessKeyStore.sh @@ -42,13 +42,13 @@ case "$OS" in ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\AccessKeyStore.java echo "Using access.policy..." - ${TESTJAVA}/bin/java \ + ${TESTJAVA}/bin/java ${TESTVMOPTS} \ -Djava.security.manager \ -Djava.security.policy==${TESTSRC}\\access.policy \ AccessKeyStore echo "Using noaccess.policy..." - ${TESTJAVA}/bin/java \ + ${TESTJAVA}/bin/java ${TESTVMOPTS} \ -Djava.security.manager \ -Djava.security.policy==${TESTSRC}\\noaccess.policy \ AccessKeyStore -deny diff --git a/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh b/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh index 197ee37b134ee3ccda90970a4cdfc4917a864ab8..77e258e4cda2e8262398778858b9918ba648da6f 100644 --- a/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh +++ b/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh @@ -40,7 +40,7 @@ case "$OS" in # execute test program - rely on it to exit if platform unsupported ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\IsSunMSCAPIAvailable.java - ${TESTJAVA}/bin/java IsSunMSCAPIAvailable + ${TESTJAVA}/bin/java ${TESTVMOPTS} IsSunMSCAPIAvailable exit ;; diff --git a/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh b/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh index ee0c6c3609f306800df2b7f26f5a82dac4338140..b6ca1395d7620f66da114383f30f6489007f73a7 100644 --- a/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh +++ b/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh @@ -43,15 +43,15 @@ case "$OS" in ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\KeyStoreCompatibilityMode.java # mode implicitly enabled - ${TESTJAVA}/bin/java KeyStoreCompatibilityMode + ${TESTJAVA}/bin/java ${TESTVMOPTS} KeyStoreCompatibilityMode # mode explicitly enabled - ${TESTJAVA}/bin/java \ + ${TESTJAVA}/bin/java ${TESTVMOPTS} \ -Dsun.security.mscapi.keyStoreCompatibilityMode="true" \ KeyStoreCompatibilityMode # mode explicitly disabled - ${TESTJAVA}/bin/java \ + ${TESTJAVA}/bin/java ${TESTVMOPTS} \ -Dsun.security.mscapi.keyStoreCompatibilityMode="false" \ KeyStoreCompatibilityMode -disable diff --git a/test/sun/security/mscapi/PublicKeyInterop.sh b/test/sun/security/mscapi/PublicKeyInterop.sh index 1967e63d26618dc0217c6aa1c28594590e18cf0c..abdad4c6530ca3eba6b89910e24a2b0148e9442d 100644 --- a/test/sun/security/mscapi/PublicKeyInterop.sh +++ b/test/sun/security/mscapi/PublicKeyInterop.sh @@ -62,7 +62,7 @@ case "$OS" in echo echo "Running the test..." ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\PublicKeyInterop.java - ${TESTJAVA}/bin/java PublicKeyInterop + ${TESTJAVA}/bin/java ${TESTVMOPTS} PublicKeyInterop rc=$? diff --git a/test/sun/security/mscapi/RSAEncryptDecrypt.sh b/test/sun/security/mscapi/RSAEncryptDecrypt.sh index 19add0a7356bb232c4edbd29e360eee611a3de5f..ed17bd1159e11f0a6030caa215f0fb0d36ae0575 100644 --- a/test/sun/security/mscapi/RSAEncryptDecrypt.sh +++ b/test/sun/security/mscapi/RSAEncryptDecrypt.sh @@ -70,7 +70,7 @@ case "$OS" in # unsupported ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\RSAEncryptDecrypt.java - ${TESTJAVA}/bin/java RSAEncryptDecrypt + ${TESTJAVA}/bin/java ${TESTVMOPTS} RSAEncryptDecrypt exit ;; diff --git a/test/sun/security/mscapi/ShortRSAKey1024.sh b/test/sun/security/mscapi/ShortRSAKey1024.sh index 1e01377ed29be3ea2e1aa0e3f6aa6e6a96b6a3f0..05db70e1a3ec0f02fe394f9f74c1827528452a01 100644 --- a/test/sun/security/mscapi/ShortRSAKey1024.sh +++ b/test/sun/security/mscapi/ShortRSAKey1024.sh @@ -89,7 +89,7 @@ case "$OS" in echo "Running the test..." ${TESTJAVA}${FS}bin${FS}javac -d . \ ${TESTSRC}${FS}ShortRSAKeyWithinTLS.java - ${TESTJAVA}${FS}bin${FS}java ShortRSAKeyWithinTLS 7106773.$BITS $BITS \ + ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ShortRSAKeyWithinTLS 7106773.$BITS $BITS \ TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA rc=$? diff --git a/test/sun/security/mscapi/SignUsingNONEwithRSA.sh b/test/sun/security/mscapi/SignUsingNONEwithRSA.sh index c89a8687877f6dc5e6353cc7619c3be7be22c3cf..f794e298d186554fa53445aa6b22021349b044b7 100644 --- a/test/sun/security/mscapi/SignUsingNONEwithRSA.sh +++ b/test/sun/security/mscapi/SignUsingNONEwithRSA.sh @@ -61,7 +61,7 @@ case "$OS" in echo echo "Running the test..." ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\SignUsingNONEwithRSA.java - ${TESTJAVA}/bin/java SignUsingNONEwithRSA + ${TESTJAVA}/bin/java ${TESTVMOPTS} SignUsingNONEwithRSA rc=$? diff --git a/test/sun/security/mscapi/SignUsingSHA2withRSA.sh b/test/sun/security/mscapi/SignUsingSHA2withRSA.sh index c939fb39e3f99989fa65dfe79e84daa7aa168405..2d433f108f015f10c6ffc97232b91ca2f9b943da 100644 --- a/test/sun/security/mscapi/SignUsingSHA2withRSA.sh +++ b/test/sun/security/mscapi/SignUsingSHA2withRSA.sh @@ -61,7 +61,7 @@ case "$OS" in echo echo "Running the test..." ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\SignUsingSHA2withRSA.java - ${TESTJAVA}/bin/java SignUsingSHA2withRSA + ${TESTJAVA}/bin/java ${TESTVMOPTS} SignUsingSHA2withRSA rc=$? diff --git a/test/sun/security/pkcs11/KeyStore/Basic.sh b/test/sun/security/pkcs11/KeyStore/Basic.sh index 54408bdfd99b9baaf6d1bff679ab7adb2c551c36..452b6290e4a10d796cea8f050d1ca46d5605d547 100644 --- a/test/sun/security/pkcs11/KeyStore/Basic.sh +++ b/test/sun/security/pkcs11/KeyStore/Basic.sh @@ -171,7 +171,7 @@ fi # run test -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ -DDIR=${TESTSRC}${FS}BasicData \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ diff --git a/test/sun/security/pkcs11/KeyStore/ClientAuth.sh b/test/sun/security/pkcs11/KeyStore/ClientAuth.sh index 0593ddf144cbbd26404d0eed1dc5d4455023d9af..d0996c1823a279071a4c6219ab782887163a5588 100644 --- a/test/sun/security/pkcs11/KeyStore/ClientAuth.sh +++ b/test/sun/security/pkcs11/KeyStore/ClientAuth.sh @@ -128,7 +128,7 @@ ${TESTJAVA}${FS}bin${FS}javac \ # run test echo "Run ClientAuth ..." -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ @@ -149,7 +149,7 @@ fi # run test with specified TLS protocol and cipher suite echo "Run ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA" -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ -DDIR=${TESTSRC}${FS}ClientAuthData${FS} \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ diff --git a/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh b/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh index 4041c0e093a9787e0560240fd6b9eff1e59274ff..3033455530253f6dcc8c7eb6e992d800202d7dc0 100644 --- a/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh +++ b/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh @@ -141,7 +141,7 @@ fi # run test cd ${TESTSRC} -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -DDIR=${TESTSRC}${FS}BasicData${FS} \ -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ diff --git a/test/sun/security/pkcs11/KeyStore/Solaris.sh b/test/sun/security/pkcs11/KeyStore/Solaris.sh index 9da8ab9c069d5b983250bb233a91094de9bbea47..5ec1ac2ec951d6c5dd351191b82281146091c9f8 100644 --- a/test/sun/security/pkcs11/KeyStore/Solaris.sh +++ b/test/sun/security/pkcs11/KeyStore/Solaris.sh @@ -142,7 +142,7 @@ fi # run test cd ${TESTSRC} -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ -DDIR=${TESTSRC}${FS}BasicData${FS} \ -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-solaris.txt \ diff --git a/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh b/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh index ce5693f5968b5963b84282cd7c204b185621da09..1a749d8949025a3b6e63b2eadd67c92d44304965 100644 --- a/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh +++ b/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh @@ -99,7 +99,7 @@ ${TESTJAVA}${FS}bin${FS}javac \ # run test -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES} \ -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ConfigQuotedString-nss.txt \ -Dtest.src=${TESTSRC} \ diff --git a/test/sun/security/pkcs11/Provider/Login.sh b/test/sun/security/pkcs11/Provider/Login.sh index 86d8f9e4f709eb404b90cbb14c242e56a2e1c2d9..6b37ef837d21c1f145afa2da77a1bfb911976b44 100644 --- a/test/sun/security/pkcs11/Provider/Login.sh +++ b/test/sun/security/pkcs11/Provider/Login.sh @@ -108,7 +108,7 @@ ${TESTJAVA}${FS}bin${FS}javac \ # run test -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath ${TESTCLASSES} \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}Login-nss.txt \ diff --git a/test/sun/security/pkcs11/ec/TestECDSA.java b/test/sun/security/pkcs11/ec/TestECDSA.java index a684d8aa8e15dafe8dc9ac1bcac0bbc87612f575..92dac4c34b65580ab6de1e0327d05c34a8befda7 100644 --- a/test/sun/security/pkcs11/ec/TestECDSA.java +++ b/test/sun/security/pkcs11/ec/TestECDSA.java @@ -179,7 +179,6 @@ public class TestECDSA extends PKCS11Test { // SHA1withECDSA and NONEwithECDSA Signature s = Signature.getInstance("SHA1withECDSA", provider); s.initSign(privateKey); - s.initSign(privateKey); s.update(data); byte[] s1 = s.sign(); 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/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.sh b/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.sh index ee4035cc6ec5fc9bc73505976ed58ed0a423b92f..b09d1564b7f95e59742df9d8a61994ef024a523a 100644 --- a/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.sh +++ b/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.sh @@ -82,7 +82,7 @@ mv \ ${TESTJAVA}${FILESEP}jre${FILESEP}lib${FILESEP}security${FILESEP}tmp_pol # run the test program -${TESTJAVA}${FILESEP}bin${FILESEP}java -Djava.security.manager \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} -Djava.security.manager \ GrantAllPermToExtWhenNoPolicy # save error status diff --git a/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh b/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh index b52db72b326af5cc65b19f3d5e17a3c323e8db61..893bbb65bc50227c926da9f850dbadda9209aebc 100644 --- a/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh +++ b/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh @@ -92,7 +92,7 @@ ${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}boot \ ${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}app \ ${TESTSRC}${FS}GetInstance.java -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -Xbootclasspath/a:"${TESTCLASSES}${FS}boot" \ -classpath "${TESTCLASSES}${FS}app" -Djava.security.manager \ -Djava.security.policy=GetInstance.policy \ @@ -106,7 +106,7 @@ if [ $status1 -ne 0 ]; then echo "Failed on first test" fi -${TESTJAVA}${FS}bin${FS}java \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ -classpath "${TESTCLASSES}${FS}boot${PS}${TESTCLASSES}${FS}app" \ -Djava.security.manager \ -Djava.security.policy=GetInstance.policy \ diff --git a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.sh b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.sh index c2d14c75bd3a06f93789de607fa27b1c642d9841..f29f6cedd946a11cce90bda63259d78dec6d6101 100644 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.sh +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.sh @@ -59,7 +59,7 @@ echo "Examining debug output for the string:" echo "${STRING}" echo "=========" -${TESTJAVA}${FS}bin${FS}java -Djavax.net.debug=all \ +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Djavax.net.debug=all \ -Dtest.src=${TESTSRC} \ DebugReportsOneExtraByte 2>&1 | \ grep "${STRING}" diff --git a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh index fa5a410aa64b669a10abd119867e3ecf90df4a02..60a38468be5e942ec870d5fda22967bbd5d8cf8e 100644 --- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh +++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh @@ -82,7 +82,7 @@ rm -rf com edu # This is the only thing we really care about as far as # test status goes. # -${TESTJAVA}${FILESEP}bin${FILESEP}java \ +${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \ -Dtest.src=${TESTSRC} \ -classpath "com.jar${PATHSEP}edu.jar" \ -Djava.security.manager \ diff --git a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh index 7696cbbd6b379138d8b891ec1ea4632bc409f6f9..85e9c22c4afa73a80002c9897792c314dbf59124 100644 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh @@ -52,5 +52,5 @@ esac ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}OriginServer.java \ ${TESTSRC}${FS}ProxyTunnelServer.java ${TESTSRC}${FS}PostThruProxy.java -${TESTJAVA}${FS}bin${FS}java PostThruProxy ${HOSTNAME} ${TESTSRC} +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} PostThruProxy ${HOSTNAME} ${TESTSRC} exit diff --git a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh index 9e2ed3c4bf0eccb19f9fa1c26617e27a95123390..96c0642480b716f6575e6931b685ce7caa930530 100644 --- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh @@ -53,5 +53,5 @@ esac ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}OriginServer.java \ ${TESTSRC}${FS}ProxyTunnelServer.java \ ${TESTSRC}${FS}PostThruProxyWithAuth.java -${TESTJAVA}${FS}bin${FS}java PostThruProxyWithAuth ${HOSTNAME} ${TESTSRC} +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} PostThruProxyWithAuth ${HOSTNAME} ${TESTSRC} exit diff --git a/test/sun/security/tools/jarsigner/emptymanifest.sh b/test/sun/security/tools/jarsigner/emptymanifest.sh index 81c0937f436140c01ed5bd770c67d9157f5bfd90..cbb72413f1a0a07a2b5fd2acfcd8cb52b678293b 100644 --- a/test/sun/security/tools/jarsigner/emptymanifest.sh +++ b/test/sun/security/tools/jarsigner/emptymanifest.sh @@ -65,7 +65,7 @@ class CrLf { } EOF $JAVAC CrLf.java -$JAVA CrLf > META-INF${FS}MANIFEST.MF +$JAVA ${TESTVMOPTS} CrLf > META-INF${FS}MANIFEST.MF zip $JFILE META-INF${FS}MANIFEST.MF A B $KT -alias a -dname CN=a -keyalg rsa -genkey -validity 300 diff --git a/test/sun/security/tools/jarsigner/ts.sh b/test/sun/security/tools/jarsigner/ts.sh index 3293a7dfa711455e0629f4eba608d790fd5ff415..43a3651f62a7708a2ec3832d67ff4651858f887d 100644 --- a/test/sun/security/tools/jarsigner/ts.sh +++ b/test/sun/security/tools/jarsigner/ts.sh @@ -87,5 +87,5 @@ $KT -alias tsbad3 -certreq | \ $KT -alias tsbad3 -importcert $JAVAC -d . ${TESTSRC}/TimestampCheck.java -$JAVA TimestampCheck +$JAVA ${TESTVMOPTS} TimestampCheck 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/security/tools/keytool/printssl.sh b/test/sun/security/tools/keytool/printssl.sh index b750ffe8d2d8cedf8b9277a7bdb962f036711dea..46de2609b0b37ffd9dc4f987fcb62b0d13b7e8d7 100644 --- a/test/sun/security/tools/keytool/printssl.sh +++ b/test/sun/security/tools/keytool/printssl.sh @@ -53,7 +53,7 @@ case "$OS" in esac ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}PrintSSL.java || exit 10 -${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC PrintSSL | ( read PORT; ${TESTJAVA}${FS}bin${FS}keytool -printcert -sslserver localhost:$PORT ) +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dtest.src=$TESTSRC PrintSSL | ( read PORT; ${TESTJAVA}${FS}bin${FS}keytool -printcert -sslserver localhost:$PORT ) status=$? rm PrintSSL*.class diff --git a/test/sun/security/tools/keytool/standard.sh b/test/sun/security/tools/keytool/standard.sh index 756d2fb1f1e2206d0bb4c668c6b3ae4ccf3e4d51..c75a7a49b46db22c7e89f6a534842390fb0ab598 100644 --- a/test/sun/security/tools/keytool/standard.sh +++ b/test/sun/security/tools/keytool/standard.sh @@ -58,7 +58,7 @@ esac ${TESTJAVA}${FS}bin${FS}javac -d . -XDignore.symbol.file ${TESTSRC}${FS}KeyToolTest.java || exit 10 -echo | ${TESTJAVA}${FS}bin${FS}java -Dfile KeyToolTest +echo | ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dfile KeyToolTest status=$? rm HumanInputStream*.class diff --git a/test/sun/security/validator/certreplace.sh b/test/sun/security/validator/certreplace.sh index 16470a3994abf823d3bf4705960c07e57b82f4e1..b45a70edaa8b1262d766a4bd9221056f548ff011 100644 --- a/test/sun/security/validator/certreplace.sh +++ b/test/sun/security/validator/certreplace.sh @@ -82,4 +82,4 @@ $KT -delete -alias user # 5. Build and run test $JAVAC -d . ${TESTSRC}${FS}CertReplace.java -$JAVA CertReplace certreplace.jks certreplace.certs +$JAVA ${TESTVMOPTS} CertReplace certreplace.jks certreplace.certs diff --git a/test/sun/security/validator/samedn.sh b/test/sun/security/validator/samedn.sh index 9d5afd40a8e27090eeeb27677da46c6a475907b2..5d9b04557131f9669d3d47be84bd47eba6a07945 100644 --- a/test/sun/security/validator/samedn.sh +++ b/test/sun/security/validator/samedn.sh @@ -78,5 +78,5 @@ $KT -delete -alias user # Check both, one of them might be dropped out of map in old codes. $JAVAC -d . ${TESTSRC}${FS}CertReplace.java -$JAVA CertReplace samedn.jks samedn1.certs || exit 1 -$JAVA CertReplace samedn.jks samedn2.certs || exit 2 +$JAVA ${TESTVMOPTS} CertReplace samedn.jks samedn1.certs || exit 1 +$JAVA ${TESTVMOPTS} CertReplace samedn.jks samedn2.certs || exit 2 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/6842838/Test6842838.sh b/test/tools/launcher/6842838/Test6842838.sh index 6c6e9aa4ba70241d422a397c59659a3b5dbe94a9..b552152a9f312578c2f4f510b8872d90199cbfdf 100644 --- a/test/tools/launcher/6842838/Test6842838.sh +++ b/test/tools/launcher/6842838/Test6842838.sh @@ -68,8 +68,8 @@ if [ ! -x ${LIBUMEM} ]; then fi BADFILE=newbadjar.jar -${JAVA_EXE} -version -${JAVA_EXE} -cp ${TESTCLASSES} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF" +${JAVA_EXE} ${TESTVMOPTS} -version +${JAVA_EXE} ${TESTVMOPTS} -cp ${TESTCLASSES} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF" LD_PRELOAD=${LIBUMEM} ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1 grep "Invalid or corrupt jarfile" test.out 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/MultipleJRE.sh b/test/tools/launcher/MultipleJRE.sh index 5c49d8bae7c141d3064a7ab5fd8c5f52071f5734..b1ef16f4062ac75ad4d5d2515eafa27dc537b42d 100644 --- a/test/tools/launcher/MultipleJRE.sh +++ b/test/tools/launcher/MultipleJRE.sh @@ -49,8 +49,8 @@ then exit 1 fi -JAVAEXE="$TESTJAVA/bin/java" -JAVA="$TESTJAVA/bin/java -classpath $TESTCLASSES" +JAVAEXE="$TESTJAVA/bin/java ${TESTVMOPTS}" +JAVA="$TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES" JAR="$TESTJAVA/bin/jar" OS=`uname -s`; 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);