diff --git a/jdk/make/CopyInterimCLDRConverter.gmk b/jdk/make/CopyInterimCLDRConverter.gmk
new file mode 100644
index 00000000000..44eb63a25ea
--- /dev/null
+++ b/jdk/make/CopyInterimCLDRConverter.gmk
@@ -0,0 +1,52 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+##########################################################################################
+
+### CLDRConverter needs the JRE time zone names from the java.base source.
+
+define cldrconverter_copytznames
+ $(MKDIR) -p '$(@D)'
+ $(RM) '$@'
+ $(SED) -e "s/package sun.util.resources/package build.tools.cldrconverter/" \
+ -e "s/extends TimeZoneNamesBundle//" \
+ -e "s/protected final/static final/" \
+ < $(<) > $@
+endef
+
+$(eval $(call SetupCopyFiles,COPY_INTERIM_CLDRCONVERTER, \
+ SRC := $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/resources, \
+ DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes/build/tools/cldrconverter, \
+ FILES := TimeZoneNames.java, \
+ MACRO := cldrconverter_copytznames))
+
+##########################################################################################
+
+all: $(COPY_INTERIM_CLDRCONVERTER)
diff --git a/jdk/make/Tools.gmk b/jdk/make/Tools.gmk
index 5e8fd6efdbf..da8a2d139a0 100644
--- a/jdk/make/Tools.gmk
+++ b/jdk/make/Tools.gmk
@@ -38,8 +38,8 @@ include SetupJavaCompilers.gmk
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
SETUP := GENERATE_OLDBYTECODE, \
- ADD_JAVAC_FLAGS := "-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes", \
- SRC := $(JDK_TOPDIR)/make/src/classes, \
+ ADD_JAVAC_FLAGS := "-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes$(PATH_SEP)$(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes", \
+ SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
COPY := boot.modules ext.modules))
diff --git a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
index 6686513e3c2..ce1e3309d94 100644
--- a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
+++ b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
@@ -27,6 +27,10 @@ include LauncherCommon.gmk
$(eval $(call SetupLauncher,jsadebugd, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
- -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
+ ,,,,,,,,,Info-privileged.plist))
+
+
+$(eval $(call SetupLauncher,jhsdb, \
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.SALauncher"$(COMMA) }' \
,,,,,,,,,Info-privileged.plist))
diff --git a/jdk/make/src/classes/build/tools/cldrconverter/Bundle.java b/jdk/make/src/classes/build/tools/cldrconverter/Bundle.java
index c4a08671ad7..6933bb750ab 100644
--- a/jdk/make/src/classes/build/tools/cldrconverter/Bundle.java
+++ b/jdk/make/src/classes/build/tools/cldrconverter/Bundle.java
@@ -27,12 +27,15 @@ package build.tools.cldrconverter;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Enumeration;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Objects;
+import java.util.ResourceBundle;
class Bundle {
static enum Type {
@@ -145,6 +148,13 @@ class Bundle {
return id;
}
+ String getJavaID() {
+ // Tweak ISO compatibility for bundle generation
+ return id.replaceFirst("^he", "iw")
+ .replaceFirst("^id", "in")
+ .replaceFirst("^yi", "ji");
+ }
+
boolean isRoot() {
return "root".equals(id);
}
@@ -298,8 +308,8 @@ class Bundle {
continue;
}
- if (id.startsWith("en")) {
- fillInAbbrs(key, nameMap);
+ if (id.equals("en")) {
+ fillInJREs(key, nameMap);
}
}
}
@@ -381,7 +391,8 @@ class Bundle {
if (Objects.nonNull(parentsMap)) {
for (Iterator it = myMap.keySet().iterator(); it.hasNext();) {
String key = it.next();
- if (Objects.deepEquals(parentsMap.get(key), myMap.get(key))) {
+ if (!key.equals("numberingScripts") && // real body "NumberElements" may differ
+ Objects.deepEquals(parentsMap.get(key), myMap.get(key))) {
it.remove();
}
}
@@ -621,78 +632,41 @@ class Bundle {
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);
+ static Object[][] jreTimeZoneNames = TimeZoneNames.getContents();
+ private void fillInJREs(String key, Map map) {
+ String tzid = null;
- // 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")) {
- if (!name.startsWith("Greenwich ")) {
- name = name.replace("Mean Time", "Summer Time");
+ if (key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
+ // Look for tzid
+ String meta = key.substring(CLDRConverter.METAZONE_ID_PREFIX.length());
+ if (meta.equals("GMT")) {
+ tzid = meta;
+ } else {
+ for (String tz : CLDRConverter.handlerMetaZones.keySet()) {
+ if (CLDRConverter.handlerMetaZones.get(tz).equals(meta)) {
+ tzid = tz;
+ break;
}
- } 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")) {
- if (!name.startsWith("Greenwich ")) {
- name = name.replace("Mean Time", "Time");
- }
- }
- map.put(TZ_GEN_LONG_KEY, name);
- fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map);
- }
- }
- }
+ } else {
+ tzid = key.substring(CLDRConverter.TIMEZONE_ID_PREFIX.length());
}
- 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);
+ if (tzid != null) {
+ for (Object[] jreZone : jreTimeZoneNames) {
+ if (jreZone[0].equals(tzid)) {
+ for (int i = 0; i < ZONE_NAME_KEYS.length; i++) {
+ if (map.get(ZONE_NAME_KEYS[i]) == null) {
+ String[] jreNames = (String[])jreZone[1];
+ map.put(ZONE_NAME_KEYS[i], jreNames[i]);
}
}
+ break;
}
}
-
- 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) {
diff --git a/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java b/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java
index bd05260fcdb..62556d7f24d 100644
--- a/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java
+++ b/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java
@@ -433,35 +433,35 @@ 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, BundleType.OPEN);
+ bundleGenerator.generateBundle("util", "LocaleNames", bundle.getJavaID(), 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, BundleType.OPEN);
+ bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getJavaID(), 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);
+ bundleGenerator.generateBundle("util", "TimeZoneNames", bundle.getJavaID(), 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, BundleType.PLAIN);
+ bundleGenerator.generateBundle("util", "CalendarData", bundle.getJavaID(), true, calendarDataMap, BundleType.PLAIN);
}
}
if (bundleTypes.contains(Bundle.Type.FORMATDATA)) {
Map formatDataMap = extractFormatData(targetMap, bundle.getID());
if (!formatDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("FormatData").add(toLanguageTag(bundle.getID()));
- bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, BundleType.PLAIN);
+ bundleGenerator.generateBundle("text", "FormatData", bundle.getJavaID(), true, formatDataMap, BundleType.PLAIN);
}
}
diff --git a/jdk/make/src/classes/build/tools/cldrconverter/LDMLParseHandler.java b/jdk/make/src/classes/build/tools/cldrconverter/LDMLParseHandler.java
index 5de0ee5a4dd..49f35854a20 100644
--- a/jdk/make/src/classes/build/tools/cldrconverter/LDMLParseHandler.java
+++ b/jdk/make/src/classes/build/tools/cldrconverter/LDMLParseHandler.java
@@ -27,6 +27,7 @@ package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
+import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -900,6 +901,12 @@ class LDMLParseHandler extends AbstractLDMLHandler
*
- *
The contents of the MBeanInfo for a Dynamic MBean
+ *
The contents of the {@code MBeanInfo} for a Dynamic MBean
* are determined by its {@link DynamicMBean#getMBeanInfo
* getMBeanInfo()} method. This includes Open MBeans and Model
* MBeans, which are kinds of Dynamic MBeans.
*
- *
The contents of the MBeanInfo for a Standard MBean
+ *
The contents of the {@code MBeanInfo} for a Standard MBean
* are determined by the MBean server as follows:
The description returned by {@link #getDescription()} and the
* descriptions of the contained attributes and operations are not specified.
*
- *
The remaining details of the MBeanInfo for a
+ *
The remaining details of the {@code MBeanInfo} for a
* Standard MBean are not specified. This includes the description of
* any contained constructors, and notifications; the names
* of parameters to constructors and operations; and the descriptions of
@@ -161,10 +161,10 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
private final transient boolean arrayGettersSafe;
/**
- * Constructs an MBeanInfo.
+ * Constructs an {@code MBeanInfo}.
*
* @param className The name of the Java class of the MBean described
- * by this MBeanInfo. This value may be any
+ * by this {@code MBeanInfo}. This value may be any
* syntactically legal Java class name. It does not have to be a
* Java class known to the MBean server or to the MBean's
* ClassLoader. If it is a Java class known to the MBean's
@@ -195,10 +195,10 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
}
/**
- * Constructs an MBeanInfo.
+ * Constructs an {@code MBeanInfo}.
*
* @param className The name of the Java class of the MBean described
- * by this MBeanInfo. This value may be any
+ * by this {@code MBeanInfo}. This value may be any
* syntactically legal Java class name. It does not have to be a
* Java class known to the MBean server or to the MBean's
* ClassLoader. If it is a Java class known to the MBean's
@@ -260,9 +260,9 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
/**
*
Returns a shallow clone of this instance.
- * The clone is obtained by simply calling super.clone(),
+ * The clone is obtained by simply calling {@code super.clone()},
* thus calling the default native shallow cloning mechanism
- * implemented by Object.clone().
+ * implemented by {@code Object.clone()}.
* No deeper cloning of any internal field is made.
*
*
Since this class is immutable, the clone method is chiefly of
@@ -281,7 +281,7 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
/**
* Returns the name of the Java class of the MBean described by
- * this MBeanInfo.
+ * this {@code MBeanInfo}.
*
* @return the class name.
*/
@@ -300,14 +300,14 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
/**
* Returns the list of attributes exposed for management.
- * Each attribute is described by an MBeanAttributeInfo object.
+ * Each attribute is described by an {@code MBeanAttributeInfo} object.
*
* The returned array is a shallow copy of the internal array,
* which means that it is a copy of the internal array of
- * references to the MBeanAttributeInfo objects
- * but that each referenced MBeanAttributeInfo object is not copied.
+ * references to the {@code MBeanAttributeInfo} objects
+ * but that each referenced {@code MBeanAttributeInfo} object is not copied.
*
- * @return An array of MBeanAttributeInfo objects.
+ * @return An array of {@code MBeanAttributeInfo} objects.
*/
public MBeanAttributeInfo[] getAttributes() {
MBeanAttributeInfo[] as = nonNullAttributes();
@@ -342,14 +342,14 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
/**
* Returns the list of operations of the MBean.
- * Each operation is described by an MBeanOperationInfo object.
+ * Each operation is described by an {@code MBeanOperationInfo} object.
*
* The returned array is a shallow copy of the internal array,
* which means that it is a copy of the internal array of
- * references to the MBeanOperationInfo objects
- * but that each referenced MBeanOperationInfo object is not copied.
+ * references to the {@code MBeanOperationInfo} objects
+ * but that each referenced {@code MBeanOperationInfo} object is not copied.
*
- * @return An array of MBeanOperationInfo objects.
+ * @return An array of {@code MBeanOperationInfo} objects.
*/
public MBeanOperationInfo[] getOperations() {
MBeanOperationInfo[] os = nonNullOperations();
@@ -374,12 +374,12 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
/**
*
Returns the list of the public constructors of the MBean.
* Each constructor is described by an
- * MBeanConstructorInfo object.
+ * {@code MBeanConstructorInfo} object.
*
*
The returned array is a shallow copy of the internal array,
* which means that it is a copy of the internal array of
- * references to the MBeanConstructorInfo objects but
- * that each referenced MBeanConstructorInfo object
+ * references to the {@code MBeanConstructorInfo} objects but
+ * that each referenced {@code MBeanConstructorInfo} object
* is not copied.
*
*
The returned list is not necessarily exhaustive. That is,
@@ -388,7 +388,7 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
* instance of this MBean's class using that constructor, even
* though it is not listed here.
*
- * @return An array of MBeanConstructorInfo objects.
+ * @return An array of {@code MBeanConstructorInfo} objects.
*/
public MBeanConstructorInfo[] getConstructors() {
MBeanConstructorInfo[] cs = nonNullConstructors();
@@ -412,14 +412,14 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
/**
* Returns the list of the notifications emitted by the MBean.
- * Each notification is described by an MBeanNotificationInfo object.
+ * Each notification is described by an {@code MBeanNotificationInfo} object.
*
* The returned array is a shallow copy of the internal array,
* which means that it is a copy of the internal array of
- * references to the MBeanNotificationInfo objects
- * but that each referenced MBeanNotificationInfo object is not copied.
+ * references to the {@code MBeanNotificationInfo} objects
+ * but that each referenced {@code MBeanNotificationInfo} object is not copied.
*
- * @return An array of MBeanNotificationInfo objects.
+ * @return An array of {@code MBeanNotificationInfo} objects.
*/
public MBeanNotificationInfo[] getNotifications() {
MBeanNotificationInfo[] ns = nonNullNotifications();
@@ -482,7 +482,7 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
*
* @param o the object to compare to.
*
- * @return true if and only if o is an MBeanInfo that is equal
+ * @return true if and only if {@code o} is an MBeanInfo that is equal
* to this one according to the rules above.
*/
@Override
@@ -534,12 +534,12 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
new WeakHashMap, Boolean>();
/**
- * Return true if subclass is known to preserve the
- * immutability of immutableClass. The class
- * immutableClass is a reference class that is known
- * to be immutable. The subclass subclass is
+ * Return true if {@code subclass} is known to preserve the
+ * immutability of {@code immutableClass}. The class
+ * {@code immutableClass} is a reference class that is known
+ * to be immutable. The subclass {@code subclass} is
* considered immutable if it does not override any public method
- * of immutableClass whose name begins with "get".
+ * of {@code immutableClass} whose name begins with "get".
* This is obviously not an infallible test for immutability,
* but it works for the public interfaces of the MBean*Info classes.
*/
diff --git a/jdk/src/java.management/share/classes/javax/management/MBeanNotificationInfo.java b/jdk/src/java.management/share/classes/javax/management/MBeanNotificationInfo.java
index e5b9b13d245..c5b81c5e0a5 100644
--- a/jdk/src/java.management/share/classes/javax/management/MBeanNotificationInfo.java
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanNotificationInfo.java
@@ -32,29 +32,29 @@ import java.util.Arrays;
import java.util.Objects;
/**
- *
The MBeanNotificationInfo class is used to describe the
+ *
The {@code MBeanNotificationInfo} class is used to describe the
* characteristics of the different notification instances
* emitted by an MBean, for a given Java class of notification.
* If an MBean emits notifications that can be instances of different Java classes,
- * then the metadata for that MBean should provide an MBeanNotificationInfo
+ * then the metadata for that MBean should provide an {@code MBeanNotificationInfo}
* object for each of these notification Java classes.
*
*
Instances of this class are immutable. Subclasses may be
* mutable but this is not recommended.
*
- *
This class extends javax.management.MBeanFeatureInfo
- * and thus provides name and description fields.
- * The name field should be the fully qualified Java class name of
+ *
This class extends {@code javax.management.MBeanFeatureInfo}
+ * and thus provides {@code name} and {@code description} fields.
+ * The {@code name} field should be the fully qualified Java class name of
* the notification objects described by this class.
*
- *
The getNotifTypes method returns an array of
+ *
The {@code getNotifTypes} method returns an array of
* strings containing the notification types that the MBean may
* emit. The notification type is a dot-notation string which
* describes what the emitted notification is about, not the Java
* class of the notification. A single generic notification class can
* be used to send notifications of several types. All of these types
* are returned in the string array result of the
- * getNotifTypes method.
+ * {@code getNotifTypes} method.
*
* @since 1.5
*/
@@ -77,7 +77,7 @@ public class MBeanNotificationInfo extends MBeanFeatureInfo implements Cloneable
private final transient boolean arrayGettersSafe;
/**
- * Constructs an MBeanNotificationInfo object.
+ * Constructs an {@code MBeanNotificationInfo} object.
*
* @param notifTypes The array of strings (in dot notation)
* containing the notification types that the MBean may emit.
@@ -93,7 +93,7 @@ public class MBeanNotificationInfo extends MBeanFeatureInfo implements Cloneable
}
/**
- * Constructs an MBeanNotificationInfo object.
+ * Constructs an {@code MBeanNotificationInfo} object.
*
* @param notifTypes The array of strings (in dot notation)
* containing the notification types that the MBean may emit.
@@ -128,9 +128,9 @@ public class MBeanNotificationInfo extends MBeanFeatureInfo implements Cloneable
/**
* Returns a shallow clone of this instance.
- * The clone is obtained by simply calling super.clone(),
+ * The clone is obtained by simply calling {@code super.clone()},
* thus calling the default native shallow cloning mechanism
- * implemented by Object.clone().
+ * implemented by {@code Object.clone()}.
* No deeper cloning of any internal field is made.
*/
public Object clone () {
@@ -179,7 +179,7 @@ public class MBeanNotificationInfo extends MBeanFeatureInfo implements Cloneable
*
* @param o the object to compare to.
*
- * @return true if and only if o is an MBeanNotificationInfo
+ * @return true if and only if {@code o} is an MBeanNotificationInfo
* such that its {@link #getName()}, {@link #getDescription()},
* {@link #getDescriptor()},
* and {@link #getNotifTypes()} values are equal (not necessarily
diff --git a/jdk/src/java.management/share/classes/javax/management/MBeanOperationInfo.java b/jdk/src/java.management/share/classes/javax/management/MBeanOperationInfo.java
index 6e11e4123e4..caa66148263 100644
--- a/jdk/src/java.management/share/classes/javax/management/MBeanOperationInfo.java
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanOperationInfo.java
@@ -83,10 +83,7 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable {
/**
* @serial The impact of the method, one of
- * INFO,
- * ACTION,
- * ACTION_INFO,
- * UNKNOWN
+ * {@code INFO, ACTION, ACTION_INFO, UNKNOWN}.
*/
private final int impact;
@@ -95,12 +92,12 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable {
/**
- * Constructs an MBeanOperationInfo object. The
+ * Constructs an {@code MBeanOperationInfo} object. The
* {@link Descriptor} of the constructed object will include
* fields contributed by any annotations on the {@code Method}
* object that contain the {@link DescriptorKey} meta-annotation.
*
- * @param method The java.lang.reflect.Method object
+ * @param method The {@code java.lang.reflect.Method} object
* describing the MBean operation.
* @param description A human readable description of the operation.
*/
@@ -114,11 +111,11 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable {
}
/**
- * Constructs an MBeanOperationInfo object.
+ * Constructs an {@code MBeanOperationInfo} object.
*
* @param name The name of the method.
* @param description A human readable description of the operation.
- * @param signature MBeanParameterInfo objects
+ * @param signature {@code MBeanParameterInfo} objects
* describing the parameters(arguments) of the method. This may be
* null with the same effect as a zero-length array.
* @param type The type of the method's return value.
@@ -135,11 +132,11 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable {
}
/**
- * Constructs an MBeanOperationInfo object.
+ * Constructs an {@code MBeanOperationInfo} object.
*
* @param name The name of the method.
* @param description A human readable description of the operation.
- * @param signature MBeanParameterInfo objects
+ * @param signature {@code MBeanParameterInfo} objects
* describing the parameters(arguments) of the method. This may be
* null with the same effect as a zero-length array.
* @param type The type of the method's return value.
@@ -174,9 +171,9 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable {
/**
*
Returns a shallow clone of this instance.
- * The clone is obtained by simply calling super.clone(),
+ * The clone is obtained by simply calling {@code super.clone()},
* thus calling the default native shallow cloning mechanism
- * implemented by Object.clone().
+ * implemented by {@code Object.clone()}.
* No deeper cloning of any internal field is made.
*
*
Since this class is immutable, cloning is chiefly of interest
@@ -203,16 +200,16 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable {
/**
*
Returns the list of parameters for this operation. Each
- * parameter is described by an MBeanParameterInfo
+ * parameter is described by an {@code MBeanParameterInfo}
* object.
*
*
The returned array is a shallow copy of the internal array,
* which means that it is a copy of the internal array of
- * references to the MBeanParameterInfo objects but
- * that each referenced MBeanParameterInfo object is
+ * references to the {@code MBeanParameterInfo} objects but
+ * that each referenced {@code MBeanParameterInfo} object is
* not copied.
*
- * @return An array of MBeanParameterInfo objects.
+ * @return An array of {@code MBeanParameterInfo} objects.
*/
public MBeanParameterInfo[] getSignature() {
// If MBeanOperationInfo was created in our implementation,
@@ -247,7 +244,7 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable {
/**
* Returns the impact of the method, one of
- * INFO, ACTION, ACTION_INFO, UNKNOWN.
+ * {@code INFO, ACTION, ACTION_INFO, UNKNOWN}.
*
* @return the impact code.
*/
@@ -280,7 +277,7 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable {
*
* @param o the object to compare to.
*
- * @return true if and only if o is an MBeanOperationInfo such
+ * @return true if and only if {@code o} is an MBeanOperationInfo such
* that its {@link #getName()}, {@link #getReturnType()}, {@link
* #getDescription()}, {@link #getImpact()}, {@link #getDescriptor()}
* and {@link #getSignature()} values are equal (not necessarily identical)
diff --git a/jdk/src/java.management/share/classes/javax/management/MBeanParameterInfo.java b/jdk/src/java.management/share/classes/javax/management/MBeanParameterInfo.java
index 8dd185e57d0..5b8ed402e34 100644
--- a/jdk/src/java.management/share/classes/javax/management/MBeanParameterInfo.java
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanParameterInfo.java
@@ -50,7 +50,7 @@ public class MBeanParameterInfo extends MBeanFeatureInfo implements Cloneable {
/**
- * Constructs an MBeanParameterInfo object.
+ * Constructs an {@code MBeanParameterInfo} object.
*
* @param name The name of the data
* @param type The type or class name of the data
@@ -63,7 +63,7 @@ public class MBeanParameterInfo extends MBeanFeatureInfo implements Cloneable {
}
/**
- * Constructs an MBeanParameterInfo object.
+ * Constructs an {@code MBeanParameterInfo} object.
*
* @param name The name of the data
* @param type The type or class name of the data
@@ -85,9 +85,9 @@ public class MBeanParameterInfo extends MBeanFeatureInfo implements Cloneable {
/**
*
Returns a shallow clone of this instance.
- * The clone is obtained by simply calling super.clone(),
+ * The clone is obtained by simply calling {@code super.clone()},
* thus calling the default native shallow cloning mechanism
- * implemented by Object.clone().
+ * implemented by {@code Object.clone()}.
* No deeper cloning of any internal field is made.
*
*
Since this class is immutable, cloning is chiefly of
@@ -126,7 +126,7 @@ public class MBeanParameterInfo extends MBeanFeatureInfo implements Cloneable {
*
* @param o the object to compare to.
*
- * @return true if and only if o is an MBeanParameterInfo such
+ * @return true if and only if {@code o} is an MBeanParameterInfo such
* that its {@link #getName()}, {@link #getType()},
* {@link #getDescriptor()}, and {@link
* #getDescription()} values are equal (not necessarily identical)
diff --git a/jdk/src/java.management/share/classes/javax/management/monitor/package.html b/jdk/src/java.management/share/classes/javax/management/monitor/package.html
index 53666160324..39a8bdb6642 100644
--- a/jdk/src/java.management/share/classes/javax/management/monitor/package.html
+++ b/jdk/src/java.management/share/classes/javax/management/monitor/package.html
@@ -41,20 +41,20 @@ questions.
The value being monitored can be a simple value
contained within a complex type. For example, the {@link
java.lang.management.MemoryMXBean MemoryMXBean} defined in
- java.lang.management has an attribute
- HeapMemoryUsage of type {@link
+ {@code java.lang.management} has an attribute
+ {@code HeapMemoryUsage} of type {@link
java.lang.management.MemoryUsage MemoryUsage}. To monitor the
- amount of used memory, described by the used
- property of MemoryUsage, you could monitor
- "HeapMemoryUsage.used". That string would be the
+ amount of used memory, described by the {@code used}
+ property of {@code MemoryUsage}, you could monitor
+ "{@code HeapMemoryUsage.used}". That string would be the
argument to {@link
javax.management.monitor.MonitorMBean#setObservedAttribute(String)
setObservedAttribute}.
-
The rules used to interpret an ObservedAttribute like
- "HeapMemoryUsage.used" are as follows. Suppose the string is
- A.e (so A would be "HeapMemoryUsage" and e
- would be "used" in the example).
+
The rules used to interpret an {@code ObservedAttribute} like
+ {@code "HeapMemoryUsage.used"} are as follows. Suppose the string is
+ A.e (so A would be {@code "HeapMemoryUsage"} and e
+ would be {@code "used"} in the example).
First the value of the attribute A is obtained. Call it
v. A value x is extracted from v as follows:
@@ -65,49 +65,49 @@ questions.
CompositeData} and if v.{@link
javax.management.openmbean.CompositeData#get(String) get}(e)
returns a value then x is that value.
-
If v is an array and e is the string "length"
+
If v is an array and e is the string {@code "length"}
then x is the length of the array.
If the above rules do not produce a value, and if introspection, as
if by calling {@link java.beans.Introspector#getBeanInfo(Class)
Introspector.getBeanInfo}, for the class of v
- (v.getClass()) identifies a property with the name
+ (v.{@code getClass()}) identifies a property with the name
e, then x is the result of reading the property value.
The third rule means for example that if the attribute
- HeapMemoryUsage is a MemoryUsage, monitoring
- "HeapMemoryUsage.used" will obtain the observed value by
- calling MemoryUsage.getUsed().
+ {@code HeapMemoryUsage} is a {@code MemoryUsage}, monitoring
+ {@code "HeapMemoryUsage.used"} will obtain the observed value by
+ calling {@code MemoryUsage.getUsed()}.
-
If the ObservedAttribute contains more than one period,
- for example "ConnectionPool.connectionStats.length", then the
+
If the {@code ObservedAttribute} contains more than one period,
+ for example {@code "ConnectionPool.connectionStats.length"}, then the
above rules are applied iteratively. Here, v would initially be
- the value of the attribute ConnectionPool, and x would
+ the value of the attribute {@code ConnectionPool}, and x would
be derived by applying the above rules with e equal to
- "connectionStats". Then v would be set to this x
+ {@code "connectionStats"}. Then v would be set to this x
and a new x derived by applying the rules again with e
- equal to "length".
+ equal to {@code "length"}.
Although it is recommended that attribute names be valid Java
identifiers, it is possible for an attribute to be called
- HeapMemoryUsage.used. This means that an
- ObservedAttribute that is HeapMemoryUsage.used
+ {@code HeapMemoryUsage.used}. This means that an
+ {@code ObservedAttribute} that is {@code HeapMemoryUsage.used}
could mean that the value to observe is either an attribute of that
- name, or the property used within an attribute called
- HeapMemoryUsage. So for compatibility reasons, when the
- ObservedAttribute contains a period (.), the monitor
+ name, or the property {@code used} within an attribute called
+ {@code HeapMemoryUsage}. So for compatibility reasons, when the
+ {@code ObservedAttribute} contains a period ({@code .}), the monitor
will check whether an attribute exists whose name is the full
- ObservedAttribute string (HeapMemoryUsage.used in the
+ {@code ObservedAttribute} string ({@code HeapMemoryUsage.used} in the
example). It does this by calling {@link
javax.management.MBeanServer#getMBeanInfo(javax.management.ObjectName)
getMBeanInfo} for the observed MBean and looking for a contained {@link
javax.management.MBeanAttributeInfo MBeanAttributeInfo} with the given
name. If one is found, then that is what is monitored. If more than one
MBean is being observed, the behavior is unspecified if some of them have
- a HeapMemoryUsage.used attribute and others do not. An
- implementation may therefore call getMBeanInfo on just one of
+ a {@code HeapMemoryUsage.used} attribute and others do not. An
+ implementation may therefore call {@code getMBeanInfo} on just one of
the MBeans in this case. The behavior is also unspecified if the result
of the check changes while the monitor is active.
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java b/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java
index 53665e8f2f9..b32458dbf43 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java
@@ -29,7 +29,7 @@ import java.io.ObjectStreamException;
import java.lang.reflect.Array;
/**
- * The ArrayType class is the open type class whose instances describe
+ * The {@code ArrayType} class is the open type class whose instances describe
* all open data values which are n-dimensional arrays of open data values.
*
* Examples of valid {@code ArrayType} instances are:
@@ -222,22 +222,31 @@ public class ArrayType extends OpenType {
/* *** Constructor *** */
/**
- * Constructs an ArrayType instance describing open data values which are
- * arrays with dimension dimension of elements whose open type is elementType.
+ * Constructs an {@code ArrayType} instance describing open data values which are
+ * arrays with dimension dimension of elements
+ * whose open type is elementType.
*
- * When invoked on an ArrayType instance, the {@link OpenType#getClassName() getClassName} method
- * returns the class name of the array instances it describes (following the rules defined by the
- * {@link Class#getName() getName} method of java.lang.Class), not the class name of the array elements
- * (which is returned by a call to getElementOpenType().getClassName()).
+ * When invoked on an {@code ArrayType} instance,
+ * the {@link OpenType#getClassName() getClassName} method
+ * returns the class name of the array instances it describes
+ * (following the rules defined by the
+ * {@link Class#getName() getName} method of {@code java.lang.Class}),
+ * not the class name of the array elements
+ * (which is returned by a call to {@code getElementOpenType().getClassName()}).
*
- * The internal field corresponding to the type name of this ArrayType instance is also set to
+ * The internal field corresponding to the type name of this
+ * {@code ArrayType} instance is also set to
* the class name of the array instances it describes.
- * In other words, the methods getClassName and getTypeName return the same string value.
- * The internal field corresponding to the description of this ArrayType instance is set to a string value
+ * In other words, the methods {@code getClassName} and
+ * {@code getTypeName} return the same string value.
+ * The internal field corresponding to the description of this
+ * {@code ArrayType} instance is set to a string value
* which follows the following template:
*
- *
if non-primitive array: <dimension>-dimension array of <element_class_name>
- *
if primitive array: <dimension>-dimension array of <primitive_type_of_the_element_class_name>
+ *
if non-primitive array: <dimension>-dimension array
+ * of <element_class_name>
+ *
if primitive array: <dimension>-dimension array
+ * of <primitive_type_of_the_element_class_name>
*
*
* As an example, the following piece of code:
@@ -267,16 +276,16 @@ public class ArrayType extends OpenType {
* System.out.println("array type description = " + t3.getDescription());
* }
*
- * @param dimension the dimension of arrays described by this ArrayType instance;
+ * @param dimension the dimension of arrays described by this {@code ArrayType} instance;
* must be greater than or equal to 1.
*
* @param elementType the open type of element values contained
- * in the arrays described by this ArrayType
+ * in the arrays described by this {@code ArrayType}
* instance; must be an instance of either
- * SimpleType, CompositeType,
- * TabularType or another ArrayType
- * with a SimpleType, CompositeType
- * or TabularType as its elementType.
+ * {@code SimpleType}, {@code CompositeType},
+ * {@code TabularType} or another {@code ArrayType}
+ * with a {@code SimpleType}, {@code CompositeType}
+ * or {@code TabularType} as its {@code elementType}.
*
* @throws IllegalArgumentException if {@code dimension} is not a positive
* integer.
@@ -318,19 +327,27 @@ public class ArrayType extends OpenType {
* returns the {@link SimpleType} corresponding to the wrapper
* type of the primitive type of the array.
*
- * When invoked on an ArrayType instance, the {@link OpenType#getClassName() getClassName} method
- * returns the class name of the array instances it describes (following the rules defined by the
- * {@link Class#getName() getName} method of java.lang.Class), not the class name of the array elements
- * (which is returned by a call to getElementOpenType().getClassName()).
+ * When invoked on an {@code ArrayType} instance,
+ * the {@link OpenType#getClassName() getClassName} method
+ * returns the class name of the array instances it describes
+ * (following the rules defined by the
+ * {@link Class#getName() getName} method of {@code java.lang.Class}),
+ * not the class name of the array elements
+ * (which is returned by a call to {@code getElementOpenType().getClassName()}).
*
- * The internal field corresponding to the type name of this ArrayType instance is also set to
+ * The internal field corresponding to the type name of this
+ * {@code ArrayType} instance is also set to
* the class name of the array instances it describes.
- * In other words, the methods getClassName and getTypeName return the same string value.
- * The internal field corresponding to the description of this ArrayType instance is set to a string value
+ * In other words, the methods {@code getClassName} and
+ * {@code getTypeName} return the same string value.
+ * The internal field corresponding to the description
+ * of this {@code ArrayType} instance is set to a string value
* which follows the following template:
*
- *
if non-primitive array: 1-dimension array of <element_class_name>
- *
if primitive array: 1-dimension array of <primitive_type_of_the_element_class_name>
+ *
if non-primitive array: 1-dimension array
+ * of <element_class_name>
+ *
if primitive array: 1-dimension array
+ * of <primitive_type_of_the_element_class_name>
*
*
* As an example, the following piece of code:
@@ -483,7 +500,7 @@ public class ArrayType extends OpenType {
/* *** ArrayType specific information methods *** */
/**
- * Returns the dimension of arrays described by this ArrayType instance.
+ * Returns the dimension of arrays described by this {@code ArrayType} instance.
*
* @return the dimension.
*/
@@ -493,7 +510,8 @@ public class ArrayType extends OpenType {
}
/**
- * Returns the open type of element values contained in the arrays described by this ArrayType instance.
+ * Returns the open type of element values contained
+ * in the arrays described by this {@code ArrayType} instance.
*
* @return the element type.
*/
@@ -503,8 +521,8 @@ public class ArrayType extends OpenType {
}
/**
- * Returns true if the open data values this open
- * type describes are primitive arrays, false otherwise.
+ * Returns {@code true} if the open data values this open
+ * type describes are primitive arrays, {@code false} otherwise.
*
* @return true if this is a primitive array type.
*
@@ -516,32 +534,32 @@ public class ArrayType extends OpenType {
}
/**
- * Tests whether obj is a value for this ArrayType
+ * Tests whether obj is a value for this {@code ArrayType}
* instance.
*
- * This method returns true if and only if obj
+ * This method returns {@code true} if and only if obj
* is not null, obj is an array and any one of the following
- * is true:
+ * is {@code true}:
*
*
- *
if this ArrayType instance describes an array of
- * SimpleType elements or their corresponding primitive types,
+ *
if this {@code ArrayType} instance describes an array of
+ * {@code SimpleType} elements or their corresponding primitive types,
* obj's class name is the same as the className field defined
- * for this ArrayType instance (i.e. the class name returned
+ * for this {@code ArrayType} instance (i.e. the class name returned
* by the {@link OpenType#getClassName() getClassName} method, which
* includes the dimension information),
- *
if this ArrayType instance describes an array of
+ *
if this {@code ArrayType} instance describes an array of
* classes implementing the {@code TabularData} interface or the
* {@code CompositeData} interface, obj is assignable to
* such a declared array, and each element contained in {obj
* is either null or a valid value for the element's open type specified
- * by this ArrayType instance.
+ * by this {@code ArrayType} instance.
*
*
* @param obj the object to be tested.
*
- * @return true if obj is a value for this
- * ArrayType instance.
+ * @return {@code true} if obj is a value for this
+ * {@code ArrayType} instance.
*/
public boolean isValue(Object obj) {
@@ -649,21 +667,21 @@ public class ArrayType extends OpenType {
/* *** Methods overriden from class Object *** */
/**
- * Compares the specified obj parameter with this
- * ArrayType instance for equality.
+ * Compares the specified {@code obj} parameter with this
+ * {@code ArrayType} instance for equality.
*
- * Two ArrayType instances are equal if and only if they
+ * Two {@code ArrayType} instances are equal if and only if they
* describe array instances which have the same dimension, elements'
* open type and primitive array flag.
*
* @param obj the object to be compared for equality with this
- * ArrayType instance; if obj
- * is null or is not an instance of the
- * class ArrayType this method returns
- * false.
+ * {@code ArrayType} instance; if obj
+ * is {@code null} or is not an instance of the
+ * class {@code ArrayType} this method returns
+ * {@code false}.
*
- * @return true if the specified object is equal to
- * this ArrayType instance.
+ * @return {@code true} if the specified object is equal to
+ * this {@code ArrayType} instance.
*/
public boolean equals(Object obj) {
@@ -697,25 +715,25 @@ public class ArrayType extends OpenType {
}
/**
- * Returns the hash code value for this ArrayType instance.
+ * Returns the hash code value for this {@code ArrayType} instance.
*
- * The hash code of an ArrayType instance is the sum of the
- * hash codes of all the elements of information used in equals
+ * The hash code of an {@code ArrayType} instance is the sum of the
+ * hash codes of all the elements of information used in {@code equals}
* comparisons (i.e. dimension, elements' open type and primitive array flag).
* The hashcode for a primitive value is the hashcode of the corresponding boxed
- * object (e.g. the hashcode for true is Boolean.TRUE.hashCode()).
- * This ensures that t1.equals(t2) implies that
- * t1.hashCode()==t2.hashCode() for any two
- * ArrayType instances t1 and t2,
+ * object (e.g. the hashcode for {@code true} is {@code Boolean.TRUE.hashCode()}).
+ * This ensures that {@code t1.equals(t2)} implies that
+ * {@code t1.hashCode()==t2.hashCode()} for any two
+ * {@code ArrayType} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * As ArrayType instances are immutable, the hash
+ * As {@code ArrayType} instances are immutable, the hash
* code for this instance is calculated once, on the first call
- * to hashCode, and then the same value is returned
+ * to {@code hashCode}, and then the same value is returned
* for subsequent calls.
*
- * @return the hash code value for this ArrayType instance
+ * @return the hash code value for this {@code ArrayType} instance
*/
public int hashCode() {
@@ -735,19 +753,19 @@ public class ArrayType extends OpenType {
}
/**
- * Returns a string representation of this ArrayType instance.
+ * Returns a string representation of this {@code ArrayType} instance.
*
* The string representation consists of the name of this class (i.e.
- * javax.management.openmbean.ArrayType), the type name,
+ * {@code javax.management.openmbean.ArrayType}), the type name,
* the dimension, the elements' open type and the primitive array flag
* defined for this instance.
*
- * As ArrayType instances are immutable, the
+ * As {@code ArrayType} instances are immutable, the
* string representation for this instance is calculated
- * once, on the first call to toString, and
+ * once, on the first call to {@code toString}, and
* then the same value is returned for subsequent calls.
*
- * @return a string representation of this ArrayType instance
+ * @return a string representation of this {@code ArrayType} instance
*/
public String toString() {
@@ -795,12 +813,12 @@ public class ArrayType extends OpenType {
*
* @param the Java type that described instances must have
* @param elementType the open type of element values contained
- * in the arrays described by this ArrayType
+ * in the arrays described by this {@code ArrayType}
* instance; must be an instance of either
- * SimpleType, CompositeType,
- * TabularType or another ArrayType
- * with a SimpleType, CompositeType
- * or TabularType as its elementType.
+ * {@code SimpleType}, {@code CompositeType},
+ * {@code TabularType} or another {@code ArrayType}
+ * with a {@code SimpleType}, {@code CompositeType}
+ * or {@code TabularType} as its {@code elementType}.
* @return an {@code ArrayType} instance
* @throws OpenDataException if elementType's className is not
* one of the allowed Java class names for open
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeData.java b/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeData.java
index f77f776f1ed..add387904f7 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeData.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeData.java
@@ -36,7 +36,8 @@ import java.util.Collection;
/**
- * The CompositeData interface specifies the behavior of a specific type of complex open data objects
+ * The {@code CompositeData} interface specifies
+ * the behavior of a specific type of complex open data objects
* which represent composite data structures.
*
*
@@ -53,55 +54,60 @@ public interface CompositeData {
public CompositeType getCompositeType();
/**
- * Returns the value of the item whose name is key.
+ * Returns the value of the item whose name is {@code key}.
*
* @param key the name of the item.
*
* @return the value associated with this key.
*
- * @throws IllegalArgumentException if key is a null or empty String.
+ * @throws IllegalArgumentException if {@code key} is a null or empty String.
*
- * @throws InvalidKeyException if key is not an existing item name for this CompositeData instance.
+ * @throws InvalidKeyException if {@code key} is not an
+ * existing item name for this {@code CompositeData} instance.
*/
public Object get(String key) ;
/**
- * Returns an array of the values of the items whose names are specified by keys, in the same order as keys.
+ * Returns an array of the values of the items whose names
+ * are specified by {@code keys}, in the same order as {@code keys}.
*
* @param keys the names of the items.
*
* @return the values corresponding to the keys.
*
- * @throws IllegalArgumentException if an element in keys is a null or empty String.
+ * @throws IllegalArgumentException if an element in {@code keys} is a null or empty String.
*
- * @throws InvalidKeyException if an element in keys is not an existing item name for this CompositeData instance.
+ * @throws InvalidKeyException if an element in {@code keys}
+ * is not an existing item name for this {@code CompositeData} instance.
*/
public Object[] getAll(String[] keys) ;
/**
- * Returns true if and only if this CompositeData instance contains
- * an item whose name is key.
- * If key is a null or empty String, this method simply returns false.
+ * Returns {@code true} if and only if this {@code CompositeData} instance contains
+ * an item whose name is {@code key}.
+ * If {@code key} is a null or empty String, this method simply returns false.
*
* @param key the key to be tested.
*
- * @return true if this CompositeData contains the key.
+ * @return true if this {@code CompositeData} contains the key.
*/
public boolean containsKey(String key) ;
/**
- * Returns true if and only if this CompositeData instance contains an item
- * whose value is value.
+ * Returns {@code true} if and only if this {@code CompositeData} instance contains an item
+ * whose value is {@code value}.
*
* @param value the value to be tested.
*
- * @return true if this CompositeData contains the value.
+ * @return true if this {@code CompositeData} contains the value.
*/
public boolean containsValue(Object value) ;
/**
- * Returns an unmodifiable Collection view of the item values contained in this CompositeData instance.
- * The returned collection's iterator will return the values in the ascending lexicographic order of the corresponding
+ * Returns an unmodifiable Collection view of the item values
+ * contained in this {@code CompositeData} instance.
+ * The returned collection's iterator will return the values
+ * in the ascending lexicographic order of the corresponding
* item names.
*
* @return the values.
@@ -110,12 +116,12 @@ public interface CompositeData {
/**
* Compares the specified obj parameter with this
- * CompositeData instance for equality.
+ * {@code CompositeData} instance for equality.
*
- * Returns true if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
*
*
obj is non null,
- *
obj also implements the CompositeData interface,
+ *
obj also implements the {@code CompositeData} interface,
*
their composite types are equal
*
their contents, i.e. (name, value) pairs are equal. If a value contained in
* the content is an array, the value comparison is done as if by calling
@@ -124,28 +130,28 @@ public interface CompositeData {
* {@code Arrays.equals(e1,e2)} for arrays of primitive types
*
*
- * This ensures that this equals method works properly for
+ * This ensures that this {@code equals} method works properly for
* obj parameters which are different implementations of the
- * CompositeData interface, with the restrictions mentioned in the
+ * {@code CompositeData} interface, with the restrictions mentioned in the
* {@link java.util.Collection#equals(Object) equals}
- * method of the java.util.Collection interface.
+ * method of the {@code java.util.Collection} interface.
*
* @param obj the object to be compared for equality with this
- * CompositeData instance.
- * @return true if the specified object is equal to this
- * CompositeData instance.
+ * {@code CompositeData} instance.
+ * @return {@code true} if the specified object is equal to this
+ * {@code CompositeData} instance.
*/
public boolean equals(Object obj) ;
/**
- * Returns the hash code value for this CompositeData instance.
+ * Returns the hash code value for this {@code CompositeData} instance.
*
- * The hash code of a CompositeData instance is the sum of the hash codes
- * of all elements of information used in equals comparisons
+ * The hash code of a {@code CompositeData} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its composite type and all the item values).
*
- * This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode()
- * for any two CompositeData instances t1 and t2,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code CompositeData} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
@@ -156,18 +162,19 @@ public interface CompositeData {
* for arrays of object reference types or the appropriate overloading
* of {@code Arrays.hashCode(e)} for arrays of primitive types.
*
- * @return the hash code value for this CompositeData instance
+ * @return the hash code value for this {@code CompositeData} instance
*/
public int hashCode() ;
/**
- * Returns a string representation of this CompositeData instance.
+ * Returns a string representation of this {@code CompositeData} instance.
*
* The string representation consists of the name of the implementing class,
- * the string representation of the composite type of this instance, and the string representation of the contents
+ * the string representation of the composite type of this instance,
+ * and the string representation of the contents
* (ie list the itemName=itemValue mappings).
*
- * @return a string representation of this CompositeData instance
+ * @return a string representation of this {@code CompositeData} instance
*/
public String toString() ;
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeDataSupport.java b/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeDataSupport.java
index 177e0dd8267..38c74692698 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeDataSupport.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeDataSupport.java
@@ -45,8 +45,8 @@ import java.util.TreeSet;
/**
- * The CompositeDataSupport class is the open data class which
- * implements the CompositeData interface.
+ * The {@code CompositeDataSupport} class is the open data class which
+ * implements the {@code CompositeData} interface.
*
*
* @since 1.5
@@ -70,15 +70,15 @@ public class CompositeDataSupport
private final CompositeType compositeType;
/**
- *
Constructs a CompositeDataSupport instance with the specified
- * compositeType, whose item values
- * are specified by itemValues[], in the same order as in
- * itemNames[].
- * As a CompositeType does not specify any order on its items,
- * the itemNames[] parameter is used
- * to specify the order in which the values are given in itemValues[].
- * The items contained in this CompositeDataSupport instance are
- * internally stored in a TreeMap,
+ *
Constructs a {@code CompositeDataSupport} instance with the specified
+ * {@code compositeType}, whose item values
+ * are specified by {@code itemValues[]}, in the same order as in
+ * {@code itemNames[]}.
+ * As a {@code CompositeType} does not specify any order on its items,
+ * the {@code itemNames[]} parameter is used
+ * to specify the order in which the values are given in {@code itemValues[]}.
+ * The items contained in this {@code CompositeDataSupport} instance are
+ * internally stored in a {@code TreeMap},
* thus sorted in ascending lexicographic order of their names, for faster
* retrieval of individual item values.
*
@@ -89,28 +89,28 @@ public class CompositeDataSupport
* @param compositeType the composite type of this composite
* data instance; must not be null.
*
- * @param itemNames itemNames must list, in any order, all the
- * item names defined in compositeType; the order in which the
- * names are listed, is used to match values in itemValues[]; must
+ * @param itemNames {@code itemNames} must list, in any order, all the
+ * item names defined in {@code compositeType}; the order in which the
+ * names are listed, is used to match values in {@code itemValues[]}; must
* not be null or empty.
*
* @param itemValues the values of the items, listed in the same order as
- * their respective names in itemNames; each item value can be
+ * their respective names in {@code itemNames}; each item value can be
* null, but if it is non-null it must be a valid value for the open type
- * defined in compositeType for the corresponding item; must be of
- * the same size as itemNames; must not be null or empty.
+ * defined in {@code compositeType} for the corresponding item; must be of
+ * the same size as {@code itemNames}; must not be null or empty.
*
- * @throws IllegalArgumentException compositeType is null, or
- * itemNames[] or itemValues[] is null or empty, or one
- * of the elements in itemNames[] is a null or empty string, or
- * itemNames[] and itemValues[] are not of the same size.
+ * @throws IllegalArgumentException {@code compositeType} is null, or
+ * {@code itemNames[]} or {@code itemValues[]} is null or empty, or one
+ * of the elements in {@code itemNames[]} is a null or empty string, or
+ * {@code itemNames[]} and {@code itemValues[]} are not of the same size.
*
- * @throws OpenDataException itemNames[] or
- * itemValues[]'s size differs from the number of items defined in
- * compositeType, or one of the elements in itemNames[]
- * does not exist as an item name defined in compositeType, or one
- * of the elements in itemValues[] is not a valid value for the
- * corresponding item as defined in compositeType.
+ * @throws OpenDataException {@code itemNames[]} or
+ * {@code itemValues[]}'s size differs from the number of items defined in
+ * {@code compositeType}, or one of the elements in {@code itemNames[]}
+ * does not exist as an item name defined in {@code compositeType}, or one
+ * of the elements in {@code itemValues[]} is not a valid value for the
+ * corresponding item as defined in {@code compositeType}.
*/
public CompositeDataSupport(
CompositeType compositeType, String[] itemNames, Object[] itemValues)
@@ -147,28 +147,29 @@ public class CompositeDataSupport
/**
*
- * Constructs a CompositeDataSupport instance with the specified compositeType, whose item names and corresponding values
- * are given by the mappings in the map items.
+ * Constructs a {@code CompositeDataSupport} instance with the specified {@code compositeType},
+ * whose item names and corresponding values
+ * are given by the mappings in the map {@code items}.
* This constructor converts the keys to a string array and the values to an object array and calls
- * CompositeDataSupport(javax.management.openmbean.CompositeType, java.lang.String[], java.lang.Object[]).
+ * {@code CompositeDataSupport(javax.management.openmbean.CompositeType, java.lang.String[], java.lang.Object[])}.
*
* @param compositeType the composite type of this composite data instance;
* must not be null.
* @param items the mappings of all the item names to their values;
- * items must contain all the item names defined in compositeType;
+ * {@code items} must contain all the item names defined in {@code compositeType};
* must not be null or empty.
*
- * @throws IllegalArgumentException compositeType is null, or
- * items is null or empty, or one of the keys in items is a null
+ * @throws IllegalArgumentException {@code compositeType} is null, or
+ * {@code items} is null or empty, or one of the keys in {@code items} is a null
* or empty string.
- * @throws OpenDataException items' size differs from the
- * number of items defined in compositeType, or one of the
- * keys in items does not exist as an item name defined in
- * compositeType, or one of the values in items
+ * @throws OpenDataException {@code items}' size differs from the
+ * number of items defined in {@code compositeType}, or one of the
+ * keys in {@code items} does not exist as an item name defined in
+ * {@code compositeType}, or one of the values in {@code items}
* is not a valid value for the corresponding item as defined in
- * compositeType.
- * @throws ArrayStoreException one or more keys in items is not of
- * the class java.lang.String.
+ * {@code compositeType}.
+ * @throws ArrayStoreException one or more keys in {@code items} is not of
+ * the class {@code java.lang.String}.
*/
public CompositeDataSupport(CompositeType compositeType,
Map items)
@@ -253,12 +254,12 @@ public class CompositeDataSupport
}
/**
- * Returns the value of the item whose name is key.
+ * Returns the value of the item whose name is {@code key}.
*
- * @throws IllegalArgumentException if key is a null or empty String.
+ * @throws IllegalArgumentException if {@code key} is a null or empty String.
*
- * @throws InvalidKeyException if key is not an existing item name for
- * this CompositeData instance.
+ * @throws InvalidKeyException if {@code key} is not an existing item name for
+ * this {@code CompositeData} instance.
*/
public Object get(String key) {
@@ -273,13 +274,13 @@ public class CompositeDataSupport
/**
* Returns an array of the values of the items whose names are specified by
- * keys, in the same order as keys.
+ * {@code keys}, in the same order as {@code keys}.
*
- * @throws IllegalArgumentException if an element in keys is a null
+ * @throws IllegalArgumentException if an element in {@code keys} is a null
* or empty String.
*
- * @throws InvalidKeyException if an element in keys is not an existing
- * item name for this CompositeData instance.
+ * @throws InvalidKeyException if an element in {@code keys} is not an existing
+ * item name for this {@code CompositeData} instance.
*/
public Object[] getAll(String[] keys) {
@@ -294,9 +295,9 @@ public class CompositeDataSupport
}
/**
- * Returns true if and only if this CompositeData instance contains
- * an item whose name is key.
- * If key is a null or empty String, this method simply returns false.
+ * Returns {@code true} if and only if this {@code CompositeData} instance contains
+ * an item whose name is {@code key}.
+ * If {@code key} is a null or empty String, this method simply returns false.
*/
public boolean containsKey(String key) {
@@ -307,9 +308,9 @@ public class CompositeDataSupport
}
/**
- * Returns true if and only if this CompositeData instance
+ * Returns {@code true} if and only if this {@code CompositeData} instance
* contains an item
- * whose value is value.
+ * whose value is {@code value}.
*/
public boolean containsValue(Object value) {
@@ -318,7 +319,7 @@ public class CompositeDataSupport
/**
* Returns an unmodifiable Collection view of the item values contained in this
- * CompositeData instance.
+ * {@code CompositeData} instance.
* The returned collection's iterator will return the values in the ascending
* lexicographic order of the corresponding
* item names.
@@ -332,7 +333,7 @@ public class CompositeDataSupport
* Compares the specified obj parameter with this
* CompositeDataSupport instance for equality.
*
- * Returns true if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
*
*
obj is non null,
*
obj also implements the CompositeData interface,
@@ -344,11 +345,11 @@ public class CompositeDataSupport
* {@code Arrays.equals(e1,e2)} for arrays of primitive types
*
*
- * This ensures that this equals method works properly for
+ * This ensures that this {@code equals} method works properly for
* obj parameters which are different implementations of the
* CompositeData interface, with the restrictions mentioned in the
* {@link java.util.Collection#equals(Object) equals}
- * method of the java.util.Collection interface.
+ * method of the {@code java.util.Collection} interface.
*
* @param obj the object to be compared for equality with this
* CompositeDataSupport instance.
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfo.java b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfo.java
index 0324efc8bf8..337cd027506 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfo.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfo.java
@@ -53,27 +53,28 @@ public interface OpenMBeanAttributeInfo extends OpenMBeanParameterInfo {
// (these will be removed when MBeanAttributeInfo is made a parent interface of this interface)
/**
- * Returns true if the attribute described by this OpenMBeanAttributeInfo instance is readable,
- * false otherwise.
+ * Returns {@code true} if the attribute described by this {@code OpenMBeanAttributeInfo}
+ * instance is readable, {@code false} otherwise.
*
* @return true if the attribute is readable.
*/
public boolean isReadable() ;
/**
- * Returns true if the attribute described by this OpenMBeanAttributeInfo instance is writable,
- * false otherwise.
+ * Returns {@code true} if the attribute described by this {@code OpenMBeanAttributeInfo}
+ * instance is writable, {@code false} otherwise.
*
* @return true if the attribute is writable.
*/
public boolean isWritable() ;
/**
- * Returns true if the attribute described by this OpenMBeanAttributeInfo instance
- * is accessed through a isXXX getter (applies only to boolean and Boolean values),
- * false otherwise.
+ * Returns {@code true} if the attribute described by this {@code OpenMBeanAttributeInfo} instance
+ * is accessed through a isXXX getter
+ * (applies only to {@code boolean} and {@code Boolean} values),
+ * {@code false} otherwise.
*
- * @return true if the attribute is accessed through isXXX.
+ * @return true if the attribute is accessed through isXXX.
*/
public boolean isIs() ;
@@ -82,50 +83,52 @@ public interface OpenMBeanAttributeInfo extends OpenMBeanParameterInfo {
//
/**
- * Compares the specified obj parameter with this OpenMBeanAttributeInfo instance for equality.
+ * Compares the specified obj parameter with this
+ * {@code OpenMBeanAttributeInfo} instance for equality.
*
- * Returns true if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
*
*
obj is non null,
- *
obj also implements the OpenMBeanAttributeInfo interface,
+ *
obj also implements the {@code OpenMBeanAttributeInfo} interface,
*
their names are equal
*
their open types are equal
*
their access properties (isReadable, isWritable and isIs) are equal
*
their default, min, max and legal values are equal.
*
- * This ensures that this equals method works properly for obj parameters which are
- * different implementations of the OpenMBeanAttributeInfo interface.
+ * This ensures that this {@code equals} method works properly for obj parameters which are
+ * different implementations of the {@code OpenMBeanAttributeInfo} interface.
*
- * @param obj the object to be compared for equality with this OpenMBeanAttributeInfo instance;
+ * @param obj the object to be compared for equality with this {@code OpenMBeanAttributeInfo} instance;
*
- * @return true if the specified object is equal to this OpenMBeanAttributeInfo instance.
+ * @return {@code true} if the specified object is equal to this {@code OpenMBeanAttributeInfo} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this OpenMBeanAttributeInfo instance.
+ * Returns the hash code value for this {@code OpenMBeanAttributeInfo} instance.
*
- * The hash code of an OpenMBeanAttributeInfo instance is the sum of the hash codes
- * of all elements of information used in equals comparisons
+ * The hash code of an {@code OpenMBeanAttributeInfo} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its name, its open type, and its default, min, max and legal values).
*
- * This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode()
- * for any two OpenMBeanAttributeInfo instances t1 and t2,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code OpenMBeanAttributeInfo} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * @return the hash code value for this OpenMBeanAttributeInfo instance
+ * @return the hash code value for this {@code OpenMBeanAttributeInfo} instance
*/
public int hashCode();
/**
- * Returns a string representation of this OpenMBeanAttributeInfo instance.
+ * Returns a string representation of this {@code OpenMBeanAttributeInfo} instance.
*
- * The string representation consists of the name of this class (ie javax.management.openmbean.OpenMBeanAttributeInfo),
+ * The string representation consists of the name of this class
+ * (ie {@code javax.management.openmbean.OpenMBeanAttributeInfo}),
* the string representation of the name and open type of the described attribute,
* and the string representation of its default, min, max and legal values.
*
- * @return a string representation of this OpenMBeanAttributeInfo instance
+ * @return a string representation of this {@code OpenMBeanAttributeInfo} instance
*/
public String toString();
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java
index 9f0c052e04c..b66bf0e8183 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java
@@ -114,7 +114,7 @@ public class OpenMBeanAttributeInfoSupport
* exposed for management.
*
* @param isIs {@code true} if the attribute's getter is of the
- * form isXXX.
+ * form isXXX.
*
* @throws IllegalArgumentException if {@code name} or {@code
* description} are null or empty string, or {@code openType} is
@@ -154,7 +154,7 @@ public class OpenMBeanAttributeInfoSupport
* exposed for management.
*
* @param isIs {@code true} if the attribute's getter is of the
- * form isXXX.
+ * form isXXX.
*
* @param descriptor The descriptor for the attribute. This may be null
* which is equivalent to an empty descriptor.
@@ -221,7 +221,7 @@ public class OpenMBeanAttributeInfoSupport
* exposed for management.
*
* @param isIs {@code true} if the attribute's getter is of the
- * form isXXX.
+ * form isXXX.
*
* @param defaultValue must be a valid value for the {@code
* openType} specified for this attribute; default value not
@@ -278,7 +278,7 @@ public class OpenMBeanAttributeInfoSupport
* exposed for management.
*
* @param isIs {@code true} if the attribute's getter is of the
- * form isXXX.
+ * form isXXX.
*
* @param defaultValue must be a valid value
* for the {@code
@@ -345,7 +345,7 @@ public class OpenMBeanAttributeInfoSupport
* exposed for management.
*
* @param isIs {@code true} if the attribute's getter is of the
- * form isXXX.
+ * form isXXX.
*
* @param defaultValue must be a valid value for the {@code
* openType} specified for this attribute; default value not
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfo.java b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfo.java
index 54be69f6622..c557c9a964d 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfo.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfo.java
@@ -60,7 +60,7 @@ public interface OpenMBeanConstructorInfo {
/**
* Returns a human readable description of the constructor
- * described by this OpenMBeanConstructorInfo instance.
+ * described by this {@code OpenMBeanConstructorInfo} instance.
*
* @return the description.
*/
@@ -68,16 +68,16 @@ public interface OpenMBeanConstructorInfo {
/**
* Returns the name of the constructor
- * described by this OpenMBeanConstructorInfo instance.
+ * described by this {@code OpenMBeanConstructorInfo} instance.
*
* @return the name.
*/
public String getName() ;
/**
- * Returns an array of OpenMBeanParameterInfo instances
+ * Returns an array of {@code OpenMBeanParameterInfo} instances
* describing each parameter in the signature of the constructor
- * described by this OpenMBeanConstructorInfo instance.
+ * described by this {@code OpenMBeanConstructorInfo} instance.
*
* @return the signature.
*/
@@ -88,48 +88,49 @@ public interface OpenMBeanConstructorInfo {
//
/**
- * Compares the specified obj parameter with this OpenMBeanConstructorInfo instance for equality.
+ * Compares the specified obj parameter with this {@code OpenMBeanConstructorInfo} instance for equality.
*
- * Returns true if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
*
*
obj is non null,
- *
obj also implements the OpenMBeanConstructorInfo interface,
+ *
obj also implements the {@code OpenMBeanConstructorInfo} interface,
*
their names are equal
*
their signatures are equal.
*
- * This ensures that this equals method works properly for obj parameters which are
- * different implementations of the OpenMBeanConstructorInfo interface.
+ * This ensures that this {@code equals} method works properly for obj parameters which are
+ * different implementations of the {@code OpenMBeanConstructorInfo} interface.
*
- * @param obj the object to be compared for equality with this OpenMBeanConstructorInfo instance;
+ * @param obj the object to be compared for equality with this {@code OpenMBeanConstructorInfo} instance;
*
- * @return true if the specified object is equal to this OpenMBeanConstructorInfo instance.
+ * @return {@code true} if the specified object is equal to this {@code OpenMBeanConstructorInfo} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this OpenMBeanConstructorInfo instance.
+ * Returns the hash code value for this {@code OpenMBeanConstructorInfo} instance.
*
- * The hash code of an OpenMBeanConstructorInfo instance is the sum of the hash codes
- * of all elements of information used in equals comparisons
+ * The hash code of an {@code OpenMBeanConstructorInfo} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its name and signature, where the signature hashCode is calculated by a call to
- * java.util.Arrays.asList(this.getSignature).hashCode()).
+ * {@code java.util.Arrays.asList(this.getSignature).hashCode()}).
*
- * This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode()
- * for any two OpenMBeanConstructorInfo instances t1 and t2,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code OpenMBeanConstructorInfo} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * @return the hash code value for this OpenMBeanConstructorInfo instance
+ * @return the hash code value for this {@code OpenMBeanConstructorInfo} instance
*/
public int hashCode();
/**
- * Returns a string representation of this OpenMBeanConstructorInfo instance.
+ * Returns a string representation of this {@code OpenMBeanConstructorInfo} instance.
*
- * The string representation consists of the name of this class (ie javax.management.openmbean.OpenMBeanConstructorInfo),
+ * The string representation consists of the name of this class
+ * (ie {@code javax.management.openmbean.OpenMBeanConstructorInfo}),
* and the name and signature of the described constructor.
*
- * @return a string representation of this OpenMBeanConstructorInfo instance
+ * @return a string representation of this {@code OpenMBeanConstructorInfo} instance
*/
public String toString();
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanInfo.java b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanInfo.java
index f63c20757d0..9243788e206 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanInfo.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanInfo.java
@@ -70,7 +70,7 @@ public interface OpenMBeanInfo {
/**
* Returns the fully qualified Java class name of the open MBean
- * instances this OpenMBeanInfo describes.
+ * instances this {@code OpenMBeanInfo} describes.
*
* @return the class name.
*/
@@ -78,19 +78,19 @@ public interface OpenMBeanInfo {
/**
* Returns a human readable description of the type of open MBean
- * instances this OpenMBeanInfo describes.
+ * instances this {@code OpenMBeanInfo} describes.
*
* @return the description.
*/
public String getDescription() ;
/**
- * Returns an array of OpenMBeanAttributeInfo instances
+ * Returns an array of {@code OpenMBeanAttributeInfo} instances
* describing each attribute in the open MBean described by this
- * OpenMBeanInfo instance. Each instance in the returned
+ * {@code OpenMBeanInfo} instance. Each instance in the returned
* array should actually be a subclass of
- * MBeanAttributeInfo which implements the
- * OpenMBeanAttributeInfo interface (typically {@link
+ * {@code MBeanAttributeInfo} which implements the
+ * {@code OpenMBeanAttributeInfo} interface (typically {@link
* OpenMBeanAttributeInfoSupport}).
*
* @return the attribute array.
@@ -98,12 +98,12 @@ public interface OpenMBeanInfo {
public MBeanAttributeInfo[] getAttributes() ;
/**
- * Returns an array of OpenMBeanOperationInfo instances
+ * Returns an array of {@code OpenMBeanOperationInfo} instances
* describing each operation in the open MBean described by this
- * OpenMBeanInfo instance. Each instance in the returned
+ * {@code OpenMBeanInfo} instance. Each instance in the returned
* array should actually be a subclass of
- * MBeanOperationInfo which implements the
- * OpenMBeanOperationInfo interface (typically {@link
+ * {@code MBeanOperationInfo} which implements the
+ * {@code OpenMBeanOperationInfo} interface (typically {@link
* OpenMBeanOperationInfoSupport}).
*
* @return the operation array.
@@ -111,12 +111,12 @@ public interface OpenMBeanInfo {
public MBeanOperationInfo[] getOperations() ;
/**
- * Returns an array of OpenMBeanConstructorInfo instances
+ * Returns an array of {@code OpenMBeanConstructorInfo} instances
* describing each constructor in the open MBean described by this
- * OpenMBeanInfo instance. Each instance in the returned
+ * {@code OpenMBeanInfo} instance. Each instance in the returned
* array should actually be a subclass of
- * MBeanConstructorInfo which implements the
- * OpenMBeanConstructorInfo interface (typically {@link
+ * {@code MBeanConstructorInfo} which implements the
+ * {@code OpenMBeanConstructorInfo} interface (typically {@link
* OpenMBeanConstructorInfoSupport}).
*
* @return the constructor array.
@@ -124,9 +124,9 @@ public interface OpenMBeanInfo {
public MBeanConstructorInfo[] getConstructors() ;
/**
- * Returns an array of MBeanNotificationInfo instances
+ * Returns an array of {@code MBeanNotificationInfo} instances
* describing each notification emitted by the open MBean
- * described by this OpenMBeanInfo instance.
+ * described by this {@code OpenMBeanInfo} instance.
*
* @return the notification array.
*/
@@ -137,50 +137,51 @@ public interface OpenMBeanInfo {
//
/**
- * Compares the specified obj parameter with this OpenMBeanInfo instance for equality.
+ * Compares the specified obj parameter with this {@code OpenMBeanInfo} instance for equality.
*
- * Returns true if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
*
*
obj is non null,
- *
obj also implements the OpenMBeanInfo interface,
+ *
obj also implements the {@code OpenMBeanInfo} interface,
*
their class names are equal
*
their infos on attributes, constructors, operations and notifications are equal
*
- * This ensures that this equals method works properly for obj parameters which are
- * different implementations of the OpenMBeanInfo interface.
- *
- * @param obj the object to be compared for equality with this OpenMBeanInfo instance;
+ * This ensures that this {@code equals} method works properly for obj parameters which are
+ * different implementations of the {@code OpenMBeanInfo} interface.
*
- * @return true if the specified object is equal to this OpenMBeanInfo instance.
+ * @param obj the object to be compared for equality with this {@code OpenMBeanInfo} instance;
+ *
+ * @return {@code true} if the specified object is equal to this {@code OpenMBeanInfo} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this OpenMBeanInfo instance.
+ * Returns the hash code value for this {@code OpenMBeanInfo} instance.
*
- * The hash code of an OpenMBeanInfo instance is the sum of the hash codes
- * of all elements of information used in equals comparisons
+ * The hash code of an {@code OpenMBeanInfo} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its class name, and its infos on attributes, constructors, operations and notifications,
* where the hashCode of each of these arrays is calculated by a call to
- * new java.util.HashSet(java.util.Arrays.asList(this.getSignature)).hashCode()).
+ * {@code new java.util.HashSet(java.util.Arrays.asList(this.getSignature)).hashCode()}).
*
- * This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode()
- * for any two OpenMBeanInfo instances t1 and t2,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code OpenMBeanInfo} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * @return the hash code value for this OpenMBeanInfo instance
+ * @return the hash code value for this {@code OpenMBeanInfo} instance
*/
public int hashCode();
/**
- * Returns a string representation of this OpenMBeanInfo instance.
+ * Returns a string representation of this {@code OpenMBeanInfo} instance.
*
- * The string representation consists of the name of this class (ie javax.management.openmbean.OpenMBeanInfo),
- * the MBean class name,
- * and the string representation of infos on attributes, constructors, operations and notifications of the described MBean.
+ * The string representation consists of the name of this class
+ * (ie {@code javax.management.openmbean.OpenMBeanInfo}), the MBean class name,
+ * and the string representation of infos on attributes, constructors,
+ * operations and notifications of the described MBean.
*
- * @return a string representation of this OpenMBeanInfo instance
+ * @return a string representation of this {@code OpenMBeanInfo} instance
*/
public String toString();
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfo.java b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfo.java
index bafd82c1610..49f9f9dd3d8 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfo.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfo.java
@@ -58,7 +58,7 @@ public interface OpenMBeanOperationInfo {
/**
* Returns a human readable description of the operation
- * described by this OpenMBeanOperationInfo instance.
+ * described by this {@code OpenMBeanOperationInfo} instance.
*
* @return the description.
*/
@@ -66,19 +66,19 @@ public interface OpenMBeanOperationInfo {
/**
* Returns the name of the operation
- * described by this OpenMBeanOperationInfo instance.
+ * described by this {@code OpenMBeanOperationInfo} instance.
*
* @return the name.
*/
public String getName() ;
/**
- * Returns an array of OpenMBeanParameterInfo instances
+ * Returns an array of {@code OpenMBeanParameterInfo} instances
* describing each parameter in the signature of the operation
- * described by this OpenMBeanOperationInfo instance.
+ * described by this {@code OpenMBeanOperationInfo} instance.
* Each instance in the returned array should actually be a
- * subclass of MBeanParameterInfo which implements the
- * OpenMBeanParameterInfo interface (typically {@link
+ * subclass of {@code MBeanParameterInfo} which implements the
+ * {@code OpenMBeanParameterInfo} interface (typically {@link
* OpenMBeanParameterInfoSupport}).
*
* @return the signature.
@@ -86,8 +86,8 @@ public interface OpenMBeanOperationInfo {
public MBeanParameterInfo[] getSignature() ;
/**
- * Returns an int constant qualifying the impact of the
- * operation described by this OpenMBeanOperationInfo
+ * Returns an {@code int} constant qualifying the impact of the
+ * operation described by this {@code OpenMBeanOperationInfo}
* instance.
*
* The returned constant is one of {@link
@@ -103,9 +103,9 @@ public interface OpenMBeanOperationInfo {
/**
* Returns the fully qualified Java class name of the values
* returned by the operation described by this
- * OpenMBeanOperationInfo instance. This method should
+ * {@code OpenMBeanOperationInfo} instance. This method should
* return the same value as a call to
- * getReturnOpenType().getClassName().
+ * {@code getReturnOpenType().getClassName()}.
*
* @return the return type.
*/
@@ -117,7 +117,7 @@ public interface OpenMBeanOperationInfo {
/**
* Returns the open type of the values returned by the
- * operation described by this OpenMBeanOperationInfo
+ * operation described by this {@code OpenMBeanOperationInfo}
* instance.
*
* @return the return type.
@@ -129,51 +129,53 @@ public interface OpenMBeanOperationInfo {
//
/**
- * Compares the specified obj parameter with this OpenMBeanOperationInfo instance for equality.
+ * Compares the specified obj parameter with this {@code OpenMBeanOperationInfo} instance for equality.
*
- * Returns true if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
*
*
obj is non null,
- *
obj also implements the OpenMBeanOperationInfo interface,
+ *
obj also implements the {@code OpenMBeanOperationInfo} interface,
*
their names are equal
*
their signatures are equal
*
their return open types are equal
*
their impacts are equal
*
- * This ensures that this equals method works properly for obj parameters which are
- * different implementations of the OpenMBeanOperationInfo interface.
+ * This ensures that this {@code equals} method works properly for obj parameters which are
+ * different implementations of the {@code OpenMBeanOperationInfo} interface.
*
- * @param obj the object to be compared for equality with this OpenMBeanOperationInfo instance;
+ * @param obj the object to be compared for equality with this {@code OpenMBeanOperationInfo} instance;
*
- * @return true if the specified object is equal to this OpenMBeanOperationInfo instance.
+ * @return {@code true} if the specified object is equal to this {@code OpenMBeanOperationInfo} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this OpenMBeanOperationInfo instance.
+ * Returns the hash code value for this {@code OpenMBeanOperationInfo} instance.
*
- * The hash code of an OpenMBeanOperationInfo instance is the sum of the hash codes
- * of all elements of information used in equals comparisons
- * (ie: its name, return open type, impact and signature, where the signature hashCode is calculated by a call to
- * java.util.Arrays.asList(this.getSignature).hashCode()).
+ * The hash code of an {@code OpenMBeanOperationInfo} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
+ * (ie: its name, return open type, impact and signature,
+ * where the signature hashCode is calculated by a call to
+ * {@code java.util.Arrays.asList(this.getSignature).hashCode()}).
*
- * This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode()
- * for any two OpenMBeanOperationInfo instances t1 and t2,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code OpenMBeanOperationInfo} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
*
- * @return the hash code value for this OpenMBeanOperationInfo instance
+ * @return the hash code value for this {@code OpenMBeanOperationInfo} instance
*/
public int hashCode();
/**
- * Returns a string representation of this OpenMBeanOperationInfo instance.
+ * Returns a string representation of this {@code OpenMBeanOperationInfo} instance.
*
- * The string representation consists of the name of this class (ie javax.management.openmbean.OpenMBeanOperationInfo),
+ * The string representation consists of the name of this class
+ * (ie {@code javax.management.openmbean.OpenMBeanOperationInfo}),
* and the name, signature, return open type and impact of the described operation.
*
- * @return a string representation of this OpenMBeanOperationInfo instance
+ * @return a string representation of this {@code OpenMBeanOperationInfo} instance
*/
public String toString();
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfo.java b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfo.java
index f7e0b4bf9a4..34489945533 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfo.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfo.java
@@ -57,7 +57,7 @@ public interface OpenMBeanParameterInfo {
/**
* Returns a human readable description of the parameter
- * described by this OpenMBeanParameterInfo instance.
+ * described by this {@code OpenMBeanParameterInfo} instance.
*
* @return the description.
*/
@@ -65,7 +65,7 @@ public interface OpenMBeanParameterInfo {
/**
* Returns the name of the parameter
- * described by this OpenMBeanParameterInfo instance.
+ * described by this {@code OpenMBeanParameterInfo} instance.
*
* @return the name.
*/
@@ -77,7 +77,7 @@ public interface OpenMBeanParameterInfo {
/**
* Returns the open type of the values of the parameter
- * described by this OpenMBeanParameterInfo instance.
+ * described by this {@code OpenMBeanParameterInfo} instance.
*
* @return the open type.
*/
@@ -85,7 +85,7 @@ public interface OpenMBeanParameterInfo {
/**
* Returns the default value for this parameter, if it has one, or
- * null otherwise.
+ * {@code null} otherwise.
*
* @return the default value.
*/
@@ -93,7 +93,7 @@ public interface OpenMBeanParameterInfo {
/**
* Returns the set of legal values for this parameter, if it has
- * one, or null otherwise.
+ * one, or {@code null} otherwise.
*
* @return the set of legal values.
*/
@@ -101,7 +101,7 @@ public interface OpenMBeanParameterInfo {
/**
* Returns the minimal value for this parameter, if it has one, or
- * null otherwise.
+ * {@code null} otherwise.
*
* @return the minimum value.
*/
@@ -109,39 +109,39 @@ public interface OpenMBeanParameterInfo {
/**
* Returns the maximal value for this parameter, if it has one, or
- * null otherwise.
+ * {@code null} otherwise.
*
* @return the maximum value.
*/
public Comparable> getMaxValue() ;
/**
- * Returns true if this parameter has a specified default
- * value, or false otherwise.
+ * Returns {@code true} if this parameter has a specified default
+ * value, or {@code false} otherwise.
*
* @return true if there is a default value.
*/
public boolean hasDefaultValue() ;
/**
- * Returns true if this parameter has a specified set of
- * legal values, or false otherwise.
+ * Returns {@code true} if this parameter has a specified set of
+ * legal values, or {@code false} otherwise.
*
* @return true if there is a set of legal values.
*/
public boolean hasLegalValues() ;
/**
- * Returns true if this parameter has a specified minimal
- * value, or false otherwise.
+ * Returns {@code true} if this parameter has a specified minimal
+ * value, or {@code false} otherwise.
*
* @return true if there is a minimum value.
*/
public boolean hasMinValue() ;
/**
- * Returns true if this parameter has a specified maximal
- * value, or false otherwise.
+ * Returns {@code true} if this parameter has a specified maximal
+ * value, or {@code false} otherwise.
*
* @return true if there is a maximum value.
*/
@@ -149,62 +149,62 @@ public interface OpenMBeanParameterInfo {
/**
* Tests whether obj is a valid value for the parameter
- * described by this OpenMBeanParameterInfo instance.
+ * described by this {@code OpenMBeanParameterInfo} instance.
*
* @param obj the object to be tested.
*
- * @return true if obj is a valid value
+ * @return {@code true} if obj is a valid value
* for the parameter described by this
- * OpenMBeanParameterInfo instance,
- * false otherwise.
+ * {@code OpenMBeanParameterInfo} instance,
+ * {@code false} otherwise.
*/
public boolean isValue(Object obj) ;
/**
- * Compares the specified obj parameter with this OpenMBeanParameterInfo instance for equality.
+ * Compares the specified obj parameter with this {@code OpenMBeanParameterInfo} instance for equality.
*
- * Returns true if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
*
*
obj is non null,
- *
obj also implements the OpenMBeanParameterInfo interface,
+ *
obj also implements the {@code OpenMBeanParameterInfo} interface,
*
their names are equal
*
their open types are equal
*
their default, min, max and legal values are equal.
*
- * This ensures that this equals method works properly for obj parameters which are
- * different implementations of the OpenMBeanParameterInfo interface.
+ * This ensures that this {@code equals} method works properly for obj parameters which are
+ * different implementations of the {@code OpenMBeanParameterInfo} interface.
*
- * @param obj the object to be compared for equality with this OpenMBeanParameterInfo instance;
+ * @param obj the object to be compared for equality with this {@code OpenMBeanParameterInfo} instance;
*
- * @return true if the specified object is equal to this OpenMBeanParameterInfo instance.
+ * @return {@code true} if the specified object is equal to this {@code OpenMBeanParameterInfo} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this OpenMBeanParameterInfo instance.
+ * Returns the hash code value for this {@code OpenMBeanParameterInfo} instance.
*
- * The hash code of an OpenMBeanParameterInfo instance is the sum of the hash codes
- * of all elements of information used in equals comparisons
+ * The hash code of an {@code OpenMBeanParameterInfo} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its name, its open type, and its default, min, max and legal values).
*
- * This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode()
- * for any two OpenMBeanParameterInfo instances t1 and t2,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code OpenMBeanParameterInfo} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * @return the hash code value for this OpenMBeanParameterInfo instance
+ * @return the hash code value for this {@code OpenMBeanParameterInfo} instance
*/
public int hashCode();
/**
- * Returns a string representation of this OpenMBeanParameterInfo instance.
+ * Returns a string representation of this {@code OpenMBeanParameterInfo} instance.
*
- * The string representation consists of the name of this class (ie javax.management.openmbean.OpenMBeanParameterInfo),
+ * The string representation consists of the name of this class (ie {@code javax.management.openmbean.OpenMBeanParameterInfo}),
* the string representation of the name and open type of the described parameter,
* and the string representation of its default, min, max and legal values.
*
- * @return a string representation of this OpenMBeanParameterInfo instance
+ * @return a string representation of this {@code OpenMBeanParameterInfo} instance
*/
public String toString();
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/TabularData.java b/jdk/src/java.management/share/classes/javax/management/openmbean/TabularData.java
index 7b8bf7ba2bf..8c423c67c57 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/TabularData.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/TabularData.java
@@ -37,7 +37,7 @@ import java.util.Collection;
/**
- * The TabularData interface specifies the behavior of a specific type of complex open data objects
+ * The {@code TabularData} interface specifies the behavior of a specific type of complex open data objects
* which represent tabular data structures.
*
* @since 1.5
@@ -50,7 +50,7 @@ public interface TabularData /*extends Map*/ {
/**
* Returns the tabular type describing this
- * TabularData instance.
+ * {@code TabularData} instance.
*
* @return the tabular type.
*/
@@ -58,21 +58,21 @@ public interface TabularData /*extends Map*/ {
/**
- * Calculates the index that would be used in this TabularData instance to refer to the specified
+ * Calculates the index that would be used in this {@code TabularData} instance to refer to the specified
* composite data value parameter if it were added to this instance.
* This method checks for the type validity of the specified value,
- * but does not check if the calculated index is already used to refer to a value in this TabularData instance.
+ * but does not check if the calculated index is already used to refer to a value in this {@code TabularData} instance.
*
* @param value the composite data value whose index in this
- * TabularData instance is to be calculated;
+ * {@code TabularData} instance is to be calculated;
* must be of the same composite type as this instance's row type;
* must not be null.
*
- * @return the index that the specified value would have in this TabularData instance.
+ * @return the index that the specified value would have in this {@code TabularData} instance.
*
- * @throws NullPointerException if value is null
+ * @throws NullPointerException if value is {@code null}
*
- * @throws InvalidOpenTypeException if value does not conform to this TabularData instance's
+ * @throws InvalidOpenTypeException if value does not conform to this {@code TabularData} instance's
* row type definition.
*/
public Object[] calculateIndex(CompositeData value) ;
@@ -83,8 +83,8 @@ public interface TabularData /*extends Map*/ {
/* *** Content information query methods *** */
/**
- * Returns the number of CompositeData values (ie the
- * number of rows) contained in this TabularData
+ * Returns the number of {@code CompositeData} values (ie the
+ * number of rows) contained in this {@code TabularData}
* instance.
*
* @return the number of values contained.
@@ -92,50 +92,50 @@ public interface TabularData /*extends Map*/ {
public int size() ;
/**
- * Returns true if the number of CompositeData
+ * Returns {@code true} if the number of {@code CompositeData}
* values (ie the number of rows) contained in this
- * TabularData instance is zero.
+ * {@code TabularData} instance is zero.
*
- * @return true if this TabularData is empty.
+ * @return true if this {@code TabularData} is empty.
*/
public boolean isEmpty() ;
/**
- * Returns true if and only if this TabularData instance contains a CompositeData value
- * (ie a row) whose index is the specified key. If key is null or does not conform to
- * this TabularData instance's TabularType definition, this method simply returns false.
+ * Returns {@code true} if and only if this {@code TabularData} instance contains a {@code CompositeData} value
+ * (ie a row) whose index is the specified key. If key is {@code null} or does not conform to
+ * this {@code TabularData} instance's {@code TabularType} definition, this method simply returns {@code false}.
*
- * @param key the index value whose presence in this TabularData instance is to be tested.
+ * @param key the index value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return true if this TabularData indexes a row value with the specified key.
+ * @return {@code true} if this {@code TabularData} indexes a row value with the specified key.
*/
public boolean containsKey(Object[] key) ;
/**
- * Returns true if and only if this TabularData instance contains the specified
- * CompositeData value. If value is null or does not conform to
- * this TabularData instance's row type definition, this method simply returns false.
+ * Returns {@code true} if and only if this {@code TabularData} instance contains the specified
+ * {@code CompositeData} value. If value is {@code null} or does not conform to
+ * this {@code TabularData} instance's row type definition, this method simply returns {@code false}.
*
- * @param value the row value whose presence in this TabularData instance is to be tested.
+ * @param value the row value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return true if this TabularData instance contains the specified row value.
+ * @return {@code true} if this {@code TabularData} instance contains the specified row value.
*/
public boolean containsValue(CompositeData value) ;
/**
- * Returns the CompositeData value whose index is
- * key, or null if there is no value mapping
- * to key, in this TabularData instance.
+ * Returns the {@code CompositeData} value whose index is
+ * key, or {@code null} if there is no value mapping
+ * to key, in this {@code TabularData} instance.
*
* @param key the key of the row to return.
*
* @return the value corresponding to key.
*
* @throws NullPointerException if the key is
- * null
+ * {@code null}
* @throws InvalidKeyException if the key does not
- * conform to this TabularData instance's *
- * TabularType definition
+ * conform to this {@code TabularData} instance's *
+ * {@code TabularType} definition
*/
public CompositeData get(Object[] key) ;
@@ -146,45 +146,45 @@ public interface TabularData /*extends Map*/ {
/**
- * Adds value to this TabularData instance.
+ * Adds value to this {@code TabularData} instance.
* The composite type of value must be the same as this
* instance's row type (ie the composite type returned by
- * this.getTabularType().{@link TabularType#getRowType
- * getRowType()}), and there must not already be an existing
- * value in this TabularData instance whose index is the
+ * this.getTabularType().{@link TabularType#getRowType
+ * getRowType()}), and there must not already be an existing
+ * value in this {@code TabularData} instance whose index is the
* same as the one calculated for the value to be
* added. The index for value is calculated according
- * to this TabularData instance's TabularType
- * definition (see TabularType.{@link
- * TabularType#getIndexNames getIndexNames()}).
+ * to this {@code TabularData} instance's {@code TabularType}
+ * definition (see TabularType.{@link
+ * TabularType#getIndexNames getIndexNames()}).
*
- * @param value the composite data value to be added as a new row to this TabularData instance;
+ * @param value the composite data value to be added as a new row to this {@code TabularData} instance;
* must be of the same composite type as this instance's row type;
* must not be null.
*
- * @throws NullPointerException if value is null
- * @throws InvalidOpenTypeException if value does not conform to this TabularData instance's
+ * @throws NullPointerException if value is {@code null}
+ * @throws InvalidOpenTypeException if value does not conform to this {@code TabularData} instance's
* row type definition.
* @throws KeyAlreadyExistsException if the index for value, calculated according to
- * this TabularData instance's TabularType definition
+ * this {@code TabularData} instance's {@code TabularType} definition
* already maps to an existing value in the underlying HashMap.
*/
public void put(CompositeData value) ;
/**
- * Removes the CompositeData value whose index is key from this TabularData instance,
- * and returns the removed value, or returns null if there is no value whose index is key.
+ * Removes the {@code CompositeData} value whose index is key from this {@code TabularData} instance,
+ * and returns the removed value, or returns {@code null} if there is no value whose index is key.
*
- * @param key the index of the value to get in this TabularData instance;
- * must be valid with this TabularData instance's row type definition;
+ * @param key the index of the value to get in this {@code TabularData} instance;
+ * must be valid with this {@code TabularData} instance's row type definition;
* must not be null.
*
- * @return previous value associated with specified key, or null
+ * @return previous value associated with specified key, or {@code null}
* if there was no mapping for key.
*
- * @throws NullPointerException if the key is null
- * @throws InvalidKeyException if the key does not conform to this TabularData instance's
- * TabularType definition
+ * @throws NullPointerException if the key is {@code null}
+ * @throws InvalidKeyException if the key does not conform to this {@code TabularData} instance's
+ * {@code TabularType} definition
*/
public CompositeData remove(Object[] key) ;
@@ -195,27 +195,27 @@ public interface TabularData /*extends Map*/ {
/**
- * Add all the elements in values to this TabularData instance.
- * If any element in values does not satisfy the constraints defined in {@link #put(CompositeData) put},
- * or if any two elements in values have the same index calculated according to this TabularData
- * instance's TabularType definition, then an exception describing the failure is thrown
- * and no element of values is added, thus leaving this TabularData instance unchanged.
+ * Add all the elements in values to this {@code TabularData} instance.
+ * If any element in values does not satisfy the constraints defined in {@link #put(CompositeData) put},
+ * or if any two elements in values have the same index calculated according to this {@code TabularData}
+ * instance's {@code TabularType} definition, then an exception describing the failure is thrown
+ * and no element of values is added, thus leaving this {@code TabularData} instance unchanged.
*
- * @param values the array of composite data values to be added as new rows to this TabularData instance;
- * if values is null or empty, this method returns without doing anything.
+ * @param values the array of composite data values to be added as new rows to this {@code TabularData} instance;
+ * if values is {@code null} or empty, this method returns without doing anything.
*
- * @throws NullPointerException if an element of values is null
+ * @throws NullPointerException if an element of values is {@code null}
* @throws InvalidOpenTypeException if an element of values does not conform to
- * this TabularData instance's row type definition
+ * this {@code TabularData} instance's row type definition
* @throws KeyAlreadyExistsException if the index for an element of values, calculated according to
- * this TabularData instance's TabularType definition
+ * this {@code TabularData} instance's {@code TabularType} definition
* already maps to an existing value in this instance,
* or two elements of values have the same index.
*/
public void putAll(CompositeData[] values) ;
/**
- * Removes all CompositeData values (ie rows) from this TabularData instance.
+ * Removes all {@code CompositeData} values (ie rows) from this {@code TabularData} instance.
*/
public void clear();
@@ -257,47 +257,47 @@ public interface TabularData /*extends Map*/ {
/**
- * Compares the specified obj parameter with this TabularData instance for equality.
+ * Compares the specified obj parameter with this {@code TabularData} instance for equality.
*
- * Returns true if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
*
*
obj is non null,
- *
obj also implements the TabularData interface,
+ *
obj also implements the {@code TabularData} interface,
*
their row types are equal
*
their contents (ie index to value mappings) are equal
*
- * This ensures that this equals method works properly for obj parameters which are
- * different implementations of the TabularData interface.
+ * This ensures that this {@code equals} method works properly for obj parameters which are
+ * different implementations of the {@code TabularData} interface.
*
- * @param obj the object to be compared for equality with this TabularData instance;
+ * @param obj the object to be compared for equality with this {@code TabularData} instance;
*
- * @return true if the specified object is equal to this TabularData instance.
+ * @return {@code true} if the specified object is equal to this {@code TabularData} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this TabularData instance.
+ * Returns the hash code value for this {@code TabularData} instance.
*
- * The hash code of a TabularData instance is the sum of the hash codes
- * of all elements of information used in equals comparisons
+ * The hash code of a {@code TabularData} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its tabular type and its content, where the content is defined as all the index to value mappings).
*
- * This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode()
- * for any two TabularDataSupport instances t1 and t2,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code TabularDataSupport} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * @return the hash code value for this TabularDataSupport instance
+ * @return the hash code value for this {@code TabularDataSupport} instance
*/
public int hashCode();
/**
- * Returns a string representation of this TabularData instance.
+ * Returns a string representation of this {@code TabularData} instance.
*
* The string representation consists of the name of the implementing class,
* and the tabular type of this instance.
*
- * @return a string representation of this TabularData instance
+ * @return a string representation of this {@code TabularData} instance
*/
public String toString();
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java b/jdk/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java
index 74ff7523268..bcbd176266e 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java
@@ -51,8 +51,9 @@ import java.util.Set;
/**
- * The TabularDataSupport class is the open data class which implements the TabularData
- * and the Map interfaces, and which is internally based on a hash map data structure.
+ * The {@code TabularDataSupport} class is the open data
+ * class which implements the {@code TabularData}
+ * and the {@code Map} interfaces, and which is internally based on a hash map data structure.
*
* @since 1.5
*/
@@ -102,13 +103,15 @@ public class TabularDataSupport
/**
- * Creates an empty TabularDataSupport instance whose open-type is tabularType,
- * and whose underlying HashMap has a default initial capacity (101) and default load factor (0.75).
+ * Creates an empty {@code TabularDataSupport} instance
+ * whose open-type is tabularType,
+ * and whose underlying {@code HashMap} has a default
+ * initial capacity (101) and default load factor (0.75).
*
- * This constructor simply calls this(tabularType, 101, 0.75f);
+ * This constructor simply calls {@code this(tabularType, 101, 0.75f);}
*
- * @param tabularType the tabular type describing this TabularData instance;
- * cannot be null.
+ * @param tabularType the tabular type describing this
+ * {@code TabularData} instance; cannot be null.
*
* @throws IllegalArgumentException if the tabular type is null.
*/
@@ -118,10 +121,10 @@ public class TabularDataSupport
}
/**
- * Creates an empty TabularDataSupport instance whose open-type is tabularType,
- * and whose underlying HashMap has the specified initial capacity and load factor.
+ * Creates an empty {@code TabularDataSupport} instance whose open-type is tabularType,
+ * and whose underlying {@code HashMap} has the specified initial capacity and load factor.
*
- * @param tabularType the tabular type describing this TabularData instance;
+ * @param tabularType the tabular type describing this {@code TabularData} instance;
* cannot be null.
*
* @param initialCapacity the initial capacity of the HashMap.
@@ -167,7 +170,7 @@ public class TabularDataSupport
/**
- * Returns the tabular type describing this TabularData instance.
+ * Returns the tabular type describing this {@code TabularData} instance.
*/
public TabularType getTabularType() {
@@ -175,21 +178,22 @@ public class TabularDataSupport
}
/**
- * Calculates the index that would be used in this TabularData instance to refer to the specified
- * composite data value parameter if it were added to this instance.
+ * Calculates the index that would be used in this {@code TabularData} instance to refer
+ * to the specified composite data value parameter if it were added to this instance.
* This method checks for the type validity of the specified value,
- * but does not check if the calculated index is already used to refer to a value in this TabularData instance.
+ * but does not check if the calculated index is already used
+ * to refer to a value in this {@code TabularData} instance.
*
* @param value the composite data value whose index in this
- * TabularData instance is to be calculated;
+ * {@code TabularData} instance is to be calculated;
* must be of the same composite type as this instance's row type;
* must not be null.
*
- * @return the index that the specified value would have in this TabularData instance.
+ * @return the index that the specified value would have in this {@code TabularData} instance.
*
- * @throws NullPointerException if value is null.
+ * @throws NullPointerException if value is {@code null}.
*
- * @throws InvalidOpenTypeException if value does not conform to this TabularData instance's
+ * @throws InvalidOpenTypeException if value does not conform to this {@code TabularData} instance's
* row type definition.
*/
public Object[] calculateIndex(CompositeData value) {
@@ -210,14 +214,14 @@ public class TabularDataSupport
/**
- * Returns true if and only if this TabularData instance contains a CompositeData value
+ * Returns {@code true} if and only if this {@code TabularData} instance contains a {@code CompositeData} value
* (ie a row) whose index is the specified key. If key cannot be cast to a one dimension array
- * of Object instances, this method simply returns false; otherwise it returns the result of the call to
- * this.containsKey((Object[]) key).
+ * of Object instances, this method simply returns {@code false}; otherwise it returns the result of the call to
+ * {@code this.containsKey((Object[]) key)}.
*
- * @param key the index value whose presence in this TabularData instance is to be tested.
+ * @param key the index value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return true if this TabularData indexes a row value with the specified key.
+ * @return {@code true} if this {@code TabularData} indexes a row value with the specified key.
*/
public boolean containsKey(Object key) {
@@ -234,13 +238,13 @@ public class TabularDataSupport
}
/**
- * Returns true if and only if this TabularData instance contains a CompositeData value
- * (ie a row) whose index is the specified key. If key is null or does not conform to
- * this TabularData instance's TabularType definition, this method simply returns false.
+ * Returns {@code true} if and only if this {@code TabularData} instance contains a {@code CompositeData} value
+ * (ie a row) whose index is the specified key. If key is {@code null} or does not conform to
+ * this {@code TabularData} instance's {@code TabularType} definition, this method simply returns {@code false}.
*
- * @param key the index value whose presence in this TabularData instance is to be tested.
+ * @param key the index value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return true if this TabularData indexes a row value with the specified key.
+ * @return {@code true} if this {@code TabularData} indexes a row value with the specified key.
*/
public boolean containsKey(Object[] key) {
@@ -248,13 +252,13 @@ public class TabularDataSupport
}
/**
- * Returns true if and only if this TabularData instance contains the specified
- * CompositeData value. If value is null or does not conform to
- * this TabularData instance's row type definition, this method simply returns false.
+ * Returns {@code true} if and only if this {@code TabularData} instance contains the specified
+ * {@code CompositeData} value. If value is {@code null} or does not conform to
+ * this {@code TabularData} instance's row type definition, this method simply returns {@code false}.
*
- * @param value the row value whose presence in this TabularData instance is to be tested.
+ * @param value the row value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return true if this TabularData instance contains the specified row value.
+ * @return {@code true} if this {@code TabularData} instance contains the specified row value.
*/
public boolean containsValue(CompositeData value) {
@@ -262,12 +266,12 @@ public class TabularDataSupport
}
/**
- * Returns true if and only if this TabularData instance contains the specified
+ * Returns {@code true} if and only if this {@code TabularData} instance contains the specified
* value.
*
- * @param value the row value whose presence in this TabularData instance is to be tested.
+ * @param value the row value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return true if this TabularData instance contains the specified row value.
+ * @return {@code true} if this {@code TabularData} instance contains the specified row value.
*/
public boolean containsValue(Object value) {
@@ -275,12 +279,13 @@ public class TabularDataSupport
}
/**
- * This method simply calls get((Object[]) key).
+ * This method simply calls {@code get((Object[]) key)}.
*
- * @throws NullPointerException if the key is null
- * @throws ClassCastException if the key is not of the type Object[]
- * @throws InvalidKeyException if the key does not conform to this TabularData instance's
- * TabularType definition
+ * @throws NullPointerException if the key is {@code null}
+ * @throws ClassCastException if the key is not of the type {@code Object[]}
+ * @throws InvalidKeyException if the key does not conform
+ * to this {@code TabularData} instance's
+ * {@code TabularType} definition
*/
public Object get(Object key) {
@@ -288,20 +293,21 @@ public class TabularDataSupport
}
/**
- * Returns the CompositeData value whose index is
- * key, or null if there is no value mapping
- * to key, in this TabularData instance.
+ * Returns the {@code CompositeData} value whose index is
+ * key, or {@code null} if there is no value mapping
+ * to key, in this {@code TabularData} instance.
*
* @param key the index of the value to get in this
- * TabularData instance; * must be valid with this
- * TabularData instance's row type definition; * must not
+ * {@code TabularData} instance; must be valid with this
+ * {@code TabularData} instance's row type definition; must not
* be null.
*
* @return the value corresponding to key.
*
- * @throws NullPointerException if the key is null
- * @throws InvalidKeyException if the key does not conform to this TabularData instance's
- * TabularType type definition.
+ * @throws NullPointerException if the key is {@code null}
+ * @throws InvalidKeyException if the key does not conform
+ * to this {@code TabularData} instance's
+ * {@code TabularType} type definition.
*/
public CompositeData get(Object[] key) {
@@ -322,23 +328,23 @@ public class TabularDataSupport
/**
- * This method simply calls put((CompositeData) value) and
- * therefore ignores its key parameter which can be null.
+ * This method simply calls {@code put((CompositeData) value)} and
+ * therefore ignores its key parameter which can be {@code null}.
*
* @param key an ignored parameter.
* @param value the {@link CompositeData} to put.
*
* @return the value which is put
*
- * @throws NullPointerException if the value is null
+ * @throws NullPointerException if the value is {@code null}
* @throws ClassCastException if the value is not of
- * the type CompositeData
+ * the type {@code CompositeData}
* @throws InvalidOpenTypeException if the value does
- * not conform to this TabularData instance's
- * TabularType definition
+ * not conform to this {@code TabularData} instance's
+ * {@code TabularType} definition
* @throws KeyAlreadyExistsException if the key for the
* value parameter, calculated according to this
- * TabularData instance's TabularType definition
+ * {@code TabularData} instance's {@code TabularType} definition
* already maps to an existing value
*/
public Object put(Object key, Object value) {
@@ -363,17 +369,17 @@ public class TabularDataSupport
}
/**
- * This method simply calls remove((Object[]) key).
+ * This method simply calls {@code remove((Object[]) key)}.
*
- * @param key an Object[] representing the key to remove.
+ * @param key an {@code Object[]} representing the key to remove.
*
- * @return previous value associated with specified key, or null
+ * @return previous value associated with specified key, or {@code null}
* if there was no mapping for key.
*
- * @throws NullPointerException if the key is null
- * @throws ClassCastException if the key is not of the type Object[]
- * @throws InvalidKeyException if the key does not conform to this TabularData instance's
- * TabularType definition
+ * @throws NullPointerException if the key is {@code null}
+ * @throws ClassCastException if the key is not of the type {@code Object[]}
+ * @throws InvalidKeyException if the key does not conform to this {@code TabularData} instance's
+ * {@code TabularType} definition
*/
public Object remove(Object key) {
@@ -381,19 +387,19 @@ public class TabularDataSupport
}
/**
- * Removes the CompositeData value whose index is key from this TabularData instance,
- * and returns the removed value, or returns null if there is no value whose index is key.
+ * Removes the {@code CompositeData} value whose index is key from this {@code TabularData} instance,
+ * and returns the removed value, or returns {@code null} if there is no value whose index is key.
*
- * @param key the index of the value to get in this TabularData instance;
- * must be valid with this TabularData instance's row type definition;
+ * @param key the index of the value to get in this {@code TabularData} instance;
+ * must be valid with this {@code TabularData} instance's row type definition;
* must not be null.
*
- * @return previous value associated with specified key, or null
+ * @return previous value associated with specified key, or {@code null}
* if there was no mapping for key.
*
- * @throws NullPointerException if the key is null
- * @throws InvalidKeyException if the key does not conform to this TabularData instance's
- * TabularType definition
+ * @throws NullPointerException if the key is {@code null}
+ * @throws InvalidKeyException if the key does not conform to this {@code TabularData} instance's
+ * {@code TabularType} definition
*/
public CompositeData remove(Object[] key) {
@@ -414,30 +420,30 @@ public class TabularDataSupport
/**
* Add all the values contained in the specified map t
- * to this TabularData instance. This method converts
+ * to this {@code TabularData} instance. This method converts
* the collection of values contained in this map into an array of
- * CompositeData values, if possible, and then call the
- * method putAll(CompositeData[]). Note that the keys
+ * {@code CompositeData} values, if possible, and then call the
+ * method {@code putAll(CompositeData[])}. Note that the keys
* used in the specified map t are ignored. This method
* allows, for example to add the content of another
- * TabularData instance with the same row type (but
+ * {@code TabularData} instance with the same row type (but
* possibly different index names) into this instance.
*
* @param t the map whose values are to be added as new rows to
- * this TabularData instance; if t is
- * null or empty, this method returns without doing
+ * this {@code TabularData} instance; if t is
+ * {@code null} or empty, this method returns without doing
* anything.
*
* @throws NullPointerException if a value in t is
- * null.
+ * {@code null}.
* @throws ClassCastException if a value in t is not an
- * instance of CompositeData.
+ * instance of {@code CompositeData}.
* @throws InvalidOpenTypeException if a value in t
- * does not conform to this TabularData instance's row
+ * does not conform to this {@code TabularData} instance's row
* type definition.
* @throws KeyAlreadyExistsException if the index for a value in
* t, calculated according to this
- * TabularData instance's TabularType definition
+ * {@code TabularData} instance's {@code TabularType} definition
* already maps to an existing value in this instance, or two
* values in t have the same index.
*/
@@ -449,14 +455,14 @@ public class TabularDataSupport
return;
}
- // Convert the values in t into an array of CompositeData
+ // Convert the values in t into an array of {@code CompositeData}
//
CompositeData[] values;
try {
values =
t.values().toArray(new CompositeData[t.size()]);
} catch (java.lang.ArrayStoreException e) {
- throw new ClassCastException("Map argument t contains values which are not instances of CompositeData");
+ throw new ClassCastException("Map argument t contains values which are not instances of {@code CompositeData}");
}
// Add the array of values
@@ -466,30 +472,30 @@ public class TabularDataSupport
/**
* Add all the elements in values to this
- * TabularData instance. If any element in
+ * {@code TabularData} instance. If any element in
* values does not satisfy the constraints defined in
- * {@link #put(CompositeData) put}, or if any two
+ * {@link #put(CompositeData) put}, or if any two
* elements in values have the same index calculated
- * according to this TabularData instance's
- * TabularType definition, then an exception describing
+ * according to this {@code TabularData} instance's
+ * {@code TabularType} definition, then an exception describing
* the failure is thrown and no element of values is
- * added, thus leaving this TabularData instance
+ * added, thus leaving this {@code TabularData} instance
* unchanged.
*
* @param values the array of composite data values to be added as
- * new rows to this TabularData instance; if
- * values is null or empty, this method
+ * new rows to this {@code TabularData} instance; if
+ * values is {@code null} or empty, this method
* returns without doing anything.
*
* @throws NullPointerException if an element of values
- * is null
+ * is {@code null}
* @throws InvalidOpenTypeException if an element of
* values does not conform to this
- * TabularData instance's row type definition (ie its
- * TabularType definition)
+ * {@code TabularData} instance's row type definition (ie its
+ * {@code TabularType} definition)
* @throws KeyAlreadyExistsException if the index for an element
* of values, calculated according to this
- * TabularData instance's TabularType definition
+ * {@code TabularData} instance's {@code TabularType} definition
* already maps to an existing value in this instance, or two
* elements of values have the same index
*/
@@ -529,7 +535,7 @@ public class TabularDataSupport
}
/**
- * Removes all rows from this TabularDataSupport instance.
+ * Removes all rows from this {@code TabularDataSupport} instance.
*/
public void clear() {
@@ -541,9 +547,9 @@ public class TabularDataSupport
/* *** Informational methods from java.util.Map *** */
/**
- * Returns the number of rows in this TabularDataSupport instance.
+ * Returns the number of rows in this {@code TabularDataSupport} instance.
*
- * @return the number of rows in this TabularDataSupport instance.
+ * @return the number of rows in this {@code TabularDataSupport} instance.
*/
public int size() {
@@ -551,9 +557,9 @@ public class TabularDataSupport
}
/**
- * Returns true if this TabularDataSupport instance contains no rows.
+ * Returns {@code true} if this {@code TabularDataSupport} instance contains no rows.
*
- * @return true if this TabularDataSupport instance contains no rows.
+ * @return {@code true} if this {@code TabularDataSupport} instance contains no rows.
*/
public boolean isEmpty() {
@@ -656,9 +662,10 @@ public class TabularDataSupport
/**
- * Returns a clone of this TabularDataSupport instance:
- * the clone is obtained by calling super.clone(), and then cloning the underlying map.
- * Only a shallow clone of the underlying map is made, i.e. no cloning of the indexes and row values is made as they are immutable.
+ * Returns a clone of this {@code TabularDataSupport} instance:
+ * the clone is obtained by calling {@code super.clone()}, and then cloning the underlying map.
+ * Only a shallow clone of the underlying map is made, i.e.
+ * no cloning of the indexes and row values is made as they are immutable.
*/
/* We cannot use covariance here and return TabularDataSupport
because this would fail with existing code that subclassed
@@ -677,21 +684,21 @@ public class TabularDataSupport
/**
- * Compares the specified obj parameter with this TabularDataSupport instance for equality.
+ * Compares the specified obj parameter with this {@code TabularDataSupport} instance for equality.
*
- * Returns true if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
*
*
obj is non null,
- *
obj also implements the TabularData interface,
+ *
obj also implements the {@code TabularData} interface,
*
their tabular types are equal
*
their contents (ie all CompositeData values) are equal.
*
- * This ensures that this equals method works properly for obj parameters which are
- * different implementations of the TabularData interface.
+ * This ensures that this {@code equals} method works properly for obj parameters which are
+ * different implementations of the {@code TabularData} interface.
*
- * @param obj the object to be compared for equality with this TabularDataSupport instance;
+ * @param obj the object to be compared for equality with this {@code TabularDataSupport} instance;
*
- * @return true if the specified object is equal to this TabularDataSupport instance.
+ * @return {@code true} if the specified object is equal to this {@code TabularDataSupport} instance.
*/
public boolean equals(Object obj) {
@@ -738,22 +745,22 @@ public class TabularDataSupport
}
/**
- * Returns the hash code value for this TabularDataSupport instance.
+ * Returns the hash code value for this {@code TabularDataSupport} instance.
*
- * The hash code of a TabularDataSupport instance is the sum of the hash codes
- * of all elements of information used in equals comparisons
+ * The hash code of a {@code TabularDataSupport} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its tabular type and its content, where the content is defined as all the CompositeData values).
*
- * This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode()
- * for any two TabularDataSupport instances t1 and t2,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code TabularDataSupport} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * However, note that another instance of a class implementing the TabularData interface
- * may be equal to this TabularDataSupport instance as defined by {@link #equals},
+ * However, note that another instance of a class implementing the {@code TabularData} interface
+ * may be equal to this {@code TabularDataSupport} instance as defined by {@link #equals},
* but may have a different hash code if it is calculated differently.
*
- * @return the hash code value for this TabularDataSupport instance
+ * @return the hash code value for this {@code TabularDataSupport} instance
*/
public int hashCode() {
@@ -768,14 +775,15 @@ public class TabularDataSupport
}
/**
- * Returns a string representation of this TabularDataSupport instance.
+ * Returns a string representation of this {@code TabularDataSupport} instance.
*
- * The string representation consists of the name of this class (ie javax.management.openmbean.TabularDataSupport),
+ * The string representation consists of the name of this class
+ * (ie {@code javax.management.openmbean.TabularDataSupport}),
* the string representation of the tabular type of this instance, and the string representation of the contents
* (ie list the key=value mappings as returned by a call to
- * dataMap.{@link java.util.HashMap#toString() toString()}).
+ * {@code dataMap.}{@link java.util.HashMap#toString() toString()}).
*
- * @return a string representation of this TabularDataSupport instance
+ * @return a string representation of this {@code TabularDataSupport} instance
*/
public String toString() {
@@ -796,14 +804,17 @@ public class TabularDataSupport
/**
- * Returns the index for value, assuming value is valid for this TabularData instance
+ * Returns the index for value, assuming value is valid for this {@code TabularData} instance
* (ie value is not null, and its composite type is equal to row type).
*
- * The index is a List, and not an array, so that an index.equals(otherIndex) call will actually compare contents,
+ * The index is a List, and not an array, so that an
+ * index.equals(otherIndex) call will actually compare contents,
* not just the objects references as is done for an array object.
*
- * The returned List is unmodifiable so that once a row has been put into the dataMap, its index cannot be modified,
- * for example by a user that would attempt to modify an index contained in the Set returned by keySet().
+ * The returned List is unmodifiable so that once a row has been put
+ * into the dataMap, its index cannot be modified,
+ * for example by a user that would attempt to modify an
+ * index contained in the Set returned by keySet().
*/
private List> internalCalculateIndex(CompositeData value) {
@@ -811,7 +822,7 @@ public class TabularDataSupport
}
/**
- * Checks if the specified key is valid for this TabularData instance.
+ * Checks if the specified key is valid for this {@code TabularData} instance.
*
* @throws NullPointerException
* @throws InvalidOpenTypeException
@@ -848,7 +859,7 @@ public class TabularDataSupport
}
/**
- * Checks the specified value's type is valid for this TabularData instance
+ * Checks the specified value's type is valid for this {@code TabularData} instance
* (ie value is not null, and its composite type is equal to row type).
*
* @throws NullPointerException
@@ -872,7 +883,7 @@ public class TabularDataSupport
}
/**
- * Checks if the specified value can be put (ie added) in this TabularData instance
+ * Checks if the specified value can be put (ie added) in this {@code TabularData} instance
* (ie value is not null, its composite type is equal to row type, and its index is not already used),
* and returns the index calculated for this value.
*
diff --git a/jdk/src/java.management/share/classes/javax/management/relation/RoleInfo.java b/jdk/src/java.management/share/classes/javax/management/relation/RoleInfo.java
index 30acf0c292b..1d4cedea6cb 100644
--- a/jdk/src/java.management/share/classes/javax/management/relation/RoleInfo.java
+++ b/jdk/src/java.management/share/classes/javax/management/relation/RoleInfo.java
@@ -42,7 +42,7 @@ import javax.management.NotCompliantMBeanException;
/**
* A RoleInfo object summarises a role in a relation type.
*
- *
The serialVersionUID of this class is 2504952983494636987L.
+ *
The serialVersionUID of this class is {@code 2504952983494636987L}.
*
* @since 1.5
*/
@@ -89,8 +89,8 @@ public class RoleInfo implements Serializable {
private static final long serialVersionUID;
/**
* @serialField name String Role name
- * @serialField isReadable boolean Read access mode: true if role is readable
- * @serialField isWritable boolean Write access mode: true if role is writable
+ * @serialField isReadable boolean Read access mode: {@code true} if role is readable
+ * @serialField isWritable boolean Write access mode: {@code true} if role is writable
* @serialField description String Role description
* @serialField minDegree int Minimum degree (i.e. minimum number of referenced MBeans in corresponding role)
* @serialField maxDegree int Maximum degree (i.e. maximum number of referenced MBeans in corresponding role)
@@ -136,12 +136,12 @@ public class RoleInfo implements Serializable {
private String name = null;
/**
- * @serial Read access mode: true if role is readable
+ * @serial Read access mode: {@code true} if role is readable
*/
private boolean isReadable;
/**
- * @serial Write access mode: true if role is writable
+ * @serial Write access mode: {@code true} if role is writable
*/
private boolean isWritable;
@@ -183,11 +183,11 @@ public class RoleInfo implements Serializable {
* can be set
* @param min minimum degree for role, i.e. minimum number of
* MBeans to provide in corresponding role
- * Must be less than or equal to max.
+ * Must be less than or equal to {@code max}.
* (ROLE_CARDINALITY_INFINITY for unlimited)
* @param max maximum degree for role, i.e. maximum number of
* MBeans to provide in corresponding role
- * Must be greater than or equal to min
+ * Must be greater than or equal to {@code min}
* (ROLE_CARDINALITY_INFINITY for unlimited)
* @param descr description of the role (can be null)
*
@@ -316,7 +316,7 @@ public class RoleInfo implements Serializable {
/**
* Copy constructor.
*
- * @param roleInfo the RoleInfo instance to be copied.
+ * @param roleInfo the {@code RoleInfo} instance to be copied.
*
* @exception IllegalArgumentException if null parameter
*/
@@ -413,7 +413,7 @@ public class RoleInfo implements Serializable {
}
/**
- * Returns true if the value parameter is greater than or equal to
+ * Returns true if the {@code value} parameter is greater than or equal to
* the expected minimum degree, false otherwise.
*
* @param value the value to be checked
@@ -431,7 +431,7 @@ public class RoleInfo implements Serializable {
}
/**
- * Returns true if the value parameter is lower than or equal to
+ * Returns true if the {@code value} parameter is lower than or equal to
* the expected maximum degree, false otherwise.
*
* @param value the value to be checked
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java
index ac54a1e7e8a..9f256481711 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java
@@ -142,7 +142,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
}
/**
- *
Constructs an RMIConnector that will connect
+ *
Constructs an {@code RMIConnector} that will connect
* the RMI connector server with the given address.
*
*
The address can refer directly to the connector server,
@@ -153,7 +153,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
* service:jmx:iiop://[host[:port]]/ior/encoded-IOR
*
*
- *
(Here, the square brackets [] are not part of the
+ *
(Here, the square brackets {@code []} are not part of the
* address but indicate that the host and port are optional.)
*
*
The address can instead indicate where to find an RMI stub
@@ -179,7 +179,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
* InitialContext#InitialContext(Hashtable) InitialContext}. This
* parameter can be null, which is equivalent to an empty Map.
*
- * @exception IllegalArgumentException if url
+ * @exception IllegalArgumentException if {@code url}
* is null.
*/
public RMIConnector(JMXServiceURL url, Map environment) {
@@ -187,14 +187,14 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
}
/**
- *
Constructs an RMIConnector using the given RMI stub.
+ *
Constructs an {@code RMIConnector} using the given RMI stub.
*
* @param rmiServer an RMI stub representing the RMI connector server.
* @param environment additional attributes specifying how to make
* the connection. This parameter can be null, which is
* equivalent to an empty Map.
*
- * @exception IllegalArgumentException if rmiServer
+ * @exception IllegalArgumentException if {@code rmiServer}
* is null.
*/
public RMIConnector(RMIServer rmiServer, Map environment) {
@@ -203,7 +203,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
/**
*
Returns a string representation of this object. In general,
- * the toString method returns a string that
+ * the {@code toString} method returns a string that
* "textually represents" this object. The result should be a
* concise but informative representation that is easy for a
* person to read.
@@ -1732,7 +1732,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
* @param environment An environment map, possibly containing an ORB.
* @return the given stub.
* @exception IllegalArgumentException if the
- * java.naming.corba.orb property is specified and
+ * {@code java.naming.corba.orb} property is specified and
* does not point to an {@link org.omg.CORBA.ORB ORB}.
* @exception IOException if the connection to the ORB failed.
**/
@@ -1767,7 +1767,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
* @param environment An environment map, possibly containing an ORB.
* @return An ORB.
* @exception IllegalArgumentException if the
- * java.naming.corba.orb property is specified and
+ * {@code java.naming.corba.orb} property is specified and
* does not point to an {@link org.omg.CORBA.ORB ORB}.
* @exception IOException if the ORB initialization failed.
**/
@@ -1793,7 +1793,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
/**
* Read RMIConnector fields from an {@link java.io.ObjectInputStream
* ObjectInputStream}.
- * Calls s.defaultReadObject() and then initializes
+ * Calls {@code s.defaultReadObject()} and then initializes
* all transient variables that need initializing.
* @param s The ObjectInputStream to read from.
* @exception InvalidObjectException if none of rmiServer stub
@@ -1818,7 +1818,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
* before serializing it. This is done using the environment
* map that was provided to the constructor, if any, and as documented
* in {@link javax.management.remote.rmi}.
- *
This method then calls s.defaultWriteObject().
+ *
This method then calls {@code s.defaultWriteObject()}.
* Usually, rmiServer is null if this object
* was constructed with a JMXServiceURL, and jmxServiceURL
* is null if this object is constructed with a RMIServer stub.
@@ -1939,9 +1939,9 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
* Lookup the RMIServer stub in a directory.
* @param jndiURL A JNDI URL indicating the location of the Stub
* (see {@link javax.management.remote.rmi}), e.g.:
- *
rmi://registry-host:port/rmi-stub-name
- *
or iiop://cosnaming-host:port/iiop-stub-name
- *
or ldap://ldap-host:port/java-container-dn
+ *
{@code rmi://registry-host:port/rmi-stub-name}
+ *
or {@code iiop://cosnaming-host:port/iiop-stub-name}
+ *
or {@code ldap://ldap-host:port/java-container-dn}
*
* @param env the environment Map passed to the connector.
* @param isIiop true if the stub is expected to be an IIOP stub.
diff --git a/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java b/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java
index f783a13f316..7db51ea5cce 100644
--- a/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java
+++ b/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java
@@ -137,7 +137,7 @@ public final class ResourceManager {
* context (never null). This is based on the environment
* parameter, the system properties, and all application resource files.
*
- *
This method will modify env and save
+ *
This method will modify {@code env} and save
* a reference to it. The caller may no longer modify it.
*
* @param env environment passed to initial context constructor.
@@ -195,7 +195,7 @@ public final class ResourceManager {
* may in turn contain values that come from system properties,
* or application resource files.
*
- * If concat is true and both the environment and the provider
+ * If {@code concat} is true and both the environment and the provider
* resource file contain the property, the two values are concatenated
* (with a ':' separator).
*
diff --git a/jdk/src/java.naming/share/classes/javax/naming/Binding.java b/jdk/src/java.naming/share/classes/javax/naming/Binding.java
index 32ad3562446..662fe0a91a6 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/Binding.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/Binding.java
@@ -49,7 +49,7 @@ public class Binding extends NameClassPair {
/**
* Contains this binding's object.
* It is initialized by the constructor and can be updated using
- * setObject.
+ * {@code setObject}.
* @serial
* @see #getObject
* @see #setObject
@@ -59,9 +59,9 @@ public class Binding extends NameClassPair {
/**
* Constructs an instance of a Binding given its name and object.
*
- * getClassName() will return
- * the class name of obj (or null if obj is null)
- * unless the class name has been explicitly set using setClassName()
+ * {@code getClassName()} will return
+ * the class name of {@code obj} (or null if {@code obj} is null)
+ * unless the class name has been explicitly set using {@code setClassName()}
*
* @param name The non-null name of the object. It is relative
* to the target context (which is
@@ -78,9 +78,9 @@ public class Binding extends NameClassPair {
* Constructs an instance of a Binding given its name, object, and whether
* the name is relative.
*
- * getClassName() will return the class name of obj
- * (or null if obj is null) unless the class name has been
- * explicitly set using setClassName()
+ * {@code getClassName()} will return the class name of {@code obj}
+ * (or null if {@code obj} is null) unless the class name has been
+ * explicitly set using {@code setClassName()}
*
* @param name The non-null string name of the object.
* @param obj The possibly null object bound to name.
@@ -104,9 +104,9 @@ public class Binding extends NameClassPair {
* to the target context (which is
* named by the first parameter of the listBindings() method)
* @param className The possibly null class name of the object
- * bound to name. If null, the class name of obj is
- * returned by getClassName(). If obj is also
- * null, getClassName() will return null.
+ * bound to {@code name}. If null, the class name of {@code obj} is
+ * returned by {@code getClassName()}. If {@code obj} is also
+ * null, {@code getClassName()} will return null.
* @param obj The possibly null object bound to name.
* @see NameClassPair#setClassName
*/
@@ -121,9 +121,9 @@ public class Binding extends NameClassPair {
*
* @param name The non-null string name of the object.
* @param className The possibly null class name of the object
- * bound to name. If null, the class name of obj is
- * returned by getClassName(). If obj is also
- * null, getClassName() will return null.
+ * bound to {@code name}. If null, the class name of {@code obj} is
+ * returned by {@code getClassName()}. If {@code obj} is also
+ * null, {@code getClassName()} will return null.
* @param obj The possibly null object bound to name.
* @param isRelative true if name is a name relative
* to the target context (which is named by
diff --git a/jdk/src/java.naming/share/classes/javax/naming/CannotProceedException.java b/jdk/src/java.naming/share/classes/javax/naming/CannotProceedException.java
index da3f55b1087..c681e335c61 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/CannotProceedException.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/CannotProceedException.java
@@ -93,9 +93,9 @@ public class CannotProceedException extends NamingException {
/**
* Contains the name of the resolved object, relative
- * to the context altNameCtx. It is a composite name.
+ * to the context {@code altNameCtx}. It is a composite name.
* If null, then no name is specified.
- * See the javax.naming.spi.ObjectFactory.getObjectInstance
+ * See the {@code javax.naming.spi.ObjectFactory.getObjectInstance}
* method for details on how this is used.
*
* This field is initialized to null.
@@ -112,9 +112,9 @@ public class CannotProceedException extends NamingException {
/**
* Contains the context relative to which
- * altName is specified. If null, then the default initial
+ * {@code altName} is specified. If null, then the default initial
* context is implied.
- * See the javax.naming.spi.ObjectFactory.getObjectInstance
+ * See the {@code javax.naming.spi.ObjectFactory.getObjectInstance}
* method for details on how this is used.
*
* This field is initialized to null.
@@ -189,16 +189,16 @@ public class CannotProceedException extends NamingException {
/**
* Sets the "remaining new name" field of this exception.
- * This is the value returned by getRemainingNewName().
+ * This is the value returned by {@code getRemainingNewName()}.
*
- * newName is a composite name. If the intent is to set
+ * {@code newName} is a composite name. If the intent is to set
* this field using a compound name or string, you must
* "stringify" the compound name, and create a composite
* name with a single component using the string. You can then
* invoke this method using the resulting composite name.
*
- * A copy of newName is made and stored.
- * Subsequent changes to name does not
+ * A copy of {@code newName} is made and stored.
+ * Subsequent changes to {@code name} does not
* affect the copy in this NamingException and vice versa.
*
* @param newName The possibly null name to set the "remaining new name" to.
@@ -214,13 +214,13 @@ public class CannotProceedException extends NamingException {
}
/**
- * Retrieves the altName field of this exception.
+ * Retrieves the {@code altName} field of this exception.
* This is the name of the resolved object, relative to the context
- * altNameCtx. It will be used during a subsequent call to the
- * javax.naming.spi.ObjectFactory.getObjectInstance method.
+ * {@code altNameCtx}. It will be used during a subsequent call to the
+ * {@code javax.naming.spi.ObjectFactory.getObjectInstance} method.
*
* @return The name of the resolved object, relative to
- * altNameCtx.
+ * {@code altNameCtx}.
* It is a composite name. If null, then no name is specified.
*
* @see #setAltName
@@ -232,10 +232,10 @@ public class CannotProceedException extends NamingException {
}
/**
- * Sets the altName field of this exception.
+ * Sets the {@code altName} field of this exception.
*
* @param altName The name of the resolved object, relative to
- * altNameCtx.
+ * {@code altNameCtx}.
* It is a composite name.
* If null, then no name is specified.
*
@@ -247,12 +247,12 @@ public class CannotProceedException extends NamingException {
}
/**
- * Retrieves the altNameCtx field of this exception.
- * This is the context relative to which altName is named.
+ * Retrieves the {@code altNameCtx} field of this exception.
+ * This is the context relative to which {@code altName} is named.
* It will be used during a subsequent call to the
- * javax.naming.spi.ObjectFactory.getObjectInstance method.
+ * {@code javax.naming.spi.ObjectFactory.getObjectInstance} method.
*
- * @return The context relative to which altName is named.
+ * @return The context relative to which {@code altName} is named.
* If null, then the default initial context is implied.
*
* @see #setAltNameCtx
@@ -264,10 +264,10 @@ public class CannotProceedException extends NamingException {
}
/**
- * Sets the altNameCtx field of this exception.
+ * Sets the {@code altNameCtx} field of this exception.
*
* @param altNameCtx
- * The context relative to which altName
+ * The context relative to which {@code altName}
* is named. If null, then the default initial context
* is implied.
*
diff --git a/jdk/src/java.naming/share/classes/javax/naming/CompositeName.java b/jdk/src/java.naming/share/classes/javax/naming/CompositeName.java
index 93ef152c64b..50534a2b5a6 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/CompositeName.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/CompositeName.java
@@ -76,7 +76,7 @@ import java.util.Properties;
*
Composite Name Examples
*This table shows examples of some composite names. Each row shows
*the string form of a composite name and its corresponding structural form
- *(CompositeName).
+ *({@code CompositeName}).
*
* Here are some composition examples. The right column shows composing
* string composite names while the left column shows composing the
- * corresponding CompositeNames. Notice that composing the
+ * corresponding {@code CompositeName}s. Notice that composing the
* string forms of two composite names simply involves concatenating
* their string forms together.
@@ -190,9 +190,9 @@ import java.util.Properties;
*
*
Multithreaded Access
- * A CompositeName instance is not synchronized against concurrent
+ * A {@code CompositeName} instance is not synchronized against concurrent
* multithreaded access. Multiple threads trying to access and modify a
- * CompositeName should lock the object.
+ * {@code CompositeName} should lock the object.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -557,8 +557,8 @@ public class CompositeName implements Name {
/**
* Overridden to avoid implementation dependency.
- * @serialData The number of components (an int) followed by
- * the individual components (each a String).
+ * @serialData The number of components (an {@code int}) followed by
+ * the individual components (each a {@code String}).
*/
private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
diff --git a/jdk/src/java.naming/share/classes/javax/naming/CompoundName.java b/jdk/src/java.naming/share/classes/javax/naming/CompoundName.java
index 059d951cd71..a7f43a095e3 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/CompoundName.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/CompoundName.java
@@ -137,9 +137,9 @@ import java.util.Properties;
* of the original compound name.
*
*
Multithreaded Access
- * A CompoundName instance is not synchronized against concurrent
+ * A {@code CompoundName} instance is not synchronized against concurrent
* multithreaded access. Multiple threads trying to access and modify a
- * CompoundName should lock the object.
+ * {@code CompoundName} should lock the object.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -194,7 +194,7 @@ public class CompoundName implements Name {
* this compound name. See class description for
* contents of properties.
* @exception InvalidNameException If 'n' violates the syntax specified
- * by syntax.
+ * by {@code syntax}.
*/
public CompoundName(String n, Properties syntax) throws InvalidNameException {
if (syntax == null) {
@@ -549,9 +549,9 @@ public class CompoundName implements Name {
/**
* Overridden to avoid implementation dependency.
- * @serialData The syntax Properties, followed by
- * the number of components (an int), and the individual
- * components (each a String).
+ * @serialData The syntax {@code Properties}, followed by
+ * the number of components (an {@code int}), and the individual
+ * components (each a {@code String}).
*/
private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
diff --git a/jdk/src/java.naming/share/classes/javax/naming/Context.java b/jdk/src/java.naming/share/classes/javax/naming/Context.java
index 8ff5b041eb5..76050396c26 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/Context.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/Context.java
@@ -33,7 +33,7 @@ import java.util.Hashtable;
* It contains methods for examining and updating these bindings.
*
*
Names
- * Each name passed as an argument to a Context method is relative
+ * Each name passed as an argument to a {@code Context} method is relative
* to that context. The empty name is used to name the context itself.
* A name parameter may never be null.
*
@@ -47,31 +47,31 @@ import java.util.Hashtable;
* The second version instead has a link to the first: the same
* documentation applies to both.
*
- * For systems that support federation, String name arguments to
- * Context methods are composite names. Name arguments that are
- * instances of CompositeName are treated as composite names,
- * while Name arguments that are not instances of
- * CompositeName are treated as compound names (which might be
- * instances of CompoundName or other implementations of compound
- * names). This allows the results of NameParser.parse() to be used as
- * arguments to the Context methods.
+ * For systems that support federation, {@code String} name arguments to
+ * {@code Context} methods are composite names. Name arguments that are
+ * instances of {@code CompositeName} are treated as composite names,
+ * while {@code Name} arguments that are not instances of
+ * {@code CompositeName} are treated as compound names (which might be
+ * instances of {@code CompoundName} or other implementations of compound
+ * names). This allows the results of {@code NameParser.parse()} to be used as
+ * arguments to the {@code Context} methods.
* Prior to JNDI 1.2, all name arguments were treated as composite names.
*
* Furthermore, for systems that support federation, all names returned
- * in a NamingEnumeration
- * from list() and listBindings() are composite names
+ * in a {@code NamingEnumeration}
+ * from {@code list()} and {@code listBindings()} are composite names
* represented as strings.
- * See CompositeName for the string syntax of names.
+ * See {@code CompositeName} for the string syntax of names.
*
* For systems that do not support federation, the name arguments (in
- * either Name or String forms) and the names returned in
- * NamingEnumeration may be names in their own namespace rather than
+ * either {@code Name} or {@code String} forms) and the names returned in
+ * {@code NamingEnumeration} may be names in their own namespace rather than
* names in a composite namespace, at the discretion of the service
* provider.
*
*
Exceptions
- * All the methods in this interface can throw a NamingException or
- * any of its subclasses. See NamingException and their subclasses
+ * All the methods in this interface can throw a {@code NamingException} or
+ * any of its subclasses. See {@code NamingException} and their subclasses
* for details on each exception.
*
*
Concurrent Access
@@ -80,26 +80,26 @@ import java.util.Hashtable;
* a single Context instance concurrently should synchronize amongst
* themselves and provide the necessary locking. Multiple threads
* each manipulating a different Context instance need not
- * synchronize. Note that the {@link #lookup(Name) lookup}
+ * synchronize. Note that the {@link #lookup(Name) lookup}
* method, when passed an empty name, will return a new Context instance
* representing the same naming context.
*
* For purposes of concurrency control,
- * a Context operation that returns a NamingEnumeration is
+ * a Context operation that returns a {@code NamingEnumeration} is
* not considered to have completed while the enumeration is still in
* use, or while any referrals generated by that operation are still
* being followed.
*
*
*
Parameters
- * A Name parameter passed to any method of the
- * Context interface or one of its subinterfaces
+ * A {@code Name} parameter passed to any method of the
+ * {@code Context} interface or one of its subinterfaces
* will not be modified by the service provider.
* The service provider may keep a reference to it
* for the duration of the operation, including any enumeration of the
* method's results and the processing of any referrals generated.
* The caller should not modify the object during this time.
- * A Name returned by any such method is owned by the caller.
+ * A {@code Name} returned by any such method is owned by the caller.
* The caller may subsequently modify it; the service provider may not.
*
*
@@ -111,7 +111,7 @@ import java.util.Hashtable;
* require specification of security credentials in order to access
* the service. Another context might require that server configuration
* information be supplied. These are referred to as the environment
- * of a context. The Context interface provides methods for
+ * of a context. The {@code Context} interface provides methods for
* retrieving and updating this environment.
*
* The environment is inherited from the parent context as
@@ -145,7 +145,7 @@ import java.util.Hashtable;
* application components and service providers may be distributed
* along with resource files.
* A JNDI resource file is a file in the properties file format (see
- * {@link java.util.Properties#load java.util.Properties}),
+ * {@link java.util.Properties#load java.util.Properties}),
* containing a list of key/value pairs.
* The key is the name of the property (e.g. "java.naming.factory.object")
* and the value is a string in the format defined
@@ -170,18 +170,18 @@ import java.util.Hashtable;
* Each service provider has an optional resource that lists properties
* specific to that provider. The name of this resource is:
*
* where prefix is
* the package name of the provider's context implementation(s),
* with each period (".") converted to a slash ("/").
*
* For example, suppose a service provider defines a context
- * implementation with class name com.sun.jndi.ldap.LdapCtx.
+ * implementation with class name {@code com.sun.jndi.ldap.LdapCtx}.
* The provider resource for this provider is named
- * com/sun/jndi/ldap/jndiprovider.properties. If the class is
+ * {@code com/sun/jndi/ldap/jndiprovider.properties}. If the class is
* not in a package, the resource's name is simply
- * jndiprovider.properties.
+ * {@code jndiprovider.properties}.
*
*
*
@@ -204,11 +204,11 @@ import java.util.Hashtable;
*
* When an application is deployed, it will generally have several
* codebase directories and JARs in its classpath. JNDI locates (using
- * {@link ClassLoader#getResources ClassLoader.getResources()})
- * all application resource files named jndi.properties
+ * {@link ClassLoader#getResources ClassLoader.getResources()})
+ * all application resource files named {@code jndi.properties}
* in the classpath.
* In addition, if the Java installation directory contains a built-in
- * properties file, typically conf/jndi.properties,
+ * properties file, typically {@code conf/jndi.properties},
* JNDI treats it as an additional application resource file.
* All of the properties contained in these files are placed
* into the environment of the initial context. This environment
@@ -220,7 +220,7 @@ import java.util.Hashtable;
* sense to do so, it concatenates all of the values (details are given
* below).
* For example, if the "java.naming.factory.object" property is found in
- * three jndi.properties resource files, the
+ * three {@code jndi.properties} resource files, the
* list of object factories is a concatenation of the property
* values from all three files.
* Using this scheme, each deployable component is responsible for
@@ -234,7 +234,7 @@ import java.util.Hashtable;
* is initialized with properties defined in the environment parameter
* passed to the constructor, the system properties,
* and the application resource files. See
- * InitialContext
+ * {@code InitialContext}
* for details.
* This initial environment is then inherited by other context instances.
*
@@ -244,7 +244,7 @@ import java.util.Hashtable;
* the values from the following two sources, in order:
*
*
The environment of the context being operated on.
- *
The provider resource file (jndiprovider.properties)
+ *
The provider resource file ({@code jndiprovider.properties})
* for the context being operated on.
*
* For each property found in both of these two sources,
@@ -278,14 +278,14 @@ public interface Context {
/**
* Retrieves the named object.
- * If name is empty, returns a new instance of this context
+ * If {@code name} is empty, returns a new instance of this context
* (which represents the same naming context as this context, but its
* environment may be modified independently and it may be accessed
* concurrently).
*
* @param name
* the name of the object to look up
- * @return the object bound to name
+ * @return the object bound to {@code name}
* @throws NamingException if a naming exception is encountered
*
* @see #lookup(String)
@@ -298,7 +298,7 @@ public interface Context {
* See {@link #lookup(Name)} for details.
* @param name
* the name of the object to look up
- * @return the object bound to name
+ * @return the object bound to {@code name}
* @throws NamingException if a naming exception is encountered
*/
public Object lookup(String name) throws NamingException;
@@ -344,7 +344,7 @@ public interface Context {
* All intermediate contexts and the target context (that named by all
* but terminal atomic component of the name) must already exist.
*
- *
If the object is a DirContext, any existing attributes
+ *
If the object is a {@code DirContext}, any existing attributes
* associated with the name are replaced with those of the object.
* Otherwise, any existing attributes associated with the name remain
* unchanged.
@@ -388,7 +388,7 @@ public interface Context {
*
This method is idempotent.
* It succeeds even if the terminal atomic name
* is not bound in the target context, but throws
- * NameNotFoundException
+ * {@code NameNotFoundException}
* if any of the intermediate contexts do not exist.
*
*
Any attributes associated with the name are removed.
@@ -424,7 +424,7 @@ public interface Context {
* the name of the existing binding; may not be empty
* @param newName
* the name of the new binding; may not be empty
- * @throws NameAlreadyBoundException if newName is already bound
+ * @throws NameAlreadyBoundException if {@code newName} is already bound
* @throws NamingException if a naming exception is encountered
*
* @see #rename(String, String)
@@ -442,7 +442,7 @@ public interface Context {
* the name of the existing binding; may not be empty
* @param newName
* the name of the new binding; may not be empty
- * @throws NameAlreadyBoundException if newName is already bound
+ * @throws NameAlreadyBoundException if {@code newName} is already bound
* @throws NamingException if a naming exception is encountered
*/
public void rename(String oldName, String newName) throws NamingException;
@@ -459,7 +459,7 @@ public interface Context {
* the name of the context to list
* @return an enumeration of the names and class names of the
* bindings in this context. Each element of the
- * enumeration is of type NameClassPair.
+ * enumeration is of type {@code NameClassPair}.
* @throws NamingException if a naming exception is encountered
*
* @see #list(String)
@@ -478,7 +478,7 @@ public interface Context {
* the name of the context to list
* @return an enumeration of the names and class names of the
* bindings in this context. Each element of the
- * enumeration is of type NameClassPair.
+ * enumeration is of type {@code NameClassPair}.
* @throws NamingException if a naming exception is encountered
*/
public NamingEnumeration list(String name)
@@ -496,7 +496,7 @@ public interface Context {
* the name of the context to list
* @return an enumeration of the bindings in this context.
* Each element of the enumeration is of type
- * Binding.
+ * {@code Binding}.
* @throws NamingException if a naming exception is encountered
*
* @see #listBindings(String)
@@ -515,7 +515,7 @@ public interface Context {
* the name of the context to list
* @return an enumeration of the bindings in this context.
* Each element of the enumeration is of type
- * Binding.
+ * {@code Binding}.
* @throws NamingException if a naming exception is encountered
*/
public NamingEnumeration listBindings(String name)
@@ -529,7 +529,7 @@ public interface Context {
*
This method is idempotent.
* It succeeds even if the terminal atomic name
* is not bound in the target context, but throws
- * NameNotFoundException
+ * {@code NameNotFoundException}
* if any of the intermediate contexts do not exist.
*
*
In a federated naming system, a context from one naming system
@@ -537,11 +537,11 @@ public interface Context {
* look up and perform operations on the foreign context using a
* composite name. However, an attempt destroy the context using
* this composite name will fail with
- * NotContextException, because the foreign context is not
+ * {@code NotContextException}, because the foreign context is not
* a "subcontext" of the context in which it is bound.
- * Instead, use unbind() to remove the
+ * Instead, use {@code unbind()} to remove the
* binding of the foreign context. Destroying the foreign context
- * requires that the destroySubcontext() be performed
+ * requires that the {@code destroySubcontext()} be performed
* on a context from the foreign context's "native" naming system.
*
* @param name
@@ -611,12 +611,12 @@ public interface Context {
/**
* Retrieves the named object, following links except
* for the terminal atomic component of the name.
- * If the object bound to name is not a link,
+ * If the object bound to {@code name} is not a link,
* returns the object itself.
*
* @param name
* the name of the object to look up
- * @return the object bound to name, not following the
+ * @return the object bound to {@code name}, not following the
* terminal link (if any).
* @throws NamingException if a naming exception is encountered
*
@@ -631,7 +631,7 @@ public interface Context {
*
* @param name
* the name of the object to look up
- * @return the object bound to name, not following the
+ * @return the object bound to {@code name}, not following the
* terminal link (if any)
* @throws NamingException if a naming exception is encountered
*/
@@ -643,8 +643,8 @@ public interface Context {
* parse names differently. This method allows an application
* to get a parser for parsing names into their atomic components
* using the naming convention of a particular naming system.
- * Within any single naming system, NameParser objects
- * returned by this method must be equal (using the equals()
+ * Within any single naming system, {@code NameParser} objects
+ * returned by this method must be equal (using the {@code equals()}
* test).
*
* @param name
@@ -765,7 +765,7 @@ public interface Context {
*
The caller should not make any changes to the object returned:
* their effect on the context is undefined.
* The environment of this context may be changed using
- * addToEnvironment() and removeFromEnvironment().
+ * {@code addToEnvironment()} and {@code removeFromEnvironment()}.
*
* @return the environment of this context; never null
* @throws NamingException if a naming exception is encountered
@@ -798,7 +798,7 @@ public interface Context {
* The string returned by this method is not a JNDI composite name
* and should not be passed directly to context methods.
* In naming systems for which the notion of full name does not
- * make sense, OperationNotSupportedException is thrown.
+ * make sense, {@code OperationNotSupportedException} is thrown.
*
* @return this context's name in its own namespace; never null
* @throws OperationNotSupportedException if the naming system does
@@ -821,7 +821,7 @@ public interface Context {
* passed to the initial context constructor,
* a system property, or an application resource file.
* If it is not specified in any of these sources,
- * NoInitialContextException is thrown when an initial
+ * {@code NoInitialContextException} is thrown when an initial
* context is required to complete an operation.
*
*
The value of this constant is "java.naming.factory.initial".
@@ -882,7 +882,7 @@ public interface Context {
* a URL context factory.
* This property may be specified in the environment, a system property,
* or one or more resource files.
- * The prefix com.sun.jndi.url is always appended to
+ * The prefix {@code com.sun.jndi.url} is always appended to
* the possibly empty list of package prefixes.
*
*
The value of this constant is "java.naming.factory.url.pkgs".
@@ -920,7 +920,7 @@ public interface Context {
* or a resource file.
* If it is not specified in any of these sources
* and the program attempts to use a JNDI URL containing a DNS name,
- * a ConfigurationException will be thrown.
+ * a {@code ConfigurationException} will be thrown.
*
*
The value of this constant is "java.naming.dns.url".
*
@@ -974,7 +974,7 @@ public interface Context {
*
"ignore"
*
ignore referrals
*
"throw"
- *
throw ReferralException when a referral is encountered.
+ *
throw {@code ReferralException} when a referral is encountered.
*
* If this property is not specified, the default is
* determined by the provider.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/InitialContext.java b/jdk/src/java.naming/share/classes/javax/naming/InitialContext.java
index 8a9792dd3b4..0fce1c94758 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/InitialContext.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/InitialContext.java
@@ -49,13 +49,13 @@ import com.sun.naming.internal.ResourceManager;
* The first occurrence of the property from the constructor's
* environment parameter and system properties.
*
- * The application resource files (jndi.properties).
+ * The application resource files ({@code jndi.properties}).
*
* For each property found in both of these two sources, or in
* more than one application resource file, the property's value
* is determined as follows. If the property is
* one of the standard JNDI properties that specify a list of JNDI
- * factories (see Context),
+ * factories (see {@code Context}),
* all of the values are
* concatenated into a single colon-separated list. For other
* properties, only the first value found is used.
@@ -68,23 +68,23 @@ import com.sun.naming.internal.ResourceManager;
* An exception to this policy is made when resolving URL strings, as described
* below.
*
- * When a URL string (a String of the form
+ * When a URL string (a {@code String} of the form
* scheme_id:rest_of_name) is passed as a name parameter to
* any method, a URL context factory for handling that scheme is
* located and used to resolve the URL. If no such factory is found,
* the initial context specified by
- * "java.naming.factory.initial" is used. Similarly, when a
- * CompositeName object whose first component is a URL string is
+ * {@code "java.naming.factory.initial"} is used. Similarly, when a
+ * {@code CompositeName} object whose first component is a URL string is
* passed as a name parameter to any method, a URL context factory is
* located and used to resolve the first name component.
* See {@link NamingManager#getURLContext
- * NamingManager.getURLContext()} for a description of how URL
+ * NamingManager.getURLContext()} for a description of how URL
* context factories are located.
*
* This default policy of locating the initial context and URL context
* factories may be overridden
* by calling
- * NamingManager.setInitialContextFactoryBuilder().
+ * {@code NamingManager.setInitialContextFactoryBuilder()}.
*
* NoInitialContextException is thrown when an initial context cannot
* be instantiated. This exception can be thrown during any interaction
@@ -125,7 +125,7 @@ public class InitialContext implements Context {
/**
* The environment associated with this InitialContext.
* It is initialized to null and is updated by the constructor
- * that accepts an environment or by the init() method.
+ * that accepts an environment or by the {@code init()} method.
* @see #addToEnvironment
* @see #removeFromEnvironment
* @see #getEnvironment
@@ -152,14 +152,14 @@ public class InitialContext implements Context {
* Constructs an initial context with the option of not
* initializing it. This may be used by a constructor in
* a subclass when the value of the environment parameter
- * is not yet known at the time the InitialContext
+ * is not yet known at the time the {@code InitialContext}
* constructor is called. The subclass's constructor will
* call this constructor, compute the value of the environment,
- * and then call init() before returning.
+ * and then call {@code init()} before returning.
*
* @param lazy
* true means do not initialize the initial context; false
- * is equivalent to calling new InitialContext()
+ * is equivalent to calling {@code new InitialContext()}
* @throws NamingException if a naming exception is encountered
*
* @see #init(Hashtable)
@@ -174,7 +174,7 @@ public class InitialContext implements Context {
/**
* Constructs an initial context.
* No environment properties are supplied.
- * Equivalent to new InitialContext(null).
+ * Equivalent to {@code new InitialContext(null)}.
*
* @throws NamingException if a naming exception is encountered
*
@@ -188,10 +188,10 @@ public class InitialContext implements Context {
* Constructs an initial context using the supplied environment.
* Environment properties are discussed in the class description.
*
- *
This constructor will not modify environment
+ *
This constructor will not modify {@code environment}
* or save a reference to it, but may save a clone.
* Caller should not modify mutable keys and values in
- * environment after it has been passed to the constructor.
+ * {@code environment} after it has been passed to the constructor.
*
* @param environment
* environment used to create the initial context.
@@ -212,7 +212,7 @@ public class InitialContext implements Context {
* Initializes the initial context using the supplied environment.
* Environment properties are discussed in the class description.
*
- *
This method will modify environment and save
+ *
This method will modify {@code environment} and save
* a reference to it. The caller may no longer modify it.
*
* @param environment
@@ -245,7 +245,7 @@ public class InitialContext implements Context {
* InitialContext ic = new InitialContext();
* Object obj = ic.lookup();
*
- *
If name is empty, returns a new instance of this context
+ *
If {@code name} is empty, returns a new instance of this context
* (which represents the same naming context as this context, but its
* environment may be modified independently and it may be accessed
* concurrently).
@@ -253,7 +253,7 @@ public class InitialContext implements Context {
* @param the type of the returned object
* @param name
* the name of the object to look up
- * @return the object bound to name
+ * @return the object bound to {@code name}
* @throws NamingException if a naming exception is encountered
*
* @see #doLookup(String)
@@ -272,7 +272,7 @@ public class InitialContext implements Context {
* @param the type of the returned object
* @param name
* the name of the object to look up
- * @return the object bound to name
+ * @return the object bound to {@code name}
* @throws NamingException if a naming exception is encountered
* @since 1.6
*/
@@ -506,7 +506,7 @@ public class InitialContext implements Context {
* this context.
* Since an initial context may never be named relative
* to any context other than itself, the value of the
- * prefix parameter must be an empty name ("").
+ * {@code prefix} parameter must be an empty name ({@code ""}).
*/
public String composeName(String name, String prefix)
throws NamingException {
@@ -518,7 +518,7 @@ public class InitialContext implements Context {
* this context.
* Since an initial context may never be named relative
* to any context other than itself, the value of the
- * prefix parameter must be an empty name.
+ * {@code prefix} parameter must be an empty name.
*/
public Name composeName(Name name, Name prefix)
throws NamingException
diff --git a/jdk/src/java.naming/share/classes/javax/naming/LinkException.java b/jdk/src/java.naming/share/classes/javax/naming/LinkException.java
index 60ce3d16181..5b4e44dccfe 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/LinkException.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/LinkException.java
@@ -204,7 +204,7 @@ public class LinkException extends NamingException {
/**
* Sets the resolved link name field of this exception.
*
- * name is a composite name. If the intent is to set
+ * {@code name} is a composite name. If the intent is to set
* this field using a compound name or string, you must
* "stringify" the compound name, and create a composite
* name with a single component using the string. You can then
@@ -230,7 +230,7 @@ public class LinkException extends NamingException {
/**
* Sets the remaining link name field of this exception.
*
- * name is a composite name. If the intent is to set
+ * {@code name} is a composite name. If the intent is to set
* this field using a compound name or string, you must
* "stringify" the compound name, and create a composite
* name with a single component using the string. You can then
diff --git a/jdk/src/java.naming/share/classes/javax/naming/Name.java b/jdk/src/java.naming/share/classes/javax/naming/Name.java
index 7ec3231dc89..03a7c1bf0ea 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/Name.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/Name.java
@@ -28,12 +28,12 @@ package javax.naming;
import java.util.Enumeration;
/**
- * The Name interface represents a generic name -- an ordered
+ * The {@code Name} interface represents a generic name -- an ordered
* sequence of components. It can be a composite name (names that
* span multiple namespaces), or a compound name (names that are
* used within individual hierarchical naming systems).
*
- *
There can be different implementations of Name; for example,
+ *
There can be different implementations of {@code Name}; for example,
* composite names, URLs, or namespace-specific compound names.
*
*
The components of a name are numbered. The indexes of a name
@@ -46,7 +46,7 @@ import java.util.Enumeration;
* value for a parameter that is a name or a name component.
* Likewise, methods that return a name or name component never return null.
*
- *
An instance of a Name may not be synchronized against
+ *
An instance of a {@code Name} may not be synchronized against
* concurrent multithreaded access if that access is not read-only.
*
* @author Rosanna Lee
@@ -82,7 +82,7 @@ public interface Name
* Returns a negative integer, zero, or a positive integer as this
* name is less than, equal to, or greater than the given name.
*
- *
As with Object.equals(), the notion of ordering for names
+ *
As with {@code Object.equals()}, the notion of ordering for names
* depends on the class that implements this interface.
* For example, the ordering may be
* based on lexicographical ordering of the name components.
@@ -93,7 +93,7 @@ public interface Name
* @param obj the non-null object to compare against.
* @return a negative integer, zero, or a positive integer as this name
* is less than, equal to, or greater than the given name
- * @throws ClassCastException if obj is not a Name of a
+ * @throws ClassCastException if obj is not a {@code Name} of a
* type that may be compared with this name
*
* @see Comparable#compareTo(Object)
@@ -170,23 +170,23 @@ public interface Name
/**
* Determines whether this name starts with a specified prefix.
- * A name n is a prefix if it is equal to
- * getPrefix(n.size()).
+ * A name {@code n} is a prefix if it is equal to
+ * {@code getPrefix(n.size())}.
*
* @param n
* the name to check
- * @return true if n is a prefix of this name, false otherwise
+ * @return true if {@code n} is a prefix of this name, false otherwise
*/
public boolean startsWith(Name n);
/**
* Determines whether this name ends with a specified suffix.
- * A name n is a suffix if it is equal to
- * getSuffix(size()-n.size()).
+ * A name {@code n} is a suffix if it is equal to
+ * {@code getSuffix(size()-n.size())}.
*
* @param n
* the name to check
- * @return true if n is a suffix of this name, false otherwise
+ * @return true if {@code n} is a suffix of this name, false otherwise
*/
public boolean endsWith(Name n);
@@ -197,7 +197,7 @@ public interface Name
* the components to add
* @return the updated name (not a new one)
*
- * @throws InvalidNameException if suffix is not a valid name,
+ * @throws InvalidNameException if {@code suffix} is not a valid name,
* or if the addition of the components would violate the syntax
* rules of this name
*/
@@ -219,7 +219,7 @@ public interface Name
*
* @throws ArrayIndexOutOfBoundsException
* if posn is outside the specified range
- * @throws InvalidNameException if n is not a valid name,
+ * @throws InvalidNameException if {@code n} is not a valid name,
* or if the addition of the components would violate the syntax
* rules of this name
*/
@@ -232,7 +232,7 @@ public interface Name
* the component to add
* @return the updated name (not a new one)
*
- * @throws InvalidNameException if adding comp would violate
+ * @throws InvalidNameException if adding {@code comp} would violate
* the syntax rules of this name
*/
public Name add(String comp) throws InvalidNameException;
@@ -252,7 +252,7 @@ public interface Name
*
* @throws ArrayIndexOutOfBoundsException
* if posn is outside the specified range
- * @throws InvalidNameException if adding comp would violate
+ * @throws InvalidNameException if adding {@code comp} would violate
* the syntax rules of this name
*/
public Name add(int posn, String comp) throws InvalidNameException;
diff --git a/jdk/src/java.naming/share/classes/javax/naming/NameClassPair.java b/jdk/src/java.naming/share/classes/javax/naming/NameClassPair.java
index 28b22004893..f69565afd2c 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/NameClassPair.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/NameClassPair.java
@@ -60,7 +60,7 @@ public class NameClassPair implements java.io.Serializable {
/**
* Contains the name of this NameClassPair.
* It is initialized by the constructor and can be updated using
- * setName().
+ * {@code setName()}.
* @serial
* @see #getName
* @see #setName
@@ -70,7 +70,7 @@ public class NameClassPair implements java.io.Serializable {
/**
*Contains the class name contained in this NameClassPair.
* It is initialized by the constructor and can be updated using
- * setClassName().
+ * {@code setClassName()}.
* @serial
* @see #getClassName
* @see #setClassName
@@ -80,7 +80,7 @@ public class NameClassPair implements java.io.Serializable {
/**
* Contains the full name of this NameClassPair within its
* own namespace.
- * It is initialized using setNameInNamespace()
+ * It is initialized using {@code setNameInNamespace()}
* @serial
* @see #getNameInNamespace
* @see #setNameInNamespace
@@ -89,10 +89,10 @@ public class NameClassPair implements java.io.Serializable {
/**
- * Records whether the name of this NameClassPair
+ * Records whether the name of this {@code NameClassPair}
* is relative to the target context.
* It is initialized by the constructor and can be updated using
- * setRelative().
+ * {@code setRelative()}.
* @serial
* @see #isRelative
* @see #setRelative
@@ -148,7 +148,7 @@ public class NameClassPair implements java.io.Serializable {
* Retrieves the class name of the object bound to the name of this binding.
* If a reference or some other indirect information is bound,
* retrieves the class name of the eventual object that
- * will be returned by Binding.getObject().
+ * will be returned by {@code Binding.getObject()}.
*
* @return The possibly null class name of object bound.
* It is null if the object bound is null.
@@ -162,10 +162,10 @@ public class NameClassPair implements java.io.Serializable {
/**
* Retrieves the name of this binding.
- * If isRelative() is true, this name is relative to the
+ * If {@code isRelative()} is true, this name is relative to the
* target context (which is named by the first parameter of the
- * list()).
- * If isRelative() is false, this name is a URL string.
+ * {@code list()}).
+ * If {@code isRelative()} is false, this name is a URL string.
*
* @return The non-null name of this binding.
* @see #isRelative
@@ -190,7 +190,7 @@ public class NameClassPair implements java.io.Serializable {
* Sets the class name of this binding.
*
* @param name the possibly null string to use as the class name.
- * If null, Binding.getClassName() will return
+ * If null, {@code Binding.getClassName()} will return
* the actual class name of the object in the binding.
* The class name will be null if the object bound is null.
* @see #getClassName
@@ -236,7 +236,7 @@ public class NameClassPair implements java.io.Serializable {
*
*
* In naming systems for which the notion of full name does not
- * apply to this binding an UnsupportedOperationException
+ * apply to this binding an {@code UnsupportedOperationException}
* is thrown.
* This exception is also thrown when a service provider written before
* the introduction of the method is in use.
@@ -261,11 +261,11 @@ public class NameClassPair implements java.io.Serializable {
/**
* Sets the full name of this binding.
* This method must be called to set the full name whenever a
- * NameClassPair is created and a full name is
+ * {@code NameClassPair} is created and a full name is
* applicable to this binding.
*
* Setting the full name to null, or not setting it at all, will
- * cause getNameInNamespace() to throw an exception.
+ * cause {@code getNameInNamespace()} to throw an exception.
*
* @param fullName The full name to use.
* @since 1.5
diff --git a/jdk/src/java.naming/share/classes/javax/naming/NamingEnumeration.java b/jdk/src/java.naming/share/classes/javax/naming/NamingEnumeration.java
index f40325e350d..b05260b2a1f 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/NamingEnumeration.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/NamingEnumeration.java
@@ -85,7 +85,7 @@ public interface NamingEnumeration extends Enumeration {
* retrieving the next element to be caught and handled
* by the application.
*
- * Note that next() can also throw the runtime exception
+ * Note that {@code next()} can also throw the runtime exception
* NoSuchElementException to indicate that the caller is
* attempting to enumerate beyond the end of the enumeration.
* This is different from a NamingException, which indicates
@@ -128,16 +128,16 @@ public interface NamingEnumeration extends Enumeration {
* its methods will yield undefined results.
* This method is intended for aborting an enumeration to free up resources.
* If an enumeration proceeds to the end--that is, until
- * hasMoreElements() or hasMore() returns false--
+ * {@code hasMoreElements()} or {@code hasMore()} returns {@code false}--
* resources will be freed up automatically and there is no need to
- * explicitly call close().
+ * explicitly call {@code close()}.
*
* This method indicates to the service provider that it is free
* to release resources associated with the enumeration, and can
- * notify servers to cancel any outstanding requests. The close()
+ * notify servers to cancel any outstanding requests. The {@code close()}
* method is a hint to implementations for managing their resources.
* Implementations are encouraged to use appropriate algorithms to
- * manage their resources when client omits the close() calls.
+ * manage their resources when client omits the {@code close()} calls.
*
* @exception NamingException If a naming exception is encountered
* while closing the enumeration.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/NamingException.java b/jdk/src/java.naming/share/classes/javax/naming/NamingException.java
index e1252da5f00..655cc86c9be 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/NamingException.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/NamingException.java
@@ -194,14 +194,14 @@ public class NamingException extends Exception {
/**
* Sets the resolved name field of this exception.
*
- * name is a composite name. If the intent is to set
+ * {@code name} is a composite name. If the intent is to set
* this field using a compound name or string, you must
* "stringify" the compound name, and create a composite
* name with a single component using the string. You can then
* invoke this method using the resulting composite name.
*
- * A copy of name is made and stored.
- * Subsequent changes to name do not
+ * A copy of {@code name} is made and stored.
+ * Subsequent changes to {@code name} do not
* affect the copy in this NamingException and vice versa.
*
* @param name The possibly null name to set resolved name to.
@@ -218,14 +218,14 @@ public class NamingException extends Exception {
/**
* Sets the remaining name field of this exception.
*
- * name is a composite name. If the intent is to set
+ * {@code name} is a composite name. If the intent is to set
* this field using a compound name or string, you must
* "stringify" the compound name, and create a composite
* name with a single component using the string. You can then
* invoke this method using the resulting composite name.
*
- * A copy of name is made and stored.
- * Subsequent changes to name do not
+ * A copy of {@code name} is made and stored.
+ * Subsequent changes to {@code name} do not
* affect the copy in this NamingException and vice versa.
* @param name The possibly null name to set remaining name to.
* If null, it sets the remaining name field to null.
@@ -275,11 +275,11 @@ public class NamingException extends Exception {
* Add components from 'name' as the last components in
* remaining name.
*
- * name is a composite name. If the intent is to append
+ * {@code name} is a composite name. If the intent is to append
* a compound name, you should "stringify" the compound name
* then invoke the overloaded form that accepts a String parameter.
*
- * Subsequent changes to name do not
+ * Subsequent changes to {@code name} do not
* affect the remaining name field in this NamingException and vice versa.
* @param name The possibly null name containing ordered components to add.
* If name is null, this method does not do anything.
@@ -326,7 +326,7 @@ public class NamingException extends Exception {
/**
* Records the root cause of this NamingException.
- * If e is this, this method does not do anything.
+ * If {@code e} is {@code this}, this method does not do anything.
*
* This method predates the general-purpose exception chaining facility.
* The {@link #initCause(Throwable)} method is now the preferred means
@@ -348,10 +348,10 @@ public class NamingException extends Exception {
/**
* Returns the cause of this exception. The cause is the
* throwable that caused this naming exception to be thrown.
- * Returns null if the cause is nonexistent or
+ * Returns {@code null} if the cause is nonexistent or
* unknown.
*
- * @return the cause of this exception, or null if the
+ * @return the cause of this exception, or {@code null} if the
* cause is nonexistent or unknown.
* @see #initCause(Throwable)
* @since 1.4
@@ -368,10 +368,10 @@ public class NamingException extends Exception {
* This method may be called at most once.
*
* @param cause the cause, which is saved for later retrieval by
- * the {@link #getCause()} method. A null value
+ * the {@link #getCause()} method. A {@code null} value
* indicates that the cause is nonexistent or unknown.
- * @return a reference to this NamingException instance.
- * @throws IllegalArgumentException if cause is this
+ * @return a reference to this {@code NamingException} instance.
+ * @throws IllegalArgumentException if {@code cause} is this
* exception. (A throwable cannot be its own cause.)
* @throws IllegalStateException if this method has already
* been called on this exception.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/Reference.java b/jdk/src/java.naming/share/classes/javax/naming/Reference.java
index 8b11bdc2e10..f1bc1c8c0cc 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/Reference.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/Reference.java
@@ -250,7 +250,7 @@ public class Reference implements Cloneable, java.io.Serializable {
* its effects on this enumeration are undefined.
*
* @return An non-null enumeration of the addresses
- * (RefAddr) in this reference.
+ * ({@code RefAddr}) in this reference.
* If this reference has zero addresses, an enumeration with
* zero elements is returned.
*/
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ReferralException.java b/jdk/src/java.naming/share/classes/javax/naming/ReferralException.java
index 7d3eaf3a849..c19a8a4d0f2 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ReferralException.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ReferralException.java
@@ -33,12 +33,12 @@ import java.util.Hashtable;
* such as that returned by LDAP v3 servers.
*
* A service provider provides
- * a subclass of ReferralException by providing implementations
- * for getReferralInfo() and getReferralContext() (and appropriate
+ * a subclass of {@code ReferralException} by providing implementations
+ * for {@code getReferralInfo()} and {@code getReferralContext()} (and appropriate
* constructors and/or corresponding "set" methods).
*
- * The following code sample shows how ReferralException can be used.
- *
{@code
+ * The following code sample shows how {@code ReferralException} can be used.
+ *
- * ReferralException is an abstract class. Concrete implementations
+ * {@code ReferralException} is an abstract class. Concrete implementations
* determine its synchronization and serialization properties.
*
- * An environment parameter passed to the getReferralContext()
+ * An environment parameter passed to the {@code getReferralContext()}
* method is owned by the caller.
* The service provider will not modify the object or keep a reference to it,
* but may keep a reference to a clone of it.
@@ -114,7 +114,7 @@ public abstract class ReferralException extends NamingException {
*
* @return The non-null context at which to continue the method.
* @exception NamingException If a naming exception was encountered.
- * Call either retryReferral() or skipReferral()
+ * Call either {@code retryReferral()} or {@code skipReferral()}
* to continue processing referrals.
*/
public abstract Context getReferralContext() throws NamingException;
@@ -127,7 +127,7 @@ public abstract class ReferralException extends NamingException {
* enumeration, the referral exception should provide a context
* at which to continue the operation.
*
- * The referral context is created using env as its environment
+ * The referral context is created using {@code env} as its environment
* properties.
* This method should be used instead of the no-arg overloaded form
* when the caller needs to use different environment properties for
@@ -143,7 +143,7 @@ public abstract class ReferralException extends NamingException {
*
* @return The non-null context at which to continue the method.
* @exception NamingException If a naming exception was encountered.
- * Call either retryReferral() or skipReferral()
+ * Call either {@code retryReferral()} or {@code skipReferral()}
* to continue processing referrals.
*/
public abstract Context
@@ -153,7 +153,7 @@ public abstract class ReferralException extends NamingException {
/**
* Discards the referral about to be processed.
* A call to this method should be followed by a call to
- * getReferralContext to allow the processing of
+ * {@code getReferralContext} to allow the processing of
* other referrals to continue.
* The following code fragment shows a typical usage pattern.
*
@@ -174,7 +174,7 @@ public abstract class ReferralException extends NamingException {
/**
* Retries the referral currently being processed.
* A call to this method should be followed by a call to
- * getReferralContext to allow the current
+ * {@code getReferralContext} to allow the current
* referral to be retried.
* The following code fragment shows a typical usage pattern.
*
diff --git a/jdk/src/java.naming/share/classes/javax/naming/directory/Attribute.java b/jdk/src/java.naming/share/classes/javax/naming/directory/Attribute.java
index 2cdc354d2da..d39f486c360 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/Attribute.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/Attribute.java
@@ -37,34 +37,34 @@ import javax.naming.OperationNotSupportedException;
* This interface represents an attribute associated with a named object.
*
* In a directory, named objects can have associated with them
- * attributes. The Attribute interface represents an attribute associated
+ * attributes. The {@code Attribute} interface represents an attribute associated
* with a named object. An attribute contains 0 or more, possibly null, values.
- * The attribute values can be ordered or unordered (see isOrdered()).
+ * The attribute values can be ordered or unordered (see {@code isOrdered()}).
* If the values are unordered, no duplicates are allowed.
* If the values are ordered, duplicates are allowed.
*
* The content and representation of an attribute and its values is defined by
* the attribute's schema. The schema contains information
* about the attribute's syntax and other properties about the attribute.
- * See getAttributeDefinition() and
- * getAttributeSyntaxDefinition()
+ * See {@code getAttributeDefinition()} and
+ * {@code getAttributeSyntaxDefinition()}
* for details regarding how to get schema information about an attribute
* if the underlying directory service supports schemas.
*
* Equality of two attributes is determined by the implementation class.
- * A simple implementation can use Object.equals() to determine equality
+ * A simple implementation can use {@code Object.equals()} to determine equality
* of attribute values, while a more sophisticated implementation might
* make use of schema information to determine equality.
* Similarly, one implementation might provide a static storage
* structure which simply returns the values passed to its
- * constructor, while another implementation might define get() and
- * getAll().
+ * constructor, while another implementation might define {@code get()} and
+ * {@code getAll()}.
* to get the values dynamically from the directory.
*
- * Note that updates to Attribute (such as adding or removing a
+ * Note that updates to {@code Attribute} (such as adding or removing a
* value) do not affect the corresponding representation of the attribute
* in the directory. Updates to the directory can only be effected
- * using operations in the DirContext interface.
+ * using operations in the {@code DirContext} interface.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -129,7 +129,7 @@ public interface Attribute extends Cloneable, java.io.Serializable {
/**
* Determines whether a value is in the attribute.
* Equality is determined by the implementation, which may use
- * Object.equals() or schema information to determine equality.
+ * {@code Object.equals()} or schema information to determine equality.
*
* @param attrVal The possibly null value to check. If null, check
* whether the attribute has an attribute value whose value is null.
@@ -141,12 +141,12 @@ public interface Attribute extends Cloneable, java.io.Serializable {
/**
* Adds a new value to the attribute.
* If the attribute values are unordered and
- * attrVal is already in the attribute, this method does nothing.
- * If the attribute values are ordered, attrVal is added to the end of
+ * {@code attrVal} is already in the attribute, this method does nothing.
+ * If the attribute values are ordered, {@code attrVal} is added to the end of
* the list of attribute values.
*
* Equality is determined by the implementation, which may use
- * Object.equals() or schema information to determine equality.
+ * {@code Object.equals()} or schema information to determine equality.
*
* @param attrVal The new possibly null value to add. If null, null
* is added as an attribute value.
@@ -156,15 +156,15 @@ public interface Attribute extends Cloneable, java.io.Serializable {
/**
* Removes a specified value from the attribute.
- * If attrval is not in the attribute, this method does nothing.
+ * If {@code attrval} is not in the attribute, this method does nothing.
* If the attribute values are ordered, the first occurrence of
- * attrVal is removed and attribute values at indices greater
+ * {@code attrVal} is removed and attribute values at indices greater
* than the removed
* value are shifted up towards the head of the list (and their indices
* decremented by one).
*
* Equality is determined by the implementation, which may use
- * Object.equals() or schema information to determine equality.
+ * {@code Object.equals()} or schema information to determine equality.
*
* @param attrval The possibly null value to remove from this attribute.
* If null, remove the attribute value that is null.
@@ -260,66 +260,66 @@ public interface Attribute extends Cloneable, java.io.Serializable {
/**
* Retrieves the attribute value from the ordered list of attribute values.
- * This method returns the value at the ix index of the list of
+ * This method returns the value at the {@code ix} index of the list of
* attribute values.
* If the attribute values are unordered,
* this method returns the value that happens to be at that index.
* @param ix The index of the value in the ordered list of attribute values.
* {@code 0 <= ix < size()}.
- * @return The possibly null attribute value at index ix;
+ * @return The possibly null attribute value at index {@code ix};
* null if the attribute value is null.
* @exception NamingException If a naming exception was encountered while
* retrieving the value.
- * @exception IndexOutOfBoundsException If ix is outside the specified range.
+ * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
*/
Object get(int ix) throws NamingException;
/**
* Removes an attribute value from the ordered list of attribute values.
- * This method removes the value at the ix index of the list of
+ * This method removes the value at the {@code ix} index of the list of
* attribute values.
* If the attribute values are unordered,
* this method removes the value that happens to be at that index.
- * Values located at indices greater than ix are shifted up towards
+ * Values located at indices greater than {@code ix} are shifted up towards
* the front of the list (and their indices decremented by one).
*
* @param ix The index of the value to remove.
* {@code 0 <= ix < size()}.
- * @return The possibly null attribute value at index ix that was removed;
+ * @return The possibly null attribute value at index {@code ix} that was removed;
* null if the attribute value is null.
- * @exception IndexOutOfBoundsException If ix is outside the specified range.
+ * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
*/
Object remove(int ix);
/**
* Adds an attribute value to the ordered list of attribute values.
- * This method adds attrVal to the list of attribute values at
- * index ix.
- * Values located at indices at or greater than ix are
+ * This method adds {@code attrVal} to the list of attribute values at
+ * index {@code ix}.
+ * Values located at indices at or greater than {@code ix} are
* shifted down towards the end of the list (and their indices incremented
* by one).
- * If the attribute values are unordered and already have attrVal,
- * IllegalStateException is thrown.
+ * If the attribute values are unordered and already have {@code attrVal},
+ * {@code IllegalStateException} is thrown.
*
* @param ix The index in the ordered list of attribute values to add the new value.
* {@code 0 <= ix <= size()}.
* @param attrVal The possibly null attribute value to add; if null, null is
* the value added.
- * @exception IndexOutOfBoundsException If ix is outside the specified range.
+ * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
* @exception IllegalStateException If the attribute values are unordered and
- * attrVal is one of those values.
+ * {@code attrVal} is one of those values.
*/
void add(int ix, Object attrVal);
/**
* Sets an attribute value in the ordered list of attribute values.
- * This method sets the value at the ix index of the list of
- * attribute values to be attrVal. The old value is removed.
+ * This method sets the value at the {@code ix} index of the list of
+ * attribute values to be {@code attrVal}. The old value is removed.
* If the attribute values are unordered,
* this method sets the value that happens to be at that index
- * to attrVal, unless attrVal is already one of the values.
- * In that case, IllegalStateException is thrown.
+ * to {@code attrVal}, unless {@code attrVal} is already one of the values.
+ * In that case, {@code IllegalStateException} is thrown.
*
* @param ix The index of the value in the ordered list of attribute values.
* {@code 0 <= ix < size()}.
@@ -327,8 +327,8 @@ public interface Attribute extends Cloneable, java.io.Serializable {
* If null, 'null' replaces the old value.
* @return The possibly null attribute value at index ix that was replaced.
* Null if the attribute value was null.
- * @exception IndexOutOfBoundsException If ix is outside the specified range.
- * @exception IllegalStateException If attrVal already exists and the
+ * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
+ * @exception IllegalStateException If {@code attrVal} already exists and the
* attribute values are unordered.
*/
Object set(int ix, Object attrVal);
diff --git a/jdk/src/java.naming/share/classes/javax/naming/directory/Attributes.java b/jdk/src/java.naming/share/classes/javax/naming/directory/Attributes.java
index b54549a0934..3273b1ed1cb 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/Attributes.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/Attributes.java
@@ -103,7 +103,7 @@ public interface Attributes extends Cloneable, java.io.Serializable {
* are undefined.
*
* @return A non-null enumeration of the attributes in this attribute set.
- * Each element of the enumeration is of class Attribute.
+ * Each element of the enumeration is of class {@code Attribute}.
* If attribute set has zero attributes, an empty enumeration
* is returned.
*/
diff --git a/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttribute.java b/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttribute.java
index eb817e4a4d6..41ab9184452 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttribute.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttribute.java
@@ -35,35 +35,35 @@ import javax.naming.NamingEnumeration;
import javax.naming.OperationNotSupportedException;
/**
- * This class provides a basic implementation of the Attribute interface.
+ * This class provides a basic implementation of the {@code Attribute} interface.
*
* This implementation does not support the schema methods
- * getAttributeDefinition() and getAttributeSyntaxDefinition().
- * They simply throw OperationNotSupportedException.
- * Subclasses of BasicAttribute should override these methods if they
+ * {@code getAttributeDefinition()} and {@code getAttributeSyntaxDefinition()}.
+ * They simply throw {@code OperationNotSupportedException}.
+ * Subclasses of {@code BasicAttribute} should override these methods if they
* support them.
*
- * The BasicAttribute class by default uses Object.equals() to
+ * The {@code BasicAttribute} class by default uses {@code Object.equals()} to
* determine equality of attribute values when testing for equality or
* when searching for values, except when the value is an array.
- * For an array, each element of the array is checked using Object.equals().
- * Subclasses of BasicAttribute can make use of schema information
+ * For an array, each element of the array is checked using {@code Object.equals()}.
+ * Subclasses of {@code BasicAttribute} can make use of schema information
* when doing similar equality checks by overriding methods
* in which such use of schema is meaningful.
- * Similarly, the BasicAttribute class by default returns the values passed to its
+ * Similarly, the {@code BasicAttribute} class by default returns the values passed to its
* constructor and/or manipulated using the add/remove methods.
- * Subclasses of BasicAttribute can override get() and getAll()
+ * Subclasses of {@code BasicAttribute} can override {@code get()} and {@code getAll()}
* to get the values dynamically from the directory (or implement
- * the Attribute interface directly instead of subclassing BasicAttribute).
+ * the {@code Attribute} interface directly instead of subclassing {@code BasicAttribute}).
*
- * Note that updates to BasicAttribute (such as adding or removing a value)
+ * Note that updates to {@code BasicAttribute} (such as adding or removing a value)
* does not affect the corresponding representation of the attribute
* in the directory. Updates to the directory can only be effected
- * using operations in the DirContext interface.
+ * using operations in the {@code DirContext} interface.
*
- * A BasicAttribute instance is not synchronized against concurrent
+ * A {@code BasicAttribute} instance is not synchronized against concurrent
* multithreaded access. Multiple threads trying to access and modify a
- * BasicAttribute should lock the object.
+ * {@code BasicAttribute} should lock the object.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -112,16 +112,16 @@ public class BasicAttribute implements Attribute {
* order the values must match.
* If obj is null or not an Attribute, false is returned.
*
- * By default Object.equals() is used when comparing the attribute
+ * By default {@code Object.equals()} is used when comparing the attribute
* id and its values except when a value is an array. For an array,
- * each element of the array is checked using Object.equals().
+ * each element of the array is checked using {@code Object.equals()}.
* A subclass may override this to make
* use of schema syntax information and matching rules,
* which define what it means for two attributes to be equal.
* How and whether a subclass makes
* use of the schema information is determined by the subclass.
- * If a subclass overrides equals(), it should also override
- * hashCode()
+ * If a subclass overrides {@code equals()}, it should also override
+ * {@code hashCode()}
* such that two attributes that are equal have the same hash code.
*
* @param obj The possibly null object to check.
@@ -172,8 +172,8 @@ public class BasicAttribute implements Attribute {
* the attribute's id and that of all of its values except for
* values that are arrays.
* For an array, the hash code of each element of the array is summed.
- * If a subclass overrides hashCode(), it should override
- * equals()
+ * If a subclass overrides {@code hashCode()}, it should override
+ * {@code equals()}
* as well so that two attributes that are equal have the same hash code.
*
* @return an int representing the hash code of this attribute.
@@ -315,10 +315,10 @@ public class BasicAttribute implements Attribute {
* Determines whether a value is in this attribute.
*
* By default,
- * Object.equals() is used when comparing attrVal
- * with this attribute's values except when attrVal is an array.
+ * {@code Object.equals()} is used when comparing {@code attrVal}
+ * with this attribute's values except when {@code attrVal} is an array.
* For an array, each element of the array is checked using
- * Object.equals().
+ * {@code Object.equals()}.
* A subclass may use schema information to determine equality.
*/
public boolean contains(Object attrVal) {
@@ -352,7 +352,7 @@ public class BasicAttribute implements Attribute {
/**
* Determines whether two attribute values are equal.
- * Use arrayEquals for arrays and Object.equals() otherwise.
+ * Use arrayEquals for arrays and {@code Object.equals()} otherwise.
*/
private static boolean valueEquals(Object obj1, Object obj2) {
if (obj1 == obj2) {
@@ -370,7 +370,7 @@ public class BasicAttribute implements Attribute {
/**
* Determines whether two arrays are equal by comparing each of their
- * elements using Object.equals().
+ * elements using {@code Object.equals()}.
*/
private static boolean arrayEquals(Object a1, Object a2) {
int len;
@@ -393,10 +393,10 @@ public class BasicAttribute implements Attribute {
/**
* Adds a new value to this attribute.
*
- * By default, Object.equals() is used when comparing attrVal
- * with this attribute's values except when attrVal is an array.
+ * By default, {@code Object.equals()} is used when comparing {@code attrVal}
+ * with this attribute's values except when {@code attrVal} is an array.
* For an array, each element of the array is checked using
- * Object.equals().
+ * {@code Object.equals()}.
* A subclass may use schema information to determine equality.
*/
public boolean add(Object attrVal) {
@@ -411,10 +411,10 @@ public class BasicAttribute implements Attribute {
/**
* Removes a specified value from this attribute.
*
- * By default, Object.equals() is used when comparing attrVal
- * with this attribute's values except when attrVal is an array.
+ * By default, {@code Object.equals()} is used when comparing {@code attrVal}
+ * with this attribute's values except when {@code attrVal} is an array.
* For an array, each element of the array is checked using
- * Object.equals().
+ * {@code Object.equals()}.
* A subclass may use schema information to determine equality.
*/
public boolean remove(Object attrval) {
diff --git a/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java b/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java
index 70ed5f4655a..0b8178c91cd 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java
@@ -207,17 +207,17 @@ public class BasicAttributes implements Attributes {
}
/**
- * Determines whether this BasicAttributes is equal to another
- * Attributes
- * Two Attributes are equal if they are both instances of
- * Attributes,
+ * Determines whether this {@code BasicAttributes} is equal to another
+ * {@code Attributes}
+ * Two {@code Attributes} are equal if they are both instances of
+ * {@code Attributes},
* treat the case of attribute IDs the same way, and contain the
- * same attributes. Each Attribute in this BasicAttributes
- * is checked for equality using Object.equals(), which may have
- * be overridden by implementations of Attribute).
- * If a subclass overrides equals(),
- * it should override hashCode()
- * as well so that two Attributes instances that are equal
+ * same attributes. Each {@code Attribute} in this {@code BasicAttributes}
+ * is checked for equality using {@code Object.equals()}, which may have
+ * be overridden by implementations of {@code Attribute}).
+ * If a subclass overrides {@code equals()},
+ * it should override {@code hashCode()}
+ * as well so that two {@code Attributes} instances that are equal
* have the same hash code.
* @param obj the possibly null object to compare against.
*
@@ -259,9 +259,9 @@ public class BasicAttributes implements Attributes {
* The hash code is computed by adding the hash code of
* the attributes of this object. If this BasicAttributes
* ignores case of its attribute IDs, one is added to the hash code.
- * If a subclass overrides hashCode(),
- * it should override equals()
- * as well so that two Attributes instances that are equal
+ * If a subclass overrides {@code hashCode()},
+ * it should override {@code equals()}
+ * as well so that two {@code Attributes} instances that are equal
* have the same hash code.
*
* @return an int representing the hash code of this BasicAttributes instance.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/directory/DirContext.java b/jdk/src/java.naming/share/classes/javax/naming/directory/DirContext.java
index 2b77486673a..5eb4b186891 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/DirContext.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/DirContext.java
@@ -33,7 +33,7 @@ import javax.naming.*;
* associated with objects, and for searching the directory.
*
*
Names
- * Each name passed as an argument to a DirContext method is relative
+ * Each name passed as an argument to a {@code DirContext} method is relative
* to that context. The empty name is used to name the context itself.
* The name parameter may never be null.
*
@@ -47,9 +47,9 @@ import javax.naming.*;
* The second version instead has a link to the first: the same
* documentation applies to both.
*
- * See Context for a discussion on the interpretation of the
- * name argument to the Context methods. These same rules
- * apply to the name argument to the DirContext methods.
+ * See {@code Context} for a discussion on the interpretation of the
+ * name argument to the {@code Context} methods. These same rules
+ * apply to the name argument to the {@code DirContext} methods.
*
*
Attribute Models
* There are two basic models of what attributes should be
@@ -82,7 +82,7 @@ import javax.naming.*;
* within the parent object and associated with the object's name.
*
*
Attribute Type Names
- * In the getAttributes() and search() methods,
+ * In the {@code getAttributes()} and {@code search()} methods,
* you can supply the attributes to return by supplying a list of
* attribute names (strings).
* The attributes that you get back might not have the same names as the
@@ -120,9 +120,9 @@ import javax.naming.*;
* purposes. An example of operational attributes is the access control
* list for an object.
*
- * In the getAttributes() and search() methods,
+ * In the {@code getAttributes()} and {@code search()} methods,
* you can specify that all attributes associated with the requested objects
- * be returned by supply null as the list of attributes to return.
+ * be returned by supply {@code null} as the list of attributes to return.
* The attributes returned do not include operational attributes.
* In order to retrieve operational attributes, you must name them explicitly.
*
@@ -140,13 +140,13 @@ import javax.naming.*;
*
*
Parameters
*
- * An Attributes, SearchControls, or array object
+ * An {@code Attributes}, {@code SearchControls}, or array object
* passed as a parameter to any method will not be modified by the
* service provider. The service provider may keep a reference to it
* for the duration of the operation, including any enumeration of the
* method's results and the processing of any referrals generated.
* The caller should not modify the object during this time.
- * An Attributes object returned by any method is owned by
+ * An {@code Attributes} object returned by any method is owned by
* the caller. The caller may subsequently modify it; the service
* provider will not.
*
@@ -254,7 +254,7 @@ public interface DirContext extends Context {
* If attempting to add more than one value to a single-valued attribute,
* throws InvalidAttributeValueException.
*
- * The value of this constant is 1.
+ * The value of this constant is {@code 1}.
*
* @see ModificationItem
* @see #modifyAttributes
@@ -273,7 +273,7 @@ public interface DirContext extends Context {
* attempting to add more than one value to a single-valued attribute,
* throws InvalidAttributeValueException.
*
- * The value of this constant is 2.
+ * The value of this constant is {@code 2}.
*
* @see ModificationItem
* @see #modifyAttributes
@@ -294,7 +294,7 @@ public interface DirContext extends Context {
* Removal of the last value will remove the attribute if the
* attribute is required to have at least one value.
*
- * The value of this constant is 3.
+ * The value of this constant is {@code 3}.
*
* @see ModificationItem
* @see #modifyAttributes
@@ -391,12 +391,12 @@ public interface DirContext extends Context {
/**
* Binds a name to an object, along with associated attributes.
- * If attrs is null, the resulting binding will have
- * the attributes associated with obj if obj is a
- * DirContext, and no attributes otherwise.
- * If attrs is non-null, the resulting binding will have
- * attrs as its attributes; any attributes associated with
- * obj are ignored.
+ * If {@code attrs} is null, the resulting binding will have
+ * the attributes associated with {@code obj} if {@code obj} is a
+ * {@code DirContext}, and no attributes otherwise.
+ * If {@code attrs} is non-null, the resulting binding will have
+ * {@code attrs} as its attributes; any attributes associated with
+ * {@code obj} are ignored.
*
* @param name
* the name to bind; may not be empty
@@ -438,16 +438,16 @@ public interface DirContext extends Context {
/**
* Binds a name to an object, along with associated attributes,
* overwriting any existing binding.
- * If attrs is null and obj is a DirContext,
- * the attributes from obj are used.
- * If attrs is null and obj is not a DirContext,
+ * If {@code attrs} is null and {@code obj} is a {@code DirContext},
+ * the attributes from {@code obj} are used.
+ * If {@code attrs} is null and {@code obj} is not a {@code DirContext},
* any existing attributes associated with the object already bound
* in the directory remain unchanged.
- * If attrs is non-null, any existing attributes associated with
- * the object already bound in the directory are removed and attrs
- * is associated with the named object. If obj is a
- * DirContext and attrs is non-null, the attributes
- * of obj are ignored.
+ * If {@code attrs} is non-null, any existing attributes associated with
+ * the object already bound in the directory are removed and {@code attrs}
+ * is associated with the named object. If {@code obj} is a
+ * {@code DirContext} and {@code attrs} is non-null, the attributes
+ * of {@code obj} are ignored.
*
* @param name
* the name to bind; may not be empty
@@ -492,8 +492,8 @@ public interface DirContext extends Context {
* component of the name), and associates the supplied attributes
* with the newly created object.
* All intermediate and target contexts must already exist.
- * If attrs is null, this method is equivalent to
- * Context.createSubcontext().
+ * If {@code attrs} is null, this method is equivalent to
+ * {@code Context.createSubcontext()}.
*
* @param name
* the name of the context to create; may not be empty
@@ -579,8 +579,8 @@ public interface DirContext extends Context {
* "object class" being referred to here is in the directory sense
* rather than in the Java sense.
* For example, if the named object is a directory object of
- * "Person" class, getSchemaClassDefinition() would return a
- * DirContext representing the (directory's) object class
+ * "Person" class, {@code getSchemaClassDefinition()} would return a
+ * {@code DirContext} representing the (directory's) object class
* definition of "Person".
*
* The information that can be retrieved from an object class definition
@@ -589,13 +589,13 @@ public interface DirContext extends Context {
* Prior to JNDI 1.2, this method
* returned a single schema object representing the class definition of
* the named object.
- * Since JNDI 1.2, this method returns a DirContext containing
+ * Since JNDI 1.2, this method returns a {@code DirContext} containing
* all of the named object's class definitions.
*
* @param name
* the name of the object whose object class
* definition is to be retrieved
- * @return the DirContext containing the named
+ * @return the {@code DirContext} containing the named
* object's class definitions; never null
*
* @throws OperationNotSupportedException if schema not supported
@@ -612,7 +612,7 @@ public interface DirContext extends Context {
* @param name
* the name of the object whose object class
* definition is to be retrieved
- * @return the DirContext containing the named
+ * @return the {@code DirContext} containing the named
* object's class definitions; never null
*
* @throws OperationNotSupportedException if schema not supported
@@ -656,7 +656,7 @@ public interface DirContext extends Context {
* substring comparison) use the version of the search
* method that takes a filter argument.
*
- * When changes are made to this DirContext,
+ * When changes are made to this {@code DirContext},
* the effect on enumerations returned by prior calls to this method
* is undefined.
*
@@ -681,8 +681,8 @@ public interface DirContext extends Context {
* all attributes are to be returned;
* an empty array indicates that none are to be returned.
* @return
- * a non-null enumeration of SearchResult objects.
- * Each SearchResult contains the attributes
+ * a non-null enumeration of {@code SearchResult} objects.
+ * Each {@code SearchResult} contains the attributes
* identified by attributesToReturn
* and the name of the corresponding object, named relative
* to the context named by name.
@@ -709,7 +709,7 @@ public interface DirContext extends Context {
* the attributes to search for
* @param attributesToReturn
* the attributes to return
- * @return a non-null enumeration of SearchResult objects
+ * @return a non-null enumeration of {@code SearchResult} objects
* @throws NamingException if a naming exception is encountered
*/
public NamingEnumeration
@@ -723,7 +723,7 @@ public interface DirContext extends Context {
* specified set of attributes.
* This method returns all the attributes of such objects.
* It is equivalent to supplying null as
- * the attributesToReturn parameter to the method
+ * the {@code attributesToReturn} parameter to the method
* search(Name, Attributes, String[]).
*
* See {@link #search(Name, Attributes, String[])} for a full description.
@@ -732,7 +732,7 @@ public interface DirContext extends Context {
* the name of the context to search
* @param matchingAttributes
* the attributes to search for
- * @return an enumeration of SearchResult objects
+ * @return an enumeration of {@code SearchResult} objects
* @throws NamingException if a naming exception is encountered
*
* @see #search(Name, Attributes, String[])
@@ -750,7 +750,7 @@ public interface DirContext extends Context {
* the name of the context to search
* @param matchingAttributes
* the attributes to search for
- * @return an enumeration of SearchResult objects
+ * @return an enumeration of {@code SearchResult} objects
* @throws NamingException if a naming exception is encountered
*/
public NamingEnumeration
@@ -807,8 +807,8 @@ public interface DirContext extends Context {
* attributes. When an operator is not applicable, the exception
* InvalidSearchFilterException is thrown.
*
- * The result is returned in an enumeration of SearchResults.
- * Each SearchResult contains the name of the object
+ * The result is returned in an enumeration of {@code SearchResult}s.
+ * Each {@code SearchResult} contains the name of the object
* and other information about the object (see SearchResult).
* The name is either relative to the target context of the search
* (which is named by the name parameter), or
@@ -817,8 +817,8 @@ public interface DirContext extends Context {
* cons specifies a search scope of
* SearchControls.OBJECT_SCOPE or
* SearchControls.SUBSTREE_SCOPE), its name is the empty
- * string. The SearchResult may also contain attributes of the
- * matching object if the cons argument specified that attributes
+ * string. The {@code SearchResult} may also contain attributes of the
+ * matching object if the {@code cons} argument specified that attributes
* be returned.
*
* If the object does not have a requested attribute, that
@@ -839,8 +839,8 @@ public interface DirContext extends Context {
* @param cons
* the search controls that control the search. If null,
* the default search controls are used (equivalent
- * to (new SearchControls())).
- * @return an enumeration of SearchResults of
+ * to {@code (new SearchControls())}).
+ * @return an enumeration of {@code SearchResult}s of
* the objects that satisfy the filter; never null
*
* @throws InvalidSearchFilterException if the search filter specified is
@@ -872,9 +872,9 @@ public interface DirContext extends Context {
* @param cons
* the search controls that control the search. If null,
* the default search controls are used (equivalent
- * to (new SearchControls())).
+ * to {@code (new SearchControls())}).
*
- * @return an enumeration of SearchResults for
+ * @return an enumeration of {@code SearchResult}s for
* the objects that satisfy the filter.
* @throws InvalidSearchFilterException if the search filter specified is
* not supported or understood by the underlying directory
@@ -935,8 +935,8 @@ public interface DirContext extends Context {
* SearchControls.SUBSTREE_SCOPE),
* its name is the empty string.
*
- * The SearchResult may also contain attributes of the matching
- * object if the cons argument specifies that attributes be
+ * The {@code SearchResult} may also contain attributes of the matching
+ * object if the {@code cons} argument specifies that attributes be
* returned.
*
* If the object does not have a requested attribute, that
@@ -972,17 +972,17 @@ public interface DirContext extends Context {
* @param cons
* the search controls that control the search. If null,
* the default search controls are used (equivalent
- * to (new SearchControls())).
- * @return an enumeration of SearchResults of the objects
+ * to {@code (new SearchControls())}).
+ * @return an enumeration of {@code SearchResult}s of the objects
* that satisfy the filter; never null
*
- * @throws ArrayIndexOutOfBoundsException if filterExpr contains
+ * @throws ArrayIndexOutOfBoundsException if {@code filterExpr} contains
* {i} expressions where i is outside
* the bounds of the array filterArgs
- * @throws InvalidSearchControlsException if cons contains
+ * @throws InvalidSearchControlsException if {@code cons} contains
* invalid settings
- * @throws InvalidSearchFilterException if filterExpr with
- * filterArgs represents an invalid search filter
+ * @throws InvalidSearchFilterException if {@code filterExpr} with
+ * {@code filterArgs} represents an invalid search filter
* @throws NamingException if a naming exception is encountered
*
* @see #search(Name, Attributes, String[])
@@ -1017,17 +1017,17 @@ public interface DirContext extends Context {
* @param cons
* the search controls that control the search. If null,
* the default search controls are used (equivalent
- * to (new SearchControls())).
- * @return an enumeration of SearchResults of the objects
+ * to {@code (new SearchControls())}).
+ * @return an enumeration of {@code SearchResult}s of the objects
* that satisfy the filter; never null
*
- * @throws ArrayIndexOutOfBoundsException if filterExpr contains
+ * @throws ArrayIndexOutOfBoundsException if {@code filterExpr} contains
* {i} expressions where i is outside
* the bounds of the array filterArgs
- * @throws InvalidSearchControlsException if cons contains
+ * @throws InvalidSearchControlsException if {@code cons} contains
* invalid settings
- * @throws InvalidSearchFilterException if filterExpr with
- * filterArgs represents an invalid search filter
+ * @throws InvalidSearchFilterException if {@code filterExpr} with
+ * {@code filterArgs} represents an invalid search filter
* @throws NamingException if a naming exception is encountered
*/
public NamingEnumeration
diff --git a/jdk/src/java.naming/share/classes/javax/naming/directory/InitialDirContext.java b/jdk/src/java.naming/share/classes/javax/naming/directory/InitialDirContext.java
index 542ffda3f2d..d9104074fb3 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/InitialDirContext.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/InitialDirContext.java
@@ -49,14 +49,14 @@ public class InitialDirContext extends InitialContext implements DirContext {
* Constructs an initial DirContext with the option of not
* initializing it. This may be used by a constructor in
* a subclass when the value of the environment parameter
- * is not yet known at the time the InitialDirContext
+ * is not yet known at the time the {@code InitialDirContext}
* constructor is called. The subclass's constructor will
* call this constructor, compute the value of the environment,
- * and then call init() before returning.
+ * and then call {@code init()} before returning.
*
* @param lazy
* true means do not initialize the initial DirContext; false
- * is equivalent to calling new InitialDirContext()
+ * is equivalent to calling {@code new InitialDirContext()}
* @throws NamingException if a naming exception is encountered
*
* @see InitialContext#init(Hashtable)
@@ -69,7 +69,7 @@ public class InitialDirContext extends InitialContext implements DirContext {
/**
* Constructs an initial DirContext.
* No environment properties are supplied.
- * Equivalent to new InitialDirContext(null).
+ * Equivalent to {@code new InitialDirContext(null)}.
*
* @throws NamingException if a naming exception is encountered
*
@@ -82,12 +82,12 @@ public class InitialDirContext extends InitialContext implements DirContext {
/**
* Constructs an initial DirContext using the supplied environment.
* Environment properties are discussed in the
- * javax.naming.InitialContext class description.
+ * {@code javax.naming.InitialContext} class description.
*
- *
This constructor will not modify environment
+ *
This constructor will not modify {@code environment}
* or save a reference to it, but may save a clone.
* Caller should not modify mutable keys and values in
- * environment after it has been passed to the constructor.
+ * {@code environment} after it has been passed to the constructor.
*
* @param environment
* environment used to create the initial DirContext.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/directory/SearchControls.java b/jdk/src/java.naming/share/classes/javax/naming/directory/SearchControls.java
index ec4deb14efa..a08e454e289 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/SearchControls.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/SearchControls.java
@@ -54,7 +54,7 @@ public class SearchControls implements java.io.Serializable {
* It contains zero element if the named object does not satisfy
* the search filter specified in search().
*
- * The value of this constant is 0.
+ * The value of this constant is {@code 0}.
*/
public final static int OBJECT_SCOPE = 0;
@@ -68,7 +68,7 @@ public class SearchControls implements java.io.Serializable {
* The names of elements in the NamingEnumeration are atomic names
* relative to the named context.
*
- * The value of this constant is 1.
+ * The value of this constant is {@code 1}.
*/
public final static int ONELEVEL_SCOPE = 1;
/**
@@ -90,14 +90,14 @@ public class SearchControls implements java.io.Serializable {
* included in the enumeration with the empty string as
* its name.
*
- * The value of this constant is 2.
+ * The value of this constant is {@code 2}.
*/
public final static int SUBTREE_SCOPE = 2;
/**
* Contains the scope with which to apply the search. One of
- * ONELEVEL_SCOPE, OBJECT_SCOPE, or
- * SUBTREE_SCOPE.
+ * {@code ONELEVEL_SCOPE}, {@code OBJECT_SCOPE}, or
+ * {@code SUBTREE_SCOPE}.
* @serial
*/
private int searchScope;
@@ -117,7 +117,7 @@ public class SearchControls implements java.io.Serializable {
private boolean derefLink;
/**
- * Indicates whether object is returned in SearchResult.
+ * Indicates whether object is returned in {@code SearchResult}.
* @serial
*/
private boolean returnObj;
@@ -130,7 +130,7 @@ public class SearchControls implements java.io.Serializable {
/**
* Contains the list of attributes to be returned in
- * SearchResult for each matching entry of search. null
+ * {@code SearchResult} for each matching entry of search. {@code null}
* indicates that all attributes are to be returned.
* @serial
*/
diff --git a/jdk/src/java.naming/share/classes/javax/naming/directory/SearchResult.java b/jdk/src/java.naming/share/classes/javax/naming/directory/SearchResult.java
index 624b9fc89c6..3217e6b55fe 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/SearchResult.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/SearchResult.java
@@ -53,9 +53,9 @@ public class SearchResult extends Binding {
* Constructs a search result using the result's name, its bound object, and
* its attributes.
*
- * getClassName() will return the class name of obj
- * (or null if obj is null) unless the class name has been
- * explicitly set using setClassName().
+ * {@code getClassName()} will return the class name of {@code obj}
+ * (or null if {@code obj} is null) unless the class name has been
+ * explicitly set using {@code setClassName()}.
*
* @param name The non-null name of the search item. It is relative
* to the target context of the search (which is
@@ -76,9 +76,9 @@ public class SearchResult extends Binding {
* Constructs a search result using the result's name, its bound object, and
* its attributes, and whether the name is relative.
*
- * getClassName() will return the class name of obj
- * (or null if obj is null) unless the class name has been
- * explicitly set using setClassName()
+ * {@code getClassName()} will return the class name of {@code obj}
+ * (or null if {@code obj} is null) unless the class name has been
+ * explicitly set using {@code setClassName()}
*
* @param name The non-null name of the search item.
* @param obj The object bound to name. Can be null.
@@ -106,9 +106,9 @@ public class SearchResult extends Binding {
* named by the first parameter of the search() method)
*
* @param className The possibly null class name of the object
- * bound to name. If null, the class name of obj is
- * returned by getClassName(). If obj is also null,
- * getClassName() will return null.
+ * bound to {@code name}. If null, the class name of {@code obj} is
+ * returned by {@code getClassName()}. If {@code obj} is also null,
+ * {@code getClassName()} will return null.
* @param obj The object bound to name. Can be null.
* @param attrs The attributes that were requested to be returned with
* this search item. Cannot be null.
@@ -127,9 +127,9 @@ public class SearchResult extends Binding {
*
* @param name The non-null name of the search item.
* @param className The possibly null class name of the object
- * bound to name. If null, the class name of obj is
- * returned by getClassName(). If obj is also null,
- * getClassName() will return null.
+ * bound to {@code name}. If null, the class name of {@code obj} is
+ * returned by {@code getClassName()}. If {@code obj} is also null,
+ * {@code getClassName()} will return null.
* @param obj The object bound to name. Can be null.
* @param attrs The attributes that were requested to be returned with
* this search item. Cannot be null.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/directory/package.html b/jdk/src/java.naming/share/classes/javax/naming/directory/package.html
index 82d066b5c13..c1f1860e5cf 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/package.html
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/package.html
@@ -28,7 +28,7 @@ questions.
-Extends the javax.naming package to provide functionality
+Extends the javax.naming package to provide functionality
for accessing directory services.
@@ -47,20 +47,20 @@ objects using specified attributes.
The Directory Context
-The DirContext
+The DirContext
interface represents a directory context.
It defines methods for examining and updating attributes associated with a
directory object, or directory entry as it is sometimes
called.
-You use getAttributes() to retrieve the attributes
+You use getAttributes() to retrieve the attributes
associated with a directory object (for which you supply the name).
-Attributes are modified using modifyAttributes().
+Attributes are modified using modifyAttributes().
You can add, replace, or remove attributes and/or attribute values
using this operation.
-DirContext also behaves as a naming context
-by extending the Context interface in the javax.naming package.
+DirContext also behaves as a naming context
+by extending the Context interface in the javax.naming package.
This means that any directory object can also provide
a naming context.
For example, the directory object for a person might contain
@@ -69,13 +69,13 @@ a context for naming objects relative to that person
such as his printers and home directory.
Searches
-DirContext contains methods for
+DirContext contains methods for
performing content-based searching of the directory.
In the simplest and most common form of usage, the application
-specifies a set of attributes--possibly with specific
-values--to match, and submits this attribute set, to the
-search() method.
-There are other overloaded forms of search()
+specifies a set of attributes--possibly with specific
+values--to match, and submits this attribute set, to the
+search() method.
+There are other overloaded forms of search()
that support more sophisticated search filters.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/event/EventContext.java b/jdk/src/java.naming/share/classes/javax/naming/event/EventContext.java
index aacf161ebbe..7266dbb758e 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/event/EventContext.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/EventContext.java
@@ -35,7 +35,7 @@ import javax.naming.NamingException;
* events fired when objects named in a context changes.
*
*
Target
- * The name parameter in the addNamingListener() methods is referred
+ * The name parameter in the {@code addNamingListener()} methods is referred
* to as the target. The target, along with the scope, identify
* the object(s) that the listener is interested in.
* It is possible to register interest in a target that does not exist, but
@@ -44,23 +44,23 @@ import javax.naming.NamingException;
*
* If a service only supports registration for existing
* targets, an attempt to register for a nonexistent target
- * results in a NameNotFoundException being thrown as early as possible,
- * preferably at the time addNamingListener() is called, or if that is
+ * results in a {@code NameNotFoundException} being thrown as early as possible,
+ * preferably at the time {@code addNamingListener()} is called, or if that is
* not possible, the listener will receive the exception through the
- * NamingExceptionEvent.
+ * {@code NamingExceptionEvent}.
*
* Also, for service providers that only support registration for existing
* targets, when the target that a listener has registered for is
* subsequently removed from the namespace, the listener is notified
- * via a NamingExceptionEvent (containing a
- *NameNotFoundException).
+ * via a {@code NamingExceptionEvent} (containing a
+ *{@code NameNotFoundException}).
*
- * An application can use the method targetMustExist() to check
- * whether a EventContext supports registration
+ * An application can use the method {@code targetMustExist()} to check
+ * whether a {@code EventContext} supports registration
* of nonexistent targets.
*
*
Event Source
- * The EventContext instance on which you invoke the
+ * The {@code EventContext} instance on which you invoke the
* registration methods is the event source of the events that are
* (potentially) generated.
* The source is not necessarily the object named by the target.
@@ -69,7 +69,7 @@ import javax.naming.NamingException;
* In other words, the target,
* along with the scope parameter, are used to identify
* the object(s) that the listener is interested in, but the event source
- * is the EventContext instance with which the listener
+ * is the {@code EventContext} instance with which the listener
* has registered.
*
* For example, suppose a listener makes the following registration:
@@ -78,52 +78,52 @@ import javax.naming.NamingException;
* src.addNamingListener("x", SUBTREE_SCOPE, listener);
*
* When an object named "x/y" is subsequently deleted, the corresponding
- * NamingEvent (evt) must contain:
+ * {@code NamingEvent} ({@code evt}) must contain:
*
* Furthermore, listener registration/deregistration is with
- * the EventContext
+ * the {@code EventContext}
* instance, and not with the corresponding object in the namespace.
* If the program intends at some point to remove a listener, then it needs to
- * keep a reference to the EventContext instance on
- * which it invoked addNamingListener() (just as
+ * keep a reference to the {@code EventContext} instance on
+ * which it invoked {@code addNamingListener()} (just as
* it needs to keep a reference to the listener in order to remove it
- * later). It cannot expect to do a lookup() and get another instance of
- * a EventContext on which to perform the deregistration.
+ * later). It cannot expect to do a {@code lookup()} and get another instance of
+ * a {@code EventContext} on which to perform the deregistration.
*
Lifetime of Registration
* A registered listener becomes deregistered when:
*
- *
It is removed using removeNamingListener().
+ *
It is removed using {@code removeNamingListener()}.
*
An exception is thrown while collecting information about the events.
- * That is, when the listener receives a NamingExceptionEvent.
- *
Context.close() is invoked on the EventContext
+ * That is, when the listener receives a {@code NamingExceptionEvent}.
+ *
{@code Context.close()} is invoked on the {@code EventContext}
* instance with which it has registered.
- * Until that point, a EventContext instance that has outstanding
+ * Until that point, a {@code EventContext} instance that has outstanding
* listeners will continue to exist and be maintained by the service provider.
*
*
Listener Implementations
* The registration/deregistration methods accept an instance of
- * NamingListener. There are subinterfaces of NamingListener
- * for different of event types of NamingEvent.
- * For example, the ObjectChangeListener
- * interface is for the NamingEvent.OBJECT_CHANGED event type.
+ * {@code NamingListener}. There are subinterfaces of {@code NamingListener}
+ * for different of event types of {@code NamingEvent}.
+ * For example, the {@code ObjectChangeListener}
+ * interface is for the {@code NamingEvent.OBJECT_CHANGED} event type.
* To register interest in multiple event types, the listener implementation
- * should implement multiple NamingListener subinterfaces and use a
- * single invocation of addNamingListener().
+ * should implement multiple {@code NamingListener} subinterfaces and use a
+ * single invocation of {@code addNamingListener()}.
* In addition to reducing the number of method calls and possibly the code size
* of the listeners, this allows some service providers to optimize the
* registration.
*
*
Threading Issues
*
- * Like Context instances in general, instances of
- * EventContext are not guaranteed to be thread-safe.
+ * Like {@code Context} instances in general, instances of
+ * {@code EventContext} are not guaranteed to be thread-safe.
* Care must be taken when multiple threads are accessing the same
- * EventContext concurrently.
+ * {@code EventContext} concurrently.
* See the
* package description
* for more information on threading issues.
@@ -138,7 +138,7 @@ public interface EventContext extends Context {
* Constant for expressing interest in events concerning the object named
* by the target.
*
- * The value of this constant is 0.
+ * The value of this constant is {@code 0}.
*/
public final static int OBJECT_SCOPE = 0;
@@ -147,7 +147,7 @@ public interface EventContext extends Context {
* in the context named by the target,
* excluding the context named by the target.
*
- * The value of this constant is 1.
+ * The value of this constant is {@code 1}.
*/
public final static int ONELEVEL_SCOPE = 1;
@@ -156,7 +156,7 @@ public interface EventContext extends Context {
* in the subtree of the object named by the target, including the object
* named by the target.
*
- * The value of this constant is 2.
+ * The value of this constant is {@code 2}.
*/
public final static int SUBTREE_SCOPE = 2;
@@ -167,31 +167,31 @@ public interface EventContext extends Context {
*
* The event source of those events is this context. See the
* class description for a discussion on event source and target.
- * See the descriptions of the constants OBJECT_SCOPE,
- * ONELEVEL_SCOPE, and SUBTREE_SCOPE to see how
- * scope affects the registration.
+ * See the descriptions of the constants {@code OBJECT_SCOPE},
+ * {@code ONELEVEL_SCOPE}, and {@code SUBTREE_SCOPE} to see how
+ * {@code scope} affects the registration.
*
- * target needs to name a context only when scope is
- * ONELEVEL_SCOPE.
- * target may name a non-context if scope is either
- * OBJECT_SCOPE or SUBTREE_SCOPE. Using
- * SUBTREE_SCOPE for a non-context might be useful,
- * for example, if the caller does not know in advance whether target
+ * {@code target} needs to name a context only when {@code scope} is
+ * {@code ONELEVEL_SCOPE}.
+ * {@code target} may name a non-context if {@code scope} is either
+ * {@code OBJECT_SCOPE} or {@code SUBTREE_SCOPE}. Using
+ * {@code SUBTREE_SCOPE} for a non-context might be useful,
+ * for example, if the caller does not know in advance whether {@code target}
* is a context and just wants to register interest in the (possibly
- * degenerate subtree) rooted at target.
+ * degenerate subtree) rooted at {@code target}.
*
* When the listener is notified of an event, the listener may
* in invoked in a thread other than the one in which
- * addNamingListener() is executed.
+ * {@code addNamingListener()} is executed.
* Care must be taken when multiple threads are accessing the same
- * EventContext concurrently.
+ * {@code EventContext} concurrently.
* See the
* package description
* for more information on threading issues.
*
* @param target A nonnull name to be resolved relative to this context.
- * @param scope One of OBJECT_SCOPE, ONELEVEL_SCOPE, or
- * SUBTREE_SCOPE.
+ * @param scope One of {@code OBJECT_SCOPE}, {@code ONELEVEL_SCOPE}, or
+ * {@code SUBTREE_SCOPE}.
* @param l The nonnull listener.
* @exception NamingException If a problem was encountered while
* adding the listener.
@@ -204,12 +204,12 @@ public interface EventContext extends Context {
* Adds a listener for receiving naming events fired
* when the object named by the string target name and scope changes.
*
- * See the overload that accepts a Name for details.
+ * See the overload that accepts a {@code Name} for details.
*
* @param target The nonnull string name of the object resolved relative
* to this context.
- * @param scope One of OBJECT_SCOPE, ONELEVEL_SCOPE, or
- * SUBTREE_SCOPE.
+ * @param scope One of {@code OBJECT_SCOPE}, {@code ONELEVEL_SCOPE}, or
+ * {@code SUBTREE_SCOPE}.
* @param l The nonnull listener.
* @exception NamingException If a problem was encountered while
* adding the listener.
@@ -220,15 +220,15 @@ public interface EventContext extends Context {
/**
* Removes a listener from receiving naming events fired
- * by this EventContext.
+ * by this {@code EventContext}.
* The listener may have registered more than once with this
- * EventContext, perhaps with different target/scope arguments.
+ * {@code EventContext}, perhaps with different target/scope arguments.
* After this method is invoked, the listener will no longer
- * receive events with this EventContext instance
+ * receive events with this {@code EventContext} instance
* as the event source (except for those events already in the process of
* being dispatched).
* If the listener was not, or is no longer, registered with
- * this EventContext instance, this method does not do anything.
+ * this {@code EventContext} instance, this method does not do anything.
*
* @param l The nonnull listener.
* @exception NamingException If a problem was encountered while
diff --git a/jdk/src/java.naming/share/classes/javax/naming/event/EventDirContext.java b/jdk/src/java.naming/share/classes/javax/naming/event/EventDirContext.java
index 86defa1b099..8be88144157 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/event/EventDirContext.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/EventDirContext.java
@@ -42,17 +42,17 @@ import javax.naming.directory.SearchControls;
* satisfy the filter. However, there might be limitations in the extent
* to which this can be supported by the service provider and underlying
* protocol/service. If the caller submits a filter that cannot be
- * supported in this way, addNamingListener() throws an
- * InvalidSearchFilterException.
+ * supported in this way, {@code addNamingListener()} throws an
+ * {@code InvalidSearchFilterException}.
*
- * See EventContext for a description of event source
+ * See {@code EventContext} for a description of event source
* and target, and information about listener registration/deregistration
* that are also applicable to methods in this interface.
* See the
* package description
* for information on threading issues.
*
- * A SearchControls or array object
+ * A {@code SearchControls} or array object
* passed as a parameter to any method is owned by the caller.
* The service provider will not modify the object or keep a reference to it.
*
@@ -64,15 +64,15 @@ import javax.naming.directory.SearchControls;
public interface EventDirContext extends EventContext, DirContext {
/**
* Adds a listener for receiving naming events fired
- * when objects identified by the search filter filter at
+ * when objects identified by the search filter {@code filter} at
* the object named by target are modified.
*
* The scope, returningObj flag, and returningAttributes flag from
- * the search controls ctls are used to control the selection
+ * the search controls {@code ctls} are used to control the selection
* of objects that the listener is interested in,
* and determines what information is returned in the eventual
- * NamingEvent object. Note that the requested
- * information to be returned might not be present in the NamingEvent
+ * {@code NamingEvent} object. Note that the requested
+ * information to be returned might not be present in the {@code NamingEvent}
* object if they are unavailable or could not be obtained by the
* service provider or service.
*
@@ -91,9 +91,9 @@ public interface EventDirContext extends EventContext, DirContext {
/**
* Adds a listener for receiving naming events fired when
- * objects identified by the search filter filter at the
+ * objects identified by the search filter {@code filter} at the
* object named by the string target name are modified.
- * See the overload that accepts a Name for details of
+ * See the overload that accepts a {@code Name} for details of
* how this method behaves.
*
* @param target The nonnull string name of the object resolved relative to this context.
@@ -111,14 +111,14 @@ public interface EventDirContext extends EventContext, DirContext {
/**
* Adds a listener for receiving naming events fired
- * when objects identified by the search filter filter and
+ * when objects identified by the search filter {@code filter} and
* filter arguments at the object named by the target are modified.
* The scope, returningObj flag, and returningAttributes flag from
- * the search controls ctls are used to control the selection
+ * the search controls {@code ctls} are used to control the selection
* of objects that the listener is interested in,
* and determines what information is returned in the eventual
- * NamingEvent object. Note that the requested
- * information to be returned might not be present in the NamingEvent
+ * {@code NamingEvent} object. Note that the requested
+ * information to be returned might not be present in the {@code NamingEvent}
* object if they are unavailable or could not be obtained by the
* service provider or service.
*
@@ -138,10 +138,10 @@ public interface EventDirContext extends EventContext, DirContext {
/**
* Adds a listener for receiving naming events fired when
- * objects identified by the search filter filter
+ * objects identified by the search filter {@code filter}
* and filter arguments at the
* object named by the string target name are modified.
- * See the overload that accepts a Name for details of
+ * See the overload that accepts a {@code Name} for details of
* how this method behaves.
*
* @param target The nonnull string name of the object resolved relative to this context.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/event/NamespaceChangeListener.java b/jdk/src/java.naming/share/classes/javax/naming/event/NamespaceChangeListener.java
index 281981daeb9..b20fc33e2f1 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/event/NamespaceChangeListener.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/NamespaceChangeListener.java
@@ -28,21 +28,21 @@ package javax.naming.event;
/**
* Specifies the methods that a listener interested in namespace changes
* must implement.
- * Specifically, the listener is interested in NamingEvents
- * with event types of OBJECT_ADDED, OBJECT_RENAMED, or
- * OBJECT_REMOVED.
+ * Specifically, the listener is interested in {@code NamingEvent}s
+ * with event types of {@code OBJECT_ADDED, OBJECT_RENAMED}, or
+ * {@code OBJECT_REMOVED}.
*
* Such a listener must:
*
*
Implement this interface and its methods.
- *
Implement NamingListener.namingExceptionThrown() so that
+ *
Implement {@code NamingListener.namingExceptionThrown()} so that
* it will be notified of exceptions thrown while attempting to
* collect information about the events.
- *
Register with the source using the source's addNamingListener()
+ *
Register with the source using the source's {@code addNamingListener()}
* method.
*
- * A listener that wants to be notified of OBJECT_CHANGED event types
- * should also implement the ObjectChangeListener
+ * A listener that wants to be notified of {@code OBJECT_CHANGED} event types
+ * should also implement the {@code ObjectChangeListener}
* interface.
*
* @author Rosanna Lee
@@ -60,7 +60,7 @@ public interface NamespaceChangeListener extends NamingListener {
* Called when an object has been added.
*
* The binding of the newly added object can be obtained using
- * evt.getNewBinding().
+ * {@code evt.getNewBinding()}.
* @param evt The nonnull event.
* @see NamingEvent#OBJECT_ADDED
*/
@@ -70,7 +70,7 @@ public interface NamespaceChangeListener extends NamingListener {
* Called when an object has been removed.
*
* The binding of the newly removed object can be obtained using
- * evt.getOldBinding().
+ * {@code evt.getOldBinding()}.
* @param evt The nonnull event.
* @see NamingEvent#OBJECT_REMOVED
*/
@@ -80,8 +80,8 @@ public interface NamespaceChangeListener extends NamingListener {
* Called when an object has been renamed.
*
* The binding of the renamed object can be obtained using
- * evt.getNewBinding(). Its old binding (before the rename)
- * can be obtained using evt.getOldBinding().
+ * {@code evt.getNewBinding()}. Its old binding (before the rename)
+ * can be obtained using {@code evt.getOldBinding()}.
* One of these may be null if the old/new binding was outside the
* scope in which the listener has registered interest.
* @param evt The nonnull event.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/event/NamingEvent.java b/jdk/src/java.naming/share/classes/javax/naming/event/NamingEvent.java
index 4655e55ef91..b604ec0e2ba 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/event/NamingEvent.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/NamingEvent.java
@@ -30,9 +30,9 @@ import javax.naming.Binding;
/**
* This class represents an event fired by a naming/directory service.
*
- * The NamingEvent's state consists of
+ * The {@code NamingEvent}'s state consists of
*
- *
The event source: the EventContext which fired this event.
+ *
The event source: the {@code EventContext} which fired this event.
*
The event type.
*
The new binding: information about the object after the change.
*
The old binding: information about the object before the change.
@@ -41,24 +41,24 @@ import javax.naming.Binding;
* information.
*
*
- * Note that the event source is always the same EventContext
+ * Note that the event source is always the same {@code EventContext}
* instance that the listener has registered with.
* Furthermore, the names of the bindings in
- * the NamingEvent are always relative to that instance.
+ * the {@code NamingEvent} are always relative to that instance.
* For example, suppose a listener makes the following registration:
*
* When an object named "x/y" is subsequently deleted, the corresponding
- * NamingEvent (evt) must contain:
+ * {@code NamingEvent} ({@code evt}) must contain:
*
*
* Care must be taken when multiple threads are accessing the same
- * EventContext concurrently.
+ * {@code EventContext} concurrently.
* See the
* package description
* for more information on threading issues.
@@ -73,13 +73,13 @@ import javax.naming.Binding;
public class NamingEvent extends java.util.EventObject {
/**
* Naming event type for indicating that a new object has been added.
- * The value of this constant is 0.
+ * The value of this constant is {@code 0}.
*/
public static final int OBJECT_ADDED = 0;
/**
* Naming event type for indicating that an object has been removed.
- * The value of this constant is 1.
+ * The value of this constant is {@code 1}.
*/
public static final int OBJECT_REMOVED = 1;
@@ -90,7 +90,7 @@ public class NamingEvent extends java.util.EventObject {
* be implemented by adding a binding with the new name and removing
* the old binding.
*
- * The old/new binding in NamingEvent may be null if the old
+ * The old/new binding in {@code NamingEvent} may be null if the old
* name or new name is outside of the scope for which the listener
* has registered.
*
@@ -102,7 +102,7 @@ public class NamingEvent extends java.util.EventObject {
* corresponding provider might not be able to prevent those
* notifications from being propagated to the listeners.
*
- * The value of this constant is 2.
+ * The value of this constant is {@code 2}.
*/
public static final int OBJECT_RENAMED = 2;
@@ -114,7 +114,7 @@ public class NamingEvent extends java.util.EventObject {
* be implemented by first removing the old binding and adding
* a new binding containing the same name but a different object.
*
- * The value of this constant is 3.
+ * The value of this constant is {@code 3}.
*/
public static final int OBJECT_CHANGED = 3;
@@ -147,16 +147,16 @@ public class NamingEvent extends java.util.EventObject {
protected Binding newBinding;
/**
- * Constructs an instance of NamingEvent.
+ * Constructs an instance of {@code NamingEvent}.
*
- * The names in newBd and oldBd are to be resolved relative
- * to the event source source.
+ * The names in {@code newBd} and {@code oldBd} are to be resolved relative
+ * to the event source {@code source}.
*
- * For an OBJECT_ADDED event type, newBd must not be null.
- * For an OBJECT_REMOVED event type, oldBd must not be null.
- * For an OBJECT_CHANGED event type, newBd and
- * oldBd must not be null. For an OBJECT_RENAMED event type,
- * one of newBd or oldBd may be null if the new or old
+ * For an {@code OBJECT_ADDED} event type, {@code newBd} must not be null.
+ * For an {@code OBJECT_REMOVED} event type, {@code oldBd} must not be null.
+ * For an {@code OBJECT_CHANGED} event type, {@code newBd} and
+ * {@code oldBd} must not be null. For an {@code OBJECT_RENAMED} event type,
+ * one of {@code newBd} or {@code oldBd} may be null if the new or old
* binding is outside of the scope for which the listener has registered.
*
* @param source The non-null context that fired this event.
@@ -192,13 +192,13 @@ public class NamingEvent extends java.util.EventObject {
/**
* Retrieves the event source that fired this event.
- * This returns the same object as EventObject.getSource().
+ * This returns the same object as {@code EventObject.getSource()}.
*
* If the result of this method is used to access the
* event source, for example, to look up the object or get its attributes,
- * then it needs to be locked because implementations of Context
+ * then it needs to be locked because implementations of {@code Context}
* are not guaranteed to be thread-safe
- * (and EventContext is a subinterface of Context).
+ * (and {@code EventContext} is a subinterface of {@code Context}).
* See the
* package description
* for more information on threading issues.
@@ -213,16 +213,16 @@ public class NamingEvent extends java.util.EventObject {
* Retrieves the binding of the object before the change.
*
* The binding must be nonnull if the object existed before the change
- * relative to the source context (getEventContext()).
- * That is, it must be nonnull for OBJECT_REMOVED and
- * OBJECT_CHANGED.
- * For OBJECT_RENAMED, it is null if the object before the rename
+ * relative to the source context ({@code getEventContext()}).
+ * That is, it must be nonnull for {@code OBJECT_REMOVED} and
+ * {@code OBJECT_CHANGED}.
+ * For {@code OBJECT_RENAMED}, it is null if the object before the rename
* is outside of the scope for which the listener has registered interest;
* it is nonnull if the object is inside the scope before the rename.
*
* The name in the binding is to be resolved relative
- * to the event source getEventContext().
- * The object returned by Binding.getObject() may be null if
+ * to the event source {@code getEventContext()}.
+ * The object returned by {@code Binding.getObject()} may be null if
* such information is unavailable.
*
* @return The possibly null binding of the object before the change.
@@ -235,16 +235,16 @@ public class NamingEvent extends java.util.EventObject {
* Retrieves the binding of the object after the change.
*
* The binding must be nonnull if the object existed after the change
- * relative to the source context (getEventContext()).
- * That is, it must be nonnull for OBJECT_ADDED and
- * OBJECT_CHANGED. For OBJECT_RENAMED,
+ * relative to the source context ({@code getEventContext()}).
+ * That is, it must be nonnull for {@code OBJECT_ADDED} and
+ * {@code OBJECT_CHANGED}. For {@code OBJECT_RENAMED},
* it is null if the object after the rename is outside the scope for
* which the listener registered interest; it is nonnull if the object
* is inside the scope after the rename.
*
* The name in the binding is to be resolved relative
- * to the event source getEventContext().
- * The object returned by Binding.getObject() may be null if
+ * to the event source {@code getEventContext()}.
+ * The object returned by {@code Binding.getObject()} may be null if
* such information is unavailable.
*
* @return The possibly null binding of the object after the change.
@@ -268,8 +268,8 @@ public class NamingEvent extends java.util.EventObject {
* Invokes the appropriate listener method on this event.
* The default implementation of
* this method handles the following event types:
- * OBJECT_ADDED, OBJECT_REMOVED,
- * OBJECT_RENAMED, OBJECT_CHANGED.
+ * {@code OBJECT_ADDED, OBJECT_REMOVED,
+ * OBJECT_RENAMED, OBJECT_CHANGED}.
*
* The listener method is executed in the same thread
* as this method. See the
diff --git a/jdk/src/java.naming/share/classes/javax/naming/event/NamingExceptionEvent.java b/jdk/src/java.naming/share/classes/javax/naming/event/NamingExceptionEvent.java
index 94aa11e394c..e8457a6e6f2 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/event/NamingExceptionEvent.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/NamingExceptionEvent.java
@@ -30,9 +30,9 @@ import javax.naming.NamingException;
/**
* This class represents an event fired when the procedures/processes
* used to collect information for notifying listeners of
- * NamingEvents threw a NamingException.
+ * {@code NamingEvent}s threw a {@code NamingException}.
* This can happen, for example, if the server which the listener is using
- * aborts subsequent to the addNamingListener() call.
+ * aborts subsequent to the {@code addNamingListener()} call.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -50,12 +50,12 @@ public class NamingExceptionEvent extends java.util.EventObject {
private NamingException exception;
/**
- * Constructs an instance of NamingExceptionEvent using
- * the context in which the NamingException was thrown and the exception
+ * Constructs an instance of {@code NamingExceptionEvent} using
+ * the context in which the {@code NamingException} was thrown and the exception
* that was thrown.
*
* @param source The non-null context in which the exception was thrown.
- * @param exc The non-null NamingException that was thrown.
+ * @param exc The non-null {@code NamingException} that was thrown.
*
*/
public NamingExceptionEvent(EventContext source, NamingException exc) {
@@ -72,16 +72,16 @@ public class NamingExceptionEvent extends java.util.EventObject {
}
/**
- * Retrieves the EventContext that fired this event.
- * This returns the same object as EventObject.getSource().
- * @return The non-null EventContext that fired this event.
+ * Retrieves the {@code EventContext} that fired this event.
+ * This returns the same object as {@code EventObject.getSource()}.
+ * @return The non-null {@code EventContext} that fired this event.
*/
public EventContext getEventContext() {
return (EventContext)getSource();
}
/**
- * Invokes the namingExceptionThrown() method on
+ * Invokes the {@code namingExceptionThrown()} method on
* a listener using this event.
* @param listener The non-null naming listener on which to invoke
* the method.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/event/NamingListener.java b/jdk/src/java.naming/share/classes/javax/naming/event/NamingListener.java
index 943d60f5ed7..b59432a0791 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/event/NamingListener.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/NamingListener.java
@@ -27,22 +27,22 @@ package javax.naming.event;
/**
* This interface is the root of listener interfaces that
- * handle NamingEvents.
+ * handle {@code NamingEvent}s.
* It does not make sense for a listener to implement just this interface.
- * A listener typically implements a subinterface of NamingListener,
- * such as ObjectChangeListener or NamespaceChangeListener.
+ * A listener typically implements a subinterface of {@code NamingListener},
+ * such as {@code ObjectChangeListener} or {@code NamespaceChangeListener}.
*
- * This interface contains a single method, namingExceptionThrown(),
+ * This interface contains a single method, {@code namingExceptionThrown()},
* that must be implemented so that the listener can be notified of
* exceptions that are thrown (by the service provider) while gathering
* information about the events that they're interested in.
* When this method is invoked, the listener has been automatically deregistered
- * from the EventContext with which it has registered.
+ * from the {@code EventContext} with which it has registered.
*
- * For example, suppose a listener implements ObjectChangeListener and
- * registers with a EventContext.
+ * For example, suppose a listener implements {@code ObjectChangeListener} and
+ * registers with a {@code EventContext}.
* Then, if the connection to the server is subsequently broken,
- * the listener will receive a NamingExceptionEvent and may
+ * the listener will receive a {@code NamingExceptionEvent} and may
* take some corrective action, such as notifying the user of the application.
*
* @author Rosanna Lee
@@ -57,7 +57,7 @@ package javax.naming.event;
public interface NamingListener extends java.util.EventListener {
/**
* Called when a naming exception is thrown while attempting
- * to fire a NamingEvent.
+ * to fire a {@code NamingEvent}.
*
* @param evt The nonnull event.
*/
diff --git a/jdk/src/java.naming/share/classes/javax/naming/event/ObjectChangeListener.java b/jdk/src/java.naming/share/classes/javax/naming/event/ObjectChangeListener.java
index 0d715fa9274..0f22f0d1242 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/event/ObjectChangeListener.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/ObjectChangeListener.java
@@ -26,27 +26,27 @@
package javax.naming.event;
/**
- * Specifies the method that a listener of a NamingEvent
- * with event type of OBJECT_CHANGED must implement.
+ * Specifies the method that a listener of a {@code NamingEvent}
+ * with event type of {@code OBJECT_CHANGED} must implement.
*
- * An OBJECT_CHANGED event type is fired when (the contents of)
+ * An {@code OBJECT_CHANGED} event type is fired when (the contents of)
* an object has changed. This might mean that its attributes have been modified,
* added, or removed, and/or that the object itself has been replaced.
* How the object has changed can be determined by examining the
- * NamingEvent's old and new bindings.
+ * {@code NamingEvent}'s old and new bindings.
*
- * A listener interested in OBJECT_CHANGED event types must:
+ * A listener interested in {@code OBJECT_CHANGED} event types must:
*
*
- *
Implement this interface and its method (objectChanged())
- *
Implement NamingListener.namingExceptionThrown() so that
+ *
Implement this interface and its method ({@code objectChanged()})
+ *
Implement {@code NamingListener.namingExceptionThrown()} so that
* it will be notified of exceptions thrown while attempting to
* collect information about the events.
- *
Register with the source using the source's addNamingListener()
+ *
Register with the source using the source's {@code addNamingListener()}
* method.
*
* A listener that wants to be notified of namespace change events
- * should also implement the NamespaceChangeListener
+ * should also implement the {@code NamespaceChangeListener}
* interface.
*
* @author Rosanna Lee
@@ -64,8 +64,8 @@ public interface ObjectChangeListener extends NamingListener {
* Called when an object has been changed.
*
* The binding of the changed object can be obtained using
- * evt.getNewBinding(). Its old binding (before the change)
- * can be obtained using evt.getOldBinding().
+ * {@code evt.getNewBinding()}. Its old binding (before the change)
+ * can be obtained using {@code evt.getOldBinding()}.
* @param evt The nonnull naming event.
* @see NamingEvent#OBJECT_CHANGED
*/
diff --git a/jdk/src/java.naming/share/classes/javax/naming/event/package.html b/jdk/src/java.naming/share/classes/javax/naming/event/package.html
index e0db2305048..f63baf85dd8 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/event/package.html
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/package.html
@@ -42,21 +42,21 @@ already deployed ones--can be accessed in a common way.
Naming Events
-This package defines a NamingEvent class to represent an event
+This package defines a NamingEvent class to represent an event
that is generated by a naming/directory service.
-It also defines subinterfaces of Context and DirContext,
-called EventContext and EventDirContext,
+It also defines subinterfaces of Context and DirContext,
+called EventContext and EventDirContext,
through which applications can register their interest in events
fired by the context.
-NamingEvent represents an event that occurs in a
+NamingEvent represents an event that occurs in a
naming or directory service. There are two categories of naming events:
Those that affect the namespace (add/remove/rename an object)
Those that affect the objects' contents.
Each category of events is handled by a corresponding listener:
-NamespaceChangeListener, ObjectChangeListener.
+NamespaceChangeListener, ObjectChangeListener.
An application, for example, can register its interest in changes to
objects in a context as follows:
@@ -82,19 +82,19 @@ class ChangeHandler implements ObjectChangeListener {
Threading Issues
When an event is dispatched to a listener, the listener method (such
-as objectChanged()) may be executed in a thread other than the
-one in which the call to addNamingListener() was executed.
+as objectChanged()) may be executed in a thread other than the
+one in which the call to addNamingListener() was executed.
The choice of which thread to use is made by the service provider.
When an event is dispatched to multiple listeners, the service provider
may choose (and is generally encouraged) to execute the listener methods
concurrently in separate threads.
-When a listener instance invokes NamingEvent.getEventContext(),
+When a listener instance invokes NamingEvent.getEventContext(),
it must take into account the possibility that other threads will be
working with that context concurrently. Likewise, when a listener is
-registered via addNamingListener(), the registering thread
+registered via addNamingListener(), the registering thread
must take into account the likely possibility that the service provider
-will later invoke the listeners in newly-created threads. As Context
+will later invoke the listeners in newly-created threads. As Context
instances are not guaranteed to be thread-safe in general, all context
operations must be synchronized as needed.
@@ -107,9 +107,9 @@ to make a request to the server to register interest in changes
on the server that will eventually be translated into events.
If an exception occurs that prevents information about the events from
being collected, the listener will never be notified of the events.
-When such an exception occurs, a NamingExceptionEvent is
+When such an exception occurs, a NamingExceptionEvent is
fired to notify the listener. The listener's
-namingExceptionThrown() method is invoked, as shown in the
+namingExceptionThrown() method is invoked, as shown in the
sample code above,
and the listener is automatically deregistered.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/BasicControl.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/BasicControl.java
index 5ce57a57203..0060d281563 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/BasicControl.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/BasicControl.java
@@ -26,7 +26,7 @@
package javax.naming.ldap;
/**
- * This class provides a basic implementation of the Control
+ * This class provides a basic implementation of the {@code Control}
* interface. It represents an LDAPv3 Control as defined in
* RFC 2251.
*
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/Control.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/Control.java
index b496716740f..93d21019f65 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/Control.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/Control.java
@@ -52,13 +52,13 @@ package javax.naming.ldap;
public interface Control extends java.io.Serializable {
/**
* Indicates a critical control.
- * The value of this constant is true.
+ * The value of this constant is {@code true}.
*/
public static final boolean CRITICAL = true;
/**
* Indicates a non-critical control.
- * The value of this constant is false.
+ * The value of this constant is {@code false}.
*/
public static final boolean NONCRITICAL = false;
@@ -75,7 +75,7 @@ public interface Control extends java.io.Serializable {
* In other words, if the server receives a critical control
* that it does not support, regardless of whether the control
* makes sense for the operation, the operation will not be performed
- * and an OperationNotSupportedException will be thrown.
+ * and an {@code OperationNotSupportedException} will be thrown.
* @return true if this control is critical; false otherwise.
*/
public boolean isCritical();
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/ControlFactory.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/ControlFactory.java
index 8d754d02b85..afb28ad347f 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/ControlFactory.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/ControlFactory.java
@@ -65,7 +65,7 @@ public abstract class ControlFactory {
* Without this mechanism, the provider would be returning
* controls that only contained data in BER encoded format.
*
- * Typically, ctl is a "basic" control containing
+ * Typically, {@code ctl} is a "basic" control containing
* BER encoded data. The factory is used to create a specialized
* control implementation, usually by decoding the BER encoded data,
* that provides methods to access that data in a type-safe and friendly
@@ -80,14 +80,14 @@ public abstract class ControlFactory {
* it is the only intended factory and that no other control factories
* should be tried. This might happen, for example, if the BER data
* in the control does not match what is expected of a control with
- * the given OID. Since this method throws NamingException,
+ * the given OID. Since this method throws {@code NamingException},
* any other internally generated exception that should be propagated
- * must be wrapped inside a NamingException.
+ * must be wrapped inside a {@code NamingException}.
*
* @param ctl A non-null control.
*
* @return A possibly null Control.
- * @exception NamingException If ctl contains invalid data that prevents it
+ * @exception NamingException If {@code ctl} contains invalid data that prevents it
* from being used to create a control. A factory should only throw
* an exception if it knows how to produce the control (identified by the OID)
* but is unable to because of, for example invalid BER data.
@@ -100,14 +100,14 @@ public abstract class ControlFactory {
* The following rule is used to create the control:
*
*
Use the control factories specified in
- * the LdapContext.CONTROL_FACTORIES property of the
+ * the {@code LdapContext.CONTROL_FACTORIES} property of the
* environment, and of the provider resource file associated with
- * ctx, in that order.
+ * {@code ctx}, in that order.
* The value of this property is a colon-separated list of factory
* class names that are tried in order, and the first one that succeeds
* in creating the control is the one used.
* If none of the factories can be loaded,
- * return ctl.
+ * return {@code ctl}.
* If an exception is encountered while creating the control, the
* exception is passed up to the caller.
*
@@ -119,9 +119,9 @@ public abstract class ControlFactory {
* @param ctx The possibly null context in which the control is being created.
* If null, no such information is available.
* @param env The possibly null environment of the context. This is used
- * to find the value of the LdapContext.CONTROL_FACTORIES property.
- * @return A control object created using ctl; or
- * ctl if a control object cannot be created using
+ * to find the value of the {@code LdapContext.CONTROL_FACTORIES} property.
+ * @return A control object created using {@code ctl}; or
+ * {@code ctl} if a control object cannot be created using
* the algorithm described above.
* @exception NamingException if a naming exception was encountered
* while attempting to create the control object.
@@ -129,7 +129,7 @@ public abstract class ControlFactory {
* exception, it is propagated up to the caller.
* If an error was encountered while loading
* and instantiating the factory and object classes, the exception
- * is wrapped inside a NamingException and then rethrown.
+ * is wrapped inside a {@code NamingException} and then rethrown.
*/
public static Control getControlInstance(Control ctl, Context ctx,
Hashtable,?> env)
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedRequest.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedRequest.java
index a528df5e28a..b37b65f1275 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedRequest.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedRequest.java
@@ -43,7 +43,7 @@ import javax.naming.NamingException;
* the classes that implement this interface, supplying them with
* any information required for a particular extended operation request.
* It would then pass such a class as an argument to the
- * LdapContext.extendedOperation() method for performing the
+ * {@code LdapContext.extendedOperation()} method for performing the
* LDAPv3 extended operation.
*
* For example, suppose the LDAP server supported a 'get time' extended operation.
@@ -90,7 +90,7 @@ public interface ExtendedRequest extends java.io.Serializable {
* Retrieves the object identifier of the request.
*
* @return The non-null object identifier string representing the LDAP
- * ExtendedRequest.requestName component.
+ * {@code ExtendedRequest.requestName} component.
*/
public String getID();
@@ -104,7 +104,7 @@ public interface ExtendedRequest extends java.io.Serializable {
* put into the extended operation to be sent to the LDAP server.
*
* @return A possibly null byte array representing the ASN.1 BER encoded
- * contents of the LDAP ExtendedRequest.requestValue
+ * contents of the LDAP {@code ExtendedRequest.requestValue}
* component.
* @exception IllegalStateException If the encoded value cannot be retrieved
* because the request contains insufficient or invalid data/state.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedResponse.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedResponse.java
index 576aa333246..36c83fd122c 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedResponse.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedResponse.java
@@ -78,7 +78,7 @@ public interface ExtendedResponse extends java.io.Serializable {
* If the server does not send it, the response will contain no ID (i.e. null).
*
* @return A possibly null object identifier string representing the LDAP
- * ExtendedResponse.responseName component.
+ * {@code ExtendedResponse.responseName} component.
*/
public String getID();
@@ -90,7 +90,7 @@ public interface ExtendedResponse extends java.io.Serializable {
* the response value. It does not include the response OID.
*
* @return A possibly null byte array representing the ASN.1 BER encoded
- * contents of the LDAP ExtendedResponse.response
+ * contents of the LDAP {@code ExtendedResponse.response}
* component.
*/
public byte[] getEncodedValue();
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/HasControls.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/HasControls.java
index fddc1bb3820..d90192ac262 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/HasControls.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/HasControls.java
@@ -60,10 +60,10 @@ import javax.naming.NamingException;
public interface HasControls {
/**
- * Retrieves an array of Controls from the object that
+ * Retrieves an array of {@code Control}s from the object that
* implements this interface. It is null if there are no controls.
*
- * @return A possibly null array of Control objects.
+ * @return A possibly null array of {@code Control} objects.
* @throws NamingException If cannot return controls due to an error.
*/
public Control[] getControls() throws NamingException;
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/InitialLdapContext.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/InitialLdapContext.java
index 1804829d34a..ad64f232b1f 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/InitialLdapContext.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/InitialLdapContext.java
@@ -34,24 +34,24 @@ import java.util.Hashtable;
* This class is the starting context for performing
* LDAPv3-style extended operations and controls.
*
- * See javax.naming.InitialContext and
- * javax.naming.InitialDirContext for details on synchronization,
+ * See {@code javax.naming.InitialContext} and
+ * {@code javax.naming.InitialDirContext} for details on synchronization,
* and the policy for how an initial context is created.
*
*
Request Controls
- * When you create an initial context (InitialLdapContext),
+ * When you create an initial context ({@code InitialLdapContext}),
* you can specify a list of request controls.
* These controls will be used as the request controls for any
* implicit LDAP "bind" operation performed by the context or contexts
* derived from the context. These are called connection request controls.
- * Use getConnectControls() to get a context's connection request
+ * Use {@code getConnectControls()} to get a context's connection request
* controls.
*
* The request controls supplied to the initial context constructor
* are not used as the context request controls
* for subsequent context operations such as searches and lookups.
* Context request controls are set and updated by using
- * setRequestControls().
+ * {@code setRequestControls()}.
*
* As shown, there can be two different sets of request controls
* associated with a context: connection request controls and context
@@ -67,14 +67,14 @@ import java.util.Hashtable;
* Controls[] respCtls = lctx.getResponseControls();
*
* It specifies first the critical controls for creating the initial context
- * (critConnCtls), and then sets the context's request controls
- * (critModCtls) for the context operation. If for some reason
- * lctx needs to reconnect to the server, it will use
- * critConnCtls. See the LdapContext interface for
+ * ({@code critConnCtls}), and then sets the context's request controls
+ * ({@code critModCtls}) for the context operation. If for some reason
+ * {@code lctx} needs to reconnect to the server, it will use
+ * {@code critConnCtls}. See the {@code LdapContext} interface for
* more discussion about request controls.
*
* Service provider implementors should read the "Service Provider" section
- * in the LdapContext class description for implementation details.
+ * in the {@code LdapContext} class description for implementation details.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -94,7 +94,7 @@ public class InitialLdapContext extends InitialDirContext implements LdapContext
/**
* Constructs an initial context using no environment properties or
* connection request controls.
- * Equivalent to new InitialLdapContext(null, null).
+ * Equivalent to {@code new InitialLdapContext(null, null)}.
*
* @throws NamingException if a naming exception is encountered
*/
@@ -105,15 +105,15 @@ public class InitialLdapContext extends InitialDirContext implements LdapContext
/**
* Constructs an initial context
* using environment properties and connection request controls.
- * See javax.naming.InitialContext for a discussion of
+ * See {@code javax.naming.InitialContext} for a discussion of
* environment properties.
*
*
This constructor will not modify its parameters or
* save references to them, but may save a clone or copy.
* Caller should not modify mutable keys and values in
- * environment after it has been passed to the constructor.
+ * {@code environment} after it has been passed to the constructor.
*
- *
connCtls is used as the underlying context instance's
+ *
{@code connCtls} is used as the underlying context instance's
* connection request controls. See the class description
* for details.
*
@@ -159,7 +159,7 @@ public class InitialLdapContext extends InitialDirContext implements LdapContext
*
* @return The non-null cached initial context.
* @exception NotContextException If the initial context is not an
- * instance of LdapContext.
+ * instance of {@code LdapContext}.
* @exception NamingException If a naming exception was encountered.
*/
private LdapContext getDefaultLdapInitCtx() throws NamingException{
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapContext.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapContext.java
index d70b865790e..43cb3352d81 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapContext.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapContext.java
@@ -35,7 +35,7 @@ import java.util.Hashtable;
* extended operations.
*
* For applications that do not require such controls or extended
- * operations, the more generic javax.naming.directory.DirContext
+ * operations, the more generic {@code javax.naming.directory.DirContext}
* should be used instead.
*
*
Usage Details About Controls
@@ -44,7 +44,7 @@ import java.util.Hashtable;
* At a high level, this support allows a user
* program to set request controls for LDAP operations that are executed
* in the course of the user program's invocation of
- * Context/DirContext
+ * {@code Context}/{@code DirContext}
* methods, and read response controls resulting from LDAP operations.
* At the implementation level, there are some details that developers of
* both the user program and service providers need to understand in order
@@ -78,60 +78,60 @@ import java.util.Hashtable;
*
Context Request Controls
* There are two ways in which a context instance gets its request controls:
*
- *
ldapContext.newInstance(reqCtls)
- *
ldapContext.setRequestControls(reqCtls)
+ *
ldapContext.newInstance(reqCtls)
+ *
ldapContext.setRequestControls(reqCtls)
*
- * where ldapContext is an instance of LdapContext.
- * Specifying null or an empty array for reqCtls
+ * where {@code ldapContext} is an instance of {@code LdapContext}.
+ * Specifying {@code null} or an empty array for {@code reqCtls}
* means no request controls.
- * newInstance() creates a new instance of a context using
- * reqCtls, while setRequestControls()
- * updates an existing context instance's request controls to reqCtls.
+ * {@code newInstance()} creates a new instance of a context using
+ * {@code reqCtls}, while {@code setRequestControls()}
+ * updates an existing context instance's request controls to {@code reqCtls}.
*
* Unlike environment properties, request controls of a context instance
* are not inherited by context instances that are derived from
- * it. Derived context instances have null as their context
+ * it. Derived context instances have {@code null} as their context
* request controls. You must set the request controls of a derived context
- * instance explicitly using setRequestControls().
+ * instance explicitly using {@code setRequestControls()}.
*
* A context instance's request controls are retrieved using
- * the method getRequestControls().
+ * the method {@code getRequestControls()}.
*
*
Connection Request Controls
* There are three ways in which connection request controls are set:
*
- *
- * where refException is an instance of
- * LdapReferralException, and ldapContext is an
- * instance of LdapContext.
- * Specifying null or an empty array for connCtls
+ * where {@code refException} is an instance of
+ * {@code LdapReferralException}, and {@code ldapContext} is an
+ * instance of {@code LdapContext}.
+ * Specifying {@code null} or an empty array for {@code connCtls}
* means no connection request controls.
*
* Like environment properties, connection request controls of a context
* are inherited by contexts that are derived from it.
* Typically, you initialize the connection request controls using the
- * InitialLdapContext constructor or
- * LdapReferralContext.getReferralContext(). These connection
+ * {@code InitialLdapContext} constructor or
+ * {@code LdapReferralContext.getReferralContext()}. These connection
* request controls are inherited by contexts that share the same
* connection--that is, contexts derived from the initial or referral
* contexts.
*
- * Use reconnect() to change the connection request controls of
+ * Use {@code reconnect()} to change the connection request controls of
* a context.
- * Invoking ldapContext.reconnect() affects only the
- * connection used by ldapContext and any new contexts instances that are
- * derived form ldapContext. Contexts that previously shared the
- * connection with ldapContext remain unchanged. That is, a context's
+ * Invoking {@code ldapContext.reconnect()} affects only the
+ * connection used by {@code ldapContext} and any new contexts instances that are
+ * derived form {@code ldapContext}. Contexts that previously shared the
+ * connection with {@code ldapContext} remain unchanged. That is, a context's
* connection request controls must be explicitly changed and is not
* affected by changes to another context's connection request
* controls.
*
* A context instance's connection request controls are retrieved using
- * the method getConnectControls().
+ * the method {@code getConnectControls()}.
*
*
*
- * The method LdapContext.getResponseControls() is used to
+ * The method {@code LdapContext.getResponseControls()} is used to
* retrieve the response controls generated by LDAP operations executed
- * as the result of invoking a Context/DirContext
+ * as the result of invoking a {@code Context}/{@code DirContext}
* operation. The result is all of the responses controls generated
* by the underlying LDAP operations, including any implicit reconnection.
* To get only the reconnection response controls,
- * use reconnect() followed by getResponseControls().
+ * use {@code reconnect()} followed by {@code getResponseControls()}.
*
*
Parameters
*
- * A Control[] array
+ * A {@code Control[]} array
* passed as a parameter to any method is owned by the caller.
* The service provider will not modify the array or keep a reference to it,
- * although it may keep references to the individual Control objects
+ * although it may keep references to the individual {@code Control} objects
* in the array.
- * A Control[] array returned by any method is immutable, and may
+ * A {@code Control[]} array returned by any method is immutable, and may
* not subsequently be modified by either the caller or the service provider.
*
* @author Rosanna Lee
@@ -207,7 +207,7 @@ public interface LdapContext extends DirContext {
* to use for the new context.
* If null, the context is initialized with no request controls.
*
- * @return A non-null LdapContext instance.
+ * @return A non-null {@code LdapContext} instance.
* @exception NamingException If an error occurred while creating
* the new instance.
* @see InitialLdapContext
@@ -224,16 +224,16 @@ public interface LdapContext extends DirContext {
* the LDAP "bind" operation, or to explicitly connect to the server
* to get response controls returned by the LDAP "bind" operation.
*
- * This method sets this context's connCtls
+ * This method sets this context's {@code connCtls}
* to be its new connection request controls. This context's
* context request controls are not affected.
* After this method has been invoked, any subsequent
- * implicit reconnections will be done using connCtls.
- * connCtls are also used as
+ * implicit reconnections will be done using {@code connCtls}.
+ * {@code connCtls} are also used as
* connection request controls for new context instances derived from this
* context.
* These connection request controls are not
- * affected by setRequestControls().
+ * affected by {@code setRequestControls()}.
*
* Service provider implementors should read the "Service Provider" section
* in the class description for implementation details.
@@ -266,17 +266,17 @@ public interface LdapContext extends DirContext {
* caller.
*
* This removes any previous request controls and adds
- * requestControls
+ * {@code requestControls}
* for use by subsequent methods invoked on this context.
* This method does not affect this context's connection request controls.
*
- * Note that requestControls will be in effect until the next
- * invocation of setRequestControls(). You need to explicitly
- * invoke setRequestControls() with null or an empty
+ * Note that {@code requestControls} will be in effect until the next
+ * invocation of {@code setRequestControls()}. You need to explicitly
+ * invoke {@code setRequestControls()} with {@code null} or an empty
* array to clear the controls if you don't want them to affect the
* context methods any more.
* To check what request controls are in effect for this context, use
- * getRequestControls().
+ * {@code getRequestControls()}.
* @param requestControls The possibly null controls to use. If null, no
* controls are used.
* @exception NamingException If an error occurred while setting the
@@ -312,10 +312,10 @@ public interface LdapContext extends DirContext {
*
* When a context method that may return response controls is invoked,
* response controls from the previous method invocation are cleared.
- * getResponseControls() returns all of the response controls
+ * {@code getResponseControls()} returns all of the response controls
* generated by LDAP operations used by the context method in the order
* received from the LDAP server.
- * Invoking getResponseControls() does not
+ * Invoking {@code getResponseControls()} does not
* clear the response controls. You can call it many times (and get
* back the same controls) until the next context method that may return
* controls is invoked.
@@ -333,7 +333,7 @@ public interface LdapContext extends DirContext {
* of the property should be a colon-separated list of the fully
* qualified class names of factory classes that will create a control
* given another control. See
- * ControlFactory.getControlInstance() for details.
+ * {@code ControlFactory.getControlInstance()} for details.
* This property may be specified in the environment, a system property,
* or one or more resource files.
*
- * String names passed to LdapName or returned by it
+ * String names passed to {@code LdapName} or returned by it
* use the full Unicode character set. They may also contain
* characters encoded into UTF-8 with each octet represented by a
* three-character substring such as "\\B4".
@@ -67,7 +67,7 @@ import java.io.IOException;
* each octet represented by a single character in the string: the
* meaning would be ambiguous.
*
- * LdapName will properly parse all valid names, but
+ * {@code LdapName} will properly parse all valid names, but
* does not attempt to detect all possible violations when parsing
* invalid names. It is "generous" in accepting invalid names.
* The "validity" of a name is determined ultimately when it
@@ -92,7 +92,7 @@ import java.io.IOException;
* empty LDAP name is represented by an empty RDN list.
*
* Concurrent multithreaded read-only access of an instance of
- * LdapName need not be synchronized.
+ * {@code LdapName} need not be synchronized.
*
* Unless otherwise noted, the behavior of passing a null argument
* to a constructor or method in this class will cause a
@@ -129,7 +129,7 @@ public class LdapName implements Name {
* The indexing of RDNs in the list follows the numbering of
* RDNs described in the class description.
*
- * @param rdns The non-null list of Rdns forming this LDAP name.
+ * @param rdns The non-null list of {@code Rdn}s forming this LDAP name.
*/
public LdapName(List rdns) {
@@ -240,7 +240,7 @@ public class LdapName implements Name {
* that is returned and vice versa.
* @param posn The 0-based index of the component at which to stop.
* Must be in the range [0,size()].
- * @return An instance of LdapName consisting of the
+ * @return An instance of {@code LdapName} consisting of the
* components at indexes in the range [0,posn).
* If posn is zero, an empty LDAP name is returned.
* @exception IndexOutOfBoundsException
@@ -263,7 +263,7 @@ public class LdapName implements Name {
*
* @param posn The 0-based index of the component at which to start.
* Must be in the range [0,size()].
- * @return An instance of LdapName consisting of the
+ * @return An instance of {@code LdapName} consisting of the
* components at indexes in the range [posn,size()).
* If posn is equal to size(), an empty LDAP name is
* returned.
@@ -282,13 +282,13 @@ public class LdapName implements Name {
/**
* Determines whether this LDAP name starts with a specified LDAP name
* prefix.
- * A name n is a prefix if it is equal to
- * getPrefix(n.size())--in other words this LDAP
+ * A name {@code n} is a prefix if it is equal to
+ * {@code getPrefix(n.size())}--in other words this LDAP
* name starts with 'n'. If n is null or not a RFC2253 formatted name
* as described in the class description, false is returned.
*
* @param n The LDAP name to check.
- * @return true if n is a prefix of this LDAP name,
+ * @return true if {@code n} is a prefix of this LDAP name,
* false otherwise.
* @see #getPrefix(int posn)
*/
@@ -309,8 +309,8 @@ public class LdapName implements Name {
* getRdn(p) matches rdns.get(p). Returns false otherwise. If rdns is
* null, false is returned.
*
- * @param rdns The sequence of Rdns to check.
- * @return true if rdns form a prefix of this LDAP name,
+ * @param rdns The sequence of {@code Rdn}s to check.
+ * @return true if {@code rdns} form a prefix of this LDAP name,
* false otherwise.
*/
public boolean startsWith(List rdns) {
@@ -326,13 +326,13 @@ public class LdapName implements Name {
/**
* Determines whether this LDAP name ends with a specified
* LDAP name suffix.
- * A name n is a suffix if it is equal to
- * getSuffix(size()-n.size())--in other words this LDAP
+ * A name {@code n} is a suffix if it is equal to
+ * {@code getSuffix(size()-n.size())}--in other words this LDAP
* name ends with 'n'. If n is null or not a RFC2253 formatted name
* as described in the class description, false is returned.
*
* @param n The LDAP name to check.
- * @return true if n is a suffix of this name, false otherwise.
+ * @return true if {@code n} is a suffix of this name, false otherwise.
* @see #getSuffix(int posn)
*/
public boolean endsWith(Name n) {
@@ -352,8 +352,8 @@ public class LdapName implements Name {
* the component getRdn(p) matches rdns.get(p). Returns false otherwise.
* If rdns is null, false is returned.
*
- * @param rdns The sequence of Rdns to check.
- * @return true if rdns form a suffix of this LDAP name,
+ * @param rdns The sequence of {@code Rdn}s to check.
+ * @return true if {@code rdns} form a suffix of this LDAP name,
* false otherwise.
*/
public boolean endsWith(List rdns) {
@@ -409,7 +409,7 @@ public class LdapName implements Name {
* @param suffix The non-null components to add.
* @return The updated name (not a new instance).
*
- * @throws InvalidNameException if suffix is not a valid LDAP
+ * @throws InvalidNameException if {@code suffix} is not a valid LDAP
* name, or if the addition of the components would violate the
* syntax rules of this LDAP name.
*/
@@ -421,7 +421,7 @@ public class LdapName implements Name {
/**
* Adds the RDNs of a name -- in order -- to the end of this name.
*
- * @param suffixRdns The non-null suffix Rdns to add.
+ * @param suffixRdns The non-null suffix {@code Rdn}s to add.
* @return The updated name (not a new instance).
*/
public Name addAll(List suffixRdns) {
@@ -440,7 +440,7 @@ public class LdapName implements Name {
*
* @return The updated name (not a new instance).
*
- * @throws InvalidNameException if suffix is not a valid LDAP
+ * @throws InvalidNameException if {@code suffix} is not a valid LDAP
* name, or if the addition of the components would violate the
* syntax rules of this LDAP name.
* @throws IndexOutOfBoundsException
@@ -469,7 +469,7 @@ public class LdapName implements Name {
* index (if any) of the first new RDN are shifted up (away from index 0) to
* accommodate the new RDNs.
*
- * @param suffixRdns The non-null suffix Rdns to add.
+ * @param suffixRdns The non-null suffix {@code Rdn}s to add.
* @param posn The index at which to add the suffix RDNs.
* Must be in the range [0,size()].
*
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapReferralException.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapReferralException.java
index ac56ae444b8..2ece32f1da1 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapReferralException.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapReferralException.java
@@ -32,15 +32,15 @@ import java.util.Hashtable;
/**
* This abstract class is used to represent an LDAP referral exception.
- * It extends the base ReferralException by providing a
- * getReferralContext() method that accepts request controls.
+ * It extends the base {@code ReferralException} by providing a
+ * {@code getReferralContext()} method that accepts request controls.
* LdapReferralException is an abstract class. Concrete implementations of it
* determine its synchronization and serialization properties.
*
- * A Control[] array passed as a parameter to
- * the getReferralContext() method is owned by the caller.
+ * A {@code Control[]} array passed as a parameter to
+ * the {@code getReferralContext()} method is owned by the caller.
* The service provider will not modify the array or keep a reference to it,
- * although it may keep references to the individual Control objects
+ * although it may keep references to the individual {@code Control} objects
* in the array.
*
* @author Rosanna Lee
@@ -73,20 +73,20 @@ public abstract class LdapReferralException extends ReferralException {
* Retrieves the context at which to continue the method using the
* context's environment and no controls.
* The referral context is created using the environment properties of
- * the context that threw the ReferralException and no controls.
+ * the context that threw the {@code ReferralException} and no controls.
*
- * where ctx is the context that threw the ReferralException.
+ * where {@code ctx} is the context that threw the {@code ReferralException.}
*
* It is overridden in this class for documentation purposes only.
- * See ReferralException for how to use this method.
+ * See {@code ReferralException} for how to use this method.
*
* @return The non-null context at which to continue the method.
* @exception NamingException If a naming exception was encountered.
- * Call either retryReferral() or skipReferral()
+ * Call either {@code retryReferral()} or {@code skipReferral()}
* to continue processing referrals.
*/
public abstract Context getReferralContext() throws NamingException;
@@ -94,7 +94,7 @@ public abstract class LdapReferralException extends ReferralException {
/**
* Retrieves the context at which to continue the method using
* environment properties and no controls.
- * The referral context is created using env as its environment
+ * The referral context is created using {@code env} as its environment
* properties and no controls.
*
* This method is equivalent to
@@ -103,14 +103,14 @@ public abstract class LdapReferralException extends ReferralException {
*
*
* It is overridden in this class for documentation purposes only.
- * See ReferralException for how to use this method.
+ * See {@code ReferralException} for how to use this method.
*
* @param env The possibly null environment to use when retrieving the
* referral context. If null, no environment properties will be used.
*
* @return The non-null context at which to continue the method.
* @exception NamingException If a naming exception was encountered.
- * Call either retryReferral() or skipReferral()
+ * Call either {@code retryReferral()} or {@code skipReferral()}
* to continue processing referrals.
*/
public abstract Context
@@ -127,12 +127,12 @@ public abstract class LdapReferralException extends ReferralException {
* To continue the operation, the client program should re-invoke
* the method using the same arguments as the original invocation.
*
- * reqCtls is used when creating the connection to the referred
+ * {@code reqCtls} is used when creating the connection to the referred
* server. These controls will be used as the connection request controls for
* the context and context instances
* derived from the context.
- * reqCtls will also be the context's request controls for
- * subsequent context operations. See the LdapContext class
+ * {@code reqCtls} will also be the context's request controls for
+ * subsequent context operations. See the {@code LdapContext} class
* description for details.
*
* This method should be used instead of the other two overloaded forms
@@ -141,7 +141,7 @@ public abstract class LdapReferralException extends ReferralException {
* it needs to supply special controls relating to authentication.
*
* Service provider implementors should read the "Service Provider" section
- * in the LdapContext class description for implementation details.
+ * in the {@code LdapContext} class description for implementation details.
*
* @param reqCtls The possibly null request controls to use for the new context.
* If null or the empty array means use no request controls.
@@ -150,7 +150,7 @@ public abstract class LdapReferralException extends ReferralException {
* properties.
* @return The non-null context at which to continue the method.
* @exception NamingException If a naming exception was encountered.
- * Call either retryReferral() or skipReferral()
+ * Call either {@code retryReferral()} or {@code skipReferral()}
* to continue processing referrals.
*/
public abstract Context
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/Rdn.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/Rdn.java
index aa22285de23..6500d903623 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/Rdn.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/Rdn.java
@@ -50,7 +50,7 @@ import java.io.IOException;
* An example of an RDN is "OU=Sales+CN=J.Smith". In this example,
* the RDN consist of multiple attribute type/value pairs. The
* RDN is parsed as described in the class description for
- * {@link javax.naming.ldap.LdapName LdapName}.
+ * {@link javax.naming.ldap.LdapName LdapName}.
*
* The Rdn class represents an RDN as attribute type/value mappings,
* which can be viewed using
@@ -79,11 +79,11 @@ import java.io.IOException;
* Rdn rdn = new Rdn("cn", "Juicy, Fruit");
* System.out.println(rdn.toString());
*
- * The last line will print cn=Juicy\, Fruit. The
- * {@link #unescapeValue(String) unescapeValue()} method can be
+ * The last line will print {@code cn=Juicy\, Fruit}. The
+ * {@link #unescapeValue(String) unescapeValue()} method can be
* used to unescape the escaped comma resulting in the original
- * value "Juicy, Fruit". The {@link #escapeValue(Object)
- * escapeValue()} method adds the escape back preceding the comma.
+ * value {@code "Juicy, Fruit"}. The {@link #escapeValue(Object)
+ * escapeValue()} method adds the escape back preceding the comma.
*
* This class can be instantiated by a string representation
* of the RDN defined in RFC 2253 as shown in the following code example:
@@ -91,10 +91,10 @@ import java.io.IOException;
* Rdn rdn = new Rdn("cn=Juicy\\, Fruit");
* System.out.println(rdn.toString());
*
- * The last line will print cn=Juicy\, Fruit.
+ * The last line will print {@code cn=Juicy\, Fruit}.
*
* Concurrent multithreaded read-only access of an instance of
- * Rdn need not be synchronized.
+ * {@code Rdn} need not be synchronized.
*
* Unless otherwise noted, the behavior of passing a null argument
* to a constructor or method in this class will cause NullPointerException
@@ -123,7 +123,7 @@ public class Rdn implements Serializable, Comparable {
*
* @param attrSet The non-null and non-empty attributes containing
* type/value mappings.
- * @throws InvalidNameException If contents of attrSet cannot
+ * @throws InvalidNameException If contents of {@code attrSet} cannot
* be used to construct a valid RDN.
*/
public Rdn(Attributes attrSet) throws InvalidNameException {
@@ -166,8 +166,8 @@ public class Rdn implements Serializable, Comparable {
}
/**
- * Constructs an Rdn from the given rdn.
- * The contents of the rdn are simply copied into the newly
+ * Constructs an Rdn from the given {@code rdn}.
+ * The contents of the {@code rdn} are simply copied into the newly
* created Rdn.
* @param rdn The non-null Rdn to be copied.
*/
@@ -583,7 +583,7 @@ public class Rdn implements Serializable, Comparable {
* This method is generous in accepting the values and does not
* catch all illegal values.
* Therefore, passing in an illegal value might not necessarily
- * trigger an IllegalArgumentException.
+ * trigger an {@code IllegalArgumentException}.
*
* @param val The non-null string to be unescaped.
* @return Unescaped value.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsRequest.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsRequest.java
index 508a16805ee..4c81bf6247c 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsRequest.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsRequest.java
@@ -43,9 +43,9 @@ import java.util.ServiceConfigurationError;
* The object identifier for StartTLS is 1.3.6.1.4.1.1466.20037
* and no extended request value is defined.
*
- * StartTlsRequest/StartTlsResponse are used to establish
+ * {@code StartTlsRequest}/{@code StartTlsResponse} are used to establish
* a TLS connection over the existing LDAP connection associated with
- * the JNDI context on which extendedOperation() is invoked.
+ * the JNDI context on which {@code extendedOperation()} is invoked.
* Typically, a JNDI program uses these classes as follows.
*
* import javax.naming.ldap.*;
@@ -127,16 +127,16 @@ public class StartTlsRequest implements ExtendedRequest {
*
* This method locates the implementation class by locating
* configuration files that have the name:
- *
* The configuration files and their corresponding implementation classes must
* be accessible to the calling thread's context class loader.
*
* Each configuration file should contain a list of fully-qualified class
* names, one per line. Space and tab characters surrounding each name, as
- * well as blank lines, are ignored. The comment character is '#'
- * (0x23); on each line all characters following the first comment
+ * well as blank lines, are ignored. The comment character is {@code '#'}
+ * ({@code 0x23}); on each line all characters following the first comment
* character are ignored. The file must be encoded in UTF-8.
*
* This method will return an instance of the first implementation
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsResponse.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsResponse.java
index 107f7031106..80cf71bcd8a 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsResponse.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsResponse.java
@@ -42,7 +42,7 @@ import javax.net.ssl.HostnameVerifier;
*
* The Start TLS extended request and response are used to establish
* a TLS connection over the existing LDAP connection associated with
- * the JNDI context on which extendedOperation() is invoked.
+ * the JNDI context on which {@code extendedOperation()} is invoked.
* Typically, a JNDI program uses the StartTLS extended request and response
* classes as follows.
*
@@ -122,7 +122,7 @@ public abstract class StartTlsResponse implements ExtendedResponse {
/**
* Overrides the default list of cipher suites enabled for use on the
* TLS connection. The cipher suites must have already been listed by
- * SSLSocketFactory.getSupportedCipherSuites() as being supported.
+ * {@code SSLSocketFactory.getSupportedCipherSuites()} as being supported.
* Even if a suite has been enabled, it still might not be used because
* the peer does not support it, or because the requisite certificates
* (and private keys) are not available.
@@ -134,13 +134,13 @@ public abstract class StartTlsResponse implements ExtendedResponse {
public abstract void setEnabledCipherSuites(String[] suites);
/**
- * Sets the hostname verifier used by negotiate()
+ * Sets the hostname verifier used by {@code negotiate()}
* after the TLS handshake has completed and the default hostname
* verification has failed.
- * setHostnameVerifier() must be called before
- * negotiate() is invoked for it to have effect.
+ * {@code setHostnameVerifier()} must be called before
+ * {@code negotiate()} is invoked for it to have effect.
* If called after
- * negotiate(), this method does not do anything.
+ * {@code negotiate()}, this method does not do anything.
*
* @param verifier The non-null hostname verifier callback.
* @see #negotiate
@@ -150,7 +150,7 @@ public abstract class StartTlsResponse implements ExtendedResponse {
/**
* Negotiates a TLS session using the default SSL socket factory.
*
- * This method is equivalent to negotiate(null).
+ * This method is equivalent to {@code negotiate(null)}.
*
* @return The negotiated SSL session
* @throws IOException If an IO error was encountered while establishing
@@ -167,16 +167,16 @@ public abstract class StartTlsResponse implements ExtendedResponse {
* attaches it to the existing connection. Performs the TLS handshake
* and returns the negotiated session information.
*
- * If cipher suites have been set via setEnabledCipherSuites
+ * If cipher suites have been set via {@code setEnabledCipherSuites}
* then they are enabled before the TLS handshake begins.
*
* Hostname verification is performed after the TLS handshake completes.
* The default hostname verification performs a match of the server's
* hostname against the hostname information found in the server's certificate.
* If this verification fails and no callback has been set via
- * setHostnameVerifier then the negotiation fails.
+ * {@code setHostnameVerifier} then the negotiation fails.
* If this verification fails and a callback has been set via
- * setHostnameVerifier, then the callback is used to determine whether
+ * {@code setHostnameVerifier}, then the callback is used to determine whether
* the negotiation succeeds.
*
* If an error occurs then the SSL socket is closed and an IOException
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotification.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotification.java
index f0da06b4da2..e9e12226934 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotification.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotification.java
@@ -32,7 +32,7 @@ import javax.naming.NamingException;
* RFC 2251.
* An unsolicited notification is sent by the LDAP server to the LDAP
* client without any provocation from the client.
- * Its format is that of an extended response (ExtendedResponse).
+ * Its format is that of an extended response ({@code ExtendedResponse}).
*
* @author Rosanna Lee
* @author Scott Seligman
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationEvent.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationEvent.java
index 7a6d6f37f35..25c6764dad9 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationEvent.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationEvent.java
@@ -49,7 +49,7 @@ public class UnsolicitedNotificationEvent extends java.util.EventObject {
private UnsolicitedNotification notice;
/**
- * Constructs a new instance of UnsolicitedNotificationEvent.
+ * Constructs a new instance of {@code UnsolicitedNotificationEvent}.
*
* @param src The non-null source that fired the event.
* @param notice The non-null unsolicited notification.
@@ -71,10 +71,10 @@ public class UnsolicitedNotificationEvent extends java.util.EventObject {
}
/**
- * Invokes the notificationReceived() method on
+ * Invokes the {@code notificationReceived()} method on
* a listener using this event.
* @param listener The non-null listener on which to invoke
- * notificationReceived.
+ * {@code notificationReceived}.
*/
public void dispatch(UnsolicitedNotificationListener listener) {
listener.notificationReceived(this);
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationListener.java b/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationListener.java
index c19c9b7b0cd..fa5980b828c 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationListener.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationListener.java
@@ -28,20 +28,20 @@ package javax.naming.ldap;
import javax.naming.event.NamingListener;
/**
- * This interface is for handling UnsolicitedNotificationEvent.
+ * This interface is for handling {@code UnsolicitedNotificationEvent}.
* "Unsolicited notification" is defined in
* RFC 2251.
* It allows the server to send unsolicited notifications to the client.
- * A UnsolicitedNotificationListener must:
+ * A {@code UnsolicitedNotificationListener} must:
*
*
Implement this interface and its method
- *
Implement NamingListener.namingExceptionThrown() so
+ *
Implement {@code NamingListener.namingExceptionThrown()} so
* that it will be notified of exceptions thrown while attempting to
* collect unsolicited notification events.
- *
Register with the context using one of the addNamingListener()
- * methods from EventContext or EventDirContext.
- * Only the NamingListener argument of these methods are applicable;
- * the rest are ignored for a UnsolicitedNotificationListener.
+ *
Register with the context using one of the {@code addNamingListener()}
+ * methods from {@code EventContext} or {@code EventDirContext}.
+ * Only the {@code NamingListener} argument of these methods are applicable;
+ * the rest are ignored for a {@code UnsolicitedNotificationListener}.
* (These arguments might be applicable to the listener if it implements
* other listener interfaces).
*
diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/package.html b/jdk/src/java.naming/share/classes/javax/naming/ldap/package.html
index 0a81850f90b..f6bf021b5f2 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/package.html
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/package.html
@@ -44,15 +44,15 @@ already deployed ones--can be accessed in a common way.
This package is for applications and service providers that deal with
LDAPv3 extended operations and controls, as defined by
RFC 2251.
-The core interface in this package is LdapContext, which defines
+The core interface in this package is LdapContext, which defines
methods on a context for performing extended operations and handling
controls.
Extended Operations
-This package defines the interface ExtendedRequest
+This package defines the interface ExtendedRequest
to represent the argument to an extended operation,
-and the interface ExtendedResponse to represent the result
+and the interface ExtendedResponse to represent the result
of the extended operation.
An extended response is always paired with an extended request
but not necessarily vice versa. That is, you can have an extended request
@@ -73,7 +73,7 @@ BER values.
For example, suppose an LDAP server supports a "get time" extended operation.
It would supply classes such as
-GetTimeRequest and GetTimeResponse,
+GetTimeRequest and GetTimeResponse,
so that applications can use this feature.
An application would use these classes as follows:
@@ -82,7 +82,7 @@ GetTimeResponse resp =
long time = resp.getTime();
-The GetTimeRequest and GetTimeResponse classes might
+The GetTimeRequest and GetTimeResponse classes might
be defined as follows:
public class GetTimeRequest implements ExtendedRequest {
@@ -105,7 +105,7 @@ public class GetTimeRequest implements ExtendedRequest {
public class GetTimeResponse() implements ExtendedResponse {
long time;
// called by GetTimeRequest.createExtendedResponse()
- public GetTimeResponse(String id, byte[] berValue, int offset, int length)
+ public GetTimeResponse(String id, byte[] berValue, int offset, int length)
throws NamingException {
// check validity of id
long time = ... // decode berValue to get time
@@ -127,7 +127,7 @@ public class GetTimeResponse() implements ExtendedResponse {
Controls
-This package defines the interface Control to represent an LDAPv3
+This package defines the interface Control to represent an LDAPv3
control. It can be a control that is sent to an LDAP server
(request control) or a control returned by an LDAP server
(response control). Unlike extended requests and responses,
@@ -149,8 +149,8 @@ encoding and decoding BER values.
For example, suppose an LDAP server supports a "signed results"
request control, which when sent with a request, asks the
-server to digitally sign the results of an operation.
-It would supply a class SignedResultsControl so that applications
+server to digitally sign the results of an operation.
+It would supply a class SignedResultsControl so that applications
can use this feature.
An application would use this class as follows:
-The SignedResultsControl class might be defined as follows:
+The SignedResultsControl class might be defined as follows:
public class SignedResultsControl implements Control {
// User-friendly constructor
@@ -180,19 +180,19 @@ public class SignedResultsControl implements Control {
When a service provider receives response controls, it uses
-the ControlFactory class to produce specific classes
-that implement the Control interface.
+the ControlFactory class to produce specific classes
+that implement the Control interface.
An LDAP server can send back response controls with an LDAP operation
and also with enumeration results, such as those returned
by a list or search operation.
-The LdapContext provides a method (getResponseControls())
+The LdapContext provides a method (getResponseControls())
for getting the response controls sent with an LDAP operation,
-while the HasControls interface is used to retrieve
+while the HasControls interface is used to retrieve
response controls associated with enumeration results.
For example, suppose an LDAP server sends back a "change ID" control in response
-to a successful modification. It would supply a class ChangeIDControl
+to a successful modification. It would supply a class ChangeIDControl
so that the application can use this feature.
An application would perform an update, and then try to get the change ID.
@@ -211,8 +211,8 @@ if (respCtls != null) {
}
}
-The vendor might supply the following ChangeIDControl and
-VendorXControlFactory classes. The VendorXControlFactory
+The vendor might supply the following ChangeIDControl and
+VendorXControlFactory classes. The VendorXControlFactory
will be used by the service provider when the provider receives response
controls from the LDAP server.
@@ -245,7 +245,7 @@ public class VendorXControlFactory extends ControlFactory {
public Control getControlInstance(Control orig) throws NamingException {
if (isOneOfMyControls(orig.getID())) {
- ...
+ ...
// determine which of ours it is and call its constructor
return (new ChangeIDControl(orig.getID(), orig.getEncodedValue()));
diff --git a/jdk/src/java.naming/share/classes/javax/naming/package.html b/jdk/src/java.naming/share/classes/javax/naming/package.html
index c23bc19ecbf..2f5d919e41c 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/package.html
+++ b/jdk/src/java.naming/share/classes/javax/naming/package.html
@@ -43,13 +43,13 @@ already deployed ones--can be accessed in a common way.
Context
This package defines the notion of a context, represented
-by the Context interface.
+by the Context interface.
A context consists of a set of name-to-object bindings.
-Context is the core interface for looking up, binding, unbinding,
+Context is the core interface for looking up, binding, unbinding,
and renaming objects, and for creating and destroying subcontexts.
-lookup() is the most commonly used operation.
-You supply lookup()
+lookup() is the most commonly used operation.
+You supply lookup()
the name of the object you want
to look up, and it returns the object bound to that name.
For example, the following code fragment looks up
@@ -65,17 +65,17 @@ printer.print(report);
Names
-Every naming method in the Context
+Every naming method in the Context
interface has two
overloads: one that accepts a
-Name argument and one that accepts a string name.
-Name is an interface that represents a generic
+Name argument and one that accepts a string name.
+Name is an interface that represents a generic
name--an ordered sequence of zero of more components.
-For these methods, Name can be used to represent a
-composite name (CompositeName)
+For these methods, Name can be used to represent a
+composite name (CompositeName)
so that you can name an object using a name which spans multiple namespaces.
-The overloads that accept Name
+The overloads that accept Name
are useful for applications that need to manipulate names: composing
them, comparing components, and so on.
The overloads that accept string names are likely to be more useful
@@ -84,14 +84,14 @@ and look up the corresponding object.
Bindings
-The Binding class represents a name-to-object binding.
+The Binding class represents a name-to-object binding.
It is a tuple containing the name of the bound object,
the name of the object's class, and the object itself.
-The Binding class is actually a subclass of
-NameClassPair, which consists
+The Binding class is actually a subclass of
+NameClassPair, which consists
simply of the object's name and the object's class name.
-The NameClassPair is useful when you only want
+The NameClassPair is useful when you only want
information about the object's class and do not want to
pay the extra cost of getting the object.
@@ -104,7 +104,7 @@ storing of Java objects. Furthermore, for some
objects in the directory, Java programs are but one group of applications
that access them. In this case, a serialized Java object might
not be the most appropriate representation.
-JNDI defines a reference, represented by the Reference
+JNDI defines a reference, represented by the Reference
class, which contains information on how to construct a copy of the object.
JNDI will attempt to turn references looked up from the directory
into the Java objects they represent, so that
@@ -117,7 +117,7 @@ is stored in the directory are Java objects.
In JNDI, all naming and directory operations are performed relative
to a context. There are no absolute roots.
Therefore JNDI defines an initial context,
-InitialContext,
+InitialContext,
which provides a starting point for naming and directory operations.
Once you have an initial context, you can use it to
look up other contexts and objects.
@@ -126,10 +126,10 @@ look up other contexts and objects.
JNDI defines a class hierarchy for exceptions that can be thrown in
the course of performing naming and directory operations. The root of
-this class hierarchy is NamingException.
+this class hierarchy is NamingException.
Programs interested in dealing with a particular exception
can catch the corresponding subclass of the exception.
-Otherwise, programs should catch NamingException.
+Otherwise, programs should catch NamingException.
* The JNDI framework allows for object implementations to
* be loaded in dynamically via object factories. See
- * ObjectFactory for details.
+ * {@code ObjectFactory} for details.
*
- * A DirObjectFactory extends ObjectFactory by allowing
- * an Attributes instance
- * to be supplied to the getObjectInstance() method.
- * DirObjectFactory implementations are intended to be used by DirContext
+ * A {@code DirObjectFactory} extends {@code ObjectFactory} by allowing
+ * an {@code Attributes} instance
+ * to be supplied to the {@code getObjectInstance()} method.
+ * {@code DirObjectFactory} implementations are intended to be used by {@code DirContext}
* service providers. The service provider, in addition reading an
* object from the directory, might already have attributes that
* are useful for the object factory to check to see whether the
@@ -71,34 +71,34 @@ public interface DirObjectFactory extends ObjectFactory {
* An example of such an environment property is user identity
* information.
*
- * DirectoryManager.getObjectInstance()
- * successively loads in object factories. If it encounters a DirObjectFactory,
- * it will invoke DirObjectFactory.getObjectInstance();
+ * {@code DirectoryManager.getObjectInstance()}
+ * successively loads in object factories. If it encounters a {@code DirObjectFactory},
+ * it will invoke {@code DirObjectFactory.getObjectInstance()};
* otherwise, it invokes
- * ObjectFactory.getObjectInstance(). It does this until a factory
+ * {@code ObjectFactory.getObjectInstance()}. It does this until a factory
* produces a non-null answer.
*
When an exception
* is thrown by an object factory, the exception is passed on to the caller
- * of DirectoryManager.getObjectInstance(). The search for other factories
+ * of {@code DirectoryManager.getObjectInstance()}. The search for other factories
* that may produce a non-null answer is halted.
* An object factory should only throw an exception if it is sure that
* it is the only intended factory and that no other object factories
* should be tried.
* If this factory cannot create an object using the arguments supplied,
* it should return null.
- *
Since DirObjectFactory extends ObjectFactory, it
+ *
Since {@code DirObjectFactory} extends {@code ObjectFactory}, it
* effectively
- * has two getObjectInstance() methods, where one differs from the other by
- * the attributes argument. Given a factory that implements DirObjectFactory,
- * DirectoryManager.getObjectInstance() will only
+ * has two {@code getObjectInstance()} methods, where one differs from the other by
+ * the attributes argument. Given a factory that implements {@code DirObjectFactory},
+ * {@code DirectoryManager.getObjectInstance()} will only
* use the method that accepts the attributes argument, while
- * NamingManager.getObjectInstance() will only use the one that does not accept
+ * {@code NamingManager.getObjectInstance()} will only use the one that does not accept
* the attributes argument.
*
- * See ObjectFactory for a description URL context factories and other
- * properties of object factories that apply equally to DirObjectFactory.
+ * See {@code ObjectFactory} for a description URL context factories and other
+ * properties of object factories that apply equally to {@code DirObjectFactory}.
*
- * The name, attrs, and environment parameters
+ * The {@code name}, {@code attrs}, and {@code environment} parameters
* are owned by the caller.
* The implementation will not modify these objects or keep references
* to them, although it may keep references to clones or copies.
@@ -112,10 +112,10 @@ public interface DirObjectFactory extends ObjectFactory {
* relative to the default initial context.
* @param environment The possibly null environment that is used in
* creating the object.
- * @param attrs The possibly null attributes containing some of obj's
- * attributes. attrs might not necessarily have all of obj's
+ * @param attrs The possibly null attributes containing some of {@code obj}'s
+ * attributes. {@code attrs} might not necessarily have all of {@code obj}'s
* attributes. If the object factory requires more attributes, it needs
- * to get it, either using obj, or name and nameCtx.
+ * to get it, either using {@code obj}, or {@code name} and {@code nameCtx}.
* The factory must not modify attrs.
* @return The object created; null if an object cannot be created.
* @exception Exception If this object factory encountered an exception
diff --git a/jdk/src/java.naming/share/classes/javax/naming/spi/DirStateFactory.java b/jdk/src/java.naming/share/classes/javax/naming/spi/DirStateFactory.java
index 4823350cb7d..3339d412764 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/DirStateFactory.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/DirStateFactory.java
@@ -33,17 +33,17 @@ import java.util.Hashtable;
* object and corresponding attributes for binding.
*
* The JNDI framework allows for object implementations to
- * be loaded in dynamically via object factories.
+ * be loaded in dynamically via {@code object factories}.
*
- * A DirStateFactory extends StateFactory
- * by allowing an Attributes instance
- * to be supplied to and be returned by the getStateToBind() method.
- * DirStateFactory implementations are intended to be used by
- * DirContext service providers.
- * When a caller binds an object using DirContext.bind(),
+ * A {@code DirStateFactory} extends {@code StateFactory}
+ * by allowing an {@code Attributes} instance
+ * to be supplied to and be returned by the {@code getStateToBind()} method.
+ * {@code DirStateFactory} implementations are intended to be used by
+ * {@code DirContext} service providers.
+ * When a caller binds an object using {@code DirContext.bind()},
* he might also specify a set of attributes to be bound with the object.
* The object and attributes to be bound are passed to
- * the getStateToBind() method of a factory.
+ * the {@code getStateToBind()} method of a factory.
* If the factory processes the object and attributes, it returns
* a corresponding pair of object and attributes to be bound.
* If the factory does not process the object, it must return null.
@@ -53,23 +53,23 @@ import java.util.Hashtable;
*
* ctx.rebind("inky", printer, printerAttrs);
*
- * An LDAP service provider for ctx uses a DirStateFactory
- * (indirectly via DirectoryManager.getStateToBind())
- * and gives it printer and printerAttrs. A factory for
- * an LDAP directory might turn printer into a set of attributes
- * and merge that with printerAttrs. The service provider then
+ * An LDAP service provider for {@code ctx} uses a {@code DirStateFactory}
+ * (indirectly via {@code DirectoryManager.getStateToBind()})
+ * and gives it {@code printer} and {@code printerAttrs}. A factory for
+ * an LDAP directory might turn {@code printer} into a set of attributes
+ * and merge that with {@code printerAttrs}. The service provider then
* uses the resulting attributes to create an LDAP entry and updates
* the directory.
*
- *
Since DirStateFactory extends StateFactory, it
- * has two getStateToBind() methods, where one
+ *
Since {@code DirStateFactory} extends {@code StateFactory}, it
+ * has two {@code getStateToBind()} methods, where one
* differs from the other by the attributes
- * argument. DirectoryManager.getStateToBind() will only use
+ * argument. {@code DirectoryManager.getStateToBind()} will only use
* the form that accepts the attributes argument, while
- * NamingManager.getStateToBind() will only use the form that
+ * {@code NamingManager.getStateToBind()} will only use the form that
* does not accept the attributes argument.
*
- *
Either form of the getStateToBind() method of a
+ *
Either form of the {@code getStateToBind()} method of a
* DirStateFactory may be invoked multiple times, possibly using different
* parameters. The implementation is thread-safe.
*
@@ -85,15 +85,15 @@ public interface DirStateFactory extends StateFactory {
* Retrieves the state of an object for binding given the object and attributes
* to be transformed.
*
- * DirectoryManager.getStateToBind()
+ * {@code DirectoryManager.getStateToBind()}
* successively loads in state factories. If a factory implements
- * DirStateFactory, DirectoryManager invokes this method;
- * otherwise, it invokes StateFactory.getStateToBind().
+ * {@code DirStateFactory}, {@code DirectoryManager} invokes this method;
+ * otherwise, it invokes {@code StateFactory.getStateToBind()}.
* It does this until a factory produces a non-null answer.
*
* When an exception is thrown by a factory,
* the exception is passed on to the caller
- * of DirectoryManager.getStateToBind(). The search for other factories
+ * of {@code DirectoryManager.getStateToBind()}. The search for other factories
* that may produce a non-null answer is halted.
* A factory should only throw an exception if it is sure that
* it is the only intended factory and that no other factories
@@ -101,36 +101,36 @@ public interface DirStateFactory extends StateFactory {
* If this factory cannot create an object using the arguments supplied,
* it should return null.
*
- * The name and nameCtx parameters may
+ * The {@code name} and {@code nameCtx} parameters may
* optionally be used to specify the name of the object being created.
* See the description of "Name and Context Parameters" in
* {@link ObjectFactory#getObjectInstance ObjectFactory.getObjectInstance()}
* for details.
- * If a factory uses nameCtx it should synchronize its use
+ * If a factory uses {@code nameCtx} it should synchronize its use
* against concurrent access, since context implementations are not
* guaranteed to be thread-safe.
*
- * The name, inAttrs, and environment parameters
+ * The {@code name}, {@code inAttrs}, and {@code environment} parameters
* are owned by the caller.
* The implementation will not modify these objects or keep references
* to them, although it may keep references to clones or copies.
* The object returned by this method is owned by the caller.
* The implementation will not subsequently modify it.
- * It will contain either a new Attributes object that is
+ * It will contain either a new {@code Attributes} object that is
* likewise owned by the caller, or a reference to the original
- * inAttrs parameter.
+ * {@code inAttrs} parameter.
*
* @param obj A possibly null object whose state is to be retrieved.
- * @param name The name of this object relative to nameCtx,
+ * @param name The name of this object relative to {@code nameCtx},
* or null if no name is specified.
- * @param nameCtx The context relative to which the name
- * parameter is specified, or null if name is
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified, or null if {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment to
* be used in the creation of the object's state.
* @param inAttrs The possibly null attributes to be bound with the object.
- * The factory must not modify inAttrs.
- * @return A Result containing the object's state for binding
+ * The factory must not modify {@code inAttrs}.
+ * @return A {@code Result} containing the object's state for binding
* and the corresponding
* attributes to be bound; null if the object don't use this factory.
* @exception NamingException If this factory encountered an exception
diff --git a/jdk/src/java.naming/share/classes/javax/naming/spi/DirectoryManager.java b/jdk/src/java.naming/share/classes/javax/naming/spi/DirectoryManager.java
index a0b979e385b..0cd2a4dd76c 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/DirectoryManager.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/DirectoryManager.java
@@ -41,18 +41,18 @@ import com.sun.naming.internal.FactoryEnumeration;
/**
- * This class contains methods for supporting DirContext
+ * This class contains methods for supporting {@code DirContext}
* implementations.
*
- * This class is an extension of NamingManager. It contains methods
+ * This class is an extension of {@code NamingManager}. It contains methods
* for use by service providers for accessing object factories and
* state factories, and for getting continuation contexts for
* supporting federation.
*
- * DirectoryManager is safe for concurrent access by multiple threads.
+ * {@code DirectoryManager} is safe for concurrent access by multiple threads.
*
* Except as otherwise noted,
- * a Name, Attributes, or environment parameter
+ * a {@code Name}, {@code Attributes}, or environment parameter
* passed to any method is owned by the caller.
* The implementation will not modify the object or keep a reference
* to it, although it may keep a reference to a clone or copy.
@@ -73,13 +73,13 @@ public class DirectoryManager extends NamingManager {
DirectoryManager() {}
/**
- * Creates a context in which to continue a DirContext operation.
- * Operates just like NamingManager.getContinuationContext(),
- * only the continuation context returned is a DirContext.
+ * Creates a context in which to continue a {@code DirContext} operation.
+ * Operates just like {@code NamingManager.getContinuationContext()},
+ * only the continuation context returned is a {@code DirContext}.
*
* @param cpe
* The non-null exception that triggered this continuation.
- * @return A non-null DirContext object for continuing the operation.
+ * @return A non-null {@code DirContext} object for continuing the operation.
* @exception NamingException If a naming exception occurred.
*
* @see NamingManager#getContinuationContext(CannotProceedException)
@@ -104,37 +104,37 @@ public class DirectoryManager extends NamingManager {
* Creates an instance of an object for the specified object,
* attributes, and environment.
*
- * This method is the same as NamingManager.getObjectInstance
+ * This method is the same as {@code NamingManager.getObjectInstance}
* except for the following differences:
*
*
- * It accepts an Attributes parameter that contains attributes
- * associated with the object. The DirObjectFactory might use these
+ * It accepts an {@code Attributes} parameter that contains attributes
+ * associated with the object. The {@code DirObjectFactory} might use these
* attributes to save having to look them up from the directory.
*
* The object factories tried must implement either
- * ObjectFactory or DirObjectFactory.
- * If it implements DirObjectFactory,
- * DirObjectFactory.getObjectInstance() is used, otherwise,
- * ObjectFactory.getObjectInstance() is used.
+ * {@code ObjectFactory} or {@code DirObjectFactory}.
+ * If it implements {@code DirObjectFactory},
+ * {@code DirObjectFactory.getObjectInstance()} is used, otherwise,
+ * {@code ObjectFactory.getObjectInstance()} is used.
*
- * Service providers that implement the DirContext interface
- * should use this method, not NamingManager.getObjectInstance().
+ * Service providers that implement the {@code DirContext} interface
+ * should use this method, not {@code NamingManager.getObjectInstance()}.
*
* @param refInfo The possibly null object for which to create an object.
- * @param name The name of this object relative to nameCtx.
+ * @param name The name of this object relative to {@code nameCtx}.
* Specifying a name is optional; if it is
- * omitted, name should be null.
- * @param nameCtx The context relative to which the name
- * parameter is specified. If null, name is
+ * omitted, {@code name} should be null.
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified. If null, {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment to
* be used in the creation of the object factory and the object.
* @param attrs The possibly null attributes associated with refInfo.
* This might not be the complete set of attributes for refInfo;
* you might be able to read more attributes from the directory.
- * @return An object created using refInfo and attrs; or
- * refInfo if an object cannot be created by
+ * @return An object created using {@code refInfo} and {@code attrs}; or
+ * {@code refInfo} if an object cannot be created by
* a factory.
* @exception NamingException If a naming exception was encountered
* while attempting to get a URL context, or if one of the
@@ -144,7 +144,7 @@ public class DirectoryManager extends NamingManager {
* and instantiating the factory and object classes.
* A factory should only throw an exception if it does not want
* other factories to be used in an attempt to create an object.
- * See DirObjectFactory.getObjectInstance().
+ * See {@code DirObjectFactory.getObjectInstance()}.
* @see NamingManager#getURLContext
* @see DirObjectFactory
* @see DirObjectFactory#getObjectInstance
@@ -246,39 +246,39 @@ public class DirectoryManager extends NamingManager {
* Retrieves the state of an object for binding when given the original
* object and its attributes.
*
- * This method is like NamingManager.getStateToBind except
+ * This method is like {@code NamingManager.getStateToBind} except
* for the following differences:
*
- *
It accepts an Attributes parameter containing attributes
- * that were passed to the DirContext.bind() method.
- *
It returns a non-null DirStateFactory.Result instance
+ *
It accepts an {@code Attributes} parameter containing attributes
+ * that were passed to the {@code DirContext.bind()} method.
+ *
It returns a non-null {@code DirStateFactory.Result} instance
* containing the object to be bound, and the attributes to
* accompany the binding. Either the object or the attributes may be null.
*
* The state factories tried must each implement either
- * StateFactory or DirStateFactory.
- * If it implements DirStateFactory, then
- * DirStateFactory.getStateToBind() is called; otherwise,
- * StateFactory.getStateToBind() is called.
+ * {@code StateFactory} or {@code DirStateFactory}.
+ * If it implements {@code DirStateFactory}, then
+ * {@code DirStateFactory.getStateToBind()} is called; otherwise,
+ * {@code StateFactory.getStateToBind()} is called.
*
*
- * Service providers that implement the DirContext interface
- * should use this method, not NamingManager.getStateToBind().
+ * Service providers that implement the {@code DirContext} interface
+ * should use this method, not {@code NamingManager.getStateToBind()}.
*
* See NamingManager.getStateToBind() for a description of how
* the list of state factories to be tried is determined.
*
* The object returned by this method is owned by the caller.
* The implementation will not subsequently modify it.
- * It will contain either a new Attributes object that is
+ * It will contain either a new {@code Attributes} object that is
* likewise owned by the caller, or a reference to the original
- * attrs parameter.
+ * {@code attrs} parameter.
*
* @param obj The non-null object for which to get state to bind.
- * @param name The name of this object relative to nameCtx,
+ * @param name The name of this object relative to {@code nameCtx},
* or null if no name is specified.
- * @param nameCtx The context relative to which the name
- * parameter is specified, or null if name is
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified, or null if {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment to
* be used in the creation of the state factory and
@@ -288,12 +288,12 @@ public class DirectoryManager extends NamingManager {
* @return A non-null DirStateFactory.Result containing
* the object and attributes to be bound.
* If no state factory returns a non-null answer, the result will contain
- * the object (obj) itself with the original attributes.
+ * the object ({@code obj}) itself with the original attributes.
* @exception NamingException If a naming exception was encountered
* while using the factories.
* A factory should only throw an exception if it does not want
* other factories to be used in an attempt to create an object.
- * See DirStateFactory.getStateToBind().
+ * See {@code DirStateFactory.getStateToBind()}.
* @see DirStateFactory
* @see DirStateFactory#getStateToBind
* @see NamingManager#getStateToBind
diff --git a/jdk/src/java.naming/share/classes/javax/naming/spi/NamingManager.java b/jdk/src/java.naming/share/classes/javax/naming/spi/NamingManager.java
index b7c0010dae2..7031e649ffe 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/NamingManager.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/NamingManager.java
@@ -49,7 +49,7 @@ import com.sun.naming.internal.FactoryEnumeration;
* NamingManager is safe for concurrent access by multiple threads.
*
* Except as otherwise noted,
- * a Name or environment parameter
+ * a {@code Name} or environment parameter
* passed to any method is owned by the caller.
* The implementation will not modify the object or keep a reference
* to it, although it may keep a reference to a clone or copy.
@@ -164,8 +164,8 @@ public class NamingManager {
/**
* Creates an object using the factories specified in the
- * Context.OBJECT_FACTORIES property of the environment
- * or of the provider resource file associated with nameCtx.
+ * {@code Context.OBJECT_FACTORIES} property of the environment
+ * or of the provider resource file associated with {@code nameCtx}.
*
* @return factory created; null if cannot create
*/
@@ -205,69 +205,69 @@ public class NamingManager {
* create a factory for creating the object.
* Otherwise, the following rules are used to create the object:
*
- *
If refInfo is a Reference
- * or Referenceable containing a factory class name,
+ *
If {@code refInfo} is a {@code Reference}
+ * or {@code Referenceable} containing a factory class name,
* use the named factory to create the object.
- * Return refInfo if the factory cannot be created.
+ * Return {@code refInfo} if the factory cannot be created.
* Under JDK 1.1, if the factory class must be loaded from a location
- * specified in the reference, a SecurityManager must have
+ * specified in the reference, a {@code SecurityManager} must have
* been installed or the factory creation will fail.
* If an exception is encountered while creating the factory,
* it is passed up to the caller.
- *
If refInfo is a Reference or
- * Referenceable with no factory class name,
- * and the address or addresses are StringRefAddrs with
+ *
If {@code refInfo} is a {@code Reference} or
+ * {@code Referenceable} with no factory class name,
+ * and the address or addresses are {@code StringRefAddr}s with
* address type "URL",
* try the URL context factory corresponding to each URL's scheme id
- * to create the object (see getURLContext()).
+ * to create the object (see {@code getURLContext()}).
* If that fails, continue to the next step.
*
Use the object factories specified in
- * the Context.OBJECT_FACTORIES property of the environment,
+ * the {@code Context.OBJECT_FACTORIES} property of the environment,
* and of the provider resource file associated with
- * nameCtx, in that order.
+ * {@code nameCtx}, in that order.
* The value of this property is a colon-separated list of factory
* class names that are tried in order, and the first one that succeeds
* in creating an object is the one used.
* If none of the factories can be loaded,
- * return refInfo.
+ * return {@code refInfo}.
* If an exception is encountered while creating the object, the
* exception is passed up to the caller.
*
*
- * Service providers that implement the DirContext
+ * Service providers that implement the {@code DirContext}
* interface should use
- * DirectoryManager.getObjectInstance(), not this method.
- * Service providers that implement only the Context
+ * {@code DirectoryManager.getObjectInstance()}, not this method.
+ * Service providers that implement only the {@code Context}
* interface should use this method.
*
* Note that an object factory (an object that implements the ObjectFactory
* interface) must be public and must have a public constructor that
* accepts no arguments.
*
- * The name and nameCtx parameters may
+ * The {@code name} and {@code nameCtx} parameters may
* optionally be used to specify the name of the object being created.
- * name is the name of the object, relative to context
- * nameCtx. This information could be useful to the object
+ * {@code name} is the name of the object, relative to context
+ * {@code nameCtx}. This information could be useful to the object
* factory or to the object implementation.
* If there are several possible contexts from which the object
* could be named -- as will often be the case -- it is up to
* the caller to select one. A good rule of thumb is to select the
* "deepest" context available.
- * If nameCtx is null, name is relative
+ * If {@code nameCtx} is null, {@code name} is relative
* to the default initial context. If no name is being specified, the
- * name parameter should be null.
+ * {@code name} parameter should be null.
*
* @param refInfo The possibly null object for which to create an object.
- * @param name The name of this object relative to nameCtx.
+ * @param name The name of this object relative to {@code nameCtx}.
* Specifying a name is optional; if it is
- * omitted, name should be null.
- * @param nameCtx The context relative to which the name
- * parameter is specified. If null, name is
+ * omitted, {@code name} should be null.
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified. If null, {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment to
* be used in the creation of the object factory and the object.
- * @return An object created using refInfo; or
- * refInfo if an object cannot be created using
+ * @return An object created using {@code refInfo}; or
+ * {@code refInfo} if an object cannot be created using
* the algorithm described above.
* @exception NamingException if a naming exception was encountered
* while attempting to get a URL context, or if one of the
@@ -404,23 +404,23 @@ public class NamingManager {
/**
- * Retrieves a context identified by obj, using the specified
+ * Retrieves a context identified by {@code obj}, using the specified
* environment.
* Used by ContinuationContext.
*
* @param obj The object identifying the context.
* @param name The name of the context being returned, relative to
- * nameCtx, or null if no name is being
+ * {@code nameCtx}, or null if no name is being
* specified.
- * See the getObjectInstance method for
+ * See the {@code getObjectInstance} method for
* details.
- * @param nameCtx The context relative to which name is
+ * @param nameCtx The context relative to which {@code name} is
* specified, or null for the default initial context.
- * See the getObjectInstance method for
+ * See the {@code getObjectInstance} method for
* details.
* @param environment Environment specifying characteristics of the
* resulting context.
- * @return A context identified by obj.
+ * @return A context identified by {@code obj}.
*
* @see #getObjectInstance
*/
@@ -480,7 +480,7 @@ public class NamingManager {
* Creates a context for the given URL scheme id.
*
* The resulting context is for resolving URLs of the
- * scheme scheme. The resulting context is not tied
+ * scheme {@code scheme}. The resulting context is not tied
* to a specific URL. It is able to handle arbitrary URLs with
* the specified scheme.
*
@@ -488,7 +488,7 @@ public class NamingManager {
* has the naming convention scheme-idURLContextFactory
* (e.g. "ftpURLContextFactory" for the "ftp" scheme-id),
* in the package specified as follows.
- * The Context.URL_PKG_PREFIXES environment property (which
+ * The {@code Context.URL_PKG_PREFIXES} environment property (which
* may contain values taken from system properties,
* or application resource files)
* contains a colon-separated list of package prefixes.
@@ -500,7 +500,7 @@ public class NamingManager {
* concatenated with the scheme id.
*
* For example, if the scheme id is "ldap", and the
- * Context.URL_PKG_PREFIXES property
+ * {@code Context.URL_PKG_PREFIXES} property
* contains "com.widget:com.wiz.jndi",
* the naming manager would attempt to load the following classes
* until one is successfully instantiated:
@@ -514,7 +514,7 @@ public class NamingManager {
* If a factory is instantiated, it is invoked with the following
* parameters to produce the resulting context.
*
* For example, invoking getObjectInstance() as shown above
* on a LDAP URL context factory would return a
@@ -530,8 +530,8 @@ public class NamingManager {
* @param environment The possibly null environment properties to be
* used in the creation of the object factory and the context.
* @return A context for resolving URLs with the
- * scheme id scheme;
- * null if the factory for creating the
+ * scheme id {@code scheme};
+ * {@code null} if the factory for creating the
* context is not found.
* @exception NamingException If a naming exception occurs while creating
* the context.
@@ -575,7 +575,7 @@ public class NamingManager {
* context factory for the URL scheme.
* @param scheme the URL scheme id for the context
* @param urlInfo information used to create the context
- * @param name name of this object relative to nameCtx
+ * @param name name of this object relative to {@code nameCtx}
* @param nameCtx Context whose provider resource file will be searched
* for package prefix values (or null if none)
* @param environment Environment properties for creating the context
@@ -630,7 +630,7 @@ public class NamingManager {
* it is used to create the factory for creating the initial
* context
*
Otherwise, the class specified in the
- * Context.INITIAL_CONTEXT_FACTORY environment property
+ * {@code Context.INITIAL_CONTEXT_FACTORY} environment property
* is used
*
*
First, the {@linkplain java.util.ServiceLoader ServiceLoader}
@@ -649,7 +649,7 @@ public class NamingManager {
* creating the context.
* @return A non-null initial context.
* @exception NoInitialContextException If the
- * Context.INITIAL_CONTEXT_FACTORY property
+ * {@code Context.INITIAL_CONTEXT_FACTORY} property
* is not found or names a nonexistent
* class or a class that cannot be instantiated,
* or if the initial context could not be created for some other
@@ -764,8 +764,8 @@ public class NamingManager {
/**
* Constant that holds the name of the environment property into
- * which getContinuationContext() stores the value of its
- * CannotProceedException parameter.
+ * which {@code getContinuationContext()} stores the value of its
+ * {@code CannotProceedException} parameter.
* This property is inherited by the continuation context, and may
* be used by that context's service provider to inspect the
* fields of the exception.
@@ -784,18 +784,18 @@ public class NamingManager {
* namespaces, a context from one naming system may need to pass
* the operation on to the next naming system. The context
* implementation does this by first constructing a
- * CannotProceedException containing information
+ * {@code CannotProceedException} containing information
* pinpointing how far it has proceeded. It then obtains a
* continuation context from JNDI by calling
- * getContinuationContext. The context
+ * {@code getContinuationContext}. The context
* implementation should then resume the context operation by
* invoking the same operation on the continuation context, using
* the remainder of the name that has not yet been resolved.
*
- * Before making use of the cpe parameter, this method
+ * Before making use of the {@code cpe} parameter, this method
* updates the environment associated with that object by setting
- * the value of the property CPE
- * to cpe. This property will be inherited by the
+ * the value of the property {@code CPE}
+ * to {@code cpe}. This property will be inherited by the
* continuation context, and may be used by that context's
* service provider to inspect the fields of this exception.
*
@@ -826,15 +826,15 @@ public class NamingManager {
/**
* Retrieves the state of an object for binding.
*
- * Service providers that implement the DirContext interface
- * should use DirectoryManager.getStateToBind(), not this method.
- * Service providers that implement only the Context interface
+ * Service providers that implement the {@code DirContext} interface
+ * should use {@code DirectoryManager.getStateToBind()}, not this method.
+ * Service providers that implement only the {@code Context} interface
* should use this method.
*
* This method uses the specified state factories in
- * the Context.STATE_FACTORIES property from the environment
+ * the {@code Context.STATE_FACTORIES} property from the environment
* properties, and from the provider resource file associated with
- * nameCtx, in that order.
+ * {@code nameCtx}, in that order.
* The value of this property is a colon-separated list of factory
* class names that are tried in order, and the first one that succeeds
* in returning the object's state is the one used.
@@ -848,35 +848,35 @@ public class NamingManager {
* interface) must be public and must have a public constructor that
* accepts no arguments.
*
- * The name and nameCtx parameters may
+ * The {@code name} and {@code nameCtx} parameters may
* optionally be used to specify the name of the object being created.
* See the description of "Name and Context Parameters" in
* {@link ObjectFactory#getObjectInstance
* ObjectFactory.getObjectInstance()}
* for details.
*
- * This method may return a Referenceable object. The
+ * This method may return a {@code Referenceable} object. The
* service provider obtaining this object may choose to store it
* directly, or to extract its reference (using
- * Referenceable.getReference()) and store that instead.
+ * {@code Referenceable.getReference()}) and store that instead.
*
* @param obj The non-null object for which to get state to bind.
- * @param name The name of this object relative to nameCtx,
+ * @param name The name of this object relative to {@code nameCtx},
* or null if no name is specified.
- * @param nameCtx The context relative to which the name
- * parameter is specified, or null if name is
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified, or null if {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment to
* be used in the creation of the state factory and
* the object's state.
- * @return The non-null object representing obj's state for
- * binding. It could be the object (obj) itself.
+ * @return The non-null object representing {@code obj}'s state for
+ * binding. It could be the object ({@code obj}) itself.
* @exception NamingException If one of the factories accessed throws an
* exception, or if an error was encountered while loading
* and instantiating the factory and object classes.
* A factory should only throw an exception if it does not want
* other factories to be used in an attempt to create an object.
- * See StateFactory.getStateToBind().
+ * See {@code StateFactory.getStateToBind()}.
* @see StateFactory
* @see StateFactory#getStateToBind
* @see DirectoryManager#getStateToBind
diff --git a/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactory.java b/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactory.java
index a02528cec9f..905902234fb 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactory.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactory.java
@@ -39,15 +39,15 @@ import javax.naming.*;
* Reference could be used to create a printer object, so that
* the caller of lookup can directly operate on the printer object
* after the lookup.
- *
An ObjectFactory is responsible
+ *
An {@code ObjectFactory} is responsible
* for creating objects of a specific type. In the above example,
* you may have a PrinterObjectFactory for creating Printer objects.
*
- * An object factory must implement the ObjectFactory interface.
+ * An object factory must implement the {@code ObjectFactory} interface.
* In addition, the factory class must be public and must have a
* public constructor that accepts no parameters.
*
- * The getObjectInstance() method of an object factory may
+ * The {@code getObjectInstance()} method of an object factory may
* be invoked multiple times, possibly using different parameters.
* The implementation is thread-safe.
*
* Special requirements of this object are supplied
- * using environment.
+ * using {@code environment}.
* An example of such an environment property is user identity
* information.
*
- * NamingManager.getObjectInstance()
+ * {@code NamingManager.getObjectInstance()}
* successively loads in object factories and invokes this method
* on them until one produces a non-null answer. When an exception
* is thrown by an object factory, the exception is passed on to the caller
- * of NamingManager.getObjectInstance()
+ * of {@code NamingManager.getObjectInstance()}
* (and no search is made for other factories
* that may produce a non-null answer).
* An object factory should only throw an exception if it is sure that
@@ -92,27 +92,27 @@ public interface ObjectFactory {
*
* A URL context factory is a special ObjectFactory that
* creates contexts for resolving URLs or objects whose locations
- * are specified by URLs. The getObjectInstance() method
+ * are specified by URLs. The {@code getObjectInstance()} method
* of a URL context factory will obey the following rules.
*
- *
If obj is null, create a context for resolving URLs of the
+ *
If {@code obj} is null, create a context for resolving URLs of the
* scheme associated with this factory. The resulting context is not tied
* to a specific URL: it is able to handle arbitrary URLs with this factory's
- * scheme id. For example, invoking getObjectInstance() with
- * obj set to null on an LDAP URL context factory would return a
+ * scheme id. For example, invoking {@code getObjectInstance()} with
+ * {@code obj} set to null on an LDAP URL context factory would return a
* context that can resolve LDAP URLs
* such as "ldap://ldap.wiz.com/o=wiz,c=us" and
* "ldap://ldap.umich.edu/o=umich,c=us".
*
- * If obj is a URL string, create an object (typically a context)
+ * If {@code obj} is a URL string, create an object (typically a context)
* identified by the URL. For example, suppose this is an LDAP URL context
- * factory. If obj is "ldap://ldap.wiz.com/o=wiz,c=us",
+ * factory. If {@code obj} is "ldap://ldap.wiz.com/o=wiz,c=us",
* getObjectInstance() would return the context named by the distinguished
* name "o=wiz, c=us" at the LDAP server ldap.wiz.com. This context can
* then be used to resolve LDAP names (such as "cn=George")
* relative to that context.
*
- * If obj is an array of URL strings, the assumption is that the
+ * If {@code obj} is an array of URL strings, the assumption is that the
* URLs are equivalent in terms of the context to which they refer.
* Verification of whether the URLs are, or need to be, equivalent is up
* to the context factory. The order of the URLs in the array is
@@ -120,13 +120,13 @@ public interface ObjectFactory {
* The object returned by getObjectInstance() is like that of the single
* URL case. It is the object named by the URLs.
*
- * If obj is of any other type, the behavior of
- * getObjectInstance() is determined by the context factory
+ * If {@code obj} is of any other type, the behavior of
+ * {@code getObjectInstance()} is determined by the context factory
* implementation.
*
*
*
- * The name and environment parameters
+ * The {@code name} and {@code environment} parameters
* are owned by the caller.
* The implementation will not modify these objects or keep references
* to them, although it may keep references to clones or copies.
@@ -135,27 +135,27 @@ public interface ObjectFactory {
* Name and Context Parameters.
*
*
- * The name and nameCtx parameters may
+ * The {@code name} and {@code nameCtx} parameters may
* optionally be used to specify the name of the object being created.
- * name is the name of the object, relative to context
- * nameCtx.
+ * {@code name} is the name of the object, relative to context
+ * {@code nameCtx}.
* If there are several possible contexts from which the object
* could be named -- as will often be the case -- it is up to
* the caller to select one. A good rule of thumb is to select the
* "deepest" context available.
- * If nameCtx is null, name is relative
+ * If {@code nameCtx} is null, {@code name} is relative
* to the default initial context. If no name is being specified, the
- * name parameter should be null.
- * If a factory uses nameCtx it should synchronize its use
+ * {@code name} parameter should be null.
+ * If a factory uses {@code nameCtx} it should synchronize its use
* against concurrent access, since context implementations are not
* guaranteed to be thread-safe.
*
* @param obj The possibly null object containing location or reference
* information that can be used in creating an object.
- * @param name The name of this object relative to nameCtx,
+ * @param name The name of this object relative to {@code nameCtx},
* or null if no name is specified.
- * @param nameCtx The context relative to which the name
- * parameter is specified, or null if name is
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified, or null if {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment that is used in
* creating the object.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactoryBuilder.java b/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactoryBuilder.java
index 19c07f0c060..8e8c6161c01 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactoryBuilder.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactoryBuilder.java
@@ -40,10 +40,10 @@ import javax.naming.NamingException;
* after the lookup. An ObjectFactory is responsible for creating
* objects of a specific type. JNDI uses a default policy for using
* and loading object factories. You can override this default policy
- * by calling NamingManager.setObjectFactoryBuilder() with an ObjectFactoryBuilder,
+ * by calling {@code NamingManager.setObjectFactoryBuilder()} with an ObjectFactoryBuilder,
* which contains the program-defined way of creating/loading
* object factories.
- * Any ObjectFactoryBuilder implementation must implement this
+ * Any {@code ObjectFactoryBuilder} implementation must implement this
* interface that for creating object factories.
*
* @author Rosanna Lee
diff --git a/jdk/src/java.naming/share/classes/javax/naming/spi/Resolver.java b/jdk/src/java.naming/share/classes/javax/naming/spi/Resolver.java
index 765490fc391..26d2d18172e 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/Resolver.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/Resolver.java
@@ -37,10 +37,10 @@ import javax.naming.NamingException;
* that do not support subtypes of Context, but which can act as
* intermediate contexts for resolution purposes.
*
- * A Name parameter passed to any method is owned
+ * A {@code Name} parameter passed to any method is owned
* by the caller. The service provider will not modify the object
* or keep a reference to it.
- * A ResolveResult object returned by any
+ * A {@code ResolveResult} object returned by any
* method is owned by the caller. The caller may subsequently modify it;
* the service provider may not.
*
diff --git a/jdk/src/java.naming/share/classes/javax/naming/spi/StateFactory.java b/jdk/src/java.naming/share/classes/javax/naming/spi/StateFactory.java
index e4c5ca6087a..9ef15b88c89 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/StateFactory.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/StateFactory.java
@@ -34,14 +34,14 @@ import java.util.Hashtable;
* The JNDI framework allows for object implementations to
* be loaded in dynamically via object factories.
* For example, when looking up a printer bound in the name space,
- * if the print service binds printer names to References, the printer
- * Reference could be used to create a printer object, so that
+ * if the print service binds printer names to {@code Reference}s, the printer
+ * {@code Reference} could be used to create a printer object, so that
* the caller of lookup can directly operate on the printer object
* after the lookup.
- *
An ObjectFactory is responsible
+ *
An {@code ObjectFactory} is responsible
* for creating objects of a specific type. In the above example,
- * you may have a PrinterObjectFactory for creating
- * Printer objects.
+ * you may have a {@code PrinterObjectFactory} for creating
+ * {@code Printer} objects.
*
* For the reverse process, when an object is bound into the namespace,
* JNDI provides state factories.
@@ -50,23 +50,23 @@ import java.util.Hashtable;
*
* ctx.rebind("inky", printer);
*
- * The service provider for ctx uses a state factory
- * to obtain the state of printer for binding into its namespace.
- * A state factory for the Printer type object might return
+ * The service provider for {@code ctx} uses a state factory
+ * to obtain the state of {@code printer} for binding into its namespace.
+ * A state factory for the {@code Printer} type object might return
* a more compact object for storage in the naming system.
*
- * A state factory must implement the StateFactory interface.
+ * A state factory must implement the {@code StateFactory} interface.
* In addition, the factory class must be public and must have a
* public constructor that accepts no parameters.
*
- * The getStateToBind() method of a state factory may
+ * The {@code getStateToBind()} method of a state factory may
* be invoked multiple times, possibly using different parameters.
* The implementation is thread-safe.
*
- * StateFactory is intended for use with service providers
- * that implement only the Context interface.
- * DirStateFactory is intended for use with service providers
- * that implement the DirContext interface.
+ * {@code StateFactory} is intended for use with service providers
+ * that implement only the {@code Context} interface.
+ * {@code DirStateFactory} is intended for use with service providers
+ * that implement the {@code DirContext} interface.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -81,18 +81,18 @@ public interface StateFactory {
/**
* Retrieves the state of an object for binding.
*
- * NamingManager.getStateToBind()
+ * {@code NamingManager.getStateToBind()}
* successively loads in state factories and invokes this method
* on them until one produces a non-null answer.
- * DirectoryManager.getStateToBind()
+ * {@code DirectoryManager.getStateToBind()}
* successively loads in state factories. If a factory implements
- * DirStateFactory, then DirectoryManager
- * invokes DirStateFactory.getStateToBind(); otherwise
- * it invokes StateFactory.getStateToBind().
+ * {@code DirStateFactory}, then {@code DirectoryManager}
+ * invokes {@code DirStateFactory.getStateToBind()}; otherwise
+ * it invokes {@code StateFactory.getStateToBind()}.
*
When an exception
* is thrown by a factory, the exception is passed on to the caller
- * of NamingManager.getStateToBind() and
- * DirectoryManager.getStateToBind().
+ * of {@code NamingManager.getStateToBind()} and
+ * {@code DirectoryManager.getStateToBind()}.
* The search for other factories
* that may produce a non-null answer is halted.
* A factory should only throw an exception if it is sure that
@@ -110,7 +110,7 @@ public interface StateFactory {
* against concurrent access, since context implementations are not
* guaranteed to be thread-safe.
*
- * The name and environment parameters
+ * The {@code name} and {@code environment} parameters
* are owned by the caller.
* The implementation will not modify these objects or keep references
* to them, although it may keep references to clones or copies.
diff --git a/jdk/src/java.naming/share/classes/javax/naming/spi/package.html b/jdk/src/java.naming/share/classes/javax/naming/spi/package.html
index f7480f0d98d..9e06fb71f73 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/package.html
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/package.html
@@ -29,7 +29,7 @@ questions.
Provides the means for dynamically plugging in support for accessing
-naming and directory services through the javax.naming
+naming and directory services through the javax.naming
and related packages.
@@ -58,9 +58,9 @@ from the initial context.
Java Object Support
-The service provider package provides support
+The service provider package provides support
for implementors of the
-javax.naming.Context.lookup()
+javax.naming.Context.lookup()
method and related methods to return Java objects that are natural
and intuitive for the Java programmer.
For example, when looking up a printer name from the directory,
diff --git a/jdk/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java b/jdk/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java
index 970aa19816d..39f65522b6c 100644
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java
@@ -40,8 +40,8 @@ import java.lang.Double;
* This class provides a skeletal implementation of the {@link Preferences}
* class, greatly easing the task of implementing it.
*
- *
This class is for Preferences implementers only.
- * Normal users of the Preferences facility should have no need to
+ *
This class is for {@code Preferences} implementers only.
+ * Normal users of the {@code Preferences} facility should have no need to
* consult this documentation. The {@link Preferences} documentation
* should suffice.
*
@@ -56,11 +56,11 @@ import java.lang.Double;
* performance.
*
*
The SPI methods fall into three groups concerning exception
- * behavior. The getSpi method should never throw exceptions, but it
+ * behavior. The {@code getSpi} method should never throw exceptions, but it
* doesn't really matter, as any exception thrown by this method will be
* intercepted by {@link #get(String,String)}, which will return the specified
- * default value to the caller. The removeNodeSpi, keysSpi,
- * childrenNamesSpi, syncSpi and flushSpi methods are specified
+ * default value to the caller. The {@code removeNodeSpi, keysSpi,
+ * childrenNamesSpi, syncSpi} and {@code flushSpi} methods are specified
* to throw {@link BackingStoreException}, and the implementation is required
* to throw this checked exception if it is unable to perform the operation.
* The exception propagates outward, causing the corresponding API method
@@ -69,7 +69,7 @@ import java.lang.Double;
*
The remaining SPI methods {@link #putSpi(String,String)}, {@link
* #removeSpi(String)} and {@link #childSpi(String)} have more complicated
* exception behavior. They are not specified to throw
- * BackingStoreException, as they can generally obey their contracts
+ * {@code BackingStoreException}, as they can generally obey their contracts
* even if the backing store is unavailable. This is true because they return
* no information and their effects are not required to become permanent until
* a subsequent call to {@link Preferences#flush()} or
@@ -79,11 +79,11 @@ import java.lang.Double;
* later processing. Even under these circumstances it is generally better to
* simply ignore the invocation and return, rather than throwing an
* exception. Under these circumstances, however, subsequently invoking
- * flush() or sync would not imply that all previous
+ * {@code flush()} or {@code sync} would not imply that all previous
* operations had successfully been made permanent.
*
- *
There is one circumstance under which putSpi, removeSpi and
- * childSpishould throw an exception: if the caller lacks
+ *
There is one circumstance under which {@code putSpi, removeSpi and
+ * childSpi} should throw an exception: if the caller lacks
* sufficient privileges on the underlying operating system to perform the
* requested operation. This will, for instance, occur on most systems
* if a non-privileged user attempts to modify system preferences.
@@ -103,18 +103,18 @@ import java.lang.Double;
* backing store. It is the implementation's responsibility to recreate the
* node if it has been deleted.
*
- *
Implementation note: In Sun's default Preferences
+ *
Implementation note: In Sun's default {@code Preferences}
* implementations, the user's identity is inherited from the underlying
* operating system and does not change for the lifetime of the virtual
- * machine. It is recognized that server-side Preferences
+ * machine. It is recognized that server-side {@code Preferences}
* implementations may have the user identity change from request to request,
- * implicitly passed to Preferences methods via the use of a
+ * implicitly passed to {@code Preferences} methods via the use of a
* static {@link ThreadLocal} instance. Authors of such implementations are
* strongly encouraged to determine the user at the time preferences
* are accessed (for example by the {@link #get(String,String)} or {@link
* #put(String,String)} method) rather than permanently associating a user
- * with each Preferences instance. The latter behavior conflicts
- * with normal Preferences usage and would lead to great confusion.
+ * with each {@code Preferences} instance. The latter behavior conflicts
+ * with normal {@code Preferences} usage and would lead to great confusion.
*
* @author Josh Bloch
* @see Preferences
@@ -149,7 +149,7 @@ public abstract class AbstractPreferences extends Preferences {
private final AbstractPreferences root; // Relative to this node
/**
- * This field should be true if this node did not exist in the
+ * This field should be {@code true} if this node did not exist in the
* backing store prior to the creation of this object. The field
* is initialized to false, but may be set to true by a subclass
* constructor (and should not be modified thereafter). This field
@@ -197,10 +197,10 @@ public abstract class AbstractPreferences extends Preferences {
* @param parent the parent of this preference node, or null if this
* is the root.
* @param name the name of this preference node, relative to its parent,
- * or "" if this is the root.
- * @throws IllegalArgumentException if name contains a slash
- * ('/'), or parent is null and
- * name isn't "".
+ * or {@code ""} if this is the root.
+ * @throws IllegalArgumentException if {@code name} contains a slash
+ * ({@code '/'}), or {@code parent} is {@code null} and
+ * name isn't {@code ""}.
*/
protected AbstractPreferences(AbstractPreferences parent, String name) {
if (parent==null) {
@@ -225,7 +225,7 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the put method as per the specification in
+ * Implements the {@code put} method as per the specification in
* {@link Preferences#put(String,String)}.
*
*
This implementation checks that the key and value are legal,
@@ -236,10 +236,10 @@ public abstract class AbstractPreferences extends Preferences {
*
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
- * @throws NullPointerException if key or value is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH or if value.length exceeds
- * MAX_VALUE_LENGTH.
+ * @throws NullPointerException if key or value is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH} or if {@code value.length} exceeds
+ * {@code MAX_VALUE_LENGTH}.
* @throws IllegalArgumentException if either key or value contain
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -267,26 +267,26 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the get method as per the specification in
+ * Implements the {@code get} method as per the specification in
* {@link Preferences#get(String,String)}.
*
- *
This implementation first checks to see if key is
- * null throwing a NullPointerException if this is
+ *
This implementation first checks to see if {@code key} is
+ * {@code null} throwing a {@code NullPointerException} if this is
* the case. Then it obtains this preference node's lock,
* checks that the node has not been removed, invokes {@link
- * #getSpi(String)}, and returns the result, unless the getSpi
- * invocation returns null or throws an exception, in which case
- * this invocation returns def.
+ * #getSpi(String)}, and returns the result, unless the {@code getSpi}
+ * invocation returns {@code null} or throws an exception, in which case
+ * this invocation returns {@code def}.
*
* @param key key whose associated value is to be returned.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key.
- * @return the value associated with key, or def
- * if no value is associated with key.
+ * preference node has no value associated with {@code key}.
+ * @return the value associated with {@code key}, or {@code def}
+ * if no value is associated with {@code key}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null. (A
- * null default is permitted.)
+ * @throws NullPointerException if key is {@code null}. (A
+ * {@code null} default is permitted.)
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -310,7 +310,7 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the remove(String) method as per the specification
+ * Implements the {@code remove(String)} method as per the specification
* in {@link Preferences#remove(String)}.
*
*
This implementation obtains this preference node's lock,
@@ -340,7 +340,7 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the clear method as per the specification in
+ * Implements the {@code clear} method as per the specification in
* {@link Preferences#clear()}.
*
*
This implementation obtains this preference node's lock,
@@ -361,18 +361,18 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the putInt method as per the specification in
+ * Implements the {@code putInt} method as per the specification in
* {@link Preferences#putInt(String,int)}.
*
- *
This implementation translates value to a string with
+ *
This implementation translates {@code value} to a string with
* {@link Integer#toString(int)} and invokes {@link #put(String,String)}
* on the result.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH.
+ * @throws NullPointerException if key is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalArgumentException if key contains
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -383,26 +383,26 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the getInt method as per the specification in
+ * Implements the {@code getInt} method as per the specification in
* {@link Preferences#getInt(String,int)}.
*
- *
This implementation invokes {@link #get(String,String) get(key,
- * null)}. If the return value is non-null, the implementation
- * attempts to translate it to an int with
+ *
This implementation invokes {@link #get(String,String) get(key,
+ * null)}. If the return value is non-null, the implementation
+ * attempts to translate it to an {@code int} with
* {@link Integer#parseInt(String)}. If the attempt succeeds, the return
- * value is returned by this method. Otherwise, def is returned.
+ * value is returned by this method. Otherwise, {@code def} is returned.
*
* @param key key whose associated value is to be returned as an int.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as an int.
* @return the int value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* an int.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -420,18 +420,18 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the putLong method as per the specification in
+ * Implements the {@code putLong} method as per the specification in
* {@link Preferences#putLong(String,long)}.
*
- *
This implementation translates value to a string with
+ *
This implementation translates {@code value} to a string with
* {@link Long#toString(long)} and invokes {@link #put(String,String)}
* on the result.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH.
+ * @throws NullPointerException if key is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalArgumentException if key contains
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -442,26 +442,26 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the getLong method as per the specification in
+ * Implements the {@code getLong} method as per the specification in
* {@link Preferences#getLong(String,long)}.
*
- *
This implementation invokes {@link #get(String,String) get(key,
- * null)}. If the return value is non-null, the implementation
- * attempts to translate it to a long with
+ *
This implementation invokes {@link #get(String,String) get(key,
+ * null)}. If the return value is non-null, the implementation
+ * attempts to translate it to a {@code long} with
* {@link Long#parseLong(String)}. If the attempt succeeds, the return
- * value is returned by this method. Otherwise, def is returned.
+ * value is returned by this method. Otherwise, {@code def} is returned.
*
* @param key key whose associated value is to be returned as a long.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a long.
* @return the long value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a long.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -479,18 +479,18 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the putBoolean method as per the specification in
+ * Implements the {@code putBoolean} method as per the specification in
* {@link Preferences#putBoolean(String,boolean)}.
*
- *
This implementation translates value to a string with
+ *
This implementation translates {@code value} to a string with
* {@link String#valueOf(boolean)} and invokes {@link #put(String,String)}
* on the result.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH.
+ * @throws NullPointerException if key is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalArgumentException if key contains
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -501,29 +501,29 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the getBoolean method as per the specification in
+ * Implements the {@code getBoolean} method as per the specification in
* {@link Preferences#getBoolean(String,boolean)}.
*
- *
This implementation invokes {@link #get(String,String) get(key,
- * null)}. If the return value is non-null, it is compared with
- * "true" using {@link String#equalsIgnoreCase(String)}. If the
- * comparison returns true, this invocation returns
- * true. Otherwise, the original return value is compared with
- * "false", again using {@link String#equalsIgnoreCase(String)}.
- * If the comparison returns true, this invocation returns
- * false. Otherwise, this invocation returns def.
+ *
This implementation invokes {@link #get(String,String) get(key,
+ * null)}. If the return value is non-null, it is compared with
+ * {@code "true"} using {@link String#equalsIgnoreCase(String)}. If the
+ * comparison returns {@code true}, this invocation returns
+ * {@code true}. Otherwise, the original return value is compared with
+ * {@code "false"}, again using {@link String#equalsIgnoreCase(String)}.
+ * If the comparison returns {@code true}, this invocation returns
+ * {@code false}. Otherwise, this invocation returns {@code def}.
*
* @param key key whose associated value is to be returned as a boolean.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a boolean.
* @return the boolean value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a boolean.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -541,18 +541,18 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the putFloat method as per the specification in
+ * Implements the {@code putFloat} method as per the specification in
* {@link Preferences#putFloat(String,float)}.
*
- *
This implementation translates value to a string with
+ *
This implementation translates {@code value} to a string with
* {@link Float#toString(float)} and invokes {@link #put(String,String)}
* on the result.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH.
+ * @throws NullPointerException if key is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalArgumentException if key contains
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -563,26 +563,26 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the getFloat method as per the specification in
+ * Implements the {@code getFloat} method as per the specification in
* {@link Preferences#getFloat(String,float)}.
*
- *
This implementation invokes {@link #get(String,String) get(key,
- * null)}. If the return value is non-null, the implementation
- * attempts to translate it to an float with
+ *
This implementation invokes {@link #get(String,String) get(key,
+ * null)}. If the return value is non-null, the implementation
+ * attempts to translate it to an {@code float} with
* {@link Float#parseFloat(String)}. If the attempt succeeds, the return
- * value is returned by this method. Otherwise, def is returned.
+ * value is returned by this method. Otherwise, {@code def} is returned.
*
* @param key key whose associated value is to be returned as a float.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a float.
* @return the float value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a float.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -600,18 +600,18 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the putDouble method as per the specification in
+ * Implements the {@code putDouble} method as per the specification in
* {@link Preferences#putDouble(String,double)}.
*
- *
This implementation translates value to a string with
+ *
This implementation translates {@code value} to a string with
* {@link Double#toString(double)} and invokes {@link #put(String,String)}
* on the result.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH.
+ * @throws NullPointerException if key is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalArgumentException if key contains
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -622,26 +622,26 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the getDouble method as per the specification in
+ * Implements the {@code getDouble} method as per the specification in
* {@link Preferences#getDouble(String,double)}.
*
- *
This implementation invokes {@link #get(String,String) get(key,
- * null)}. If the return value is non-null, the implementation
- * attempts to translate it to an double with
+ *
This implementation invokes {@link #get(String,String) get(key,
+ * null)}. If the return value is non-null, the implementation
+ * attempts to translate it to an {@code double} with
* {@link Double#parseDouble(String)}. If the attempt succeeds, the return
- * value is returned by this method. Otherwise, def is returned.
+ * value is returned by this method. Otherwise, {@code def} is returned.
*
* @param key key whose associated value is to be returned as a double.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a double.
* @return the double value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a double.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -659,12 +659,12 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the putByteArray method as per the specification in
+ * Implements the {@code putByteArray} method as per the specification in
* {@link Preferences#putByteArray(String,byte[])}.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key or value is null.
+ * @throws NullPointerException if key or value is {@code null}.
* @throws IllegalArgumentException if key.length() exceeds MAX_KEY_LENGTH
* or if value.length exceeds MAX_VALUE_LENGTH*3/4.
* @throws IllegalArgumentException if key contains
@@ -677,21 +677,21 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the getByteArray method as per the specification in
+ * Implements the {@code getByteArray} method as per the specification in
* {@link Preferences#getByteArray(String,byte[])}.
*
* @param key key whose associated value is to be returned as a byte array.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a byte array.
* @return the byte array value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a byte array.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null. (A
- * null value for defis permitted.)
+ * @throws NullPointerException if {@code key} is {@code null}. (A
+ * {@code null} value for {@code def} is permitted.)
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -710,7 +710,7 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the keys method as per the specification in
+ * Implements the {@code keys} method as per the specification in
* {@link Preferences#keys()}.
*
*
This implementation obtains this preference node's lock, checks that
@@ -734,15 +734,15 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the children method as per the specification in
+ * Implements the {@code children} method as per the specification in
* {@link Preferences#childrenNames()}.
*
*
This implementation obtains this preference node's lock, checks that
- * the node has not been removed, constructs a TreeSet initialized
+ * the node has not been removed, constructs a {@code TreeSet} initialized
* to the names of children already cached (the children in this node's
* "child-cache"), invokes {@link #childrenNamesSpi()}, and adds all of the
* returned child-names into the set. The elements of the tree set are
- * dumped into a String array using the toArray method,
+ * dumped into a {@code String} array using the {@code toArray} method,
* and this array is returned.
*
* @return the names of the children of this preference node.
@@ -780,7 +780,7 @@ public abstract class AbstractPreferences extends Preferences {
= new AbstractPreferences[0];
/**
- * Implements the parent method as per the specification in
+ * Implements the {@code parent} method as per the specification in
* {@link Preferences#parent()}.
*
*
This implementation obtains this preference node's lock, checks that
@@ -801,35 +801,35 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the node method as per the specification in
+ * Implements the {@code node} method as per the specification in
* {@link Preferences#node(String)}.
*
*
This implementation obtains this preference node's lock and checks
- * that the node has not been removed. If path is "",
- * this node is returned; if path is "/", this node's
- * root is returned. If the first character in path is
- * not '/', the implementation breaks path into
+ * that the node has not been removed. If {@code path} is {@code ""},
+ * this node is returned; if {@code path} is {@code "/"}, this node's
+ * root is returned. If the first character in {@code path} is
+ * not {@code '/'}, the implementation breaks {@code path} into
* tokens and recursively traverses the path from this node to the
- * named node, "consuming" a name and a slash from path at
+ * named node, "consuming" a name and a slash from {@code path} at
* each step of the traversal. At each step, the current node is locked
* and the node's child-cache is checked for the named node. If it is
* not found, the name is checked to make sure its length does not
- * exceed MAX_NAME_LENGTH. Then the {@link #childSpi(String)}
+ * exceed {@code MAX_NAME_LENGTH}. Then the {@link #childSpi(String)}
* method is invoked, and the result stored in this node's child-cache.
- * If the newly created Preferences object's {@link #newNode}
- * field is true and there are any node change listeners,
+ * If the newly created {@code Preferences} object's {@link #newNode}
+ * field is {@code true} and there are any node change listeners,
* a notification event is enqueued for processing by the event dispatch
* thread.
*
*
When there are no more tokens, the last value found in the
- * child-cache or returned by childSpi is returned by this
- * method. If during the traversal, two "/" tokens occur
- * consecutively, or the final token is "/" (rather than a name),
- * an appropriate IllegalArgumentException is thrown.
+ * child-cache or returned by {@code childSpi} is returned by this
+ * method. If during the traversal, two {@code "/"} tokens occur
+ * consecutively, or the final token is {@code "/"} (rather than a name),
+ * an appropriate {@code IllegalArgumentException} is thrown.
*
- *
If the first character of path is '/'
+ *
If the first character of {@code path} is {@code '/'}
* (indicating an absolute path name) this preference node's
- * lock is dropped prior to breaking path into tokens, and
+ * lock is dropped prior to breaking {@code path} into tokens, and
* this method recursively traverses the path starting from the root
* (rather than starting from this node). The traversal is otherwise
* identical to the one described for relative path names. Dropping
@@ -889,7 +889,7 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the nodeExists method as per the specification in
+ * Implements the {@code nodeExists} method as per the specification in
* {@link Preferences#nodeExists(String)}.
*
*
This implementation is very similar to {@link #node(String)},
@@ -906,7 +906,7 @@ public abstract class AbstractPreferences extends Preferences {
* with a slash character and is more than one character long).
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method and
- * pathname is not the empty string ("").
+ * {@code pathname} is not the empty string ({@code ""}).
*/
public boolean nodeExists(String path)
throws BackingStoreException
@@ -953,7 +953,7 @@ public abstract class AbstractPreferences extends Preferences {
/**
- * Implements the removeNode() method as per the specification in
+ * Implements the {@code removeNode()} method as per the specification in
* {@link Preferences#removeNode()}.
*
*
This implementation checks to see that this node is the root; if so,
@@ -964,7 +964,7 @@ public abstract class AbstractPreferences extends Preferences {
* of its children are cached: The {@link #childrenNamesSpi()} method is
* invoked and each returned child name is checked for containment in the
* child-cache. If a child is not already cached, the {@link
- * #childSpi(String)} method is invoked to create a Preferences
+ * #childSpi(String)} method is invoked to create a {@code Preferences}
* instance for it, and this instance is put into the child-cache. Then
* the helper method calls itself recursively on each node contained in its
* child-cache. Next, it invokes {@link #removeNodeSpi()}, marks itself
@@ -1024,7 +1024,7 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the name method as per the specification in
+ * Implements the {@code name} method as per the specification in
* {@link Preferences#name()}.
*
*
This implementation merely returns the name that was
@@ -1037,7 +1037,7 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the absolutePath method as per the specification in
+ * Implements the {@code absolutePath} method as per the specification in
* {@link Preferences#absolutePath()}.
*
*
This implementation merely returns the absolute path name that
@@ -1052,7 +1052,7 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the isUserNode method as per the specification in
+ * Implements the {@code isUserNode} method as per the specification in
* {@link Preferences#isUserNode()}.
*
*
This implementation compares this node's root node (which is stored
@@ -1060,8 +1060,8 @@ public abstract class AbstractPreferences extends Preferences {
* {@link Preferences#userRoot()}. If the two object references are
* identical, this method returns true.
*
- * @return true if this preference node is in the user
- * preference tree, false if it's in the system
+ * @return {@code true} if this preference node is in the user
+ * preference tree, {@code false} if it's in the system
* preference tree.
*/
public boolean isUserNode() {
@@ -1160,7 +1160,7 @@ public abstract class AbstractPreferences extends Preferences {
/**
* Put the given key-value association into this preference node. It is
- * guaranteed that key and value are non-null and of
+ * guaranteed that {@code key} and {@code value} are non-null and of
* legal length. Also, it is guaranteed that this node has not been
* removed. (The implementor needn't check for any of these things.)
*
@@ -1172,29 +1172,29 @@ public abstract class AbstractPreferences extends Preferences {
/**
* Return the value associated with the specified key at this preference
- * node, or null if there is no association for this key, or the
+ * node, or {@code null} if there is no association for this key, or the
* association cannot be determined at this time. It is guaranteed that
- * key is non-null. Also, it is guaranteed that this node has
+ * {@code key} is non-null. Also, it is guaranteed that this node has
* not been removed. (The implementor needn't check for either of these
* things.)
*
*
Generally speaking, this method should not throw an exception
* under any circumstances. If, however, if it does throw an exception,
- * the exception will be intercepted and treated as a null
+ * the exception will be intercepted and treated as a {@code null}
* return value.
*
*
This method is invoked with the lock on this node held.
*
* @param key the key
* @return the value associated with the specified key at this preference
- * node, or null if there is no association for this
+ * node, or {@code null} if there is no association for this
* key, or the association cannot be determined at this time.
*/
protected abstract String getSpi(String key);
/**
* Remove the association (if any) for the specified key at this
- * preference node. It is guaranteed that key is non-null.
+ * preference node. It is guaranteed that {@code key} is non-null.
* Also, it is guaranteed that this node has not been removed.
* (The implementor needn't check for either of these things.)
*
@@ -1215,9 +1215,9 @@ public abstract class AbstractPreferences extends Preferences {
* result of a single invocation to {@link Preferences#removeNode()}).
*
*
The removal of a node needn't become persistent until the
- * flush method is invoked on this node (or an ancestor).
+ * {@code flush} method is invoked on this node (or an ancestor).
*
- *
If this node throws a BackingStoreException, the exception
+ *
If this node throws a {@code BackingStoreException}, the exception
* will propagate out beyond the enclosing {@link #removeNode()}
* invocation.
*
@@ -1235,7 +1235,7 @@ public abstract class AbstractPreferences extends Preferences {
*
*
This method is invoked with the lock on this node held.
*
- *
If this node throws a BackingStoreException, the exception
+ *
If this node throws a {@code BackingStoreException}, the exception
* will propagate out beyond the enclosing {@link #keys()} invocation.
*
* @return an array of the keys that have an associated value in this
@@ -1254,7 +1254,7 @@ public abstract class AbstractPreferences extends Preferences {
*
*
This method is invoked with the lock on this node held.
*
- *
If this node throws a BackingStoreException, the exception
+ *
If this node throws a {@code BackingStoreException}, the exception
* will propagate out beyond the enclosing {@link #childrenNames()}
* invocation.
*
@@ -1268,8 +1268,8 @@ public abstract class AbstractPreferences extends Preferences {
throws BackingStoreException;
/**
- * Returns the named child if it exists, or null if it does not.
- * It is guaranteed that nodeName is non-null, non-empty,
+ * Returns the named child if it exists, or {@code null} if it does not.
+ * It is guaranteed that {@code nodeName} is non-null, non-empty,
* does not contain the slash character ('/'), and is no longer than
* {@link #MAX_NAME_LENGTH} characters. Also, it is guaranteed
* that this node has not been removed. (The implementor needn't check
@@ -1288,7 +1288,7 @@ public abstract class AbstractPreferences extends Preferences {
* with the specified node name. If a child node has the correct name,
* the {@link #childSpi(String)} method is invoked and the resulting
* node is returned. If the iteration completes without finding the
- * specified name, null is returned.
+ * specified name, {@code null} is returned.
*
* @param nodeName name of the child to be searched for.
* @return the named child if it exists, or null if it does not.
@@ -1310,7 +1310,7 @@ public abstract class AbstractPreferences extends Preferences {
/**
* Returns the named child of this preference node, creating it if it does
- * not already exist. It is guaranteed that name is non-null,
+ * not already exist. It is guaranteed that {@code name} is non-null,
* non-empty, does not contain the slash character ('/'), and is no longer
* than {@link #MAX_NAME_LENGTH} characters. Also, it is guaranteed that
* this node has not been removed. (The implementor needn't check for any
@@ -1325,12 +1325,12 @@ public abstract class AbstractPreferences extends Preferences {
*
*
The implementer must ensure that the returned node has not been
* removed. If a like-named child of this node was previously removed, the
- * implementer must return a newly constructed AbstractPreferences
- * node; once removed, an AbstractPreferences node
+ * implementer must return a newly constructed {@code AbstractPreferences}
+ * node; once removed, an {@code AbstractPreferences} node
* cannot be "resuscitated."
*
*
If this method causes a node to be created, this node is not
- * guaranteed to be persistent until the flush method is
+ * guaranteed to be persistent until the {@code flush} method is
* invoked on this node or one of its ancestors (or descendants).
*
*
This method is invoked with the lock on this node held.
@@ -1350,7 +1350,7 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the sync method as per the specification in
+ * Implements the {@code sync} method as per the specification in
* {@link Preferences#sync()}.
*
*
This implementation calls a recursive helper method that locks this
@@ -1398,7 +1398,7 @@ public abstract class AbstractPreferences extends Preferences {
* entire subtree at once, the implementer is encouraged to override
* sync(), rather than merely overriding this method.
*
- *
If this node throws a BackingStoreException, the exception
+ *
If this node throws a {@code BackingStoreException}, the exception
* will propagate out beyond the enclosing {@link #sync()} invocation.
*
* @throws BackingStoreException if this operation cannot be completed
@@ -1408,7 +1408,7 @@ public abstract class AbstractPreferences extends Preferences {
protected abstract void syncSpi() throws BackingStoreException;
/**
- * Implements the flush method as per the specification in
+ * Implements the {@code flush} method as per the specification in
* {@link Preferences#flush()}.
*
*
This implementation calls a recursive helper method that locks this
@@ -1459,7 +1459,7 @@ public abstract class AbstractPreferences extends Preferences {
* encouraged to override flush(), rather than merely overriding this
* method.
*
- *
If this node throws a BackingStoreException, the exception
+ *
If this node throws a {@code BackingStoreException}, the exception
* will propagate out beyond the enclosing {@link #flush()} invocation.
*
* @throws BackingStoreException if this operation cannot be completed
@@ -1469,12 +1469,12 @@ public abstract class AbstractPreferences extends Preferences {
protected abstract void flushSpi() throws BackingStoreException;
/**
- * Returns true iff this node (or an ancestor) has been
+ * Returns {@code true} iff this node (or an ancestor) has been
* removed with the {@link #removeNode()} method. This method
* locks this node prior to returning the contents of the private
* field used to track this state.
*
- * @return true iff this node (or an ancestor) has been
+ * @return {@code true} iff this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
*/
protected boolean isRemoved() {
@@ -1630,12 +1630,12 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the exportNode method as per the specification in
+ * Implements the {@code exportNode} method as per the specification in
* {@link Preferences#exportNode(OutputStream)}.
*
* @param os the output stream on which to emit the XML document.
* @throws IOException if writing to the specified output stream
- * results in an IOException.
+ * results in an {@code IOException}.
* @throws BackingStoreException if preference data cannot be read from
* backing store.
*/
@@ -1646,12 +1646,12 @@ public abstract class AbstractPreferences extends Preferences {
}
/**
- * Implements the exportSubtree method as per the specification in
+ * Implements the {@code exportSubtree} method as per the specification in
* {@link Preferences#exportSubtree(OutputStream)}.
*
* @param os the output stream on which to emit the XML document.
* @throws IOException if writing to the specified output stream
- * results in an IOException.
+ * results in an {@code IOException}.
* @throws BackingStoreException if preference data cannot be read from
* backing store.
*/
diff --git a/jdk/src/java.prefs/share/classes/java/util/prefs/Base64.java b/jdk/src/java.prefs/share/classes/java/util/prefs/Base64.java
index 50ed3582bb6..523379c4612 100644
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/Base64.java
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/Base64.java
@@ -124,7 +124,7 @@ class Base64 {
* Translates the specified Base64 string (as per Preferences.get(byte[]))
* into a byte array.
*
- * @throw IllegalArgumentException if s is not a valid Base64
+ * @throw IllegalArgumentException if {@code s} is not a valid Base64
* string.
*/
static byte[] base64ToByteArray(String s) {
@@ -136,7 +136,7 @@ class Base64 {
* into a byte array.
*
* @throw IllegalArgumentException or ArrayOutOfBoundsException
- * if s is not a valid alternate representation
+ * if {@code s} is not a valid alternate representation
* Base64 string.
*/
static byte[] altBase64ToByteArray(String s) {
diff --git a/jdk/src/java.prefs/share/classes/java/util/prefs/NodeChangeEvent.java b/jdk/src/java.prefs/share/classes/java/util/prefs/NodeChangeEvent.java
index f108925a0ee..af8d10a2471 100644
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/NodeChangeEvent.java
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/NodeChangeEvent.java
@@ -28,7 +28,7 @@ package java.util.prefs;
import java.io.NotSerializableException;
/**
- * An event emitted by a Preferences node to indicate that
+ * An event emitted by a {@code Preferences} node to indicate that
* a child of that node has been added or removed.
*
* Note, that although NodeChangeEvent inherits Serializable interface from
@@ -52,7 +52,7 @@ public class NodeChangeEvent extends java.util.EventObject {
private Preferences child;
/**
- * Constructs a new NodeChangeEvent instance.
+ * Constructs a new {@code NodeChangeEvent} instance.
*
* @param parent The parent of the node that was added or removed.
* @param child The node that was added or removed.
diff --git a/jdk/src/java.prefs/share/classes/java/util/prefs/PreferenceChangeEvent.java b/jdk/src/java.prefs/share/classes/java/util/prefs/PreferenceChangeEvent.java
index f7cf7b5ef5a..f108d68a457 100644
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/PreferenceChangeEvent.java
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/PreferenceChangeEvent.java
@@ -28,7 +28,7 @@ package java.util.prefs;
import java.io.NotSerializableException;
/**
- * An event emitted by a Preferences node to indicate that
+ * An event emitted by a {@code Preferences} node to indicate that
* a preference has been added, removed or has had its value changed.
*
* Note, that although PreferenceChangeEvent inherits Serializable interface
@@ -52,18 +52,18 @@ public class PreferenceChangeEvent extends java.util.EventObject {
private String key;
/**
- * New value for preference, or null if it was removed.
+ * New value for preference, or {@code null} if it was removed.
*
* @serial
*/
private String newValue;
/**
- * Constructs a new PreferenceChangeEvent instance.
+ * Constructs a new {@code PreferenceChangeEvent} instance.
*
* @param node The Preferences node that emitted the event.
* @param key The key of the preference that was changed.
- * @param newValue The new value of the preference, or null
+ * @param newValue The new value of the preference, or {@code null}
* if the preference is being removed.
*/
public PreferenceChangeEvent(Preferences node, String key,
@@ -94,7 +94,7 @@ public class PreferenceChangeEvent extends java.util.EventObject {
/**
* Returns the new value for the preference.
*
- * @return The new value for the preference, or null if the
+ * @return The new value for the preference, or {@code null} if the
* preference was removed.
*/
public String getNewValue() {
diff --git a/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java b/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java
index 9edefc5affb..67394641c9d 100644
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java
@@ -72,10 +72,10 @@ import java.lang.Double;
* only restrictions on this name are that it cannot be the empty string, and
* it cannot contain the slash character ('/').
*
- *
The root node has an absolute path name of "/". Children of
- * the root node have absolute path names of "/" + <node
+ *
The root node has an absolute path name of {@code "/"}. Children of
+ * the root node have absolute path names of {@code "/" + }<node
* name>. All other nodes have absolute path names of <parent's
- * absolute path name> + "/" + <node name>.
+ * absolute path name>{@code + "/" + }<node name>.
* Note that all absolute path names begin with the slash character.
*
*
A node n's path name relative to its ancestor a
@@ -102,18 +102,18 @@ import java.lang.Double;
*
All of the methods that modify preferences data are permitted to operate
* asynchronously; they may return immediately, and changes will eventually
* propagate to the persistent backing store with an implementation-dependent
- * delay. The flush method may be used to synchronously force
+ * delay. The {@code flush} method may be used to synchronously force
* updates to the backing store. Normal termination of the Java Virtual
* Machine will not result in the loss of pending updates -- an explicit
- * flush invocation is not required upon termination to ensure
+ * {@code flush} invocation is not required upon termination to ensure
* that pending updates are made persistent.
*
- *
All of the methods that read preferences from a Preferences
+ *
All of the methods that read preferences from a {@code Preferences}
* object require the invoker to provide a default value. The default value is
* returned if no value has been previously set or if the backing store is
* unavailable. The intent is to allow applications to operate, albeit
* with slightly degraded functionality, even if the backing store becomes
- * unavailable. Several methods, like flush, have semantics that
+ * unavailable. Several methods, like {@code flush}, have semantics that
* prevent them from operating if the backing store is unavailable. Ordinary
* applications should have no need to invoke any of these methods, which can
* be identified by the fact that they are declared to throw {@link
@@ -181,31 +181,31 @@ import java.lang.Double;
* value CDATA #REQUIRED >
* }
*
- * Every Preferences implementation must have an associated {@link
+ * Every {@code Preferences} implementation must have an associated {@link
* PreferencesFactory} implementation. Every Java(TM) SE implementation must provide
- * some means of specifying which PreferencesFactory implementation
+ * some means of specifying which {@code PreferencesFactory} implementation
* is used to generate the root preferences nodes. This allows the
* administrator to replace the default preferences implementation with an
* alternative implementation.
*
- *
Implementation note: In Sun's JRE, the PreferencesFactory
+ *
Implementation note: In Sun's JRE, the {@code PreferencesFactory}
* implementation is located as follows:
*
*
*
*
If the system property
- * java.util.prefs.PreferencesFactory is defined, then it is
+ * {@code java.util.prefs.PreferencesFactory} is defined, then it is
* taken to be the fully-qualified name of a class implementing the
- * PreferencesFactory interface. The class is loaded and
+ * {@code PreferencesFactory} interface. The class is loaded and
* instantiated; if this process fails then an unspecified error is
* thrown.
*
- *
If a PreferencesFactory implementation class file
+ *
If a {@code PreferencesFactory} implementation class file
* has been installed in a jar file that is visible to the
* {@link java.lang.ClassLoader#getSystemClassLoader system class loader},
* and that jar file contains a provider-configuration file named
- * java.util.prefs.PreferencesFactory in the resource
- * directory META-INF/services, then the first class name
+ * {@code java.util.prefs.PreferencesFactory} in the resource
+ * directory {@code META-INF/services}, then the first class name
* specified in that file is taken. If more than one such jar file is
* provided, the first one found will be used. The class is loaded
* and instantiated; if this process fails then an unspecified error
@@ -213,7 +213,7 @@ import java.lang.Double;
*
*
Finally, if neither the above-mentioned system property nor
* an extension jar file is provided, then the system-wide default
- * PreferencesFactory implementation for the underlying
+ * {@code PreferencesFactory} implementation for the underlying
* platform is loaded and instantiated.
*
*
@@ -328,19 +328,19 @@ public abstract class Preferences {
* Returns the preference node from the calling user's preference tree
* that is associated (by convention) with the specified class's package.
* The convention is as follows: the absolute path name of the node is the
- * fully qualified package name, preceded by a slash ('/'), and
- * with each period ('.') replaced by a slash. For example the
+ * fully qualified package name, preceded by a slash ({@code '/'}), and
+ * with each period ({@code '.'}) replaced by a slash. For example the
* absolute path name of the node associated with the class
- * com.acme.widget.Foo is /com/acme/widget.
+ * {@code com.acme.widget.Foo} is {@code /com/acme/widget}.
*
*
This convention does not apply to the unnamed package, whose
- * associated preference node is <unnamed>. This node
+ * associated preference node is {@code }. This node
* is not intended for long term use, but for convenience in the early
* development of programs that do not yet belong to a package, and
* for "throwaway" programs. Valuable data should not be stored
* at this node as it is shared by all programs that use it.
*
- *
A class Foo wishing to access preferences pertaining to its
+ *
A class {@code Foo} wishing to access preferences pertaining to its
* package can obtain a preference node as follows:
@@ -353,15 +353,15 @@ public abstract class Preferences {
* node and its ancestors if they do not already exist. If the returned
* node did not exist prior to this call, this node and any ancestors that
* were created by this call are not guaranteed to become permanent until
- * the flush method is called on the returned node (or one of its
+ * the {@code flush} method is called on the returned node (or one of its
* ancestors or descendants).
*
* @param c the class for whose package a user preference node is desired.
* @return the user preference node associated with the package of which
- * c is a member.
- * @throws NullPointerException if c is null.
+ * {@code c} is a member.
+ * @throws NullPointerException if {@code c} is {@code null}.
* @throws SecurityException if a security manager is present and
- * it denies RuntimePermission("preferences").
+ * it denies {@code RuntimePermission("preferences")}.
* @see RuntimePermission
*/
public static Preferences userNodeForPackage(Class> c) {
@@ -372,19 +372,19 @@ public abstract class Preferences {
* Returns the preference node from the system preference tree that is
* associated (by convention) with the specified class's package. The
* convention is as follows: the absolute path name of the node is the
- * fully qualified package name, preceded by a slash ('/'), and
- * with each period ('.') replaced by a slash. For example the
+ * fully qualified package name, preceded by a slash ({@code '/'}), and
+ * with each period ({@code '.'}) replaced by a slash. For example the
* absolute path name of the node associated with the class
- * com.acme.widget.Foo is /com/acme/widget.
+ * {@code com.acme.widget.Foo} is {@code /com/acme/widget}.
*
*
This convention does not apply to the unnamed package, whose
- * associated preference node is <unnamed>. This node
+ * associated preference node is {@code }. This node
* is not intended for long term use, but for convenience in the early
* development of programs that do not yet belong to a package, and
* for "throwaway" programs. Valuable data should not be stored
* at this node as it is shared by all programs that use it.
*
- *
A class Foo wishing to access preferences pertaining to its
+ *
A class {@code Foo} wishing to access preferences pertaining to its
* package can obtain a preference node as follows:
@@ -397,15 +397,15 @@ public abstract class Preferences {
* node and its ancestors if they do not already exist. If the returned
* node did not exist prior to this call, this node and any ancestors that
* were created by this call are not guaranteed to become permanent until
- * the flush method is called on the returned node (or one of its
+ * the {@code flush} method is called on the returned node (or one of its
* ancestors or descendants).
*
* @param c the class for whose package a system preference node is desired.
* @return the system preference node associated with the package of which
- * c is a member.
- * @throws NullPointerException if c is null.
+ * {@code c} is a member.
+ * @throws NullPointerException if {@code c} is {@code null}.
* @throws SecurityException if a security manager is present and
- * it denies RuntimePermission("preferences").
+ * it denies {@code RuntimePermission("preferences")}.
* @see RuntimePermission
*/
public static Preferences systemNodeForPackage(Class> c) {
@@ -443,7 +443,7 @@ public abstract class Preferences {
*
* @return the root preference node for the calling user.
* @throws SecurityException If a security manager is present and
- * it denies RuntimePermission("preferences").
+ * it denies {@code RuntimePermission("preferences")}.
* @see RuntimePermission
*/
public static Preferences userRoot() {
@@ -459,7 +459,7 @@ public abstract class Preferences {
*
* @return the root preference node for the system.
* @throws SecurityException If a security manager is present and
- * it denies RuntimePermission("preferences").
+ * it denies {@code RuntimePermission("preferences")}.
* @see RuntimePermission
*/
public static Preferences systemRoot() {
@@ -483,10 +483,10 @@ public abstract class Preferences {
*
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
- * @throws NullPointerException if key or value is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH or if value.length exceeds
- * MAX_VALUE_LENGTH.
+ * @throws NullPointerException if key or value is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH} or if {@code value.length} exceeds
+ * {@code MAX_VALUE_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if either key or value contain
@@ -506,14 +506,14 @@ public abstract class Preferences {
*
* @param key key whose associated value is to be returned.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key.
- * @return the value associated with key, or def
- * if no value is associated with key, or the backing
+ * preference node has no value associated with {@code key}.
+ * @return the value associated with {@code key}, or {@code def}
+ * if no value is associated with {@code key}, or the backing
* store is inaccessible.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null. (A
- * null value for defis permitted.)
+ * @throws NullPointerException if {@code key} is {@code null}. (A
+ * {@code null} value for {@code def} is permitted.)
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -526,10 +526,10 @@ public abstract class Preferences {
*
If this implementation supports stored defaults, and there is
* such a default for the specified preference, the stored default will be
* "exposed" by this call, in the sense that it will be returned
- * by a succeeding call to get.
+ * by a succeeding call to {@code get}.
*
* @param key key whose mapping is to be removed from the preference node.
- * @throws NullPointerException if key is null.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains the null control
@@ -545,7 +545,7 @@ public abstract class Preferences {
*
If this implementation supports stored defaults, and this
* node in the preferences hierarchy contains any such defaults,
* the stored defaults will be "exposed" by this call, in the sense that
- * they will be returned by succeeding calls to get.
+ * they will be returned by succeeding calls to {@code get}.
*
* @throws BackingStoreException if this operation cannot be completed
* due to a failure in the backing store, or inability to
@@ -565,9 +565,9 @@ public abstract class Preferences {
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH.
+ * @throws NullPointerException if {@code key} is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains
@@ -582,27 +582,27 @@ public abstract class Preferences {
* an integer as by {@link Integer#parseInt(String)}. Returns the
* specified default if there is no value associated with the key,
* the backing store is inaccessible, or if
- * Integer.parseInt(String) would throw a {@link
+ * {@code Integer.parseInt(String)} would throw a {@link
* NumberFormatException} if the associated value were passed. This
* method is intended for use in conjunction with {@link #putInt}.
*
*
If the implementation supports stored defaults and such a
* default exists, is accessible, and could be converted to an int
- * with Integer.parseInt, this int is returned in preference to
+ * with {@code Integer.parseInt}, this int is returned in preference to
* the specified default.
*
* @param key key whose associated value is to be returned as an int.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as an int,
* or the backing store is inaccessible.
* @return the int value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* an int.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #putInt(String,int)
@@ -619,9 +619,9 @@ public abstract class Preferences {
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH.
+ * @throws NullPointerException if {@code key} is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains
@@ -636,27 +636,27 @@ public abstract class Preferences {
* a long as by {@link Long#parseLong(String)}. Returns the
* specified default if there is no value associated with the key,
* the backing store is inaccessible, or if
- * Long.parseLong(String) would throw a {@link
+ * {@code Long.parseLong(String)} would throw a {@link
* NumberFormatException} if the associated value were passed. This
* method is intended for use in conjunction with {@link #putLong}.
*
*
If the implementation supports stored defaults and such a
* default exists, is accessible, and could be converted to a long
- * with Long.parseLong, this long is returned in preference to
+ * with {@code Long.parseLong}, this long is returned in preference to
* the specified default.
*
* @param key key whose associated value is to be returned as a long.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a long,
* or the backing store is inaccessible.
* @return the long value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a long.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #putLong(String,long)
@@ -667,15 +667,15 @@ public abstract class Preferences {
/**
* Associates a string representing the specified boolean value with the
* specified key in this preference node. The associated string is
- * "true" if the value is true, and "false" if it is
+ * {@code "true"} if the value is true, and {@code "false"} if it is
* false. This method is intended for use in conjunction with
* {@link #getBoolean}.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH.
+ * @throws NullPointerException if {@code key} is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains
@@ -688,34 +688,34 @@ public abstract class Preferences {
/**
* Returns the boolean value represented by the string associated with the
* specified key in this preference node. Valid strings
- * are "true", which represents true, and "false", which
- * represents false. Case is ignored, so, for example, "TRUE"
- * and "False" are also valid. This method is intended for use in
+ * are {@code "true"}, which represents true, and {@code "false"}, which
+ * represents false. Case is ignored, so, for example, {@code "TRUE"}
+ * and {@code "False"} are also valid. This method is intended for use in
* conjunction with {@link #putBoolean}.
*
*
Returns the specified default if there is no value
* associated with the key, the backing store is inaccessible, or if the
- * associated value is something other than "true" or
- * "false", ignoring case.
+ * associated value is something other than {@code "true"} or
+ * {@code "false"}, ignoring case.
*
*
If the implementation supports stored defaults and such a
* default exists and is accessible, it is used in preference to the
* specified default, unless the stored default is something other than
- * "true" or "false", ignoring case, in which case the
+ * {@code "true"} or {@code "false"}, ignoring case, in which case the
* specified default is used.
*
* @param key key whose associated value is to be returned as a boolean.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a boolean,
* or the backing store is inaccessible.
* @return the boolean value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a boolean.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #get(String,String)
@@ -732,9 +732,9 @@ public abstract class Preferences {
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH.
+ * @throws NullPointerException if {@code key} is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains
@@ -748,27 +748,27 @@ public abstract class Preferences {
* specified key in this preference node. The string is converted to an
* integer as by {@link Float#parseFloat(String)}. Returns the specified
* default if there is no value associated with the key, the backing store
- * is inaccessible, or if Float.parseFloat(String) would throw a
+ * is inaccessible, or if {@code Float.parseFloat(String)} would throw a
* {@link NumberFormatException} if the associated value were passed.
* This method is intended for use in conjunction with {@link #putFloat}.
*
*
If the implementation supports stored defaults and such a
* default exists, is accessible, and could be converted to a float
- * with Float.parseFloat, this float is returned in preference to
+ * with {@code Float.parseFloat}, this float is returned in preference to
* the specified default.
*
* @param key key whose associated value is to be returned as a float.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a float,
* or the backing store is inaccessible.
* @return the float value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a float.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #putFloat(String,float)
@@ -785,9 +785,9 @@ public abstract class Preferences {
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is null.
- * @throws IllegalArgumentException if key.length() exceeds
- * MAX_KEY_LENGTH.
+ * @throws NullPointerException if {@code key} is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains
@@ -801,27 +801,27 @@ public abstract class Preferences {
* specified key in this preference node. The string is converted to an
* integer as by {@link Double#parseDouble(String)}. Returns the specified
* default if there is no value associated with the key, the backing store
- * is inaccessible, or if Double.parseDouble(String) would throw a
+ * is inaccessible, or if {@code Double.parseDouble(String)} would throw a
* {@link NumberFormatException} if the associated value were passed.
* This method is intended for use in conjunction with {@link #putDouble}.
*
*
If the implementation supports stored defaults and such a
* default exists, is accessible, and could be converted to a double
- * with Double.parseDouble, this double is returned in preference
+ * with {@code Double.parseDouble}, this double is returned in preference
* to the specified default.
*
* @param key key whose associated value is to be returned as a double.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a double,
* or the backing store is inaccessible.
* @return the double value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a double.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #putDouble(String,double)
@@ -837,14 +837,14 @@ public abstract class Preferences {
* with one minor change: the string will consist solely of characters
* from the Base64 Alphabet; it will not contain any newline
* characters. Note that the maximum length of the byte array is limited
- * to three quarters of MAX_VALUE_LENGTH so that the length
- * of the Base64 encoded String does not exceed MAX_VALUE_LENGTH.
+ * to three quarters of {@code MAX_VALUE_LENGTH} so that the length
+ * of the Base64 encoded String does not exceed {@code MAX_VALUE_LENGTH}.
* This method is intended for use in conjunction with
* {@link #getByteArray}.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key or value is null.
+ * @throws NullPointerException if key or value is {@code null}.
* @throws IllegalArgumentException if key.length() exceeds MAX_KEY_LENGTH
* or if value.length exceeds MAX_VALUE_LENGTH*3/4.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -879,17 +879,17 @@ public abstract class Preferences {
*
* @param key key whose associated value is to be returned as a byte array.
* @param def the value to be returned in the event that this
- * preference node has no value associated with key
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a byte array,
* or the backing store is inaccessible.
* @return the byte array value represented by the string associated with
- * key in this preference node, or def if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a byte array.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is null. (A
- * null value for defis permitted.)
+ * @throws NullPointerException if {@code key} is {@code null}. (A
+ * {@code null} value for {@code def} is permitted.)
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #get(String,String)
@@ -932,7 +932,7 @@ public abstract class Preferences {
public abstract String[] childrenNames() throws BackingStoreException;
/**
- * Returns the parent of this preference node, or null if this is
+ * Returns the parent of this preference node, or {@code null} if this is
* the root.
*
* @return the parent of this preference node.
@@ -945,12 +945,12 @@ public abstract class Preferences {
* Returns the named preference node in the same tree as this node,
* creating it and any of its ancestors if they do not already exist.
* Accepts a relative or absolute path name. Relative path names
- * (which do not begin with the slash character ('/')) are
+ * (which do not begin with the slash character {@code ('/')}) are
* interpreted relative to this preference node.
*
*
If the returned node did not exist prior to this call, this node and
* any ancestors that were created by this call are not guaranteed
- * to become permanent until the flush method is called on
+ * to become permanent until the {@code flush} method is called on
* the returned node (or one of its ancestors or descendants).
*
* @param pathName the path name of the preference node to return.
@@ -958,7 +958,7 @@ public abstract class Preferences {
* @throws IllegalArgumentException if the path name is invalid (i.e.,
* it contains multiple consecutive slash characters, or ends
* with a slash character and is more than one character long).
- * @throws NullPointerException if path name is null.
+ * @throws NullPointerException if path name is {@code null}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @see #flush()
@@ -968,14 +968,14 @@ public abstract class Preferences {
/**
* Returns true if the named preference node exists in the same tree
* as this node. Relative path names (which do not begin with the slash
- * character ('/')) are interpreted relative to this preference
+ * character {@code ('/')}) are interpreted relative to this preference
* node.
*
*
If this node (or an ancestor) has already been removed with the
* {@link #removeNode()} method, it is legal to invoke this method,
- * but only with the path name ""; the invocation will return
- * false. Thus, the idiom p.nodeExists("") may be
- * used to test whether p has been removed.
+ * but only with the path name {@code ""}; the invocation will return
+ * {@code false}. Thus, the idiom {@code p.nodeExists("")} may be
+ * used to test whether {@code p} has been removed.
*
* @param pathName the path name of the node whose existence
* is to be checked.
@@ -986,10 +986,10 @@ public abstract class Preferences {
* @throws IllegalArgumentException if the path name is invalid (i.e.,
* it contains multiple consecutive slash characters, or ends
* with a slash character and is more than one character long).
- * @throws NullPointerException if path name is null.
+ * @throws NullPointerException if path name is {@code null}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method and
- * pathName is not the empty string ("").
+ * {@code pathName} is not the empty string ({@code ""}).
*/
public abstract boolean nodeExists(String pathName)
throws BackingStoreException;
@@ -1000,19 +1000,19 @@ public abstract class Preferences {
* removed, attempting any method other than {@link #name()},
* {@link #absolutePath()}, {@link #isUserNode()}, {@link #flush()} or
* {@link #node(String) nodeExists("")} on the corresponding
- * Preferences instance will fail with an
- * IllegalStateException. (The methods defined on {@link Object}
+ * {@code Preferences} instance will fail with an
+ * {@code IllegalStateException}. (The methods defined on {@link Object}
* can still be invoked on a node after it has been removed; they will not
- * throw IllegalStateException.)
+ * throw {@code IllegalStateException}.)
*
*
The removal is not guaranteed to be persistent until the
- * flush method is called on this node (or an ancestor).
+ * {@code flush} method is called on this node (or an ancestor).
*
*
If this implementation supports stored defaults, removing a
* node exposes any stored defaults at or below this node. Thus, a
- * subsequent call to nodeExists on this node's path name may
- * return true, and a subsequent call to node on this
- * path name may return a (different) Preferences instance
+ * subsequent call to {@code nodeExists} on this node's path name may
+ * return {@code true}, and a subsequent call to {@code node} on this
+ * path name may return a (different) {@code Preferences} instance
* representing a non-empty collection of preferences and/or children.
*
* @throws BackingStoreException if this operation cannot be completed
@@ -1041,19 +1041,19 @@ public abstract class Preferences {
public abstract String absolutePath();
/**
- * Returns true if this preference node is in the user
- * preference tree, false if it's in the system preference tree.
+ * Returns {@code true} if this preference node is in the user
+ * preference tree, {@code false} if it's in the system preference tree.
*
- * @return true if this preference node is in the user
- * preference tree, false if it's in the system
+ * @return {@code true} if this preference node is in the user
+ * preference tree, {@code false} if it's in the system
* preference tree.
*/
public abstract boolean isUserNode();
/**
* Returns a string representation of this preferences node,
- * as if computed by the expression:(this.isUserNode() ? "User" :
- * "System") + " Preference Node: " + this.absolutePath().
+ * as if computed by the expression:{@code (this.isUserNode() ? "User" :
+ * "System") + " Preference Node: " + this.absolutePath()}.
*/
public abstract String toString();
@@ -1086,9 +1086,9 @@ public abstract class Preferences {
/**
* Ensures that future reads from this preference node and its
* descendants reflect any changes that were committed to the persistent
- * store (from any VM) prior to the sync invocation. As a
+ * store (from any VM) prior to the {@code sync} invocation. As a
* side-effect, forces any changes in the contents of this preference node
- * and its descendants to the persistent store, as if the flush
+ * and its descendants to the persistent store, as if the {@code flush}
* method had been invoked on this node.
*
* @throws BackingStoreException if this operation cannot be completed
@@ -1107,7 +1107,7 @@ public abstract class Preferences {
* node, or when the value associated with a preference is changed.
* (Preference change events are not generated by the {@link
* #removeNode()} method, which generates a node change event.
- * Preference change events are generated by the clear
+ * Preference change events are generated by the {@code clear}
* method.)
*
*
Events are only guaranteed for changes made within the same JVM
@@ -1118,7 +1118,7 @@ public abstract class Preferences {
* desiring such events must register with each descendant.
*
* @param pcl The preference change listener to add.
- * @throws NullPointerException if pcl is null.
+ * @throws NullPointerException if {@code pcl} is null.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @see #removePreferenceChangeListener(PreferenceChangeListener)
@@ -1132,7 +1132,7 @@ public abstract class Preferences {
* receives preference change events.
*
* @param pcl The preference change listener to remove.
- * @throws IllegalArgumentException if pcl was not a registered
+ * @throws IllegalArgumentException if {@code pcl} was not a registered
* preference change listener on this node.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
@@ -1163,8 +1163,8 @@ public abstract class Preferences {
* circumstances, implementations are neither required to generate node
* change events nor prohibited from doing so.
*
- * @param ncl The NodeChangeListener to add.
- * @throws NullPointerException if ncl is null.
+ * @param ncl The {@code NodeChangeListener} to add.
+ * @throws NullPointerException if {@code ncl} is null.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @see #removeNodeChangeListener(NodeChangeListener)
@@ -1173,12 +1173,12 @@ public abstract class Preferences {
public abstract void addNodeChangeListener(NodeChangeListener ncl);
/**
- * Removes the specified NodeChangeListener, so it no longer
+ * Removes the specified {@code NodeChangeListener}, so it no longer
* receives change events.
*
- * @param ncl The NodeChangeListener to remove.
- * @throws IllegalArgumentException if ncl was not a registered
- * NodeChangeListener on this node.
+ * @param ncl The {@code NodeChangeListener} to remove.
+ * @throws IllegalArgumentException if {@code ncl} was not a registered
+ * {@code NodeChangeListener} on this node.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @see #addNodeChangeListener(NodeChangeListener)
@@ -1206,7 +1206,7 @@ public abstract class Preferences {
*
* @param os the output stream on which to emit the XML document.
* @throws IOException if writing to the specified output stream
- * results in an IOException.
+ * results in an {@code IOException}.
* @throws BackingStoreException if preference data cannot be read from
* backing store.
* @see #importPreferences(InputStream)
@@ -1237,7 +1237,7 @@ public abstract class Preferences {
*
* @param os the output stream on which to emit the XML document.
* @throws IOException if writing to the specified output stream
- * results in an IOException.
+ * results in an {@code IOException}.
* @throws BackingStoreException if preference data cannot be read from
* backing store.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -1273,11 +1273,11 @@ public abstract class Preferences {
*
* @param is the input stream from which to read the XML document.
* @throws IOException if reading from the specified input stream
- * results in an IOException.
+ * results in an {@code IOException}.
* @throws InvalidPreferencesFormatException Data on input stream does not
* constitute a valid XML document with the mandated document type.
* @throws SecurityException If a security manager is present and
- * it denies RuntimePermission("preferences").
+ * it denies {@code RuntimePermission("preferences")}.
* @see RuntimePermission
*/
public static void importPreferences(InputStream is)
diff --git a/jdk/src/java.prefs/share/classes/java/util/prefs/PreferencesFactory.java b/jdk/src/java.prefs/share/classes/java/util/prefs/PreferencesFactory.java
index d7341e6569d..f660c26ff7b 100644
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/PreferencesFactory.java
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/PreferencesFactory.java
@@ -29,12 +29,12 @@ import java.util.*;
/**
* A factory object that generates Preferences objects. Providers of
* new {@link Preferences} implementations should provide corresponding
- * PreferencesFactory implementations so that the new
- * Preferences implementation can be installed in place of the
+ * {@code PreferencesFactory} implementations so that the new
+ * {@code Preferences} implementation can be installed in place of the
* platform-specific default implementation.
*
- *
This class is for Preferences implementers only.
- * Normal users of the Preferences facility should have no need to
+ *
This class is for {@code Preferences} implementers only.
+ * Normal users of the {@code Preferences} facility should have no need to
* consult this documentation.
*
* @author Josh Bloch
diff --git a/jdk/src/java.prefs/share/classes/java/util/prefs/XmlSupport.java b/jdk/src/java.prefs/share/classes/java/util/prefs/XmlSupport.java
index e7bb3730803..b8045920edf 100644
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/XmlSupport.java
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/XmlSupport.java
@@ -88,7 +88,7 @@ class XmlSupport {
* an XML document conforming to the definition in the Preferences spec.
*
* @throws IOException if writing to the specified output stream
- * results in an IOException.
+ * results in an {@code IOException}.
* @throws BackingStoreException if preference data cannot be read from
* backing store.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -188,7 +188,7 @@ class XmlSupport {
* spec.
*
* @throws IOException if reading from the specified output stream
- * results in an IOException.
+ * results in an {@code IOException}.
* @throws InvalidPreferencesFormatException Data on input stream does not
* constitute a valid XML document with the mandated document type.
*/
@@ -337,7 +337,7 @@ class XmlSupport {
* as the internal (undocumented) format for FileSystemPrefs.
*
* @throws IOException if writing to the specified output stream
- * results in an IOException.
+ * results in an {@code IOException}.
*/
static void exportMap(OutputStream os, Map map) throws IOException {
Document doc = createPrefsDoc("map");
@@ -363,7 +363,7 @@ class XmlSupport {
* the key-value pairs int the XML-document when this method returns.)
*
* @throws IOException if reading from the specified output stream
- * results in an IOException.
+ * results in an {@code IOException}.
* @throws InvalidPreferencesFormatException Data on input stream does not
* constitute a valid XML document with the mandated document type.
*/
diff --git a/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferences.java b/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferences.java
index 1e93cb88a32..617adb13042 100644
--- a/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferences.java
+++ b/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferences.java
@@ -33,10 +33,10 @@ import java.security.PrivilegedAction;
import sun.util.logging.PlatformLogger;
/**
- * Windows registry based implementation of Preferences.
- * Preferences' systemRoot and userRoot are stored in
- * HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs and
- * HKEY_CURRENT_USER\Software\JavaSoft\Prefs correspondingly.
+ * Windows registry based implementation of {@code Preferences}.
+ * {@code Preferences}' {@code systemRoot} and {@code userRoot} are stored in
+ * {@code HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs} and
+ * {@code HKEY_CURRENT_USER\Software\JavaSoft\Prefs} correspondingly.
*
* @author Konstantin Kladko
* @see Preferences
@@ -60,31 +60,31 @@ class WindowsPreferences extends AbstractPreferences {
private static PlatformLogger logger;
/**
- * Windows registry path to Preferences's root nodes.
+ * Windows registry path to {@code Preferences}'s root nodes.
*/
private static final byte[] WINDOWS_ROOT_PATH =
stringToByteArray("Software\\JavaSoft\\Prefs");
/**
- * Windows handles to HKEY_CURRENT_USER and
- * HKEY_LOCAL_MACHINE hives.
+ * Windows handles to {@code HKEY_CURRENT_USER} and
+ * {@code HKEY_LOCAL_MACHINE} hives.
*/
private static final int HKEY_CURRENT_USER = 0x80000001;
private static final int HKEY_LOCAL_MACHINE = 0x80000002;
/**
- * Mount point for Preferences' user root.
+ * Mount point for {@code Preferences}' user root.
*/
private static final int USER_ROOT_NATIVE_HANDLE = HKEY_CURRENT_USER;
/**
- * Mount point for Preferences' system root.
+ * Mount point for {@code Preferences}' system root.
*/
private static final int SYSTEM_ROOT_NATIVE_HANDLE = HKEY_LOCAL_MACHINE;
/**
* Maximum byte-encoded path length for Windows native functions,
- * ending null character not included.
+ * ending {@code null} character not included.
*/
private static final int MAX_WINDOWS_PATH_LENGTH = 256;
@@ -388,7 +388,7 @@ class WindowsPreferences extends AbstractPreferences {
}
/**
- * Constructs a WindowsPreferences node, creating underlying
+ * Constructs a {@code WindowsPreferences} node, creating underlying
* Windows registry node and all its Windows parents, if they are not yet
* created.
* Logs a warning message, if Windows Registry is unavailable.
@@ -617,7 +617,7 @@ class WindowsPreferences extends AbstractPreferences {
}
/**
- * Implements AbstractPreferencesputSpi() method.
+ * Implements {@code AbstractPreferences} {@code putSpi()} method.
* Puts name-value pair into the underlying Windows registry node.
* Logs a warning, if Windows registry is unavailable.
* @see #getSpi(String)
@@ -645,7 +645,7 @@ class WindowsPreferences extends AbstractPreferences {
}
/**
- * Implements AbstractPreferencesgetSpi() method.
+ * Implements {@code AbstractPreferences} {@code getSpi()} method.
* Gets a string value from the underlying Windows registry node.
* Logs a warning, if Windows registry is unavailable.
* @see #putSpi(String, String)
@@ -666,7 +666,7 @@ class WindowsPreferences extends AbstractPreferences {
}
/**
- * Implements AbstractPreferencesremoveSpi() method.
+ * Implements {@code AbstractPreferences} {@code removeSpi()} method.
* Deletes a string name-value pair from the underlying Windows registry
* node, if this value still exists.
* Logs a warning, if Windows registry is unavailable or key has already
@@ -692,7 +692,7 @@ class WindowsPreferences extends AbstractPreferences {
}
/**
- * Implements AbstractPreferenceskeysSpi() method.
+ * Implements {@code AbstractPreferences} {@code keysSpi()} method.
* Gets value names from the underlying Windows registry node.
* Throws a BackingStoreException and logs a warning, if
* Windows registry is unavailable.
@@ -744,7 +744,7 @@ class WindowsPreferences extends AbstractPreferences {
}
/**
- * Implements AbstractPreferenceschildrenNamesSpi() method.
+ * Implements {@code AbstractPreferences} {@code childrenNamesSpi()} method.
* Calls Windows registry to retrive children of this node.
* Throws a BackingStoreException and logs a warning message,
* if Windows registry is not available.
@@ -798,7 +798,7 @@ class WindowsPreferences extends AbstractPreferences {
}
/**
- * Implements Preferencesflush() method.
+ * Implements {@code Preferences} {@code flush()} method.
* Flushes Windows registry changes to disk.
* Throws a BackingStoreException and logs a warning message if Windows
* registry is not available.
@@ -837,7 +837,7 @@ class WindowsPreferences extends AbstractPreferences {
/**
- * Implements Preferencessync() method.
+ * Implements {@code Preferences} {@code sync()} method.
* Flushes Windows registry changes to disk. Equivalent to flush().
* @see flush()
*/
@@ -848,7 +848,7 @@ class WindowsPreferences extends AbstractPreferences {
}
/**
- * Implements AbstractPreferenceschildSpi() method.
+ * Implements {@code AbstractPreferences} {@code childSpi()} method.
* Constructs a child node with a
* given name and creates its underlying Windows registry node,
* if it does not exist.
@@ -859,7 +859,7 @@ class WindowsPreferences extends AbstractPreferences {
}
/**
- * Implements AbstractPreferencesremoveNodeSpi() method.
+ * Implements {@code AbstractPreferences} {@code removeNodeSpi()} method.
* Deletes underlying Windows registry node.
* Throws a BackingStoreException and logs a warning, if Windows registry
* is not available.
@@ -956,7 +956,7 @@ class WindowsPreferences extends AbstractPreferences {
* "A" is encoded as "/A". Character '\' is encoded as '//',
* '/' is encoded as '\'.
* The constructed string is converted to byte array by truncating the
- * highest byte and adding the terminating null character.
+ * highest byte and adding the terminating {@code null} character.
*
* altBase64 encoding is used, if java string does contain at least
* one character less, than 0x0020, or greater, than 0x007f.
diff --git a/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferencesFactory.java b/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferencesFactory.java
index 9ffc975529e..75c072ebd2f 100644
--- a/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferencesFactory.java
+++ b/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferencesFactory.java
@@ -25,7 +25,7 @@
package java.util.prefs;
/**
- * Implementation of PreferencesFactory to return
+ * Implementation of {@code PreferencesFactory} to return
* WindowsPreferences objects.
*
* @author Konstantin Kladko
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSCredentialImpl.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSCredentialImpl.java
index fff2c39f619..6d0d711325e 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSCredentialImpl.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSCredentialImpl.java
@@ -547,8 +547,8 @@ public class GSSCredentialImpl implements GSSCredential {
/**
* Returns the specified mechanism's credential-element.
*
- * @param mechOid - the oid for mechanism to retrieve
- * @param throwExcep - boolean indicating if the function is
+ * @param mechOid the oid for mechanism to retrieve
+ * @param initiate boolean indicating if the function is
* to throw exception or return null when element is not
* found.
* @return mechanism credential object
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSToken.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSToken.java
index 0027bc99762..e7a874aed93 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSToken.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSToken.java
@@ -84,7 +84,7 @@ public abstract class GSSToken {
*
* @param data the array containing the bytes of the integer value
* @param pos the offset in the array
- * @size the number of bytes to read from the array.
+ * @param size the number of bytes to read from the array.
* @return the integer value
*/
public static final int readLittleEndian(byte[] data, int pos, int size) {
@@ -141,7 +141,7 @@ public abstract class GSSToken {
* Reads a two byte integer value from an InputStream.
*
* @param is the InputStream to read from
- * @returns the integer value
+ * @return the integer value
* @throws IOException if some errors occurs while reading the integer
* bytes.
*/
@@ -155,7 +155,7 @@ public abstract class GSSToken {
*
* @param src the byte arra to read from
* @param pos the offset to start reading from
- * @returns the integer value
+ * @return the integer value
*/
public static final int readInt(byte[] src, int pos) {
return ((0xFF & src[pos])<<8 | (0xFF & src[pos+1]));
@@ -167,8 +167,8 @@ public abstract class GSSToken {
*
* @param is the InputStream to read from
* @param buffer the buffer to store the bytes into
- * @param throws EOFException if EOF is reached before all bytes are
- * read.
+ * @throws EOFException if EOF is reached before all bytes are
+ * read.
* @throws IOException is an error occurs while reading
*/
public static final void readFully(InputStream is, byte[] buffer)
@@ -184,8 +184,8 @@ public abstract class GSSToken {
* @param buffer the buffer to store the bytes into
* @param offset the offset to start storing at
* @param len the number of bytes to read
- * @param throws EOFException if EOF is reached before all bytes are
- * read.
+ * @throws EOFException if EOF is reached before all bytes are
+ * read.
* @throws IOException is an error occurs while reading
*/
public static final void readFully(InputStream is,
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/LoginConfigImpl.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/LoginConfigImpl.java
index a06d3db01b3..26181f7b720 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/LoginConfigImpl.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/LoginConfigImpl.java
@@ -48,7 +48,7 @@ public class LoginConfigImpl extends Configuration {
* A new instance of LoginConfigImpl must be created for each login request
* since it's only used by a single (caller, mech) pair
* @param caller defined in GSSUtil as CALLER_XXX final fields
- * @param oid defined in GSSUtil as XXX_MECH_OID final fields
+ * @param mech defined in GSSUtil as XXX_MECH_OID final fields
*/
public LoginConfigImpl(GSSCaller caller, Oid mech) {
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/ProviderList.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/ProviderList.java
index c72916159fe..d73db358714 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/ProviderList.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/ProviderList.java
@@ -46,7 +46,7 @@ import sun.security.action.GetPropertyAction;
* queries this class whenever it needs a mechanism's factory.
*
* This class stores an ordered list of pairs of the form
- * . When it attempts to instantiate a mechanism
+ * {@code }. When it attempts to instantiate a mechanism
* defined by oid o, it steps through the list looking for an entry
* with oid=o, or with oid=null. (An entry with oid=null matches all
* mechanisms.) When it finds such an entry, the corresponding
@@ -74,12 +74,12 @@ import sun.security.action.GetPropertyAction;
* the system ones don't suffice.
*
* If a mechanism's factory is being obtained from a provider as a
- * result of encountering a entryof the form where
+ * result of encountering a entryof the form {@code } where
* oid is non-null, then the assumption is that the application added
* this entry and it wants this mechanism to be obtained from this
* provider. Thus is the provider does not actually contain the
* requested mechanism, an exception will be thrown. However, if the
- * entry were of the form , then it is viewed more
+ * entry were of the form {@code }, then it is viewed more
* liberally and is simply skipped over if the provider does not claim to
* support the requested mechanism.
*/
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5NameElement.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5NameElement.java
index e06ca3edac8..964d8890070 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5NameElement.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5NameElement.java
@@ -198,8 +198,8 @@ public class Krb5NameElement
* If either name denotes an anonymous principal, the call should
* return false.
*
- * @param name to be compared with
- * @returns true if they both refer to the same entity, else false
+ * @param other to be compared with
+ * @return true if they both refer to the same entity, else false
* @exception GSSException with major codes of BAD_NAMETYPE,
* BAD_NAME, FAILURE
*/
@@ -224,7 +224,7 @@ public class Krb5NameElement
* situation where an error occurs.
*
* @param another the object to be compared to
- * @returns true if they both refer to the same entity, else false
+ * @return true if they both refer to the same entity, else false
* @see #equals(GSSNameSpi)
*/
public boolean equals(Object another) {
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java
index 057dcf2ccf4..8611642715a 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java
@@ -51,14 +51,14 @@ import java.security.Provider;
* and the context flags before the context is fully established. The
* isProtReady method is used to indicate that these services are
* available.
- *
+ *
*
* Context establishment tokens are defined in a mechanism independent
* format in section 3.1 of RFC 2743. The GSS-Framework will add
* and remove the mechanism independent header portion of this token format
* depending on whether a token is received or is being sent. The mechanism
- * should only generate or expect to read the inner-context token portion..
- *
+ * should only generate or expect to read the inner-context token portion.
+ *
* On the other hands, tokens used for per-message calls are generated
* entirely by the mechanism. It is possible that the mechanism chooses to
* encase inner-level per-message tokens in a header similar to that used
@@ -239,7 +239,7 @@ public interface GSSContextSpi {
* asked to provide.
* @param confReq a flag indicating whether confidentiality will be
* requested or not
- * @param outputSize the maximum size of the output token
+ * @param maxTokSize the maximum size of the output token
* @return the maximum size for the input message that can be
* provided to the wrap() method in order to guarantee that these
* requirements are met.
@@ -254,7 +254,7 @@ public interface GSSContextSpi {
* @param is the user-provided message to be protected
* @param os the token to be sent to the peer. It includes
* the message from is with the requested protection.
- * @param msgPro on input it contains the requested qop and
+ * @param msgProp on input it contains the requested qop and
* confidentiality state, on output, the applied values
* @exception GSSException may be thrown
* @see unwrap
@@ -365,7 +365,7 @@ public interface GSSContextSpi {
*
* @param is token generated by getMIC
* @param msgStr the message to check integrity for
- * @param msgProp will contain the applied QOP and confidentiality
+ * @param mProp will contain the applied QOP and confidentiality
* states of the token as well as any informatory status codes
* @exception GSSException may be thrown
*/
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSNameSpi.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSNameSpi.java
index 61fc2074655..24362d0074f 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSNameSpi.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSNameSpi.java
@@ -46,7 +46,7 @@ public interface GSSNameSpi {
* return false.
*
* @param name to be compared with
- * @returns true if they both refer to the same entity, else false
+ * @return true if they both refer to the same entity, else false
* @exception GSSException with major codes of BAD_NAMETYPE,
* BAD_NAME, FAILURE
*/
@@ -60,7 +60,7 @@ public interface GSSNameSpi {
* situation where an error occurs.
*
* @param another the object to be compared to
- * @returns true if they both refer to the same entity, else false
+ * @return true if they both refer to the same entity, else false
* @see #equals(GSSNameSpi)
*/
public boolean equals(Object another);
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/MechanismFactory.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/MechanismFactory.java
index 5d40fffe409..e5bba5f2931 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/MechanismFactory.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/MechanismFactory.java
@@ -147,7 +147,7 @@ public interface MechanismFactory {
*
* An exported name will generally be passed in using this method.
*
- * @param nameBytes the bytes describing this entity to the mechanism
+ * @param name the bytes describing this entity to the mechanism
* @param nameType an Oid serving as a clue as to how the mechanism should
* interpret the nameStr
* @throws GSSException if any of the errors described in RFC 2743 for
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Checksum.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Checksum.java
index 6a7f491257d..d5f0627d2ad 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Checksum.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Checksum.java
@@ -128,8 +128,8 @@ public class Checksum {
/**
* Constructs a new Checksum using the raw data and type.
- * @data the byte array of checksum.
- * @new_cksumType the type of checksum.
+ * @param data the byte array of checksum.
+ * @param new_cksumType the type of checksum.
*
*/
// used in InitialToken
@@ -141,8 +141,8 @@ public class Checksum {
/**
* Constructs a new Checksum by calculating the checksum over the data
* using specified checksum type.
- * @new_cksumType the type of checksum.
- * @data the data that needs to be performed a checksum calculation on.
+ * @param new_cksumType the type of checksum.
+ * @param data the data that needs to be performed a checksum calculation on.
*/
public Checksum(int new_cksumType, byte[] data)
throws KdcErrException, KrbCryptoException {
@@ -159,8 +159,8 @@ public class Checksum {
/**
* Constructs a new Checksum by calculating the keyed checksum
* over the data using specified checksum type.
- * @new_cksumType the type of checksum.
- * @data the data that needs to be performed a checksum calculation on.
+ * @param new_cksumType the type of checksum.
+ * @param data the data that needs to be performed a checksum calculation on.
*/
// KrbSafe, KrbTgsReq
public Checksum(int new_cksumType, byte[] data,
@@ -238,12 +238,12 @@ public class Checksum {
/**
* Encodes a Checksum object.
- *
* This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
index ade2a42539a..0a67cf7135e 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
@@ -330,7 +330,7 @@ public class Config {
*
* @param s the string duration
* @return time in seconds
- * @throw KrbException if format is illegal
+ * @throws KrbException if format is illegal
*/
public static int duration(String s) throws KrbException {
@@ -392,7 +392,7 @@ public class Config {
* @param keys the keys
* @return the int value, Integer.MIN_VALUE is returned if it cannot be
* found or the value is not a legal integer.
- * @throw IllegalArgumentException if any of the keys is illegal
+ * @throws IllegalArgumentException if any of the keys is illegal
* @see #get(java.lang.String[])
*/
public int getIntValue(String... keys) {
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Credentials.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Credentials.java
index 4b72f4f01cc..17ce0e9bb2c 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Credentials.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Credentials.java
@@ -279,7 +279,7 @@ public class Credentials {
* @param ticketCache the path to the tickets file. A value
* of null will be accepted to indicate that the default
* path should be searched
- * @returns the TGT credentials or null if none were found. If the tgt
+ * @return the TGT credentials or null if none were found. If the tgt
* expired, it is the responsibility of the caller to determine this.
*/
public static Credentials acquireTGTFromCache(PrincipalName princ,
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptedData.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptedData.java
index cca32f22f70..b44fbcd18a2 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptedData.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptedData.java
@@ -259,20 +259,20 @@ public class EncryptedData implements Cloneable {
/**
* Returns an ASN.1 encoded EncryptedData type.
*
- *
+ *
* @return byte array of encoded EncryptedData object.
* @exception Asn1Exception if an error occurs while decoding an
* ASN1 encoded data.
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java
index 6887f85524c..d484d7c5571 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java
@@ -101,11 +101,11 @@ public class EncryptionKey
* Obtains all versions of the secret key of the principal from a
* keytab.
*
- * @Param princ the principal whose secret key is desired
+ * @param princ the principal whose secret key is desired
* @param keytab the path to the keytab file. A value of null
* will be accepted to indicate that the default path should be
* searched.
- * @returns an array of secret keys or null if none were found.
+ * @return an array of secret keys or null if none were found.
*/
public static EncryptionKey[] acquireSecretKeys(PrincipalName princ,
String keytab) {
@@ -127,7 +127,7 @@ public class EncryptionKey
* @param password NOT null
* @param etype
* @param snp can be NULL
- * @returns never null
+ * @return never null
*/
public static EncryptionKey acquireSecretKey(PrincipalName cname,
char[] password, int etype, PAData.SaltAndParams snp)
@@ -150,7 +150,7 @@ public class EncryptionKey
* @param salt NOT null
* @param etype
* @param s2kparams can be NULL
- * @returns never null
+ * @return never null
*/
public static EncryptionKey acquireSecretKey(char[] password,
String salt, int etype, byte[] s2kparams)
@@ -388,11 +388,11 @@ public class EncryptionKey
/**
* Returns the ASN.1 encoding of this EncryptionKey.
*
- *
* This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReqBuilder.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReqBuilder.java
index 5b6688000f7..953bb557041 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReqBuilder.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReqBuilder.java
@@ -110,7 +110,7 @@ public final class KrbAsReqBuilder {
* realm, where default realm will be used. This realm will be the target
* realm for AS-REQ. I believe a client should only get initial TGT from
* its own realm.
- * @param keys must not be null. if empty, might be quite useless.
+ * @param ktab must not be null. If empty, might be quite useless.
* This argument will neither be modified nor stored by the method.
* @throws KrbException
*/
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbCred.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbCred.java
index 45854d36fcc..b97ba8b11cc 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbCred.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbCred.java
@@ -34,8 +34,6 @@ package sun.security.krb5;
import sun.security.krb5.internal.*;
import sun.security.krb5.internal.crypto.KeyUsage;
import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
import sun.security.util.DerValue;
@@ -65,7 +63,6 @@ public class KrbCred {
PrincipalName client = tgt.getClient();
PrincipalName tgService = tgt.getServer();
- PrincipalName server = serviceTicket.getServer();
if (!serviceTicket.getClient().equals(client))
throw new KrbException(Krb5.KRB_ERR_GENERIC,
"Client principal does not match");
@@ -78,28 +75,10 @@ public class KrbCred {
options.set(KDCOptions.FORWARDED, true);
options.set(KDCOptions.FORWARDABLE, true);
- HostAddresses sAddrs = null;
-
- // GSSName.NT_HOSTBASED_SERVICE should display with KRB_NT_SRV_HST
- if (server.getNameType() == PrincipalName.KRB_NT_SRV_HST) {
- sAddrs = new HostAddresses(server);
- } else if (server.getNameType() == PrincipalName.KRB_NT_UNKNOWN) {
- // Sometimes this is also a server
- if (server.getNameStrings().length >= 2) {
- String host = server.getNameStrings()[1];
- try {
- InetAddress[] addr = InetAddress.getAllByName(host);
- if (addr != null && addr.length > 0) {
- sAddrs = new HostAddresses(addr);
- }
- } catch (UnknownHostException ioe) {
- // maybe we guessed wrong, let sAddrs be null
- }
- }
- }
-
KrbTgsReq tgsReq = new KrbTgsReq(options, tgt, tgService,
- null, null, null, null, sAddrs, null, null, null);
+ null, null, null, null,
+ null, // No easy way to get addresses right
+ null, null, null);
credMessg = createMessage(tgsReq.sendAndGetCreds(), key);
obuf = credMessg.asn1Encode();
@@ -111,7 +90,6 @@ public class KrbCred {
EncryptionKey sessionKey
= delegatedCreds.getSessionKey();
PrincipalName princ = delegatedCreds.getClient();
- Realm realm = princ.getRealm();
PrincipalName tgService = delegatedCreds.getServer();
KrbCredInfo credInfo = new KrbCredInfo(sessionKey,
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java
index 8cd833f0966..bf5a9539079 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java
@@ -45,14 +45,14 @@ import sun.security.krb5.internal.util.KerberosString;
/**
* Implements the ASN.1 PrincipalName type and its realm in a single class.
- *
+ * }
* This class is immutable.
* @see Realm
*/
@@ -211,14 +211,14 @@ public class PrincipalName implements Cloneable {
/**
* Returns the ASN.1 encoding of the
- *
+ *
* This definition reflects the Network Working Group RFC 4120
@@ -638,7 +638,8 @@ public class PrincipalName implements Cloneable {
* name, the second component is returned.
* Null is returned if there are not two or more
* components in the name.
- * @returns instance component of a multi-component name.
+ *
+ * @return instance component of a multi-component name.
*/
public String getInstanceComponent()
{
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Realm.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Realm.java
index 65f1f6fd59f..bc8ce330d9d 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Realm.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Realm.java
@@ -41,9 +41,8 @@ import sun.security.krb5.internal.util.KerberosString;
/**
* Implements the ASN.1 Realm type.
*
- *
- * Realm ::= GeneralString
- *
+ * {@code Realm ::= GeneralString}
+ *
* This class is immutable.
*/
public class Realm implements Cloneable {
@@ -244,8 +243,8 @@ public class Realm implements Cloneable {
*
* @param cRealm the initiating realm, not null
* @param sRealm the target realm, not null, not equals to cRealm
- * @returns array of realms including at least cRealm as the first
- * element
+ * @return array of realms including at least cRealm as the first
+ * element
*/
public static String[] getRealmsList(String cRealm, String sRealm) {
try {
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APOptions.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APOptions.java
index c9644af6a0f..88ef620d076 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APOptions.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APOptions.java
@@ -38,17 +38,17 @@ import java.io.IOException;
/**
* Implements the ASN.1 APOptions type.
*
- *
+ *
*
* KerberosFlags ::= BIT STRING (SIZE (32..MAX))
* -- minimum number of bits shall be sent,
* -- but no fewer than 32
*
+ * }
*
* This definition reflects the Network Working Group RFC4120
* specification available at
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APRep.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APRep.java
index 4a8bea86b2d..017159d6d91 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APRep.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APRep.java
@@ -39,13 +39,13 @@ import java.math.BigInteger;
/**
* Implements the ASN.1 AP-REP type.
*
- *
* This definition reflects the Network Working Group RFC 4120
@@ -131,7 +132,7 @@ public class HostAddress implements Cloneable {
/**
* Gets the InetAddress of this HostAddress.
* @return the IP address for this specified host.
- * @exception if no IP address for the host could be found.
+ * @exception UnknownHostException if no IP address for the host could be found.
*
*/
public InetAddress getInetAddress() throws UnknownHostException {
@@ -295,4 +296,11 @@ public class HostAddress implements Cloneable {
}
}
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(Arrays.toString(address));
+ sb.append('(').append(addrType).append(')');
+ return sb.toString();
+ }
}
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java
index da80d8c0e00..8d43debb7be 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java
@@ -45,7 +45,7 @@ import sun.security.krb5.internal.ccache.CCacheOutputStream;
/**
* Implements the ASN.1 HostAddresses type.
*
- *
+ *
{@code
* HostAddresses -- NOTE: subtly different from rfc1510,
* -- but has a value mapping and encodes the same
* ::= SEQUENCE OF HostAddress
@@ -54,7 +54,7 @@ import sun.security.krb5.internal.ccache.CCacheOutputStream;
* addr-type [0] Int32,
* address [1] OCTET STRING
* }
- *
+ * }
*
*
* This definition reflects the Network Working Group RFC 4120
@@ -338,4 +338,9 @@ public class HostAddresses implements Cloneable {
for (int i = 0; i < inetAddresses.length; i++)
addresses[i] = new HostAddress(inetAddresses[i]);
}
+
+ @Override
+ public String toString() {
+ return Arrays.toString(addresses);
+ }
}
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCOptions.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCOptions.java
index a07bb477095..7cd666390f8 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCOptions.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCOptions.java
@@ -40,7 +40,7 @@ import java.io.IOException;
/**
* Implements the ASN.1 KDCOptions type.
*
- *
+ *
{@code
* KDCOptions ::= KerberosFlags
* -- reserved(0),
* -- forwardable(1),
@@ -69,7 +69,7 @@ import java.io.IOException;
* -- minimum number of bits shall be sent,
* -- but no fewer than 32
*
- *
+ * }
*
*
* This definition reflects the Network Working Group RFC 4120
@@ -115,7 +115,7 @@ import java.io.IOException;
* in the addresses field of the request.
*
FORWARDED, PROXY, ENC_TKT_IN_SKEY, RENEW, VALIDATE are used only in
* subsequent requests.
- *
+ *
*/
public class KDCOptions extends KerberosFlags {
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCRep.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCRep.java
index 5c4ca1e8f0d..0548a1aa497 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCRep.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCRep.java
@@ -38,7 +38,7 @@ import java.math.BigInteger;
/**
* Implements the ASN.1 KDC-REP type.
*
- *
* This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java
index da30f9dc42c..7bd1f75172e 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java
@@ -46,9 +46,7 @@ import java.util.TimeZone;
/**
* Implements the ASN.1 KerberosTime type. This is an immutable class.
*
- *
- * KerberosTime ::= GeneralizedTime -- with no fractional seconds
- *
+ * {@code KerberosTime ::= GeneralizedTime} -- with no fractional seconds
*
* The timestamps used in Kerberos are encoded as GeneralizedTimes. A
* KerberosTime value shall not include any fractional portions of the
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KrbCredInfo.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KrbCredInfo.java
index 2b771e0616e..952506c5b74 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KrbCredInfo.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KrbCredInfo.java
@@ -38,7 +38,7 @@ import java.io.IOException;
/**
* Implements the ASN.1 KrbCredInfo type.
*
- *
+ *
+ * }
*/
public class MethodData {
private int methodType;
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAData.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAData.java
index f3fdb0b9457..36fb36d5817 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAData.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAData.java
@@ -39,13 +39,13 @@ import sun.security.krb5.internal.util.KerberosString;
/**
* Implements the ASN.1 PA-DATA type.
*
- *
+ *
{@code
* PA-DATA ::= SEQUENCE {
* -- NOTE: first tag is [1], not [0]
* padata-type [1] Int32,
* padata-value [2] OCTET STRING -- might be encoded AP-REQ
* }
- *
+ * }
*
*
* This definition reflects the Network Working Group RFC 4120
@@ -140,11 +140,14 @@ public class PAData {
/**
* Gets the preferred etype from the PAData array.
- * 1. ETYPE-INFO2-ENTRY with unknown s2kparams ignored
- * 2. ETYPE-INFO2 preferred to ETYPE-INFO
- * 3. multiple entries for same etype in one PA-DATA, use the first one.
- * 4. Multiple PA-DATA with same type, choose the last one
+ *
+ *
ETYPE-INFO2-ENTRY with unknown s2kparams ignored
+ *
ETYPE-INFO2 preferred to ETYPE-INFO
+ *
Multiple entries for same etype in one PA-DATA, use the first one.
+ *
Multiple PA-DATA with same type, choose the last one.
+ *
* (This is useful when PA-DATAs from KRB-ERROR and AS-REP are combined).
+ *
* @return the etype, or defaultEType if not enough info
* @throws Asn1Exception|IOException if there is an encoding error
*/
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAEncTSEnc.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAEncTSEnc.java
index e7d63572be8..8c80d7071ad 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAEncTSEnc.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAEncTSEnc.java
@@ -38,12 +38,12 @@ import java.math.BigInteger;
/**
* Implements the ASN.1 PAEncTSEnc type.
*
- *
+ *
* This definition reflects the Network Working Group RFC 4120
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Des.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Des.java
index 73dbc55babd..2eb0f783ab6 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Des.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Des.java
@@ -226,7 +226,7 @@ public final class Des {
/**
* Generates DES key from the password.
- * @param password a char[] used to create the key.
+ * @param passwdChars a char[] used to create the key.
* @return DES key.
*
* @modified by Yanni Zhang, Dec 6, 99
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/DesMacCksumType.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/DesMacCksumType.java
index 3c3842f59dd..8372fce74c9 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/DesMacCksumType.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/DesMacCksumType.java
@@ -125,7 +125,7 @@ public class DesMacCksumType extends CksumType {
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*
* @modified by Yanni Zhang, 12/08/99.
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacMd5ArcFourCksumType.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacMd5ArcFourCksumType.java
index 4a233dd803e..030da0d5cb1 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacMd5ArcFourCksumType.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacMd5ArcFourCksumType.java
@@ -95,7 +95,7 @@ public class HmacMd5ArcFourCksumType extends CksumType {
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*/
public boolean verifyKeyedChecksum(byte[] data, int size,
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes128CksumType.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes128CksumType.java
index ba31b575dce..ca265a74112 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes128CksumType.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes128CksumType.java
@@ -95,7 +95,7 @@ public class HmacSha1Aes128CksumType extends CksumType {
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*/
public boolean verifyKeyedChecksum(byte[] data, int size,
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes256CksumType.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes256CksumType.java
index d9f213b0722..92808d19ad4 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes256CksumType.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes256CksumType.java
@@ -95,7 +95,7 @@ public class HmacSha1Aes256CksumType extends CksumType {
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*/
public boolean verifyKeyedChecksum(byte[] data, int size,
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Des3KdCksumType.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Des3KdCksumType.java
index 9547ea00ae7..87dae9c6497 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Des3KdCksumType.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Des3KdCksumType.java
@@ -89,7 +89,7 @@ public class HmacSha1Des3KdCksumType extends CksumType {
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*/
public boolean verifyKeyedChecksum(byte[] data, int size,
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/RsaMd5DesCksumType.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/RsaMd5DesCksumType.java
index c4c5383316e..53681671603 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/RsaMd5DesCksumType.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/RsaMd5DesCksumType.java
@@ -120,7 +120,7 @@ public final class RsaMd5DesCksumType extends CksumType {
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*
* @modified by Yanni Zhang, 12/08/99.
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ktab/KeyTab.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ktab/KeyTab.java
index 602f5ed7a3a..d989f22250c 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ktab/KeyTab.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ktab/KeyTab.java
@@ -513,7 +513,7 @@ public class KeyTab implements KeyTabConstants {
/**
* Creates key table file version.
* @param file the key table file.
- * @exception IOException.
+ * @exception IOException
*/
public synchronized void createVersion(File file) throws IOException {
try (KeyTabOutputStream kos =
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/AuthList.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/AuthList.java
index 1764271a272..5ee380eb599 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/AuthList.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/AuthList.java
@@ -45,7 +45,7 @@ import sun.security.krb5.internal.KrbApErrException;
* self-cleanup of expired items in the cache.
*
* AuthTimeWithHash objects inside a cache are always sorted from big (new) to
- * small (old) as determined by {@see AuthTimeWithHash#compareTo}. In the most
+ * small (old) as determined by {@link AuthTimeWithHash#compareTo}. In the most
* common case a newcomer should be newer than the first element.
*
* @author Yanni Zhang
diff --git a/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java b/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java
index 5839a5e13e4..066728647c4 100644
--- a/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java
+++ b/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java
@@ -59,26 +59,25 @@ public class Kinit {
* We currently support only file-based credentials cache to
* store the tickets obtained from the KDC.
* By default, for all Unix platforms a cache file named
- * /tmp/krb5cc_<uid> will be generated. The <uid> is the
+ * {@code /tmp/krb5cc_} will be generated. The {@code } is the
* numeric user identifier.
* For all other platforms, a cache file named
- * <USER_HOME>/krb5cc_<USER_NAME> would be generated.
+ * {@code /krb5cc_} would be generated.
*
- * <USER_HOME> is obtained from java.lang.System
+ * {@code } is obtained from {@code java.lang.System}
* property user.home.
- * <USER_NAME> is obtained from java.lang.System
+ * {@code } is obtained from {@code java.lang.System}
* property user.name.
- * If <USER_HOME> is null the cache file would be stored in
+ * If {@code } is null the cache file would be stored in
* the current directory that the program is running from.
- * <USER_NAME> is operating system's login username.
+ * {@code } is operating system's login username.
* It could be different from user's principal name.
- *
- *
+ *
* For instance, on Windows NT, it could be
- * c:\winnt\profiles\duke\krb5cc_duke, in
- * which duke is the <USER_NAME>, and c:\winnt\profile\duke is the
- * <USER_HOME>.
- *
+ * {@code c:\winnt\profiles\duke\krb5cc_duke}, in
+ * which duke is the {@code } and {@code c:\winnt\profile\duke} is the
+ * {@code }.
+ *
* A single user could have multiple principal names,
* but the primary principal of the credentials cache could only be one,
* which means one cache file could only store tickets for one
@@ -88,10 +87,8 @@ public class Kinit {
* To avoid overwriting, you need to specify
* a different cache file name when you request a
* new ticket.
- *
- *
+ *
* You can specify the location of the cache file by using the -c option
- *
*/
public static void main(String[] args) {
diff --git a/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java b/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java
index ca5a473cbae..c32e9d0eea4 100644
--- a/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java
+++ b/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java
@@ -69,8 +69,10 @@ public class Klist {
*
-n do not reverse-resolve addresses
*
* available options for keytabs:
+ *
*
-t shows keytab entry timestamps
*
-K shows keytab entry DES keys
+ *
*/
public static void main(String[] args) {
Klist klist = new Klist();
diff --git a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/FactoryImpl.java b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/FactoryImpl.java
index fa0e67bee59..048cb3b4794 100644
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/FactoryImpl.java
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/FactoryImpl.java
@@ -60,7 +60,7 @@ SaslServerFactory{
*
* @throws SaslException If there is an error creating the DigestMD5
* SASL client.
- * @returns a new SaslClient ; otherwise null if unsuccessful.
+ * @return a new SaslClient; otherwise null if unsuccessful.
*/
public SaslClient createSaslClient(String[] mechs,
String authorizationId, String protocol, String serverName,
@@ -90,7 +90,7 @@ SaslServerFactory{
*
* @throws SaslException If there is an error creating the DigestMD5
* SASL server.
- * @returns a new SaslServer ; otherwise null if unsuccessful.
+ * @return a new SaslServer; otherwise null if unsuccessful.
*/
public SaslServer createSaslServer(String mech,
String protocol, String serverName, Map props, CallbackHandler cbh)
@@ -114,7 +114,7 @@ SaslServerFactory{
/**
* Returns the authentication mechanisms that this factory can produce.
*
- * @returns String[] {"DigestMD5"} if policies in env match those of this
+ * @return String[] {"DigestMD5"} if policies in env match those of this
* factory.
*/
public String[] getMechanismNames(Map env) {
diff --git a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java
index 4a9b730a9ad..12fafe81857 100644
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java
@@ -57,7 +57,7 @@ SaslServerFactory{
/**
* Returns a new instance of the NTLM SASL client mechanism.
* Argument checks are performed in SaslClient's constructor.
- * @returns a new SaslClient ; otherwise null if unsuccessful.
+ * @return a new SaslClient; otherwise null if unsuccessful.
* @throws SaslException If there is an error creating the NTLM
* SASL client.
*/
@@ -86,7 +86,7 @@ SaslServerFactory{
/**
* Returns a new instance of the NTLM SASL server mechanism.
* Argument checks are performed in SaslServer's constructor.
- * @returns a new SaslServer ; otherwise null if unsuccessful.
+ * @return a new SaslServer; otherwise null if unsuccessful.
* @throws SaslException If there is an error creating the NTLM
* SASL server.
*/
@@ -116,7 +116,7 @@ SaslServerFactory{
/**
* Returns the authentication mechanisms that this factory can produce.
*
- * @returns String[] {"NTLM"} if policies in env match those of this
+ * @return String[] {"NTLM"} if policies in env match those of this
* factory.
*/
public String[] getMechanismNames(Map env) {
diff --git a/jdk/src/java.sql/share/classes/javax/sql/RowSet.java b/jdk/src/java.sql/share/classes/javax/sql/RowSet.java
index 264e6e3bff1..6801b9b3852 100644
--- a/jdk/src/java.sql/share/classes/javax/sql/RowSet.java
+++ b/jdk/src/java.sql/share/classes/javax/sql/RowSet.java
@@ -1477,7 +1477,7 @@ public interface RowSet extends ResultSet {
/**
* Sets the designated parameter to a InputStream object.
- * The "{@code InputStream} must contain the number
+ * The {@code InputStream} must contain the number
* of characters specified by length, otherwise a SQLException will be
* generated when the CallableStatement is executed.
* This method differs from the setBinaryStream (int, InputStream, int)
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java
index b3b7c310bce..c540648f4b1 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java
@@ -41,12 +41,12 @@ import com.sun.org.apache.xml.internal.security.utils.Base64;
* as defined in the W3C specification for XML-Signature Syntax and Processing.
* The XML Schema Definition is defined as:
*
- *
+ *
{@code
*
*
*
*
- *
+ * }
*
* @author Sean Mullan
*/
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
index b845d4cb6b2..9869d3325da 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
@@ -57,7 +57,7 @@ public final class DOMPGPData extends DOMStructure implements PGPData {
* and optional list of external elements.
*
* @param keyPacket a PGP Key Material Packet as defined in section 5.5 of
- * RFC 2440. The
+ * RFC 2440. The
* array is cloned to prevent subsequent modification.
* @param other a list of {@link XMLStructure}s representing elements from
* an external namespace. The list is defensively copied to prevent
@@ -90,10 +90,10 @@ public final class DOMPGPData extends DOMStructure implements PGPData {
* optional key packet and list of external elements.
*
* @param keyId a PGP public key id as defined in section 11.2 of
- * RFC 2440. The
+ * RFC 2440. The
* array is cloned to prevent subsequent modification.
* @param keyPacket a PGP Key Material Packet as defined in section 5.5 of
- * RFC 2440 (may
+ * RFC 2440 (may
* be null). The array is cloned to prevent subsequent
* modification.
* @param other a list of {@link XMLStructure}s representing elements from
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
index 2cc0f993db5..91f9054657a 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
@@ -118,7 +118,6 @@ public final class DOMReference extends DOMStructure
* is defensively copied to protect against subsequent modification.
* May be null or empty.
* @param id the reference ID (may be null)
- * @return a Reference
* @throws NullPointerException if dm is null
* @throws ClassCastException if any of the transforms are
* not of type Transform
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
index 0923eb41c40..1119e4d1b77 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
@@ -58,7 +58,6 @@ public final class DOMSignatureProperties extends DOMStructure
* @param properties a list of one or more {@link SignatureProperty}s. The
* list is defensively copied to protect against subsequent modification.
* @param id the Id (may be null)
- * @return a DOMSignatureProperties
* @throws ClassCastException if properties contains any
* entries that are not of type {@link SignatureProperty}
* @throws IllegalArgumentException if properties is empty
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
index 2b43dffda92..d597e634f47 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
@@ -59,7 +59,6 @@ public final class DOMSignatureProperty extends DOMStructure
* is defensively copied to protect against subsequent modification.
* @param target the target URI
* @param id the Id (may be null)
- * @return a SignatureProperty
* @throws ClassCastException if content contains any
* entries that are not of type {@link XMLStructure}
* @throws IllegalArgumentException if content is empty
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java
index 74131a652b3..77f2298e277 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java
@@ -53,7 +53,7 @@ public class DOMTransform extends DOMStructure implements Transform {
protected TransformService spi;
/**
- * Creates a DOMTransform.
+ * Creates a {@code DOMTransform}.
*
* @param spi the TransformService
*/
@@ -62,7 +62,7 @@ public class DOMTransform extends DOMStructure implements Transform {
}
/**
- * Creates a DOMTransform from an element. This constructor
+ * Creates a {@code DOMTransform} from an element. This constructor
* invokes the abstract {@link #unmarshalParams unmarshalParams} method to
* unmarshal any algorithm-specific input parameters.
*
@@ -138,12 +138,12 @@ public class DOMTransform extends DOMStructure implements Transform {
* Transforms the specified data using the underlying transform algorithm.
*
* @param data the data to be transformed
- * @param sc the XMLCryptoContext containing
- * additional context (may be null if not applicable)
+ * @param xc the {@code XMLCryptoContext} containing
+ * additional context (may be {@code null} if not applicable)
* @return the transformed data
- * @throws NullPointerException if data is null
+ * @throws NullPointerException if {@code data} is {@code null}
* @throws XMLSignatureException if an unexpected error occurs while
- * executing the transform
+ * executing the transform
*/
public Data transform(Data data, XMLCryptoContext xc)
throws TransformException
@@ -155,14 +155,14 @@ public class DOMTransform extends DOMStructure implements Transform {
* Transforms the specified data using the underlying transform algorithm.
*
* @param data the data to be transformed
- * @param sc the XMLCryptoContext containing
- * additional context (may be null if not applicable)
- * @param os the OutputStream that should be used to write
- * the transformed data to
+ * @param xc the {@code XMLCryptoContext} containing
+ * additional context (may be {@code null} if not applicable)
+ * @param os the {@code OutputStream} that should be used to write
+ * the transformed data to
* @return the transformed data
- * @throws NullPointerException if data is null
+ * @throws NullPointerException if {@code data} is {@code null}
* @throws XMLSignatureException if an unexpected error occurs while
- * executing the transform
+ * executing the transform
*/
public Data transform(Data data, XMLCryptoContext xc, OutputStream os)
throws TransformException
@@ -201,16 +201,16 @@ public class DOMTransform extends DOMStructure implements Transform {
/**
* Transforms the specified data using the underlying transform algorithm.
* This method invokes the {@link #marshal marshal} method and passes it
- * the specified DOMSignContext before transforming the data.
+ * the specified {@code DOMSignContext} before transforming the data.
*
* @param data the data to be transformed
- * @param sc the XMLCryptoContext containing
- * additional context (may be null if not applicable)
+ * @param sc the {@code XMLCryptoContext} containing
+ * additional context (may be {@code null} if not applicable)
* @param context the marshalling context
* @return the transformed data
* @throws MarshalException if an exception occurs while marshalling
- * @throws NullPointerException if data or context
- * is null
+ * @throws NullPointerException if {@code data} or {@code context}
+ * is {@code null}
* @throws XMLSignatureException if an unexpected error occurs while
* executing the transform
*/
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
index 7c27607e236..42ef686aa81 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
@@ -65,7 +65,6 @@ public final class DOMX509Data extends DOMStructure implements X509Data {
* or {@link javax.xml.dsig.XMLStructure} ({@link X509IssuerSerial}
* objects or elements from an external namespace). The list is
* defensively copied to protect against subsequent modification.
- * @return a X509Data
* @throws NullPointerException if content is null
* @throws IllegalArgumentException if content is empty
* @throws ClassCastException if content contains any entries
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
index 6ce2c4ac736..b2ede4c7382 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
@@ -63,7 +63,6 @@ public final class DOMXMLObject extends DOMStructure implements XMLObject {
* @param id the Id (may be null)
* @param mimeType the mime type (may be null)
* @param encoding the encoding (may be null)
- * @return an XMLObject
* @throws ClassCastException if content contains any
* entries that are not of type {@link XMLStructure}
*/
diff --git a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java
index 1219c4fda5b..b90a9c93eb7 100644
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java
@@ -79,32 +79,6 @@ public class JISAutoDetect
throw new UnsupportedOperationException();
}
- /**
- * accessor methods used to share byte masking tables
- * with the sun.io JISAutoDetect implementation
- */
-
- public static byte[] getByteMask1() {
- return Decoder.maskTable1;
- }
-
- public static byte[] getByteMask2() {
- return Decoder.maskTable2;
- }
-
- public final static boolean canBeSJIS1B(int mask) {
- return (mask & SJIS1B_MASK) != 0;
- }
-
- public final static boolean canBeEUCJP(int mask) {
- return (mask & EUCJP_MASK) != 0;
- }
-
- public final static boolean canBeEUCKana(int mask1, int mask2) {
- return ((mask1 & EUCJP_KANA1_MASK) != 0)
- && ((mask2 & EUCJP_KANA2_MASK) != 0);
- }
-
// A heuristic algorithm for guessing if EUC-decoded text really
// might be Japanese text. Better heuristics are possible...
private static boolean looksLikeJapanese(CharBuffer cb) {
@@ -144,9 +118,10 @@ public class JISAutoDetect
src.position(p);
}
- private CoderResult decodeLoop(Charset cs,
+ private CoderResult decodeLoop(DelegatableDecoder decoder,
ByteBuffer src, CharBuffer dst) {
- detectedDecoder = (DelegatableDecoder) cs.newDecoder();
+ ((CharsetDecoder)decoder).reset();
+ detectedDecoder = decoder;
return detectedDecoder.decodeLoop(src, dst);
}
@@ -157,7 +132,9 @@ public class JISAutoDetect
// All ASCII?
if (! src.hasRemaining())
return CoderResult.UNDERFLOW;
- if (! dst.hasRemaining())
+ // Overflow only if there is still ascii but no out buffer.
+ if (!dst.hasRemaining() &&
+ isPlainASCII(src.get(src.position())))
return CoderResult.OVERFLOW;
// We need to perform double, not float, arithmetic; otherwise
@@ -172,7 +149,7 @@ public class JISAutoDetect
ByteBuffer src2022 = src.asReadOnlyBuffer();
CoderResult res2022 = dd2022.decodeLoop(src2022, sandbox);
if (! res2022.isError())
- return decodeLoop(cs2022, src, dst);
+ return decodeLoop(dd2022, src, dst);
// We must choose between EUC and SJIS
Charset csEUCJ = Charset.forName(EUCJPName);
@@ -180,30 +157,30 @@ public class JISAutoDetect
DelegatableDecoder ddEUCJ
= (DelegatableDecoder) csEUCJ.newDecoder();
+ DelegatableDecoder ddSJIS
+ = (DelegatableDecoder) csSJIS.newDecoder();
+
ByteBuffer srcEUCJ = src.asReadOnlyBuffer();
sandbox.clear();
CoderResult resEUCJ = ddEUCJ.decodeLoop(srcEUCJ, sandbox);
// If EUC decoding fails, must be SJIS
if (resEUCJ.isError())
- return decodeLoop(csSJIS, src, dst);
-
- DelegatableDecoder ddSJIS
- = (DelegatableDecoder) csSJIS.newDecoder();
+ return decodeLoop(ddSJIS, src, dst);
ByteBuffer srcSJIS = src.asReadOnlyBuffer();
CharBuffer sandboxSJIS = CharBuffer.allocate(cbufsiz);
CoderResult resSJIS = ddSJIS.decodeLoop(srcSJIS, sandboxSJIS);
// If SJIS decoding fails, must be EUC
if (resSJIS.isError())
- return decodeLoop(csEUCJ, src, dst);
+ return decodeLoop(ddEUCJ, src, dst);
// From here on, we have some ambiguity, and must guess.
// We prefer input that does not appear to end mid-character.
if (srcEUCJ.position() > srcSJIS.position())
- return decodeLoop(csEUCJ, src, dst);
+ return decodeLoop(ddEUCJ, src, dst);
if (srcEUCJ.position() < srcSJIS.position())
- return decodeLoop(csSJIS, src, dst);
+ return decodeLoop(ddSJIS, src, dst);
// end-of-input is after the first byte of the first char?
if (src.position() == srcEUCJ.position())
@@ -211,8 +188,8 @@ public class JISAutoDetect
// Use heuristic knowledge of typical Japanese text
sandbox.flip();
- Charset guess = looksLikeJapanese(sandbox) ? csEUCJ : csSJIS;
- return decodeLoop(guess, src, dst);
+ return decodeLoop(looksLikeJapanese(sandbox) ? ddEUCJ : ddSJIS,
+ src, dst);
}
return detectedDecoder.decodeLoop(src, dst);
@@ -267,140 +244,5 @@ public class JISAutoDetect
return("EUC_JP");
}
- // Mask tables - each entry indicates possibility of first or
- // second byte being SJIS or EUC_JP
- private static final byte maskTable1[] = {
- 0, 0, 0, 0, // 0x00 - 0x03
- 0, 0, 0, 0, // 0x04 - 0x07
- 0, 0, 0, 0, // 0x08 - 0x0b
- 0, 0, 0, 0, // 0x0c - 0x0f
- 0, 0, 0, 0, // 0x10 - 0x13
- 0, 0, 0, 0, // 0x14 - 0x17
- 0, 0, 0, 0, // 0x18 - 0x1b
- 0, 0, 0, 0, // 0x1c - 0x1f
- 0, 0, 0, 0, // 0x20 - 0x23
- 0, 0, 0, 0, // 0x24 - 0x27
- 0, 0, 0, 0, // 0x28 - 0x2b
- 0, 0, 0, 0, // 0x2c - 0x2f
- 0, 0, 0, 0, // 0x30 - 0x33
- 0, 0, 0, 0, // 0x34 - 0x37
- 0, 0, 0, 0, // 0x38 - 0x3b
- 0, 0, 0, 0, // 0x3c - 0x3f
- 0, 0, 0, 0, // 0x40 - 0x43
- 0, 0, 0, 0, // 0x44 - 0x47
- 0, 0, 0, 0, // 0x48 - 0x4b
- 0, 0, 0, 0, // 0x4c - 0x4f
- 0, 0, 0, 0, // 0x50 - 0x53
- 0, 0, 0, 0, // 0x54 - 0x57
- 0, 0, 0, 0, // 0x58 - 0x5b
- 0, 0, 0, 0, // 0x5c - 0x5f
- 0, 0, 0, 0, // 0x60 - 0x63
- 0, 0, 0, 0, // 0x64 - 0x67
- 0, 0, 0, 0, // 0x68 - 0x6b
- 0, 0, 0, 0, // 0x6c - 0x6f
- 0, 0, 0, 0, // 0x70 - 0x73
- 0, 0, 0, 0, // 0x74 - 0x77
- 0, 0, 0, 0, // 0x78 - 0x7b
- 0, 0, 0, 0, // 0x7c - 0x7f
- 0, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x80 - 0x83
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x84 - 0x87
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x88 - 0x8b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0x8c - 0x8f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x90 - 0x93
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x94 - 0x97
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x98 - 0x9b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x9c - 0x9f
- 0, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xa0 - 0xa3
- SJIS1B_MASK|EUCJP_MASK|EUCJP_KANA1_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xa4 - 0xa7
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xa8 - 0xab
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xac - 0xaf
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xb0 - 0xb3
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xb4 - 0xb7
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xb8 - 0xbb
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xbc - 0xbf
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xc0 - 0xc3
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xc4 - 0xc7
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xc8 - 0xcb
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xcc - 0xcf
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xd0 - 0xd3
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xd4 - 0xd7
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xd8 - 0xdb
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xdc - 0xdf
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xe0 - 0xe3
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xe4 - 0xe7
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xe8 - 0xeb
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xec - 0xef
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xf0 - 0xf3
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xf4 - 0xf7
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xf8 - 0xfb
- SJIS2B_MASK|EUCJP_MASK, EUCJP_MASK, EUCJP_MASK, 0 // 0xfc - 0xff
- };
-
- private static final byte maskTable2[] = {
- 0, 0, 0, 0, // 0x00 - 0x03
- 0, 0, 0, 0, // 0x04 - 0x07
- 0, 0, 0, 0, // 0x08 - 0x0b
- 0, 0, 0, 0, // 0x0c - 0x0f
- 0, 0, 0, 0, // 0x10 - 0x13
- 0, 0, 0, 0, // 0x14 - 0x17
- 0, 0, 0, 0, // 0x18 - 0x1b
- 0, 0, 0, 0, // 0x1c - 0x1f
- 0, 0, 0, 0, // 0x20 - 0x23
- 0, 0, 0, 0, // 0x24 - 0x27
- 0, 0, 0, 0, // 0x28 - 0x2b
- 0, 0, 0, 0, // 0x2c - 0x2f
- 0, 0, 0, 0, // 0x30 - 0x33
- 0, 0, 0, 0, // 0x34 - 0x37
- 0, 0, 0, 0, // 0x38 - 0x3b
- 0, 0, 0, 0, // 0x3c - 0x3f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x40 - 0x43
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x44 - 0x47
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x48 - 0x4b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x4c - 0x4f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x50 - 0x53
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x54 - 0x57
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x58 - 0x5b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x5c - 0x5f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x60 - 0x63
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x64 - 0x67
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x68 - 0x6b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x6c - 0x6f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x70 - 0x73
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x74 - 0x77
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x78 - 0x7b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, 0, // 0x7c - 0x7f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x80 - 0x83
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x84 - 0x87
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x88 - 0x8b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x8c - 0x8f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x90 - 0x93
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x94 - 0x97
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x98 - 0x9b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x9c - 0x9f
- SJIS2B_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xa0 - 0xa3
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xa4 - 0xa7
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xa8 - 0xab
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xac - 0xaf
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xb0 - 0xb3
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xb4 - 0xb7
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xb8 - 0xbb
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xbc - 0xbf
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xc0 - 0xc3
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xc4 - 0xc7
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xc8 - 0xcb
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xcc - 0xcf
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xd0 - 0xd3
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xd4 - 0xd7
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xd8 - 0xdb
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xdc - 0xdf
- SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xe0 - 0xe3
- SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xe4 - 0xe7
- SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xe8 - 0xeb
- SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xec - 0xef
- SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xf0 - 0xf3
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xf4 - 0xf7
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xf8 - 0xfb
- SJIS2B_MASK|EUCJP_MASK, EUCJP_MASK, EUCJP_MASK, 0 // 0xfc - 0xff
- };
}
}
diff --git a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java
index 29dd09510b8..2721fb118e0 100644
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java
@@ -50,17 +50,16 @@ package sun.security.pkcs11.wrapper;
/**
- * interface CK_CREATEMUTEX.
+ * interface CK_CREATEMUTEX.
*
- * @author Karl Scheibelhofer
- * @author Martin Schlaeffer
+ * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
+ * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
*/
public interface CK_CREATEMUTEX {
/**
* Method CK_CREATEMUTEX
*
- * @param ppMutex
* @return The mutex (lock) object.
* @exception PKCS11Exception
*/
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index d12d071a46b..10be3c68111 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -379,7 +379,7 @@ sun/tools/jinfo/JInfoRunningProcessFlagTest.java generic-all
# 8057732
sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java generic-all
-# 8064572 8060736 8062938
-sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
+# 8132648
+sun/tools/jhsdb/BasicLauncherTest.java generic-all
############################################################################
diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups
index fa237c9be2b..c83b2a5780a 100644
--- a/jdk/test/TEST.groups
+++ b/jdk/test/TEST.groups
@@ -28,14 +28,20 @@
tier1 = \
:jdk_lang \
:jdk_util \
+ sun/nio/cs/ISO8859x.java \
+ java/nio/Buffer \
+ com/sun/crypto/provider/Cipher \
:jdk_math
tier2 = \
:jdk_io \
:jdk_nio \
+ -sun/nio/cs/ISO8859x.java \
+ -java/nio/Buffer \
:jdk_net \
:jdk_time \
:jdk_security \
+ -com/sun/crypto/provider/Cipher \
:jdk_text \
:core_tools \
:jdk_other \
@@ -43,7 +49,8 @@ tier2 = \
tier3 = \
:jdk_rmi \
- :jdk_beans
+ :jdk_beans \
+ :jdk_imageio
###############################################################################
#
diff --git a/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh b/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh
index a1f6b7c5a03..8d8df5cfc0e 100644
--- a/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh
+++ b/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh
@@ -30,6 +30,7 @@
# TTY: dump command not implemented.
# @author Tim Bell
#
+# @key intermittent
# @run shell ArrayLengthDumpTest.sh
#
classname=ArrayLengthDumpTarg
diff --git a/jdk/test/com/sun/jdi/BreakpointTest.java b/jdk/test/com/sun/jdi/BreakpointTest.java
index 55f0b0d2219..1266f0a274b 100644
--- a/jdk/test/com/sun/jdi/BreakpointTest.java
+++ b/jdk/test/com/sun/jdi/BreakpointTest.java
@@ -28,6 +28,7 @@
*
* @author jjh
*
+ * @key intermittent
* @modules jdk.jdi
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g BreakpointTest.java
@@ -45,7 +46,7 @@ import java.util.*;
// the debuggee, waits a bit, and enables the bkpt again.
class BreakpointTarg {
- public final static int BKPT_LINE = 55;
+ public final static int BKPT_LINE = 56;
// LINE NUMBER SENSITIVE
public static long count;
diff --git a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh
index e358487d3be..f7bcb89e715 100644
--- a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh
+++ b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh
@@ -29,6 +29,7 @@
# @author dcubed (based on the test program posted to the following
# Eclipse thread https://bugs.eclipse.org/bugs/show_bug.cgi?id=279137)
#
+# @key intermittent
# @run shell BreakpointWithFullGC.sh
compileOptions=-g
diff --git a/jdk/test/com/sun/jdi/CatchAllTest.sh b/jdk/test/com/sun/jdi/CatchAllTest.sh
index 19b70d99bc8..52d1864384b 100644
--- a/jdk/test/com/sun/jdi/CatchAllTest.sh
+++ b/jdk/test/com/sun/jdi/CatchAllTest.sh
@@ -29,6 +29,7 @@
# @summary REGRESSION: jdb rejects the syntax catch java.lang.IndexOutOfBoundsException
# @author Tim Bell
#
+# @key intermittent
# @run shell CatchAllTest.sh
#
classname=CatchAllTestTarg
diff --git a/jdk/test/com/sun/jdi/CatchCaughtTest.sh b/jdk/test/com/sun/jdi/CatchCaughtTest.sh
index e1665283a55..47a0d356e36 100644
--- a/jdk/test/com/sun/jdi/CatchCaughtTest.sh
+++ b/jdk/test/com/sun/jdi/CatchCaughtTest.sh
@@ -29,6 +29,7 @@
# @summary TTY: 'catch caught' with no class pattern throws NullPointerException
# @author Tim Bell
#
+# @key intermittent
# @run shell CatchCaughtTest.sh
#
classname=CatchCaughtTestTarg
diff --git a/jdk/test/com/sun/jdi/CatchPatternTest.sh b/jdk/test/com/sun/jdi/CatchPatternTest.sh
index a490760db4e..1164b74b94d 100644
--- a/jdk/test/com/sun/jdi/CatchPatternTest.sh
+++ b/jdk/test/com/sun/jdi/CatchPatternTest.sh
@@ -28,6 +28,7 @@
# @summary TTY: surprising ExceptionSpec.resolveEventRequest() wildcard results
# @author Tim Bell
#
+# @key intermittent
# @run shell CatchPatternTest.sh
classname=CatchPatternTestTarg
createJavaFile()
diff --git a/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh b/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh
index 34f0942824b..c5beb904d30 100644
--- a/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh
+++ b/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh
@@ -28,6 +28,7 @@
# @bug 4507088
# @summary TTY: Add a comment delimiter to the jdb command set
# @author Tim Bell
+# @key intermittent
# @run shell CommandCommentDelimiter.sh
#
diff --git a/jdk/test/com/sun/jdi/DeoptimizeWalk.sh b/jdk/test/com/sun/jdi/DeoptimizeWalk.sh
index c8df10fac0f..e8fc44c4281 100644
--- a/jdk/test/com/sun/jdi/DeoptimizeWalk.sh
+++ b/jdk/test/com/sun/jdi/DeoptimizeWalk.sh
@@ -27,6 +27,7 @@
# @bug 4525714
# @summary jtreg test PopAsynchronousTest fails in build 85 with -Xcomp
# @author Jim Holmlund/Swamy Venkataramanappa
+# @key intermittent
# @run shell DeoptimizeWalk.sh
# This is another test of the same bug. The bug occurs when trying
diff --git a/jdk/test/com/sun/jdi/ExceptionEvents.java b/jdk/test/com/sun/jdi/ExceptionEvents.java
index 054ad248cc2..8835c4603f6 100644
--- a/jdk/test/com/sun/jdi/ExceptionEvents.java
+++ b/jdk/test/com/sun/jdi/ExceptionEvents.java
@@ -28,6 +28,7 @@
*
* @author Robert Field
*
+ * @key intermittent
* @modules jdk.jdi
* @run build TestScaffold VMConnection
* @run compile -g ExceptionEvents.java
diff --git a/jdk/test/com/sun/jdi/JdbExprTest.sh b/jdk/test/com/sun/jdi/JdbExprTest.sh
index ecfd9432aed..a3c4ce168f4 100644
--- a/jdk/test/com/sun/jdi/JdbExprTest.sh
+++ b/jdk/test/com/sun/jdi/JdbExprTest.sh
@@ -26,6 +26,7 @@
# @test
# @bug 4660158
# @author Staffan Larsen
+# @key intermittent
# @run shell JdbExprTest.sh
# These are variables that can be set to control execution
diff --git a/jdk/test/com/sun/jdi/JdbMissStep.sh b/jdk/test/com/sun/jdi/JdbMissStep.sh
index 62c0f3eabf9..42a1108a6c8 100644
--- a/jdk/test/com/sun/jdi/JdbMissStep.sh
+++ b/jdk/test/com/sun/jdi/JdbMissStep.sh
@@ -28,6 +28,7 @@
# @summary REGRESSION: jdb / jdi not stopping at some breakpoints and steps in j2sdk1.4.
# @author Jim Holmlund
#
+# @key intermittent
# @run shell JdbMissStep.sh
# These are variables that can be set to control execution
diff --git a/jdk/test/com/sun/jdi/JdbVarargsTest.sh b/jdk/test/com/sun/jdi/JdbVarargsTest.sh
index 61c3e1c70c3..483c00a5d0a 100644
--- a/jdk/test/com/sun/jdi/JdbVarargsTest.sh
+++ b/jdk/test/com/sun/jdi/JdbVarargsTest.sh
@@ -29,6 +29,7 @@
#
# @author jjh
#
+# @key intermittent
# @run shell JdbVarargsTest.sh
classname=JdbVarargsTest
diff --git a/jdk/test/com/sun/jdi/MixedSuspendTest.sh b/jdk/test/com/sun/jdi/MixedSuspendTest.sh
index c8b64ea36c7..e18b20bd120 100644
--- a/jdk/test/com/sun/jdi/MixedSuspendTest.sh
+++ b/jdk/test/com/sun/jdi/MixedSuspendTest.sh
@@ -29,6 +29,7 @@
#
# @author Jim Holmlund
#
+# @key intermittent
# @modules jdk.jdi
# @run build TestScaffold VMConnection TargetListener TargetAdapter
# @run shell MixedSuspendTest.sh
diff --git a/jdk/test/com/sun/jdi/NotAField.sh b/jdk/test/com/sun/jdi/NotAField.sh
index acc627c92ad..d8ae30c7698 100644
--- a/jdk/test/com/sun/jdi/NotAField.sh
+++ b/jdk/test/com/sun/jdi/NotAField.sh
@@ -29,6 +29,7 @@
# @summary TTY: NullPointerException at
# com.sun.tools.jdi.MirrorImpl.validateMirrors
# @author Tim Bell
+# @key intermittent
# @run shell NotAField.sh
#
diff --git a/jdk/test/com/sun/jdi/RedefineAbstractClass.sh b/jdk/test/com/sun/jdi/RedefineAbstractClass.sh
index 9e6e484dc04..9d0a8f9cc10 100644
--- a/jdk/test/com/sun/jdi/RedefineAbstractClass.sh
+++ b/jdk/test/com/sun/jdi/RedefineAbstractClass.sh
@@ -31,6 +31,7 @@
# methods are called.
# @author Daniel D. Daugherty
#
+# @key intermittent
# @run shell RedefineAbstractClass.sh
compileOptions=-g
diff --git a/jdk/test/com/sun/jdi/RedefineAnnotation.sh b/jdk/test/com/sun/jdi/RedefineAnnotation.sh
index 066e3d3eb4b..45e27acbf96 100644
--- a/jdk/test/com/sun/jdi/RedefineAnnotation.sh
+++ b/jdk/test/com/sun/jdi/RedefineAnnotation.sh
@@ -28,6 +28,7 @@
# @summary Redefine a class that has an annotation and verify that the
# new annotation is returned.
#
+# @key intermittent
# @run shell RedefineAnnotation.sh
compileOptions=-g
diff --git a/jdk/test/com/sun/jdi/RedefineClearBreakpoint.sh b/jdk/test/com/sun/jdi/RedefineClearBreakpoint.sh
index 697a3c839cd..59e8bc8ac6c 100644
--- a/jdk/test/com/sun/jdi/RedefineClearBreakpoint.sh
+++ b/jdk/test/com/sun/jdi/RedefineClearBreakpoint.sh
@@ -27,6 +27,7 @@
# @bug 4705330
# @summary Netbeans Fix and Continue crashes JVM
# @author Jim Holmlund/Swamy Venkataramanappa
+# @key intermittent
# @run shell RedefineClearBreakpoint.sh
# The failure occurs after a bkpt is set and then cleared
diff --git a/jdk/test/com/sun/jdi/RedefineException.sh b/jdk/test/com/sun/jdi/RedefineException.sh
index e1bc0a3b215..c2f0555f79e 100644
--- a/jdk/test/com/sun/jdi/RedefineException.sh
+++ b/jdk/test/com/sun/jdi/RedefineException.sh
@@ -28,6 +28,7 @@
# @summary The VM crashes when a method in a redefined class throws an exception.
# @author Jim Holmlund
#
+# @key intermittent
# @run shell RedefineException.sh
# This is another symptomm of 4559100
diff --git a/jdk/test/com/sun/jdi/RedefineFinal.sh b/jdk/test/com/sun/jdi/RedefineFinal.sh
index c35a29d7019..0ad4e5f500e 100644
--- a/jdk/test/com/sun/jdi/RedefineFinal.sh
+++ b/jdk/test/com/sun/jdi/RedefineFinal.sh
@@ -27,6 +27,7 @@
# @bug 4788344
# @summary RedefineClasses is an apparent no-op if instance method is final
#
+# @key intermittent
# @run shell RedefineFinal.sh
compileOptions=-g
diff --git a/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh b/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh
index 112c6c3e53d..bd3bb514d52 100644
--- a/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh
+++ b/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh
@@ -27,6 +27,7 @@
# @bug 6394084
# @summary Redefine class can't handle addition of 64 bit constants in JDK1.5.0_05
#
+# @key intermittent
# @run shell RedefineIntConstantToLong.sh
compileOptions=-g
diff --git a/jdk/test/com/sun/jdi/RedefinePop.sh b/jdk/test/com/sun/jdi/RedefinePop.sh
index c92e83d2f70..7d223e1201e 100644
--- a/jdk/test/com/sun/jdi/RedefinePop.sh
+++ b/jdk/test/com/sun/jdi/RedefinePop.sh
@@ -30,6 +30,7 @@
#
# The failure occurs with debug java when the pop deletes the
# line that called the method which is being popped.
+# @key intermittent
# @run shell RedefinePop.sh
diff --git a/jdk/test/com/sun/jdi/RedefineStep.sh b/jdk/test/com/sun/jdi/RedefineStep.sh
index d6680ab79ec..0f457f10681 100644
--- a/jdk/test/com/sun/jdi/RedefineStep.sh
+++ b/jdk/test/com/sun/jdi/RedefineStep.sh
@@ -27,6 +27,7 @@
# @bug 4689395
# @summary "step over" after a class is redefined acts like "step out"
# @author Jim Holmlund
+# @key intermittent
# @run shell RedefineStep.sh
#
diff --git a/jdk/test/com/sun/jdi/RedefineTTYLineNumber.sh b/jdk/test/com/sun/jdi/RedefineTTYLineNumber.sh
index 8bc7a845ef2..ba0c658db4d 100644
--- a/jdk/test/com/sun/jdi/RedefineTTYLineNumber.sh
+++ b/jdk/test/com/sun/jdi/RedefineTTYLineNumber.sh
@@ -27,6 +27,7 @@
# @bug 4660756
# @summary TTY: Need to clear source cache after doing a redefine class
# @author Jim Holmlund
+# @key intermittent
# @run shell/timeout=240 RedefineTTYLineNumber.sh
#set -x
diff --git a/jdk/test/com/sun/jdi/SimulResumerTest.java b/jdk/test/com/sun/jdi/SimulResumerTest.java
index e05f27eb8d1..7d9fae6c2a9 100644
--- a/jdk/test/com/sun/jdi/SimulResumerTest.java
+++ b/jdk/test/com/sun/jdi/SimulResumerTest.java
@@ -28,6 +28,7 @@
*
* @author jjh
*
+ * @key intermittent
* @modules jdk.jdi
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g SimulResumerTest.java
diff --git a/jdk/test/com/sun/jdi/StringConvertTest.sh b/jdk/test/com/sun/jdi/StringConvertTest.sh
index 053396c9297..50924cd7f7f 100644
--- a/jdk/test/com/sun/jdi/StringConvertTest.sh
+++ b/jdk/test/com/sun/jdi/StringConvertTest.sh
@@ -29,6 +29,7 @@
# 2. TTY: run on expression evaluation
# @author jim/suvasis mukherjee
#
+# @key intermittent
# @run shell StringConvertTest.sh
# Run this script to see the bug. See comments at the end
diff --git a/jdk/test/com/sun/jdi/sde/FilterMangleTest.java b/jdk/test/com/sun/jdi/sde/FilterMangleTest.java
index e5a6d601177..349a73ffbb1 100644
--- a/jdk/test/com/sun/jdi/sde/FilterMangleTest.java
+++ b/jdk/test/com/sun/jdi/sde/FilterMangleTest.java
@@ -5,6 +5,7 @@
*
* @author Robert Field / Jim Holmlund
*
+ * @key intermittent
* @library ..
* @modules jdk.jdi
* @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
diff --git a/jdk/test/com/sun/jndi/dns/IPv6NameserverPlatformParsingTest.java b/jdk/test/com/sun/jndi/dns/IPv6NameserverPlatformParsingTest.java
index fac68ba0756..65cafd1d48b 100644
--- a/jdk/test/com/sun/jndi/dns/IPv6NameserverPlatformParsingTest.java
+++ b/jdk/test/com/sun/jndi/dns/IPv6NameserverPlatformParsingTest.java
@@ -31,25 +31,12 @@ import javax.naming.spi.NamingManager;
import com.sun.jndi.dns.DnsContext;
/**
- * @test
* @bug 6991580
* @summary IPv6 Nameservers in resolv.conf throws NumberFormatException
- * @run main/manual IPv6NameserverPlatformParsingTest
- *
- * In order to run this test be sure to place, for example, the following
- * snippet into your platform's {@code /etc/resolv.conf}:
- *
- *
- * Then, run this test as manual jtreg test.
*
* @author Severin Gehwolf
- *
*/
+
public class IPv6NameserverPlatformParsingTest {
private static boolean foundIPv6 = false;
diff --git a/jdk/test/com/sun/jndi/dns/Test6991580.java b/jdk/test/com/sun/jndi/dns/Test6991580.java
new file mode 100644
index 00000000000..d0b065f794c
--- /dev/null
+++ b/jdk/test/com/sun/jndi/dns/Test6991580.java
@@ -0,0 +1,358 @@
+
+/*
+ * Copyright (c) 2015, 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.awt.Button;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.TextArea;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ * @test
+ * @bug 6991580 8080108
+ * @requires os.family != "windows"
+ * @summary IPv6 Nameservers in resolv.conf throws NumberFormatException
+ * @build IPv6NameserverPlatformParsingTest
+ * @run main/manual Test6991580
+ */
+
+
+public class Test6991580 {
+
+ private static void init() throws Exception {
+ //*** Create instructions for the user here ***
+
+ String[] instructions =
+ {
+ "This test should only be run on non-Windows systems.",
+ "If your system doesn't meet this condition, press PASS.",
+ "To run the test follow these instructions:",
+ "1. Open a terminal window.",
+ "2. Make sure you have, for example, the following snippet "
+ + "into your platform's /etc/resolv.conf:",
+ "nameserver 127.0.0.1",
+ "nameserver 2001:4860:4860::8888",
+ "nameserver [::1]:5353",
+ "nameserver 127.0.0.1:5353",
+ "Modify the /etc/resolv.conf file if needed. "
+ + "Don't forget to save the original content of the file.",
+ "3. Type \"cd " + System.getProperty("test.classes") + "\".",
+ "4. Type \"" + System.getProperty("java.home") +
+ "/bin/java IPv6NameserverPlatformParsingTest\".",
+ "5. If you see",
+ "\"PASS: Found IPv6 address and DnsClient parsed it correctly.\"",
+ ", press PASS else press FAIL.",
+ "6. If you modified /etc/resolv.conf on the step #2, "
+ + "please, restore the original content of the file."
+ };
+
+ Sysout.createDialog( );
+ Sysout.printInstructions( instructions );
+ }
+
+ /*****************************************************
+ Standard Test Machinery Section
+ DO NOT modify anything in this section -- it's a
+ standard chunk of code which has all of the
+ synchronisation necessary for the test harness.
+ By keeping it the same in all tests, it is easier
+ to read and understand someone else's test, as
+ well as insuring that all tests behave correctly
+ with the test harness.
+ There is a section following this for test-defined
+ classes
+ ******************************************************/
+ private static boolean theTestPassed = false;
+ private static boolean testGeneratedInterrupt = false;
+ private static String failureMessage = "";
+
+ private static Thread mainThread = null;
+
+ private static int sleepTime = 300000;
+
+ public static void main( String args[] ) throws Exception
+ {
+ mainThread = Thread.currentThread();
+ try
+ {
+ init();
+ }
+ catch( TestPassedException e )
+ {
+ //The test passed, so just return from main and harness will
+ // interepret this return as a pass
+ return;
+ }
+ //At this point, neither test passed nor test failed has been
+ // called -- either would have thrown an exception and ended the
+ // test, so we know we have multiple threads.
+
+ //Test involves other threads, so sleep and wait for them to
+ // called pass() or fail()
+ try
+ {
+ Thread.sleep( sleepTime );
+ //Timed out, so fail the test
+ throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+ }
+ catch (InterruptedException e)
+ {
+ if( ! testGeneratedInterrupt ) throw e;
+
+ //reset flag in case hit this code more than once for some reason (just safety)
+ testGeneratedInterrupt = false;
+ if ( theTestPassed == false )
+ {
+ throw new RuntimeException( failureMessage );
+ }
+ }
+
+ }//main
+
+ public static synchronized void setTimeoutTo( int seconds )
+ {
+ sleepTime = seconds * 1000;
+ }
+
+ public static synchronized void pass()
+ {
+ Sysout.println( "The test passed." );
+ Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
+ //first check if this is executing in main thread
+ if ( mainThread == Thread.currentThread() )
+ {
+ //Still in the main thread, so set the flag just for kicks,
+ // and throw a test passed exception which will be caught
+ // and end the test.
+ theTestPassed = true;
+ throw new TestPassedException();
+ }
+ //pass was called from a different thread, so set the flag and interrupt
+ // the main thead.
+ theTestPassed = true;
+ testGeneratedInterrupt = true;
+ mainThread.interrupt();
+ }//pass()
+
+ public static synchronized void fail()
+ {
+ //test writer didn't specify why test failed, so give generic
+ fail( "it just plain failed! :-)" );
+ }
+
+ public static synchronized void fail( String whyFailed )
+ {
+ Sysout.println( "The test failed: " + whyFailed );
+ Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
+ //check if this called from main thread
+ if ( mainThread == Thread.currentThread() )
+ {
+ //If main thread, fail now 'cause not sleeping
+ throw new RuntimeException( whyFailed );
+ }
+ theTestPassed = false;
+ testGeneratedInterrupt = true;
+ failureMessage = whyFailed;
+ mainThread.interrupt();
+ }//fail()
+
+ }
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+ {
+ }
+
+//*********** End Standard Test Machinery Section **********
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+ {
+ private static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+ }// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog implements ActionListener
+ {
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 120;
+ Panel buttonP = new Panel();
+ Button passB = new Button( "pass" );
+ Button failB = new Button( "fail" );
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ passB = new Button( "pass" );
+ passB.setActionCommand( "pass" );
+ passB.addActionListener( this );
+ buttonP.add( "East", passB );
+
+ failB = new Button( "fail" );
+ failB.setActionCommand( "fail" );
+ failB.addActionListener( this );
+ buttonP.add( "West", failB );
+
+ add( "South", buttonP );
+ pack();
+
+ show();
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ }
+
+ //catch presses of the passed and failed buttons.
+ //simply call the standard pass() or fail() static methods of
+ //DialogOrient
+ @Override
+ public void actionPerformed( ActionEvent e )
+ {
+ if( "pass".equals(e.getActionCommand()) )
+ {
+ Test6991580.pass();
+ }
+ else
+ {
+ Test6991580.fail();
+ }
+ }
+
+ }
diff --git a/jdk/test/com/sun/tools/attach/BasicTests.java b/jdk/test/com/sun/tools/attach/BasicTests.java
index 30e6ed395b3..720ae0004dd 100644
--- a/jdk/test/com/sun/tools/attach/BasicTests.java
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java
@@ -41,7 +41,7 @@ import com.sun.tools.attach.VirtualMachineDescriptor;
* @test
* @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
* @summary Basic unit tests for the VM attach mechanism.
- * @modules jdk.jartool/sun.tools.jar
+ * @key intermittent
* @library /lib/testlibrary
* @modules java.instrument
* java.management
diff --git a/jdk/test/java/lang/ClassLoader/Assert.java b/jdk/test/java/lang/ClassLoader/Assert.java
index fb2376d45d4..57b6febedb2 100644
--- a/jdk/test/java/lang/ClassLoader/Assert.java
+++ b/jdk/test/java/lang/ClassLoader/Assert.java
@@ -28,7 +28,7 @@
* @run main/othervm Assert
* @summary Test the assertion facility
* @author Mike McCloskey
- * @key randomness
+ * @key randomness intermittent
*/
import package1.*;
diff --git a/jdk/test/java/lang/instrument/BootClassPath/BootClassPathTest.sh b/jdk/test/java/lang/instrument/BootClassPath/BootClassPathTest.sh
index e0a564189fa..ed499e1f59f 100644
--- a/jdk/test/java/lang/instrument/BootClassPath/BootClassPathTest.sh
+++ b/jdk/test/java/lang/instrument/BootClassPath/BootClassPathTest.sh
@@ -26,6 +26,7 @@
# @summary Test non US-ASCII characters in the value of the Boot-Class-Path
# attribute.
#
+# @key intermittent
# @modules java.instrument
# @run shell/timeout=240 BootClassPathTest.sh
diff --git a/jdk/test/java/lang/instrument/ManifestTest.sh b/jdk/test/java/lang/instrument/ManifestTest.sh
index a9466905e80..4196a7de022 100644
--- a/jdk/test/java/lang/instrument/ManifestTest.sh
+++ b/jdk/test/java/lang/instrument/ManifestTest.sh
@@ -26,6 +26,7 @@
# @summary JLI JAR manifest processing should ignore leading and trailing white space.
# @author Daniel D. Daugherty
#
+# @key intermittent
# @modules java.instrument
# @run build ManifestTestApp ExampleForBootClassPath
# @run shell/timeout=900 ManifestTest.sh
diff --git a/jdk/test/java/lang/instrument/PremainClass/InheritAgent0101.java b/jdk/test/java/lang/instrument/PremainClass/InheritAgent0101.java
index 32c0dd91dc0..8766c8a57da 100644
--- a/jdk/test/java/lang/instrument/PremainClass/InheritAgent0101.java
+++ b/jdk/test/java/lang/instrument/PremainClass/InheritAgent0101.java
@@ -27,6 +27,7 @@
* @summary test config (0,1,0,1): inherited 1-arg and declared 1-arg in agent class
* @author Daniel D. Daugherty, Sun Microsystems
*
+ * @key intermittent
* @run shell ../MakeJAR3.sh InheritAgent0101
* @run main/othervm -javaagent:InheritAgent0101.jar DummyMain
*/
diff --git a/jdk/test/java/lang/instrument/RedefineBigClass.sh b/jdk/test/java/lang/instrument/RedefineBigClass.sh
index 0098bf596da..a2c702e69dd 100644
--- a/jdk/test/java/lang/instrument/RedefineBigClass.sh
+++ b/jdk/test/java/lang/instrument/RedefineBigClass.sh
@@ -26,6 +26,7 @@
# @summary Redefine a big class.
# @author Daniel D. Daugherty
#
+# @key intermittent
# @modules java.instrument
# @run shell MakeJAR3.sh RedefineBigClassAgent 'Can-Redefine-Classes: true'
# @run build BigClass RedefineBigClassApp NMTHelper
diff --git a/jdk/test/java/lang/instrument/RetransformBigClass.sh b/jdk/test/java/lang/instrument/RetransformBigClass.sh
index 8f9d992f422..3e65bff87cb 100644
--- a/jdk/test/java/lang/instrument/RetransformBigClass.sh
+++ b/jdk/test/java/lang/instrument/RetransformBigClass.sh
@@ -26,6 +26,7 @@
# @summary Retransform a big class.
# @author Daniel D. Daugherty
#
+# @key intermittent
# @modules java.instrument
# @run shell MakeJAR4.sh RetransformBigClassAgent SimpleIdentityTransformer 'Can-Retransform-Classes: true'
# @run build BigClass RetransformBigClassApp NMTHelper
diff --git a/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java b/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java
index 9de573c3851..8bb229e50d1 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java
@@ -27,6 +27,7 @@
* @summary Basic unit test of ThreadMXBean.getAllThreadIds()
* @author Alexei Guibadoulline and Mandy Chung
*
+ * @key intermittent
* @modules java.management
* @run main/othervm AllThreadIds
*/
diff --git a/jdk/test/java/nio/Buffer/Basic.java b/jdk/test/java/nio/Buffer/Basic.java
index aef98306a9c..cf592ced1a9 100644
--- a/jdk/test/java/nio/Buffer/Basic.java
+++ b/jdk/test/java/nio/Buffer/Basic.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, 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
@@ -25,7 +25,7 @@
* @summary Unit test for buffers
* @bug 4413135 4414911 4416536 4416562 4418782 4471053 4472779 4490253 4523725
* 4526177 4463011 4660660 4661219 4663521 4782970 4804304 4938424 6231529
- * 6221101 6234263 6535542 6591971 6593946 6795561 7190219 7199551
+ * 6221101 6234263 6535542 6591971 6593946 6795561 7190219 7199551 8065556
* @author Mark Reinhold
*/
diff --git a/jdk/test/java/nio/file/FileStore/Basic.java b/jdk/test/java/nio/file/FileStore/Basic.java
index 465f3f2a8d2..f81d3d95a8b 100644
--- a/jdk/test/java/nio/file/FileStore/Basic.java
+++ b/jdk/test/java/nio/file/FileStore/Basic.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, 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
@@ -116,9 +116,15 @@ public class Basic {
store.type());
// check space attributes are accessible
- store.getTotalSpace();
- store.getUnallocatedSpace();
- store.getUsableSpace();
+ try {
+ store.getTotalSpace();
+ store.getUnallocatedSpace();
+ store.getUsableSpace();
+ } catch (NoSuchFileException nsfe) {
+ // ignore exception as the store could have been
+ // deleted since the iterator was instantiated
+ System.err.format("%s was not found\n", store);
+ }
// two distinct FileStores should not be equal
assertTrue(!store.equals(prev));
diff --git a/jdk/test/java/security/KeyStore/EntryMethods.java b/jdk/test/java/security/KeyStore/EntryMethods.java
index 396e04346fa..410fd1a6cee 100644
--- a/jdk/test/java/security/KeyStore/EntryMethods.java
+++ b/jdk/test/java/security/KeyStore/EntryMethods.java
@@ -23,7 +23,7 @@
/*
* @test 1.5, 03/06/24
- * @bug 4850376
+ * @bug 4850376 8130850
* @summary Provide generic storage KeyStore storage facilities
*/
@@ -50,6 +50,20 @@ public class EntryMethods
}
}
+ public static class MyLoadStoreParameter
+ implements KeyStore.LoadStoreParameter {
+
+ private KeyStore.ProtectionParameter protection;
+
+ MyLoadStoreParameter(KeyStore.ProtectionParameter protection) {
+ this.protection = protection;
+ }
+
+ public KeyStore.ProtectionParameter getProtectionParameter() {
+ return protection;
+ }
+ }
+
public static class FooEntry implements KeyStore.Entry { }
public EntryMethods() throws Exception {
@@ -103,9 +117,17 @@ public class EntryMethods
throw new SecurityException("[Pre1.5] test " + tNum + " failed");
} catch (UnsupportedOperationException uoe) {
System.out.println("[Pre1.5] test " + tNum++ + " passed");
+ } catch (NoSuchAlgorithmException nsae) {
+ System.out.println("[Pre1.5] test " + tNum++ + " passed");
}
+ // TEST load custom param
+ ks.load(new MyLoadStoreParameter(
+ new KeyStore.PasswordProtection(password)));
+ System.out.println("[Pre1.5] test " + tNum++ + " passed");
+
+
// TEST store random param
ks.load(pre15fis, password);
diff --git a/jdk/test/java/security/testlibrary/CertificateBuilder.java b/jdk/test/java/security/testlibrary/CertificateBuilder.java
new file mode 100644
index 00000000000..4ab26d0d12e
--- /dev/null
+++ b/jdk/test/java/security/testlibrary/CertificateBuilder.java
@@ -0,0 +1,539 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.testlibrary;
+
+import java.io.*;
+import java.util.*;
+import java.security.*;
+import java.security.cert.X509Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.Extension;
+import javax.security.auth.x500.X500Principal;
+import java.math.BigInteger;
+
+import sun.security.util.DerOutputStream;
+import sun.security.util.DerValue;
+import sun.security.util.ObjectIdentifier;
+import sun.security.x509.AccessDescription;
+import sun.security.x509.AlgorithmId;
+import sun.security.x509.AuthorityInfoAccessExtension;
+import sun.security.x509.AuthorityKeyIdentifierExtension;
+import sun.security.x509.SubjectKeyIdentifierExtension;
+import sun.security.x509.BasicConstraintsExtension;
+import sun.security.x509.ExtendedKeyUsageExtension;
+import sun.security.x509.DNSName;
+import sun.security.x509.GeneralName;
+import sun.security.x509.GeneralNames;
+import sun.security.x509.KeyUsageExtension;
+import sun.security.x509.SerialNumber;
+import sun.security.x509.SubjectAlternativeNameExtension;
+import sun.security.x509.URIName;
+import sun.security.x509.KeyIdentifier;
+
+/**
+ * Helper class that builds and signs X.509 certificates.
+ *
+ * A CertificateBuilder is created with a default constructor, and then
+ * uses additional public methods to set the public key, desired validity
+ * dates, serial number and extensions. It is expected that the caller will
+ * have generated the necessary key pairs prior to using a CertificateBuilder
+ * to generate certificates.
+ *
+ * The following methods are mandatory before calling build():
+ *
+ *
+ * Additionally, the caller can either provide a {@link List} of
+ * {@link Extension} objects, or use the helper classes to add specific
+ * extension types.
+ *
+ * When all required and desired parameters are set, the
+ * {@link #build(java.security.cert.X509Certificate, java.security.PrivateKey,
+ * java.lang.String)} method can be used to create the {@link X509Certificate}
+ * object.
+ *
+ * Multiple certificates may be cut from the same settings using subsequent
+ * calls to the build method. Settings may be cleared using the
+ * {@link #reset()} method.
+ */
+public class CertificateBuilder {
+ private final CertificateFactory factory;
+
+ private X500Principal subjectName = null;
+ private BigInteger serialNumber = null;
+ private PublicKey publicKey = null;
+ private Date notBefore = null;
+ private Date notAfter = null;
+ private final Map extensions = new HashMap<>();
+ private byte[] tbsCertBytes;
+ private byte[] signatureBytes;
+
+ /**
+ * Default constructor for a {@code CertificateBuilder} object.
+ *
+ * @throws CertificateException if the underlying {@link CertificateFactory}
+ * cannot be instantiated.
+ */
+ public CertificateBuilder() throws CertificateException {
+ factory = CertificateFactory.getInstance("X.509");
+ }
+
+ /**
+ * Set the subject name for the certificate.
+ *
+ * @param name An {@link X500Principal} to be used as the subject name
+ * on this certificate.
+ */
+ public void setSubjectName(X500Principal name) {
+ subjectName = name;
+ }
+
+ /**
+ * Set the subject name for the certificate.
+ *
+ * @param name The subject name in RFC 2253 format
+ */
+ public void setSubjectName(String name) {
+ subjectName = new X500Principal(name);
+ }
+
+ /**
+ * Set the public key for this certificate.
+ *
+ * @param pubKey The {@link PublicKey} to be used on this certificate.
+ */
+ public void setPublicKey(PublicKey pubKey) {
+ publicKey = Objects.requireNonNull(pubKey, "Caught null public key");
+ }
+
+ /**
+ * Set the NotBefore date on the certificate.
+ *
+ * @param nbDate A {@link Date} object specifying the start of the
+ * certificate validity period.
+ */
+ public void setNotBefore(Date nbDate) {
+ Objects.requireNonNull(nbDate, "Caught null notBefore date");
+ notBefore = (Date)nbDate.clone();
+ }
+
+ /**
+ * Set the NotAfter date on the certificate.
+ *
+ * @param naDate A {@link Date} object specifying the end of the
+ * certificate validity period.
+ */
+ public void setNotAfter(Date naDate) {
+ Objects.requireNonNull(naDate, "Caught null notAfter date");
+ notAfter = (Date)naDate.clone();
+ }
+
+ /**
+ * Set the validity period for the certificate
+ *
+ * @param nbDate A {@link Date} object specifying the start of the
+ * certificate validity period.
+ * @param naDate A {@link Date} object specifying the end of the
+ * certificate validity period.
+ */
+ public void setValidity(Date nbDate, Date naDate) {
+ setNotBefore(nbDate);
+ setNotAfter(naDate);
+ }
+
+ /**
+ * Set the serial number on the certificate.
+ *
+ * @param serial A serial number in {@link BigInteger} form.
+ */
+ public void setSerialNumber(BigInteger serial) {
+ Objects.requireNonNull(serial, "Caught null serial number");
+ serialNumber = serial;
+ }
+
+
+ /**
+ * Add a single extension to the certificate.
+ *
+ * @param ext The extension to be added.
+ */
+ public void addExtension(Extension ext) {
+ Objects.requireNonNull(ext, "Caught null extension");
+ extensions.put(ext.getId(), ext);
+ }
+
+ /**
+ * Add multiple extensions contained in a {@code List}.
+ *
+ * @param extList The {@link List} of extensions to be added to
+ * the certificate.
+ */
+ public void addExtensions(List extList) {
+ Objects.requireNonNull(extList, "Caught null extension list");
+ for (Extension ext : extList) {
+ extensions.put(ext.getId(), ext);
+ }
+ }
+
+ /**
+ * Helper method to add DNSName types for the SAN extension
+ *
+ * @param dnsNames A {@code List} of names to add as DNSName types
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addSubjectAltNameDNSExt(List dnsNames) throws IOException {
+ if (!dnsNames.isEmpty()) {
+ GeneralNames gNames = new GeneralNames();
+ for (String name : dnsNames) {
+ gNames.add(new GeneralName(new DNSName(name)));
+ }
+ addExtension(new SubjectAlternativeNameExtension(false,
+ gNames));
+ }
+ }
+
+ /**
+ * Helper method to add one or more OCSP URIs to the Authority Info Access
+ * certificate extension.
+ *
+ * @param locations A list of one or more OCSP responder URIs as strings
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addAIAExt(List locations)
+ throws IOException {
+ if (!locations.isEmpty()) {
+ List acDescList = new ArrayList<>();
+ for (String ocspUri : locations) {
+ acDescList.add(new AccessDescription(
+ AccessDescription.Ad_OCSP_Id,
+ new GeneralName(new URIName(ocspUri))));
+ }
+ addExtension(new AuthorityInfoAccessExtension(acDescList));
+ }
+ }
+
+ /**
+ * Set a Key Usage extension for the certificate. The extension will
+ * be marked critical.
+ *
+ * @param bitSettings Boolean array for all nine bit settings in the order
+ * documented in RFC 5280 section 4.2.1.3.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addKeyUsageExt(boolean[] bitSettings) throws IOException {
+ addExtension(new KeyUsageExtension(bitSettings));
+ }
+
+ /**
+ * Set the Basic Constraints Extension for a certificate.
+ *
+ * @param crit {@code true} if critical, {@code false} otherwise
+ * @param isCA {@code true} if the extension will be on a CA certificate,
+ * {@code false} otherwise
+ * @param maxPathLen The maximum path length issued by this CA. Values
+ * less than zero will omit this field from the resulting extension and
+ * no path length constraint will be asserted.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addBasicConstraintsExt(boolean crit, boolean isCA,
+ int maxPathLen) throws IOException {
+ addExtension(new BasicConstraintsExtension(crit, isCA, maxPathLen));
+ }
+
+ /**
+ * Add the Authority Key Identifier extension.
+ *
+ * @param authorityCert The certificate of the issuing authority.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addAuthorityKeyIdExt(X509Certificate authorityCert)
+ throws IOException {
+ addAuthorityKeyIdExt(authorityCert.getPublicKey());
+ }
+
+ /**
+ * Add the Authority Key Identifier extension.
+ *
+ * @param authorityKey The public key of the issuing authority.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addAuthorityKeyIdExt(PublicKey authorityKey) throws IOException {
+ KeyIdentifier kid = new KeyIdentifier(authorityKey);
+ addExtension(new AuthorityKeyIdentifierExtension(kid, null, null));
+ }
+
+ /**
+ * Add the Subject Key Identifier extension.
+ *
+ * @param subjectKey The public key to be used in the resulting certificate
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addSubjectKeyIdExt(PublicKey subjectKey) throws IOException {
+ byte[] keyIdBytes = new KeyIdentifier(subjectKey).getIdentifier();
+ addExtension(new SubjectKeyIdentifierExtension(keyIdBytes));
+ }
+
+ /**
+ * Add the Extended Key Usage extension.
+ *
+ * @param ekuOids A {@link List} of object identifiers in string form.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addExtendedKeyUsageExt(List ekuOids)
+ throws IOException {
+ if (!ekuOids.isEmpty()) {
+ Vector oidVector = new Vector<>();
+ for (String oid : ekuOids) {
+ oidVector.add(new ObjectIdentifier(oid));
+ }
+ addExtension(new ExtendedKeyUsageExtension(oidVector));
+ }
+ }
+
+ /**
+ * Clear all settings and return the {@code CertificateBuilder} to
+ * its default state.
+ */
+ public void reset() {
+ extensions.clear();
+ subjectName = null;
+ notBefore = null;
+ notAfter = null;
+ serialNumber = null;
+ publicKey = null;
+ signatureBytes = null;
+ tbsCertBytes = null;
+ }
+
+ /**
+ * Build the certificate.
+ *
+ * @param issuerCert The certificate of the issuing authority, or
+ * {@code null} if the resulting certificate is self-signed.
+ * @param issuerKey The private key of the issuing authority
+ * @param algName The signature algorithm name
+ *
+ * @return The resulting {@link X509Certificate}
+ *
+ * @throws IOException if an encoding error occurs.
+ * @throws CertificateException If the certificate cannot be generated
+ * by the underlying {@link CertificateFactory}
+ * @throws NoSuchAlgorithmException If an invalid signature algorithm
+ * is provided.
+ */
+ public X509Certificate build(X509Certificate issuerCert,
+ PrivateKey issuerKey, String algName)
+ throws IOException, CertificateException, NoSuchAlgorithmException {
+ // TODO: add some basic checks (key usage, basic constraints maybe)
+
+ AlgorithmId signAlg = AlgorithmId.get(algName);
+ byte[] encodedCert = encodeTopLevel(issuerCert, issuerKey, signAlg);
+ ByteArrayInputStream bais = new ByteArrayInputStream(encodedCert);
+ return (X509Certificate)factory.generateCertificate(bais);
+ }
+
+ /**
+ * Encode the contents of the outer-most ASN.1 SEQUENCE:
+ *
+ *
+ *
+ * @param issuerCert The certificate of the issuing authority, or
+ * {@code null} if the resulting certificate is self-signed.
+ * @param issuerKey The private key of the issuing authority
+ * @param signAlg The signature algorithm object
+ *
+ * @return The DER-encoded X.509 certificate
+ *
+ * @throws CertificateException If an error occurs during the
+ * signing process.
+ * @throws IOException if an encoding error occurs.
+ */
+ private byte[] encodeTopLevel(X509Certificate issuerCert,
+ PrivateKey issuerKey, AlgorithmId signAlg)
+ throws CertificateException, IOException {
+ DerOutputStream outerSeq = new DerOutputStream();
+ DerOutputStream topLevelItems = new DerOutputStream();
+
+ tbsCertBytes = encodeTbsCert(issuerCert, signAlg);
+ topLevelItems.write(tbsCertBytes);
+ try {
+ signatureBytes = signCert(issuerKey, signAlg);
+ } catch (GeneralSecurityException ge) {
+ throw new CertificateException(ge);
+ }
+ signAlg.derEncode(topLevelItems);
+ topLevelItems.putBitString(signatureBytes);
+ outerSeq.write(DerValue.tag_Sequence, topLevelItems);
+
+ return outerSeq.toByteArray();
+ }
+
+ /**
+ * Encode the bytes for the TBSCertificate structure:
+ *
+ * TBSCertificate ::= SEQUENCE {
+ * version [0] EXPLICIT Version DEFAULT v1,
+ * serialNumber CertificateSerialNumber,
+ * signature AlgorithmIdentifier,
+ * issuer Name,
+ * validity Validity,
+ * subject Name,
+ * subjectPublicKeyInfo SubjectPublicKeyInfo,
+ * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,
+ * -- If present, version MUST be v2 or v3
+ * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,
+ * -- If present, version MUST be v2 or v3
+ * extensions [3] EXPLICIT Extensions OPTIONAL
+ * -- If present, version MUST be v3
+ * }
+ *
+ * @param issuerCert The certificate of the issuing authority, or
+ * {@code null} if the resulting certificate is self-signed.
+ * @param signAlg The signature algorithm object
+ *
+ * @return The DER-encoded bytes for the TBSCertificate structure
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ private byte[] encodeTbsCert(X509Certificate issuerCert,
+ AlgorithmId signAlg) throws IOException {
+ DerOutputStream tbsCertSeq = new DerOutputStream();
+ DerOutputStream tbsCertItems = new DerOutputStream();
+
+ // Hardcode to V3
+ byte[] v3int = {0x02, 0x01, 0x02};
+ tbsCertItems.write(DerValue.createTag(DerValue.TAG_CONTEXT, true,
+ (byte)0), v3int);
+
+ // Serial Number
+ SerialNumber sn = new SerialNumber(serialNumber);
+ sn.encode(tbsCertItems);
+
+ // Algorithm ID
+ signAlg.derEncode(tbsCertItems);
+
+ // Issuer Name
+ if (issuerCert != null) {
+ tbsCertItems.write(
+ issuerCert.getSubjectX500Principal().getEncoded());
+ } else {
+ // Self-signed
+ tbsCertItems.write(subjectName.getEncoded());
+ }
+
+ // Validity period (set as UTCTime)
+ DerOutputStream valSeq = new DerOutputStream();
+ valSeq.putUTCTime(notBefore);
+ valSeq.putUTCTime(notAfter);
+ tbsCertItems.write(DerValue.tag_Sequence, valSeq);
+
+ // Subject Name
+ tbsCertItems.write(subjectName.getEncoded());
+
+ // SubjectPublicKeyInfo
+ tbsCertItems.write(publicKey.getEncoded());
+
+ // TODO: Extensions!
+ encodeExtensions(tbsCertItems);
+
+ // Wrap it all up in a SEQUENCE and return the bytes
+ tbsCertSeq.write(DerValue.tag_Sequence, tbsCertItems);
+ return tbsCertSeq.toByteArray();
+ }
+
+ /**
+ * Encode the extensions segment for an X.509 Certificate:
+ *
+ *
+ * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
+ *
+ * Extension ::= SEQUENCE {
+ * extnID OBJECT IDENTIFIER,
+ * critical BOOLEAN DEFAULT FALSE,
+ * extnValue OCTET STRING
+ * -- contains the DER encoding of an ASN.1 value
+ * -- corresponding to the extension type identified
+ * -- by extnID
+ * }
+ *
+ *
+ * @param tbsStream The {@code DerOutputStream} that holds the
+ * TBSCertificate contents.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ private void encodeExtensions(DerOutputStream tbsStream)
+ throws IOException {
+ DerOutputStream extSequence = new DerOutputStream();
+ DerOutputStream extItems = new DerOutputStream();
+
+ for (Extension ext : extensions.values()) {
+ ext.encode(extItems);
+ }
+ extSequence.write(DerValue.tag_Sequence, extItems);
+ tbsStream.write(DerValue.createTag(DerValue.TAG_CONTEXT, true,
+ (byte)3), extSequence);
+ }
+
+ /**
+ * Digitally sign the X.509 certificate.
+ *
+ * @param issuerKey The private key of the issuing authority
+ * @param signAlg The signature algorithm object
+ *
+ * @return The digital signature bytes.
+ *
+ * @throws GeneralSecurityException If any errors occur during the
+ * digital signature process.
+ */
+ private byte[] signCert(PrivateKey issuerKey, AlgorithmId signAlg)
+ throws GeneralSecurityException {
+ Signature sig = Signature.getInstance(signAlg.getName());
+ sig.initSign(issuerKey);
+ sig.update(tbsCertBytes);
+ return sig.sign();
+ }
+ }
diff --git a/jdk/test/java/security/testlibrary/SimpleOCSPServer.java b/jdk/test/java/security/testlibrary/SimpleOCSPServer.java
new file mode 100644
index 00000000000..aba02e87c76
--- /dev/null
+++ b/jdk/test/java/security/testlibrary/SimpleOCSPServer.java
@@ -0,0 +1,1540 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.testlibrary;
+
+import java.io.*;
+import java.net.*;
+import java.security.*;
+import java.security.cert.CRLReason;
+import java.security.cert.X509Certificate;
+import java.security.cert.Extension;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateEncodingException;
+import java.security.Signature;
+import java.util.*;
+import java.util.concurrent.*;
+import java.text.SimpleDateFormat;
+import java.math.BigInteger;
+
+import sun.security.x509.*;
+import sun.security.x509.PKIXExtensions;
+import sun.security.provider.certpath.ResponderId;
+import sun.security.provider.certpath.CertId;
+import sun.security.provider.certpath.OCSPResponse;
+import sun.security.provider.certpath.OCSPResponse.ResponseStatus;
+import sun.security.util.Debug;
+import sun.security.util.DerInputStream;
+import sun.security.util.DerOutputStream;
+import sun.security.util.DerValue;
+import sun.security.util.ObjectIdentifier;
+
+
+/**
+ * This is a simple OCSP server designed to listen and respond to incoming
+ * requests.
+ */
+public class SimpleOCSPServer {
+ private final Debug debug = Debug.getInstance("oserv");
+ private static final ObjectIdentifier OCSP_BASIC_RESPONSE_OID =
+ ObjectIdentifier.newInternal(
+ new int[] { 1, 3, 6, 1, 5, 5, 7, 48, 1, 1});
+ private static final SimpleDateFormat utcDateFmt =
+ new SimpleDateFormat("MMM dd yyyy, HH:mm:ss z");
+
+ // CertStatus values
+ public static enum CertStatus {
+ CERT_STATUS_GOOD,
+ CERT_STATUS_REVOKED,
+ CERT_STATUS_UNKNOWN,
+ }
+
+ // Fields used for the networking portion of the responder
+ private ServerSocket servSocket;
+ private InetAddress listenAddress;
+ private int listenPort;
+
+ // Keystore information (certs, keys, etc.)
+ private KeyStore keystore;
+ private X509Certificate issuerCert;
+ private X509Certificate signerCert;
+ private PrivateKey signerKey;
+
+ // Fields used for the operational portions of the server
+ private boolean logEnabled = false;
+ private ExecutorService threadPool;
+ private volatile boolean started = false;
+ private volatile boolean receivedShutdown = false;
+ private long delayMsec = 0;
+
+ // Fields used in the generation of responses
+ private long nextUpdateInterval = -1;
+ private Date nextUpdate = null;
+ private ResponderId respId;
+ private AlgorithmId sigAlgId;
+ private Map statusDb =
+ Collections.synchronizedMap(new HashMap<>());
+
+ /**
+ * Construct a SimpleOCSPServer using keystore, password, and alias
+ * parameters.
+ *
+ * @param ks the keystore to be used
+ * @param password the password to access key material in the keystore
+ * @param issuerAlias the alias of the issuer certificate
+ * @param signerAlias the alias of the signer certificate and key. A
+ * value of {@code null} means that the {@code issuerAlias} will be used
+ * to look up the signer key.
+ *
+ * @throws GeneralSecurityException if there are problems accessing the
+ * keystore or finding objects within the keystore.
+ * @throws IOException if a {@code ResponderId} cannot be generated from
+ * the signer certificate.
+ */
+ public SimpleOCSPServer(KeyStore ks, String password, String issuerAlias,
+ String signerAlias) throws GeneralSecurityException, IOException {
+ this(null, 0, ks, password, issuerAlias, signerAlias);
+ }
+
+ /**
+ * Construct a SimpleOCSPServer using specific network parameters,
+ * keystore, password, and alias.
+ *
+ * @param addr the address to bind the server to. A value of {@code null}
+ * means the server will bind to all interfaces.
+ * @param port the port to listen on. A value of {@code 0} will mean that
+ * the server will randomly pick an open ephemeral port to bind to.
+ * @param ks the keystore to be used
+ * @param password the password to access key material in the keystore
+ * @param issuerAlias the alias of the issuer certificate
+ * @param signerAlias the alias of the signer certificate and key. A
+ * value of {@code null} means that the {@code issuerAlias} will be used
+ * to look up the signer key.
+ *
+ * @throws GeneralSecurityException if there are problems accessing the
+ * keystore or finding objects within the keystore.
+ * @throws IOException if a {@code ResponderId} cannot be generated from
+ * the signer certificate.
+ */
+ public SimpleOCSPServer(InetAddress addr, int port, KeyStore ks,
+ String password, String issuerAlias, String signerAlias)
+ throws GeneralSecurityException, IOException {
+ Objects.requireNonNull(ks, "Null keystore provided");
+ Objects.requireNonNull(issuerAlias, "Null issuerName provided");
+
+ utcDateFmt.setTimeZone(TimeZone.getTimeZone("GMT"));
+
+ keystore = ks;
+ issuerCert = (X509Certificate)ks.getCertificate(issuerAlias);
+ if (issuerCert == null) {
+ throw new IllegalArgumentException("Certificate for alias " +
+ issuerAlias + " not found");
+ }
+
+ if (signerAlias != null) {
+ signerCert = (X509Certificate)ks.getCertificate(signerAlias);
+ if (signerCert == null) {
+ throw new IllegalArgumentException("Certificate for alias " +
+ signerAlias + " not found");
+ }
+ signerKey = (PrivateKey)ks.getKey(signerAlias,
+ password.toCharArray());
+ if (signerKey == null) {
+ throw new IllegalArgumentException("PrivateKey for alias " +
+ signerAlias + " not found");
+ }
+ } else {
+ signerCert = issuerCert;
+ signerKey = (PrivateKey)ks.getKey(issuerAlias,
+ password.toCharArray());
+ if (signerKey == null) {
+ throw new IllegalArgumentException("PrivateKey for alias " +
+ issuerAlias + " not found");
+ }
+ }
+
+ sigAlgId = AlgorithmId.get("Sha256withRSA");
+ respId = new ResponderId(signerCert.getSubjectX500Principal());
+ listenAddress = addr;
+ listenPort = port;
+ }
+
+ /**
+ * Start the server. The server will bind to the specified network
+ * address and begin listening for incoming connections.
+ *
+ * @throws IOException if any number of things go wonky.
+ */
+ public synchronized void start() throws IOException {
+ // You cannot start the server twice.
+ if (started) {
+ log("Server has already been started");
+ return;
+ } else {
+ started = true;
+ }
+
+ // Create and start the thread pool
+ threadPool = Executors.newFixedThreadPool(32, new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t = Executors.defaultThreadFactory().newThread(r);
+ t.setDaemon(true);
+ return t;
+ }
+ });
+
+ threadPool.submit(new Runnable() {
+ @Override
+ public void run() {
+ try (ServerSocket sSock = new ServerSocket()) {
+ servSocket = sSock;
+ servSocket.setReuseAddress(true);
+ servSocket.setSoTimeout(500);
+ servSocket.bind(new InetSocketAddress(listenAddress,
+ listenPort), 128);
+ log("Listening on " + servSocket.getLocalSocketAddress());
+
+ // Update the listenPort with the new port number. If
+ // the server is restarted, it will bind to the same
+ // port rather than picking a new one.
+ listenPort = servSocket.getLocalPort();
+
+ // Main dispatch loop
+ while (!receivedShutdown) {
+ try {
+ Socket newConnection = servSocket.accept();
+ threadPool.submit(new OcspHandler(newConnection));
+ } catch (SocketTimeoutException timeout) {
+ // Nothing to do here. If receivedShutdown
+ // has changed to true then the loop will
+ // exit on its own.
+ } catch (IOException ioe) {
+ // Something bad happened, log and force a shutdown
+ log("Unexpected Exception: " + ioe);
+ stop();
+ }
+ }
+
+ log("Shutting down...");
+ threadPool.shutdown();
+ } catch (IOException ioe) {
+ err(ioe);
+ }
+
+ // Reset state variables so the server can be restarted
+ receivedShutdown = false;
+ started = false;
+ }
+ });
+ }
+
+ /**
+ * Stop the OCSP server.
+ */
+ public synchronized void stop() {
+ if (started) {
+ receivedShutdown = true;
+ log("Received shutdown notification");
+ }
+ }
+
+ /**
+ * Print {@code SimpleOCSPServer} operating parameters.
+ *
+ * @return the {@code SimpleOCSPServer} operating parameters in
+ * {@code String} form.
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("OCSP Server:\n");
+ sb.append("----------------------------------------------\n");
+ sb.append("issuer: ").append(issuerCert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("signer: ").append(signerCert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("ResponderId: ").append(respId).append("\n");
+ sb.append("----------------------------------------------");
+
+ return sb.toString();
+ }
+
+ /**
+ * Helpful debug routine to hex dump byte arrays.
+ *
+ * @param data the array of bytes to dump to stdout.
+ *
+ * @return the hexdump of the byte array
+ */
+ private static String dumpHexBytes(byte[] data) {
+ return dumpHexBytes(data, 16, "\n", " ");
+ }
+
+ /**
+ *
+ * @param data the array of bytes to dump to stdout.
+ * @param itemsPerLine the number of bytes to display per line
+ * if the {@code lineDelim} character is blank then all bytes will be
+ * printed on a single line.
+ * @param lineDelim the delimiter between lines
+ * @param itemDelim the delimiter between bytes
+ *
+ * @return The hexdump of the byte array
+ */
+ private static String dumpHexBytes(byte[] data, int itemsPerLine,
+ String lineDelim, String itemDelim) {
+ StringBuilder sb = new StringBuilder();
+ if (data != null) {
+ for (int i = 0; i < data.length; i++) {
+ if (i % itemsPerLine == 0 && i != 0) {
+ sb.append(lineDelim);
+ }
+ sb.append(String.format("%02X", data[i])).append(itemDelim);
+ }
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Enable or disable the logging feature.
+ *
+ * @param enable {@code true} to enable logging, {@code false} to
+ * disable it. The setting must be activated before the server calls
+ * its start method. Any calls after that have no effect.
+ */
+ public void enableLog(boolean enable) {
+ if (!started) {
+ logEnabled = enable;
+ }
+ }
+
+ /**
+ * Sets the nextUpdate interval. Intervals will be calculated relative
+ * to the server startup time. When first set, the nextUpdate date is
+ * calculated based on the current time plus the interval. After that,
+ * calls to getNextUpdate() will return this date if it is still
+ * later than current time. If not, the Date will be updated to the
+ * next interval that is later than current time. This value must be set
+ * before the server has had its start method called. Calls made after
+ * the server has been started have no effect.
+ *
+ * @param interval the recurring time interval in seconds used to
+ * calculate nextUpdate times. A value less than or equal to 0 will
+ * disable the nextUpdate feature.
+ */
+ public synchronized void setNextUpdateInterval(long interval) {
+ if (!started) {
+ if (interval <= 0) {
+ nextUpdateInterval = -1;
+ nextUpdate = null;
+ log("nexUpdate support has been disabled");
+ } else {
+ nextUpdateInterval = interval * 1000;
+ nextUpdate = new Date(System.currentTimeMillis() +
+ nextUpdateInterval);
+ log("nextUpdate set to " + nextUpdate);
+ }
+ }
+ }
+
+ /**
+ * Return the nextUpdate {@code Date} object for this server. If the
+ * nextUpdate date has already passed, set a new nextUpdate based on
+ * the nextUpdate interval and return that date.
+ *
+ * @return a {@code Date} object set to the nextUpdate field for OCSP
+ * responses.
+ */
+ private synchronized Date getNextUpdate() {
+ if (nextUpdate != null && nextUpdate.before(new Date())) {
+ long nuEpochTime = nextUpdate.getTime();
+ long currentTime = System.currentTimeMillis();
+
+ // Keep adding nextUpdate intervals until you reach a date
+ // that is later than current time.
+ while (currentTime >= nuEpochTime) {
+ nuEpochTime += nextUpdateInterval;
+ }
+
+ // Set the nextUpdate for future threads
+ nextUpdate = new Date(nuEpochTime);
+ log("nextUpdate updated to new value: " + nextUpdate);
+ }
+ return nextUpdate;
+ }
+
+ /**
+ * Add entries into the responder's status database.
+ *
+ * @param newEntries a map of {@code CertStatusInfo} objects, keyed on
+ * their serial number (as a {@code BigInteger}). All serial numbers
+ * are assumed to have come from this responder's issuer certificate.
+ *
+ * @throws IOException if a CertId cannot be generated.
+ */
+ public void updateStatusDb(Map newEntries)
+ throws IOException {
+ if (newEntries != null) {
+ for (BigInteger serial : newEntries.keySet()) {
+ CertStatusInfo info = newEntries.get(serial);
+ if (info != null) {
+ CertId cid = new CertId(issuerCert,
+ new SerialNumber(serial));
+ statusDb.put(cid, info);
+ log("Added entry for serial " + serial + "(" +
+ info.getType() + ")");
+ }
+ }
+ }
+ }
+
+ /**
+ * Check the status database for revocation information one one or more
+ * certificates.
+ *
+ * @param reqList the list of {@code LocalSingleRequest} objects taken
+ * from the incoming OCSP request.
+ *
+ * @return a {@code Map} of {@code CertStatusInfo} objects keyed by their
+ * {@code CertId} values, for each single request passed in. Those
+ * CertIds not found in the statusDb will have returned List members with
+ * a status of UNKNOWN.
+ */
+ private Map checkStatusDb(
+ List reqList) {
+ // TODO figure out what, if anything to do with request extensions
+ Map returnMap = new HashMap<>();
+
+ for (LocalOcspRequest.LocalSingleRequest req : reqList) {
+ CertId cid = req.getCertId();
+ CertStatusInfo info = statusDb.get(cid);
+ if (info != null) {
+ log("Status for SN " + cid.getSerialNumber() + ": " +
+ info.getType());
+ returnMap.put(cid, info);
+ } else {
+ log("Status for SN " + cid.getSerialNumber() +
+ " not found, using CERT_STATUS_UNKNOWN");
+ returnMap.put(cid,
+ new CertStatusInfo(CertStatus.CERT_STATUS_UNKNOWN));
+ }
+ }
+
+ return Collections.unmodifiableMap(returnMap);
+ }
+
+ /**
+ * Set the digital signature algorithm used to sign OCSP responses.
+ *
+ * @param algName The algorithm name
+ *
+ * @throws NoSuchAlgorithmException if the algorithm name is invalid.
+ */
+ public void setSignatureAlgorithm(String algName)
+ throws NoSuchAlgorithmException {
+ if (!started) {
+ sigAlgId = AlgorithmId.get(algName);
+ }
+ }
+
+ /**
+ * Get the port the OCSP server is running on.
+ *
+ * @return the port that the OCSP server is running on, or -1 if the
+ * server has not yet been bound to a port.
+ */
+ public int getPort() {
+ if (servSocket != null && started) {
+ InetSocketAddress inetSock =
+ (InetSocketAddress)servSocket.getLocalSocketAddress();
+ return inetSock.getPort();
+ } else {
+ return -1;
+ }
+ }
+
+ /**
+ * Set a delay between the reception of the request and production of
+ * the response.
+ *
+ * @param delayMillis the number of milliseconds to wait before acting
+ * on the incoming request.
+ */
+ public void setDelay(long delayMillis) {
+ if (!started) {
+ delayMsec = delayMillis > 0 ? delayMillis : 0;
+ if (delayMsec > 0) {
+ log("OCSP latency set to " + delayMsec + " milliseconds.");
+ } else {
+ log("OCSP latency disabled");
+ }
+ }
+ }
+
+ /**
+ * Log a message to stdout.
+ *
+ * @param message the message to log
+ */
+ private synchronized void log(String message) {
+ if (logEnabled || debug != null) {
+ System.out.println("[" + Thread.currentThread().getName() + "]: " +
+ message);
+ }
+ }
+
+ /**
+ * Log an error message on the stderr stream.
+ *
+ * @param message the message to log
+ */
+ private static synchronized void err(String message) {
+ System.out.println("[" + Thread.currentThread().getName() + "]: " +
+ message);
+ }
+
+ /**
+ * Log exception information on the stderr stream.
+ *
+ * @param exc the exception to dump information about
+ */
+ private static synchronized void err(Throwable exc) {
+ System.out.print("[" + Thread.currentThread().getName() +
+ "]: Exception: ");
+ exc.printStackTrace(System.out);
+ }
+
+ /**
+ * The {@code CertStatusInfo} class defines an object used to return
+ * information from the internal status database. The data in this
+ * object may be used to construct OCSP responses.
+ */
+ public static class CertStatusInfo {
+ private CertStatus certStatusType;
+ private CRLReason reason;
+ private Date revocationTime;
+
+ /**
+ * Create a Certificate status object by providing the status only.
+ * If the status is {@code REVOKED} then current time is assumed
+ * for the revocation time.
+ *
+ * @param statType the status for this entry.
+ */
+ public CertStatusInfo(CertStatus statType) {
+ this(statType, null, null);
+ }
+
+ /**
+ * Create a CertStatusInfo providing both type and revocation date
+ * (if applicable).
+ *
+ * @param statType the status for this entry.
+ * @param revDate if applicable, the date that revocation took place.
+ * A value of {@code null} indicates that current time should be used.
+ * If the value of {@code statType} is not {@code CERT_STATUS_REVOKED},
+ * then the {@code revDate} parameter is ignored.
+ */
+ public CertStatusInfo(CertStatus statType, Date revDate) {
+ this(statType, revDate, null);
+ }
+
+ /**
+ * Create a CertStatusInfo providing type, revocation date
+ * (if applicable) and revocation reason.
+ *
+ * @param statType the status for this entry.
+ * @param revDate if applicable, the date that revocation took place.
+ * A value of {@code null} indicates that current time should be used.
+ * If the value of {@code statType} is not {@code CERT_STATUS_REVOKED},
+ * then the {@code revDate} parameter is ignored.
+ * @param revReason the reason the certificate was revoked. A value of
+ * {@code null} means that no reason was provided.
+ */
+ public CertStatusInfo(CertStatus statType, Date revDate,
+ CRLReason revReason) {
+ Objects.requireNonNull(statType, "Cert Status must be non-null");
+ certStatusType = statType;
+ switch (statType) {
+ case CERT_STATUS_GOOD:
+ case CERT_STATUS_UNKNOWN:
+ revocationTime = null;
+ break;
+ case CERT_STATUS_REVOKED:
+ revocationTime = revDate != null ? (Date)revDate.clone() :
+ new Date();
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown status type: " +
+ statType);
+ }
+ }
+
+ /**
+ * Get the cert status type
+ *
+ * @return the status applied to this object (e.g.
+ * {@code CERT_STATUS_GOOD}, {@code CERT_STATUS_UNKNOWN}, etc.)
+ */
+ public CertStatus getType() {
+ return certStatusType;
+ }
+
+ /**
+ * Get the revocation time (if applicable).
+ *
+ * @return the revocation time as a {@code Date} object, or
+ * {@code null} if not applicable (i.e. if the certificate hasn't been
+ * revoked).
+ */
+ public Date getRevocationTime() {
+ return (revocationTime != null ? (Date)revocationTime.clone() :
+ null);
+ }
+
+ /**
+ * Get the revocation reason.
+ *
+ * @return the revocation reason, or {@code null} if one was not
+ * provided.
+ */
+ public CRLReason getRevocationReason() {
+ return reason;
+ }
+ }
+
+ /**
+ * Runnable task that handles incoming OCSP Requests and returns
+ * responses.
+ */
+ private class OcspHandler implements Runnable {
+ private final Socket sock;
+ InetSocketAddress peerSockAddr;
+
+ /**
+ * Construct an {@code OcspHandler}.
+ *
+ * @param incomingSocket the socket the server created on accept()
+ */
+ private OcspHandler(Socket incomingSocket) {
+ sock = incomingSocket;
+ }
+
+ /**
+ * Run the OCSP Request parser and construct a response to be sent
+ * back to the client.
+ */
+ @Override
+ public void run() {
+ // If we have implemented a delay to simulate network latency
+ // wait out the delay here before any other processing.
+ try {
+ if (delayMsec > 0) {
+ Thread.sleep(delayMsec);
+ }
+ } catch (InterruptedException ie) {
+ // Just log the interrupted sleep
+ log("Delay of " + delayMsec + " milliseconds was interrupted");
+ }
+
+ try (Socket ocspSocket = sock;
+ InputStream in = ocspSocket.getInputStream();
+ OutputStream out = ocspSocket.getOutputStream()) {
+ peerSockAddr =
+ (InetSocketAddress)ocspSocket.getRemoteSocketAddress();
+ log("Received incoming connection from " + peerSockAddr);
+ String[] headerTokens = readLine(in).split(" ");
+ LocalOcspRequest ocspReq = null;
+ LocalOcspResponse ocspResp = null;
+ ResponseStatus respStat = ResponseStatus.INTERNAL_ERROR;
+ try {
+ if (headerTokens[0] != null) {
+ switch (headerTokens[0]) {
+ case "POST":
+ ocspReq = parseHttpOcspPost(in);
+ break;
+ case "GET":
+ // req = parseHttpOcspGet(in);
+ // TODO implement the GET parsing
+ throw new IOException("GET method unsupported");
+ default:
+ respStat = ResponseStatus.MALFORMED_REQUEST;
+ throw new IOException("Not a GET or POST");
+ }
+ } else {
+ respStat = ResponseStatus.MALFORMED_REQUEST;
+ throw new IOException("Unable to get HTTP method");
+ }
+
+ if (ocspReq != null) {
+ log(ocspReq.toString());
+ // Get responses for all CertIds in the request
+ Map statusMap =
+ checkStatusDb(ocspReq.getRequests());
+ if (statusMap.isEmpty()) {
+ respStat = ResponseStatus.UNAUTHORIZED;
+ } else {
+ ocspResp = new LocalOcspResponse(
+ ResponseStatus.SUCCESSFUL, statusMap,
+ ocspReq.getExtensions());
+ }
+ } else {
+ respStat = ResponseStatus.MALFORMED_REQUEST;
+ throw new IOException("Found null request");
+ }
+ } catch (IOException | RuntimeException exc) {
+ err(exc);
+ }
+ if (ocspResp == null) {
+ ocspResp = new LocalOcspResponse(respStat);
+ }
+ sendResponse(out, ocspResp);
+ } catch (IOException | CertificateException exc) {
+ err(exc);
+ }
+ }
+
+ /**
+ * Send an OCSP response on an {@code OutputStream}.
+ *
+ * @param out the {@code OutputStream} on which to send the response.
+ * @param resp the OCSP response to send.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void sendResponse(OutputStream out, LocalOcspResponse resp)
+ throws IOException {
+ StringBuilder sb = new StringBuilder();
+
+ byte[] respBytes;
+ try {
+ respBytes = resp.getBytes();
+ } catch (RuntimeException re) {
+ err(re);
+ return;
+ }
+
+ sb.append("HTTP/1.0 200 OK\r\n");
+ sb.append("Content-Type: application/ocsp-response\r\n");
+ sb.append("Content-Length: ").append(respBytes.length);
+ sb.append("\r\n\r\n");
+
+ out.write(sb.toString().getBytes("UTF-8"));
+ out.write(respBytes);
+ log(resp.toString());
+ }
+
+ /**
+ * Parse the incoming HTTP POST of an OCSP Request.
+ *
+ * @param inStream the input stream from the socket bound to this
+ * {@code OcspHandler}.
+ *
+ * @return the OCSP Request as a {@code LocalOcspRequest}
+ *
+ * @throws IOException if there are network related issues or problems
+ * occur during parsing of the OCSP request.
+ * @throws CertificateException if one or more of the certificates in
+ * the OCSP request cannot be read/parsed.
+ */
+ private LocalOcspRequest parseHttpOcspPost(InputStream inStream)
+ throws IOException, CertificateException {
+ boolean endOfHeader = false;
+ boolean properContentType = false;
+ int length = -1;
+
+ while (!endOfHeader) {
+ String[] lineTokens = readLine(inStream).split(" ");
+ if (lineTokens[0].isEmpty()) {
+ endOfHeader = true;
+ } else if (lineTokens[0].equalsIgnoreCase("Content-Type:")) {
+ if (lineTokens[1] == null ||
+ !lineTokens[1].equals(
+ "application/ocsp-request")) {
+ log("Unknown Content-Type: " +
+ (lineTokens[1] != null ?
+ lineTokens[1] : ""));
+ return null;
+ } else {
+ properContentType = true;
+ log("Content-Type = " + lineTokens[1]);
+ }
+ } else if (lineTokens[0].equalsIgnoreCase("Content-Length:")) {
+ if (lineTokens[1] != null) {
+ length = Integer.parseInt(lineTokens[1]);
+ log("Content-Length = " + length);
+ }
+ }
+ }
+
+ // Okay, make sure we got what we needed from the header, then
+ // read the remaining OCSP Request bytes
+ if (properContentType && length >= 0) {
+ byte[] ocspBytes = new byte[length];
+ inStream.read(ocspBytes);
+ return new LocalOcspRequest(ocspBytes);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Read a line of text that is CRLF-delimited.
+ *
+ * @param is the {@code InputStream} tied to the socket
+ * for this {@code OcspHandler}
+ *
+ * @return a {@code String} consisting of the line of text
+ * read from the stream with the CRLF stripped.
+ *
+ * @throws IOException if any I/O error occurs.
+ */
+ private String readLine(InputStream is) throws IOException {
+ PushbackInputStream pbis = new PushbackInputStream(is);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ boolean done = false;
+ while (!done) {
+ byte b = (byte)pbis.read();
+ if (b == '\r') {
+ byte bNext = (byte)pbis.read();
+ if (bNext == '\n' || bNext == -1) {
+ done = true;
+ } else {
+ pbis.unread(bNext);
+ bos.write(b);
+ }
+ } else if (b == -1) {
+ done = true;
+ } else {
+ bos.write(b);
+ }
+ }
+
+ return new String(bos.toByteArray(), "UTF-8");
+ }
+ }
+
+
+ /**
+ * Simple nested class to handle OCSP requests without making
+ * changes to sun.security.provider.certpath.OCSPRequest
+ */
+ public class LocalOcspRequest {
+
+ private byte[] nonce;
+ private byte[] signature = null;
+ private AlgorithmId algId = null;
+ private int version = 0;
+ private GeneralName requestorName = null;
+ private Map extensions = Collections.emptyMap();
+ private final List requestList = new ArrayList<>();
+ private final List certificates = new ArrayList<>();
+
+ /**
+ * Construct a {@code LocalOcspRequest} from its DER encoding.
+ *
+ * @param requestBytes the DER-encoded bytes
+ *
+ * @throws IOException if decoding errors occur
+ * @throws CertificateException if certificates are found in the
+ * OCSP request and they do not parse correctly.
+ */
+ private LocalOcspRequest(byte[] requestBytes) throws IOException,
+ CertificateException {
+ Objects.requireNonNull(requestBytes, "Received null input");
+
+ DerInputStream dis = new DerInputStream(requestBytes);
+
+ // Parse the top-level structure, it should have no more than
+ // two elements.
+ DerValue[] topStructs = dis.getSequence(2);
+ for (DerValue dv : topStructs) {
+ if (dv.tag == DerValue.tag_Sequence) {
+ parseTbsRequest(dv);
+ } else if (dv.isContextSpecific((byte)0)) {
+ parseSignature(dv);
+ } else {
+ throw new IOException("Unknown tag at top level: " +
+ dv.tag);
+ }
+ }
+ }
+
+ /**
+ * Parse the signature block from an OCSP request
+ *
+ * @param sigSequence a {@code DerValue} containing the signature
+ * block at the outer sequence datum.
+ *
+ * @throws IOException if any non-certificate-based parsing errors occur
+ * @throws CertificateException if certificates are found in the
+ * OCSP request and they do not parse correctly.
+ */
+ private void parseSignature(DerValue sigSequence)
+ throws IOException, CertificateException {
+ DerValue[] sigItems = sigSequence.data.getSequence(3);
+ if (sigItems.length != 3) {
+ throw new IOException("Invalid number of signature items: " +
+ "expected 3, got " + sigItems.length);
+ }
+
+ algId = AlgorithmId.parse(sigItems[0]);
+ signature = sigItems[1].getBitString();
+
+ if (sigItems[2].isContextSpecific((byte)0)) {
+ DerValue[] certDerItems = sigItems[2].data.getSequence(4);
+ int i = 0;
+ for (DerValue dv : certDerItems) {
+ X509Certificate xc = new X509CertImpl(dv);
+ certificates.add(xc);
+ }
+ } else {
+ throw new IOException("Invalid tag in signature block: " +
+ sigItems[2].tag);
+ }
+ }
+
+ /**
+ * Parse the to-be-signed request data
+ *
+ * @param tbsReqSeq a {@code DerValue} object containing the to-be-
+ * signed OCSP request at the outermost SEQUENCE tag.
+ * @throws IOException if any parsing errors occur
+ */
+ private void parseTbsRequest(DerValue tbsReqSeq) throws IOException {
+ while (tbsReqSeq.data.available() > 0) {
+ DerValue dv = tbsReqSeq.data.getDerValue();
+ if (dv.isContextSpecific((byte)0)) {
+ // The version was explicitly called out
+ version = dv.data.getInteger();
+ } else if (dv.isContextSpecific((byte)1)) {
+ // A GeneralName was provided
+ requestorName = new GeneralName(dv.data.getDerValue());
+ } else if (dv.isContextSpecific((byte)2)) {
+ // Parse the extensions
+ DerValue[] extItems = dv.data.getSequence(2);
+ extensions = parseExtensions(extItems);
+ } else if (dv.tag == DerValue.tag_Sequence) {
+ while (dv.data.available() > 0) {
+ requestList.add(new LocalSingleRequest(dv.data));
+ }
+ }
+ }
+ }
+
+ /**
+ * Parse a SEQUENCE of extensions. This routine is used both
+ * at the overall request level and down at the singleRequest layer.
+ *
+ * @param extDerItems an array of {@code DerValue} items, each one
+ * consisting of a DER-encoded extension.
+ *
+ * @return a {@code Map} of zero or more extensions,
+ * keyed by its object identifier in {@code String} form.
+ *
+ * @throws IOException if any parsing errors occur.
+ */
+ private Map parseExtensions(DerValue[] extDerItems)
+ throws IOException {
+ Map extMap = new HashMap<>();
+
+ if (extDerItems != null && extDerItems.length != 0) {
+ for (DerValue extDerVal : extDerItems) {
+ sun.security.x509.Extension ext =
+ new sun.security.x509.Extension(extDerVal);
+ extMap.put(ext.getId(), ext);
+ }
+ }
+
+ return extMap;
+ }
+
+ /**
+ * Return the list of single request objects in this OCSP request.
+ *
+ * @return an unmodifiable {@code List} of zero or more requests.
+ */
+ private List getRequests() {
+ return Collections.unmodifiableList(requestList);
+ }
+
+ /**
+ * Return the list of X.509 Certificates in this OCSP request.
+ *
+ * @return an unmodifiable {@code List} of zero or more
+ * {@cpde X509Certificate} objects.
+ */
+ private List getCertificates() {
+ return Collections.unmodifiableList(certificates);
+ }
+
+ /**
+ * Return the map of OCSP request extensions.
+ *
+ * @return an unmodifiable {@code Map} of zero or more
+ * {@code Extension} objects, keyed by their object identifiers
+ * in {@code String} form.
+ */
+ private Map getExtensions() {
+ return Collections.unmodifiableMap(extensions);
+ }
+
+ /**
+ * Display the {@code LocalOcspRequest} in human readable form.
+ *
+ * @return a {@code String} representation of the
+ * {@code LocalOcspRequest}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append(String.format("OCSP Request: Version %d (0x%X)",
+ version + 1, version)).append("\n");
+ if (requestorName != null) {
+ sb.append("Requestor Name: ").append(requestorName).
+ append("\n");
+ }
+
+ int requestCtr = 0;
+ for (LocalSingleRequest lsr : requestList) {
+ sb.append("Request [").append(requestCtr++).append("]\n");
+ sb.append(lsr).append("\n");
+ }
+ if (!extensions.isEmpty()) {
+ sb.append("Extensions (").append(extensions.size()).
+ append(")\n");
+ for (Extension ext : extensions.values()) {
+ sb.append("\t").append(ext).append("\n");
+ }
+ }
+ if (signature != null) {
+ sb.append("Signature: ").append(algId).append("\n");
+ sb.append(dumpHexBytes(signature)).append("\n");
+ int certCtr = 0;
+ for (X509Certificate cert : certificates) {
+ sb.append("Certificate [").append(certCtr++).append("]").
+ append("\n");
+ sb.append("\tSubject: ");
+ sb.append(cert.getSubjectX500Principal()).append("\n");
+ sb.append("\tIssuer: ");
+ sb.append(cert.getIssuerX500Principal()).append("\n");
+ sb.append("\tSerial: ").append(cert.getSerialNumber());
+ }
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Inner class designed to handle the decoding/representation of
+ * single requests within a {@code LocalOcspRequest} object.
+ */
+ public class LocalSingleRequest {
+ private final CertId cid;
+ private Map extensions = Collections.emptyMap();
+
+ private LocalSingleRequest(DerInputStream dis)
+ throws IOException {
+ DerValue[] srItems = dis.getSequence(2);
+
+ // There should be 1, possibly 2 DerValue items
+ if (srItems.length == 1 || srItems.length == 2) {
+ // The first parsable item should be the mandatory CertId
+ cid = new CertId(srItems[0].data);
+ if (srItems.length == 2) {
+ if (srItems[1].isContextSpecific((byte)0)) {
+ DerValue[] extDerItems = srItems[1].data.getSequence(2);
+ extensions = parseExtensions(extDerItems);
+ } else {
+ throw new IOException("Illegal tag in Request " +
+ "extensions: " + srItems[1].tag);
+ }
+ }
+ } else {
+ throw new IOException("Invalid number of items in " +
+ "Request (" + srItems.length + ")");
+ }
+ }
+
+ /**
+ * Get the {@code CertId} for this single request.
+ *
+ * @return the {@code CertId} for this single request.
+ */
+ private CertId getCertId() {
+ return cid;
+ }
+
+ /**
+ * Return the map of single request extensions.
+ *
+ * @return an unmodifiable {@code Map} of zero or more
+ * {@code Extension} objects, keyed by their object identifiers
+ * in {@code String} form.
+ */
+ private Map getExtensions() {
+ return Collections.unmodifiableMap(extensions);
+ }
+
+ /**
+ * Display the {@code LocalSingleRequest} in human readable form.
+ *
+ * @return a {@code String} representation of the
+ * {@code LocalSingleRequest}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("CertId, Algorithm = ");
+ sb.append(cid.getHashAlgorithm()).append("\n");
+ sb.append("\tIssuer Name Hash: ");
+ sb.append(dumpHexBytes(cid.getIssuerNameHash(), 256, "", ""));
+ sb.append("\n");
+ sb.append("\tIssuer Key Hash: ");
+ sb.append(dumpHexBytes(cid.getIssuerKeyHash(), 256, "", ""));
+ sb.append("\n");
+ sb.append("\tSerial Number: ").append(cid.getSerialNumber());
+ if (!extensions.isEmpty()) {
+ sb.append("Extensions (").append(extensions.size()).
+ append(")\n");
+ for (Extension ext : extensions.values()) {
+ sb.append("\t").append(ext).append("\n");
+ }
+ }
+
+ return sb.toString();
+ }
+ }
+ }
+
+ /**
+ * Simple nested class to handle OCSP requests without making
+ * changes to sun.security.provider.certpath.OCSPResponse
+ */
+ public class LocalOcspResponse {
+ private final int version = 0;
+ private final OCSPResponse.ResponseStatus responseStatus;
+ private final Map respItemMap;
+ private final Date producedAtDate;
+ private final List singleResponseList =
+ new ArrayList<>();
+ private final Map responseExtensions;
+ private byte[] signature;
+ private final List certificates;
+ private final byte[] encodedResponse;
+
+ /**
+ * Constructor for the generation of non-successful responses
+ *
+ * @param respStat the OCSP response status.
+ *
+ * @throws IOException if an error happens during encoding
+ * @throws NullPointerException if {@code respStat} is {@code null}
+ * or {@code respStat} is successful.
+ */
+ public LocalOcspResponse(OCSPResponse.ResponseStatus respStat)
+ throws IOException {
+ this(respStat, null, null);
+ }
+
+ /**
+ * Construct a response from a list of certificate
+ * status objects and extensions.
+ *
+ * @param respStat the status of the entire response
+ * @param itemMap a {@code Map} of {@code CertId} objects and their
+ * respective revocation statuses from the server's response DB.
+ * @param reqExtensions a {@code Map} of request extensions
+ *
+ * @throws IOException if an error happens during encoding
+ * @throws NullPointerException if {@code respStat} is {@code null}
+ * or {@code respStat} is successful, and a {@code null} {@code itemMap}
+ * has been provided.
+ */
+ public LocalOcspResponse(OCSPResponse.ResponseStatus respStat,
+ Map itemMap,
+ Map reqExtensions) throws IOException {
+ responseStatus = Objects.requireNonNull(respStat,
+ "Illegal null response status");
+ if (responseStatus == ResponseStatus.SUCCESSFUL) {
+ respItemMap = Objects.requireNonNull(itemMap,
+ "SUCCESSFUL responses must have a response map");
+ producedAtDate = new Date();
+
+ // Turn the answerd from the response DB query into a list
+ // of single responses.
+ for (CertId id : itemMap.keySet()) {
+ singleResponseList.add(
+ new LocalSingleResponse(id, itemMap.get(id)));
+ }
+
+ responseExtensions = setResponseExtensions(reqExtensions);
+ certificates = new ArrayList<>();
+ if (signerCert != issuerCert) {
+ certificates.add(signerCert);
+ }
+ certificates.add(issuerCert);
+ } else {
+ respItemMap = null;
+ producedAtDate = null;
+ responseExtensions = null;
+ certificates = null;
+ }
+ encodedResponse = this.getBytes();
+ }
+
+ /**
+ * Set the response extensions based on the request extensions
+ * that were received. Right now, this is limited to the
+ * OCSP nonce extension.
+ *
+ * @param reqExts a {@code Map} of zero or more request extensions
+ *
+ * @return a {@code Map} of zero or more response extensions, keyed
+ * by the extension object identifier in {@code String} form.
+ */
+ private Map setResponseExtensions(
+ Map reqExts) {
+ Map respExts = new HashMap<>();
+ String ocspNonceStr = PKIXExtensions.OCSPNonce_Id.toString();
+
+ if (reqExts != null) {
+ for (String id : reqExts.keySet()) {
+ if (id.equals(ocspNonceStr)) {
+ // We found a nonce, add it into the response extensions
+ Extension ext = reqExts.get(id);
+ if (ext != null) {
+ respExts.put(id, ext);
+ log("Added OCSP Nonce to response");
+ } else {
+ log("Error: Found nonce entry, but found null " +
+ "value. Skipping");
+ }
+ }
+ }
+ }
+
+ return respExts;
+ }
+
+ /**
+ * Get the DER-encoded response bytes for this response
+ *
+ * @return a byte array containing the DER-encoded bytes for
+ * the response
+ *
+ * @throws IOException if any encoding errors occur
+ */
+ private byte[] getBytes() throws IOException {
+ DerOutputStream outerSeq = new DerOutputStream();
+ DerOutputStream responseStream = new DerOutputStream();
+ responseStream.putEnumerated(responseStatus.ordinal());
+ if (responseStatus == ResponseStatus.SUCCESSFUL &&
+ respItemMap != null) {
+ encodeResponseBytes(responseStream);
+ }
+
+ // Commit the outermost sequence bytes
+ outerSeq.write(DerValue.tag_Sequence, responseStream);
+ return outerSeq.toByteArray();
+ }
+
+ private void encodeResponseBytes(DerOutputStream responseStream)
+ throws IOException {
+ DerOutputStream explicitZero = new DerOutputStream();
+ DerOutputStream respItemStream = new DerOutputStream();
+
+ respItemStream.putOID(OCSP_BASIC_RESPONSE_OID);
+
+ byte[] basicOcspBytes = encodeBasicOcspResponse();
+ respItemStream.putOctetString(basicOcspBytes);
+ explicitZero.write(DerValue.tag_Sequence, respItemStream);
+ responseStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
+ true, (byte)0), explicitZero);
+ }
+
+ private byte[] encodeBasicOcspResponse() throws IOException {
+ DerOutputStream outerSeq = new DerOutputStream();
+ DerOutputStream basicORItemStream = new DerOutputStream();
+
+ // Encode the tbsResponse
+ byte[] tbsResponseBytes = encodeTbsResponse();
+ basicORItemStream.write(tbsResponseBytes);
+
+ try {
+ sigAlgId.derEncode(basicORItemStream);
+
+ // Create the signature
+ Signature sig = Signature.getInstance(sigAlgId.getName());
+ sig.initSign(signerKey);
+ sig.update(tbsResponseBytes);
+ signature = sig.sign();
+ basicORItemStream.putBitString(signature);
+ } catch (GeneralSecurityException exc) {
+ err(exc);
+ throw new IOException(exc);
+ }
+
+ // Add certificates
+ try {
+ DerOutputStream certStream = new DerOutputStream();
+ ArrayList certList = new ArrayList<>();
+ if (signerCert != issuerCert) {
+ certList.add(new DerValue(signerCert.getEncoded()));
+ }
+ certList.add(new DerValue(issuerCert.getEncoded()));
+ DerValue[] dvals = new DerValue[certList.size()];
+ certStream.putSequence(certList.toArray(dvals));
+ basicORItemStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
+ true, (byte)0), certStream);
+ } catch (CertificateEncodingException cex) {
+ err(cex);
+ throw new IOException(cex);
+ }
+
+ // Commit the outermost sequence bytes
+ outerSeq.write(DerValue.tag_Sequence, basicORItemStream);
+ return outerSeq.toByteArray();
+ }
+
+ private byte[] encodeTbsResponse() throws IOException {
+ DerOutputStream outerSeq = new DerOutputStream();
+ DerOutputStream tbsStream = new DerOutputStream();
+
+ // Note: We're not going explicitly assert the version
+ tbsStream.write(respId.getEncoded());
+ tbsStream.putGeneralizedTime(producedAtDate);
+
+ // Sequence of responses
+ encodeSingleResponses(tbsStream);
+
+ // TODO: add response extension support
+ encodeExtensions(tbsStream);
+
+ outerSeq.write(DerValue.tag_Sequence, tbsStream);
+ return outerSeq.toByteArray();
+ }
+
+ private void encodeSingleResponses(DerOutputStream tbsStream)
+ throws IOException {
+ DerValue[] srDerVals = new DerValue[singleResponseList.size()];
+ int srDvCtr = 0;
+
+ for (LocalSingleResponse lsr : singleResponseList) {
+ srDerVals[srDvCtr++] = new DerValue(lsr.getBytes());
+ }
+
+ tbsStream.putSequence(srDerVals);
+ }
+
+ private void encodeExtensions(DerOutputStream tbsStream)
+ throws IOException {
+ DerOutputStream extSequence = new DerOutputStream();
+ DerOutputStream extItems = new DerOutputStream();
+
+ for (Extension ext : responseExtensions.values()) {
+ ext.encode(extItems);
+ }
+ extSequence.write(DerValue.tag_Sequence, extItems);
+ tbsStream.write(DerValue.createTag(DerValue.TAG_CONTEXT, true,
+ (byte)1), extSequence);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append("OCSP Response: ").append(responseStatus).append("\n");
+ if (responseStatus == ResponseStatus.SUCCESSFUL) {
+ sb.append("Response Type: ").
+ append(OCSP_BASIC_RESPONSE_OID.toString()).append("\n");
+ sb.append(String.format("Version: %d (0x%X)", version + 1,
+ version)).append("\n");
+ sb.append("Responder Id: ").append(respId.toString()).
+ append("\n");
+ sb.append("Produced At: ").
+ append(utcDateFmt.format(producedAtDate)).append("\n");
+
+ int srCtr = 0;
+ for (LocalSingleResponse lsr : singleResponseList) {
+ sb.append("SingleResponse [").append(srCtr++).append("]\n");
+ sb.append(lsr);
+ }
+
+ if (!responseExtensions.isEmpty()) {
+ sb.append("Extensions (").append(responseExtensions.size()).
+ append(")\n");
+ for (Extension ext : responseExtensions.values()) {
+ sb.append("\t").append(ext).append("\n");
+ }
+ } else {
+ sb.append("\n");
+ }
+
+ if (signature != null) {
+ sb.append("Signature: ").append(sigAlgId).append("\n");
+ sb.append(dumpHexBytes(signature)).append("\n");
+ int certCtr = 0;
+ for (X509Certificate cert : certificates) {
+ sb.append("Certificate [").append(certCtr++).append("]").
+ append("\n");
+ sb.append("\tSubject: ");
+ sb.append(cert.getSubjectX500Principal()).append("\n");
+ sb.append("\tIssuer: ");
+ sb.append(cert.getIssuerX500Principal()).append("\n");
+ sb.append("\tSerial: ").append(cert.getSerialNumber());
+ sb.append("\n");
+ }
+ }
+ }
+
+ return sb.toString();
+ }
+
+ private class LocalSingleResponse {
+ private final CertId certId;
+ private final CertStatusInfo csInfo;
+ private final Date thisUpdate;
+ private final Date lsrNextUpdate;
+ private final Map singleExtensions;
+
+ public LocalSingleResponse(CertId cid, CertStatusInfo info) {
+ certId = Objects.requireNonNull(cid, "CertId must be non-null");
+ csInfo = Objects.requireNonNull(info,
+ "CertStatusInfo must be non-null");
+
+ // For now, we'll keep things simple and make the thisUpdate
+ // field the same as the producedAt date.
+ thisUpdate = producedAtDate;
+ lsrNextUpdate = getNextUpdate();
+
+ // TODO Add extensions support
+ singleExtensions = Collections.emptyMap();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Certificate Status: ").append(csInfo.getType());
+ sb.append("\n");
+ if (csInfo.getType() == CertStatus.CERT_STATUS_REVOKED) {
+ sb.append("Revocation Time: ");
+ sb.append(utcDateFmt.format(csInfo.getRevocationTime()));
+ sb.append("\n");
+ if (csInfo.getRevocationReason() != null) {
+ sb.append("Revocation Reason: ");
+ sb.append(csInfo.getRevocationReason()).append("\n");
+ }
+ }
+
+ sb.append("CertId, Algorithm = ");
+ sb.append(certId.getHashAlgorithm()).append("\n");
+ sb.append("\tIssuer Name Hash: ");
+ sb.append(dumpHexBytes(certId.getIssuerNameHash(), 256, "", ""));
+ sb.append("\n");
+ sb.append("\tIssuer Key Hash: ");
+ sb.append(dumpHexBytes(certId.getIssuerKeyHash(), 256, "", ""));
+ sb.append("\n");
+ sb.append("\tSerial Number: ").append(certId.getSerialNumber());
+ sb.append("\n");
+ sb.append("This Update: ");
+ sb.append(utcDateFmt.format(thisUpdate)).append("\n");
+ if (lsrNextUpdate != null) {
+ sb.append("Next Update: ");
+ sb.append(utcDateFmt.format(lsrNextUpdate)).append("\n");
+ }
+
+ if (!singleExtensions.isEmpty()) {
+ sb.append("Extensions (").append(singleExtensions.size()).
+ append(")\n");
+ for (Extension ext : singleExtensions.values()) {
+ sb.append("\t").append(ext).append("\n");
+ }
+ }
+
+ return sb.toString();
+ }
+
+ public byte[] getBytes() throws IOException {
+ byte[] nullData = { };
+ DerOutputStream responseSeq = new DerOutputStream();
+ DerOutputStream srStream = new DerOutputStream();
+
+ // Encode the CertId
+ certId.encode(srStream);
+
+ // Next, encode the CertStatus field
+ CertStatus csiType = csInfo.getType();
+ switch (csiType) {
+ case CERT_STATUS_GOOD:
+ srStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
+ false, (byte)0), nullData);
+ break;
+ case CERT_STATUS_REVOKED:
+ DerOutputStream revInfo = new DerOutputStream();
+ revInfo.putGeneralizedTime(csInfo.getRevocationTime());
+ CRLReason revReason = csInfo.getRevocationReason();
+ if (revReason != null) {
+ byte[] revDer = new byte[3];
+ revDer[0] = DerValue.tag_Enumerated;
+ revDer[1] = 1;
+ revDer[2] = (byte)revReason.ordinal();
+ revInfo.write(DerValue.createTag(
+ DerValue.TAG_CONTEXT, true, (byte)0),
+ revDer);
+ }
+ srStream.write(DerValue.createTag(
+ DerValue.TAG_CONTEXT, true, (byte)1),
+ revInfo);
+ break;
+ case CERT_STATUS_UNKNOWN:
+ srStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
+ false, (byte)2), nullData);
+ break;
+ default:
+ throw new IOException("Unknown CertStatus: " + csiType);
+ }
+
+ // Add the necessary dates
+ srStream.putGeneralizedTime(thisUpdate);
+ if (lsrNextUpdate != null) {
+ DerOutputStream nuStream = new DerOutputStream();
+ nuStream.putGeneralizedTime(lsrNextUpdate);
+ srStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
+ true, (byte)0), nuStream);
+ }
+
+ // TODO add singleResponse Extension support
+
+ // Add the single response to the response output stream
+ responseSeq.write(DerValue.tag_Sequence, srStream);
+ return responseSeq.toByteArray();
+ }
+ }
+ }
+}
diff --git a/jdk/test/java/text/Format/NumberFormat/Bug8132125.java b/jdk/test/java/text/Format/NumberFormat/Bug8132125.java
new file mode 100644
index 00000000000..e19b2cd17eb
--- /dev/null
+++ b/jdk/test/java/text/Format/NumberFormat/Bug8132125.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, 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 8132125
+ * @summary Checks Swiss' number elements
+ */
+
+import java.text.*;
+import java.util.*;
+
+public class Bug8132125 {
+ public static void main(String[] args) {
+ Locale deCH = new Locale("de", "CH");
+ NumberFormat nf = NumberFormat.getInstance(deCH);
+
+ String expected = "54'839'483.142"; // i.e. "." as decimal separator, "'" as grouping separator
+ String actual = nf.format(54839483.1415);
+ if (!actual.equals(expected)) {
+ throw new RuntimeException("correct for de_CH: " + expected + " vs. actual " + actual);
+ }
+ }
+}
diff --git a/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java b/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java
index 09bafea5835..94bf083abcb 100644
--- a/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java
+++ b/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java
@@ -146,7 +146,7 @@ public class TestZoneTextPrinterParser extends AbstractTestPrinterParser {
{"Asia/Macau", "China Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
{"Asia/Taipei", "Taipei Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
{"America/Chicago", "CST", none, Locale.ENGLISH, TextStyle.SHORT},
- {"Asia/Taipei", "TST", preferred, Locale.ENGLISH, TextStyle.SHORT},
+ {"Asia/Taipei", "CST", preferred, Locale.ENGLISH, TextStyle.SHORT},
{"Australia/South", "ACST", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
{"America/Chicago", "CDT", none, Locale.ENGLISH, TextStyle.SHORT},
{"Asia/Shanghai", "CDT", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
diff --git a/jdk/test/java/util/Scanner/ScanTest.java b/jdk/test/java/util/Scanner/ScanTest.java
index 7c8fba4de25..388bac0103b 100644
--- a/jdk/test/java/util/Scanner/ScanTest.java
+++ b/jdk/test/java/util/Scanner/ScanTest.java
@@ -26,6 +26,7 @@
* @bug 4313885 4926319 4927634 5032610 5032622 5049968 5059533 6223711 6277261 6269946 6288823
* @summary Basic tests of java.util.Scanner methods
* @key randomness
+ * @run main/othervm ScanTest
*/
import java.util.*;
diff --git a/jdk/test/java/util/TimeZone/CLDRDisplayNamesTest.java b/jdk/test/java/util/TimeZone/CLDRDisplayNamesTest.java
index dac2ceab150..aae1c639d73 100644
--- a/jdk/test/java/util/TimeZone/CLDRDisplayNamesTest.java
+++ b/jdk/test/java/util/TimeZone/CLDRDisplayNamesTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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,12 +23,13 @@
/*
* @test
- * @bug 8005471 8008577
+ * @bug 8005471 8008577 8129881 8130845
* @run main/othervm -Djava.locale.providers=CLDR CLDRDisplayNamesTest
* @summary Make sure that localized time zone names of CLDR are used
* if specified.
*/
+import java.text.*;
import java.util.*;
import static java.util.TimeZone.*;
@@ -72,6 +73,8 @@ public class CLDRDisplayNamesTest {
};
public static void main(String[] args) {
+ // Make sure that localized time zone names of CLDR are used
+ // if specified.
TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
int errors = 0;
for (String[] data : CLDR_DATA) {
@@ -87,6 +90,35 @@ public class CLDRDisplayNamesTest {
}
}
}
+
+ // for 8129881
+ tz = TimeZone.getTimeZone("Europe/Vienna");
+ String name = tz.getDisplayName(false, SHORT);
+ if (!"CET".equals(name)) {
+ System.err.printf("error: got '%s' expected 'CET' %n", name);
+ errors++;
+ }
+
+ // for 8130845
+ SimpleDateFormat fmtROOT = new SimpleDateFormat("EEE MMM d hh:mm:ss z yyyy", Locale.ROOT);
+ SimpleDateFormat fmtUS = new SimpleDateFormat("EEE MMM d hh:mm:ss z yyyy", Locale.US);
+ SimpleDateFormat fmtUK = new SimpleDateFormat("EEE MMM d hh:mm:ss z yyyy", Locale.UK);
+ Locale originalLocale = Locale.getDefault();
+ try {
+ Locale.setDefault(Locale.ROOT);
+ fmtROOT.parse("Thu Nov 13 04:35:51 AKST 2008");
+ fmtUS.parse("Thu Nov 13 04:35:51 AKST 2008");
+ fmtUK.parse("Thu Nov 13 04:35:51 GMT-09:00 2008");
+ String dateString = new Date().toString();
+ System.out.println("Date: "+dateString);
+ System.out.println("Parsed Date: "+new Date(Date.parse(dateString)).toString());
+ } catch (ParseException pe) {
+ System.err.println(pe);
+ errors++;
+ } finally {
+ Locale.setDefault(originalLocale);
+ }
+
if (errors > 0) {
throw new RuntimeException("test failed");
}
diff --git a/jdk/test/java/util/logging/LoggingDeadlock2.java b/jdk/test/java/util/logging/LoggingDeadlock2.java
index bada1395985..ca4f3302438 100644
--- a/jdk/test/java/util/logging/LoggingDeadlock2.java
+++ b/jdk/test/java/util/logging/LoggingDeadlock2.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6467152 6716076 6829503
+ * @bug 6467152 6716076 6829503 8132550
* @summary deadlock occurs in LogManager initialization and JVM termination
* @author Serguei Spitsyn / Hitachi / Martin Buchholz
*
diff --git a/jdk/test/javax/management/monitor/ReflectionExceptionTest.java b/jdk/test/javax/management/monitor/ReflectionExceptionTest.java
index c3b0b02dc14..a196c0d5a53 100644
--- a/jdk/test/javax/management/monitor/ReflectionExceptionTest.java
+++ b/jdk/test/javax/management/monitor/ReflectionExceptionTest.java
@@ -27,6 +27,7 @@
* @summary Test that the jmx.monitor.error.runtime monitor notification
* is emitted when getAttribute throws ReflectionException.
* @author Luis-Miguel Alventosa
+ * @key intermittent
* @modules java.management
* @run clean ReflectionExceptionTest MBeanServerBuilderImpl
* MBeanServerForwarderInvocationHandler
diff --git a/jdk/test/javax/management/monitor/StringMonitorDeadlockTest.java b/jdk/test/javax/management/monitor/StringMonitorDeadlockTest.java
index 7f016bb673b..1359ad4aa65 100644
--- a/jdk/test/javax/management/monitor/StringMonitorDeadlockTest.java
+++ b/jdk/test/javax/management/monitor/StringMonitorDeadlockTest.java
@@ -27,6 +27,7 @@
* @summary Test that no locks are held when a monitor attribute is sampled
* or notif delivered.
* @author Eamonn McManus
+ * @key intermittent
* @modules java.management
* @run clean StringMonitorDeadlockTest
* @run build StringMonitorDeadlockTest
diff --git a/jdk/test/javax/management/mxbean/GenericArrayTypeTest.java b/jdk/test/javax/management/mxbean/GenericArrayTypeTest.java
index 6fa7e56c334..d22a4a1587c 100644
--- a/jdk/test/javax/management/mxbean/GenericArrayTypeTest.java
+++ b/jdk/test/javax/management/mxbean/GenericArrayTypeTest.java
@@ -26,6 +26,7 @@
* @bug 6292705
* @summary Test support for arrays in parameterized types.
* @author Luis-Miguel Alventosa
+ * @key intermittent
* @modules java.management
* @run clean GenericArrayTypeTest
* @run build GenericArrayTypeTest
diff --git a/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java b/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java
index ba230bce611..869c5ed8343 100644
--- a/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java
+++ b/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java
@@ -26,6 +26,7 @@
* @bug 4940957 8025205
* @summary Tests behaviour when connections break
* @author Eamonn McManus
+ * @key intermittent
* @modules java.management
* @run clean BrokenConnectionTest
* @run build BrokenConnectionTest
diff --git a/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java b/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java
index c59d723aa13..7edc956cb93 100644
--- a/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java
@@ -27,6 +27,7 @@
* @summary Check the emission of notifications when a Security Manager is
* installed. Test the property "jmx.remote.x.check.notification.emission".
* @author Luis-Miguel Alventosa
+ * @key intermittent
* @modules java.management
* @run clean NotificationEmissionTest
* @run build NotificationEmissionTest
diff --git a/jdk/test/javax/net/ssl/DTLS/NoMacInitialClientHello.java b/jdk/test/javax/net/ssl/DTLS/NoMacInitialClientHello.java
index 1e46b82fef2..540efd8686f 100644
--- a/jdk/test/javax/net/ssl/DTLS/NoMacInitialClientHello.java
+++ b/jdk/test/javax/net/ssl/DTLS/NoMacInitialClientHello.java
@@ -29,7 +29,8 @@
* @bug 8043758
* @summary Datagram Transport Layer Security (DTLS)
* @compile DTLSOverDatagram.java
- * @run main/othervm NoMacInitialClientHello
+ * @run main/othervm -Djdk.tls.client.enableStatusRequestExtension=false
+ * NoMacInitialClientHello
*/
import java.net.DatagramPacket;
diff --git a/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java b/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java
new file mode 100644
index 00000000000..817f619ccdc
--- /dev/null
+++ b/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java
@@ -0,0 +1,797 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS
+ * @library ../../../../java/security/testlibrary
+ * @build CertificateBuilder SimpleOCSPServer
+ * @run main/othervm HttpsUrlConnClient
+ */
+
+import java.io.*;
+import java.math.BigInteger;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.net.Socket;
+import java.net.URL;
+import java.net.HttpURLConnection;
+import java.net.InetAddress;
+import javax.net.ssl.*;
+import java.security.KeyStore;
+import java.security.PublicKey;
+import java.security.Security;
+import java.security.GeneralSecurityException;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertPathValidatorException.BasicReason;
+import java.security.cert.Certificate;
+import java.security.cert.PKIXBuilderParameters;
+import java.security.cert.X509CertSelector;
+import java.security.cert.X509Certificate;
+import java.security.cert.PKIXRevocationChecker;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+import sun.security.testlibrary.SimpleOCSPServer;
+import sun.security.testlibrary.CertificateBuilder;
+import sun.security.validator.ValidatorException;
+
+public class HttpsUrlConnClient {
+
+ /*
+ * =============================================================
+ * Set the various variables needed for the tests, then
+ * specify what tests to run on each side.
+ */
+
+ static final byte[] LINESEP = { 10 };
+ static final Base64.Encoder B64E = Base64.getMimeEncoder(64, LINESEP);
+
+ // Turn on TLS debugging
+ static boolean debug = true;
+
+ /*
+ * Should we run the client or server in a separate thread?
+ * Both sides can throw exceptions, but do you have a preference
+ * as to which side should be the main thread.
+ */
+ static boolean separateServerThread = true;
+ Thread clientThread = null;
+ Thread serverThread = null;
+
+ static String passwd = "passphrase";
+ static String ROOT_ALIAS = "root";
+ static String INT_ALIAS = "intermediate";
+ static String SSL_ALIAS = "ssl";
+
+ /*
+ * Is the server ready to serve?
+ */
+ volatile static boolean serverReady = false;
+ volatile int serverPort = 0;
+
+ volatile Exception serverException = null;
+ volatile Exception clientException = null;
+
+ // PKI components we will need for this test
+ static KeyStore rootKeystore; // Root CA Keystore
+ static KeyStore intKeystore; // Intermediate CA Keystore
+ static KeyStore serverKeystore; // SSL Server Keystore
+ static KeyStore trustStore; // SSL Client trust store
+ static SimpleOCSPServer rootOcsp; // Root CA OCSP Responder
+ static int rootOcspPort; // Port number for root OCSP
+ static SimpleOCSPServer intOcsp; // Intermediate CA OCSP Responder
+ static int intOcspPort; // Port number for intermed. OCSP
+
+ private static final String SIMPLE_WEB_PAGE = "\n" +
+ "Web Page!\n" +
+ "
Web Page!
\n";
+ private static final SimpleDateFormat utcDateFmt =
+ new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z");
+ /*
+ * If the client or server is doing some kind of object creation
+ * that the other side depends on, and that thread prematurely
+ * exits, you may experience a hang. The test harness will
+ * terminate all hung threads after its timeout has expired,
+ * currently 3 minutes by default, but you might try to be
+ * smart about it....
+ */
+ public static void main(String[] args) throws Exception {
+ if (debug) {
+ System.setProperty("javax.net.debug", "ssl");
+ }
+
+ System.setProperty("javax.net.ssl.keyStore", "");
+ System.setProperty("javax.net.ssl.keyStorePassword", "");
+ System.setProperty("javax.net.ssl.trustStore", "");
+ System.setProperty("javax.net.ssl.trustStorePassword", "");
+
+ // Create the PKI we will use for the test and start the OCSP servers
+ createPKI();
+ utcDateFmt.setTimeZone(TimeZone.getTimeZone("GMT"));
+
+ testPKIXParametersRevEnabled();
+
+ // shut down the OCSP responders before finishing the test
+ intOcsp.stop();
+ rootOcsp.stop();
+ }
+
+ /**
+ * Do a basic connection using PKIXParameters with revocation checking
+ * enabled and client-side OCSP disabled. It will only pass if all
+ * stapled responses are present, valid and have a GOOD status.
+ */
+ static void testPKIXParametersRevEnabled() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+
+ System.out.println("=====================================");
+ System.out.println("Stapling enabled, PKIXParameters with");
+ System.out.println("Revocation checking enabled ");
+ System.out.println("=====================================");
+
+ // Set the certificate entry in the intermediate OCSP responder
+ // with a revocation date of 8 hours ago.
+ X509Certificate sslCert =
+ (X509Certificate)serverKeystore.getCertificate(SSL_ALIAS);
+ Map revInfo =
+ new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_REVOKED,
+ new Date(System.currentTimeMillis() -
+ TimeUnit.HOURS.toMillis(8))));
+ intOcsp.updateStatusDb(revInfo);
+
+ // Set up revocation checking on the client with no client-side
+ // OCSP fall-back
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+ Security.setProperty("ocsp.enable", "false");
+
+ HttpsUrlConnClient sslTest = new HttpsUrlConnClient(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (!checkClientValidationFailure(tr.clientExc, BasicReason.REVOKED)) {
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else {
+ throw new RuntimeException(
+ "Expected client failure, but the client succeeded");
+ }
+ }
+
+ // In this case the server should also have thrown an exception
+ // because of the client alert
+ if (tr.serverExc instanceof SSLHandshakeException) {
+ if (!tr.serverExc.getMessage().contains(
+ "alert: bad_certificate_status_response")) {
+ throw tr.serverExc;
+ }
+ }
+
+ System.out.println(" PASS");
+ System.out.println("=====================================\n");
+ }
+
+ /*
+ * Define the server side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doServerSide(ServerParameters servParams) throws Exception {
+
+ // Selectively enable or disable the feature
+ System.setProperty("jdk.tls.server.enableStatusRequestExtension",
+ Boolean.toString(servParams.enabled));
+
+ // Set all the other operating parameters
+ System.setProperty("jdk.tls.stapling.cacheSize",
+ Integer.toString(servParams.cacheSize));
+ System.setProperty("jdk.tls.stapling.cacheLifetime",
+ Integer.toString(servParams.cacheLifetime));
+ System.setProperty("jdk.tls.stapling.responseTimeout",
+ Integer.toString(servParams.respTimeout));
+ System.setProperty("jdk.tls.stapling.responderURI", servParams.respUri);
+ System.setProperty("jdk.tls.stapling.responderOverride",
+ Boolean.toString(servParams.respOverride));
+ System.setProperty("jdk.tls.stapling.ignoreExtensions",
+ Boolean.toString(servParams.ignoreExts));
+
+ // Set keystores and trust stores for the server
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(serverKeystore, passwd.toCharArray());
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+ tmf.init(trustStore);
+
+ SSLContext sslc = SSLContext.getInstance("TLS");
+ sslc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+ SSLServerSocketFactory sslssf = sslc.getServerSocketFactory();
+ SSLServerSocket sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort);
+
+ serverPort = sslServerSocket.getLocalPort();
+ log("Server Port is " + serverPort);
+
+ // Dump the private key in PKCS8 format, not encrypted. This
+ // key dump can be used if the traffic was captured using tcpdump
+ // or wireshark to look into the encrypted packets for debug purposes.
+ if (debug) {
+ byte[] keybytes = serverKeystore.getKey(SSL_ALIAS,
+ passwd.toCharArray()).getEncoded();
+ PKCS8EncodedKeySpec p8spec = new PKCS8EncodedKeySpec(keybytes);
+ StringBuilder keyPem = new StringBuilder();
+ keyPem.append("-----BEGIN PRIVATE KEY-----\n");
+ keyPem.append(B64E.encodeToString(p8spec.getEncoded())).append("\n");
+ keyPem.append("-----END PRIVATE KEY-----\n");
+ log("Private key is:\n" + keyPem.toString());
+ }
+
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ try (SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(sslSocket.getInputStream()));
+ OutputStream out = sslSocket.getOutputStream()) {
+ StringBuilder hdrBldr = new StringBuilder();
+ String line;
+ while ((line = in.readLine()) != null && !line.isEmpty()) {
+ hdrBldr.append(line).append("\n");
+ }
+ String headerText = hdrBldr.toString();
+ log("Header Received: " + headerText.length() + " bytes\n" +
+ headerText);
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("HTTP/1.0 200 OK\r\n");
+ sb.append("Date: ").append(utcDateFmt.format(new Date())).
+ append("\r\n");
+ sb.append("Content-Type: text/html\r\n");
+ sb.append("Content-Length: ").append(SIMPLE_WEB_PAGE.length());
+ sb.append("\r\n\r\n");
+ out.write(sb.toString().getBytes("UTF-8"));
+ out.write(SIMPLE_WEB_PAGE.getBytes("UTF-8"));
+ out.flush();
+ log("Server replied with:\n" + sb.toString() + SIMPLE_WEB_PAGE);
+ }
+ }
+
+ /*
+ * Define the client side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doClientSide(ClientParameters cliParams) throws Exception {
+
+ /*
+ * Wait for server to get started.
+ */
+ while (!serverReady) {
+ Thread.sleep(50);
+ }
+
+ // Selectively enable or disable the feature
+ System.setProperty("jdk.tls.client.enableStatusRequestExtension",
+ Boolean.toString(cliParams.enabled));
+
+ HtucSSLSocketFactory sockFac = new HtucSSLSocketFactory(cliParams);
+ HttpsURLConnection.setDefaultSSLSocketFactory(sockFac);
+ URL location = new URL("https://localhost:" + serverPort);
+ HttpsURLConnection tlsConn =
+ (HttpsURLConnection)location.openConnection();
+ tlsConn.setConnectTimeout(5000);
+ tlsConn.setReadTimeout(5000);
+ tlsConn.setDoInput(true);
+
+ try (InputStream in = tlsConn.getInputStream()) {
+ // Check the response
+ if (debug && tlsConn.getResponseCode() !=
+ HttpURLConnection.HTTP_OK) {
+ log("Received HTTP error: " + tlsConn.getResponseCode() +
+ " - " + tlsConn.getResponseMessage());
+ throw new IOException("HTTP error: " +
+ tlsConn.getResponseCode());
+ }
+
+ int contentLength = tlsConn.getContentLength();
+ if (contentLength == -1) {
+ contentLength = Integer.MAX_VALUE;
+ }
+ byte[] response = new byte[contentLength > 2048 ? 2048 : contentLength];
+ int total = 0;
+ while (total < contentLength) {
+ int count = in.read(response, total, response.length - total);
+ if (count < 0)
+ break;
+
+ total += count;
+ log("Read " + count + " bytes (" + total + " total)");
+ if (total >= response.length && total < contentLength) {
+ response = Arrays.copyOf(response, total * 2);
+ }
+ }
+ response = Arrays.copyOf(response, total);
+ String webPage = new String(response, 0, total);
+ if (debug) {
+ log("Web page:\n" + webPage);
+ }
+ }
+ }
+
+ /*
+ * Primary constructor, used to drive remainder of the test.
+ *
+ * Fork off the other side, then do your work.
+ */
+ HttpsUrlConnClient(ClientParameters cliParams,
+ ServerParameters servParams) throws Exception {
+ Exception startException = null;
+ try {
+ if (separateServerThread) {
+ startServer(servParams, true);
+ startClient(cliParams, false);
+ } else {
+ startClient(cliParams, true);
+ startServer(servParams, false);
+ }
+ } catch (Exception e) {
+ startException = e;
+ }
+
+ /*
+ * Wait for other side to close down.
+ */
+ if (separateServerThread) {
+ if (serverThread != null) {
+ serverThread.join();
+ }
+ } else {
+ if (clientThread != null) {
+ clientThread.join();
+ }
+ }
+ }
+
+ /**
+ * Checks a validation failure to see if it failed for the reason we think
+ * it should. This comes in as an SSLException of some sort, but it
+ * encapsulates a ValidatorException which in turn encapsulates the
+ * CertPathValidatorException we are interested in.
+ *
+ * @param e the exception thrown at the top level
+ * @param reason the underlying CertPathValidatorException BasicReason
+ * we are expecting it to have.
+ *
+ * @return true if the reason matches up, false otherwise.
+ */
+ static boolean checkClientValidationFailure(Exception e,
+ BasicReason reason) {
+ boolean result = false;
+
+ if (e instanceof SSLException) {
+ Throwable valExc = e.getCause();
+ if (valExc instanceof sun.security.validator.ValidatorException) {
+ Throwable cause = valExc.getCause();
+ if (cause instanceof CertPathValidatorException) {
+ CertPathValidatorException cpve =
+ (CertPathValidatorException)cause;
+ if (cpve.getReason() == reason) {
+ result = true;
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ TestResult getResult() {
+ TestResult tr = new TestResult();
+ tr.clientExc = clientException;
+ tr.serverExc = serverException;
+ return tr;
+ }
+
+ final void startServer(ServerParameters servParams, boolean newThread)
+ throws Exception {
+ if (newThread) {
+ serverThread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ doServerSide(servParams);
+ } catch (Exception e) {
+ /*
+ * Our server thread just died.
+ *
+ * Release the client, if not active already...
+ */
+ System.err.println("Server died...");
+ serverReady = true;
+ serverException = e;
+ }
+ }
+ };
+ serverThread.start();
+ } else {
+ try {
+ doServerSide(servParams);
+ } catch (Exception e) {
+ serverException = e;
+ } finally {
+ serverReady = true;
+ }
+ }
+ }
+
+ final void startClient(ClientParameters cliParams, boolean newThread)
+ throws Exception {
+ if (newThread) {
+ clientThread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ doClientSide(cliParams);
+ } catch (Exception e) {
+ /*
+ * Our client thread just died.
+ */
+ System.err.println("Client died...");
+ clientException = e;
+ }
+ }
+ };
+ clientThread.start();
+ } else {
+ try {
+ doClientSide(cliParams);
+ } catch (Exception e) {
+ clientException = e;
+ }
+ }
+ }
+
+ /**
+ * Creates the PKI components necessary for this test, including
+ * Root CA, Intermediate CA and SSL server certificates, the keystores
+ * for each entity, a client trust store, and starts the OCSP responders.
+ */
+ private static void createPKI() throws Exception {
+ CertificateBuilder cbld = new CertificateBuilder();
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+ keyGen.initialize(2048);
+ KeyStore.Builder keyStoreBuilder =
+ KeyStore.Builder.newInstance("PKCS12", null,
+ new KeyStore.PasswordProtection(passwd.toCharArray()));
+
+ // Generate Root, IntCA, EE keys
+ KeyPair rootCaKP = keyGen.genKeyPair();
+ log("Generated Root CA KeyPair");
+ KeyPair intCaKP = keyGen.genKeyPair();
+ log("Generated Intermediate CA KeyPair");
+ KeyPair sslKP = keyGen.genKeyPair();
+ log("Generated SSL Cert KeyPair");
+
+ // Set up the Root CA Cert
+ cbld.setSubjectName("CN=Root CA Cert, O=SomeCompany");
+ cbld.setPublicKey(rootCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("1"));
+ // Make a 3 year validity starting from 60 days ago
+ long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(60);
+ long end = start + TimeUnit.DAYS.toMillis(1085);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, rootCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ // Make our Root CA Cert!
+ X509Certificate rootCert = cbld.build(null, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Root CA Created:\n" + certInfo(rootCert));
+
+ // Now build a keystore and add the keys and cert
+ rootKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] rootChain = {rootCert};
+ rootKeystore.setKeyEntry(ROOT_ALIAS, rootCaKP.getPrivate(),
+ passwd.toCharArray(), rootChain);
+
+ // Now fire up the OCSP responder
+ rootOcsp = new SimpleOCSPServer(rootKeystore, passwd, ROOT_ALIAS, null);
+ rootOcsp.enableLog(debug);
+ rootOcsp.setNextUpdateInterval(3600);
+ rootOcsp.start();
+ Thread.sleep(1000); // Give the server a second to start up
+ rootOcspPort = rootOcsp.getPort();
+ String rootRespURI = "http://localhost:" + rootOcspPort;
+ log("Root OCSP Responder URI is " + rootRespURI);
+
+ // Now that we have the root keystore and OCSP responder we can
+ // create our intermediate CA.
+ cbld.reset();
+ cbld.setSubjectName("CN=Intermediate CA Cert, O=SomeCompany");
+ cbld.setPublicKey(intCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("100"));
+ // Make a 2 year validity starting from 30 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30);
+ end = start + TimeUnit.DAYS.toMillis(730);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, intCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ cbld.addAIAExt(Collections.singletonList(rootRespURI));
+ // Make our Intermediate CA Cert!
+ X509Certificate intCaCert = cbld.build(rootCert, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Intermediate CA Created:\n" + certInfo(intCaCert));
+
+ // Provide intermediate CA cert revocation info to the Root CA
+ // OCSP responder.
+ Map revInfo =
+ new HashMap<>();
+ revInfo.put(intCaCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ rootOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ intKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] intChain = {intCaCert, rootCert};
+ intKeystore.setKeyEntry(INT_ALIAS, intCaKP.getPrivate(),
+ passwd.toCharArray(), intChain);
+ intKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // Now fire up the Intermediate CA OCSP responder
+ intOcsp = new SimpleOCSPServer(intKeystore, passwd,
+ INT_ALIAS, null);
+ intOcsp.enableLog(debug);
+ intOcsp.setNextUpdateInterval(3600);
+ intOcsp.start();
+ Thread.sleep(1000);
+ intOcspPort = intOcsp.getPort();
+ String intCaRespURI = "http://localhost:" + intOcspPort;
+ log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
+
+ // Last but not least, let's make our SSLCert and add it to its own
+ // Keystore
+ cbld.reset();
+ cbld.setSubjectName("CN=SSLCertificate, O=SomeCompany");
+ cbld.setPublicKey(sslKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("4096"));
+ // Make a 1 year validity starting from 7 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7);
+ end = start + TimeUnit.DAYS.toMillis(365);
+ cbld.setValidity(new Date(start), new Date(end));
+
+ // Add extensions
+ addCommonExts(cbld, sslKP.getPublic(), intCaKP.getPublic());
+ boolean[] kuBits = {true, false, true, false, false, false,
+ false, false, false};
+ cbld.addKeyUsageExt(kuBits);
+ List ekuOids = new ArrayList<>();
+ ekuOids.add("1.3.6.1.5.5.7.3.1");
+ ekuOids.add("1.3.6.1.5.5.7.3.2");
+ cbld.addExtendedKeyUsageExt(ekuOids);
+ cbld.addSubjectAltNameDNSExt(Collections.singletonList("localhost"));
+ cbld.addAIAExt(Collections.singletonList(intCaRespURI));
+ // Make our SSL Server Cert!
+ X509Certificate sslCert = cbld.build(intCaCert, intCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("SSL Certificate Created:\n" + certInfo(sslCert));
+
+ // Provide SSL server cert revocation info to the Intermeidate CA
+ // OCSP responder.
+ revInfo = new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ serverKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] sslChain = {sslCert, intCaCert, rootCert};
+ serverKeystore.setKeyEntry(SSL_ALIAS, sslKP.getPrivate(),
+ passwd.toCharArray(), sslChain);
+ serverKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // And finally a Trust Store for the client
+ trustStore = keyStoreBuilder.getKeyStore();
+ trustStore.setCertificateEntry(ROOT_ALIAS, rootCert);
+ }
+
+ private static void addCommonExts(CertificateBuilder cbld,
+ PublicKey subjKey, PublicKey authKey) throws IOException {
+ cbld.addSubjectKeyIdExt(subjKey);
+ cbld.addAuthorityKeyIdExt(authKey);
+ }
+
+ private static void addCommonCAExts(CertificateBuilder cbld)
+ throws IOException {
+ cbld.addBasicConstraintsExt(true, true, -1);
+ // Set key usage bits for digitalSignature, keyCertSign and cRLSign
+ boolean[] kuBitSettings = {true, false, false, false, false, true,
+ true, false, false};
+ cbld.addKeyUsageExt(kuBitSettings);
+ }
+
+ /**
+ * Helper routine that dumps only a few cert fields rather than
+ * the whole toString() output.
+ *
+ * @param cert an X509Certificate to be displayed
+ *
+ * @return the String output of the issuer, subject and
+ * serial number
+ */
+ private static String certInfo(X509Certificate cert) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Issuer: ").append(cert.getIssuerX500Principal()).
+ append("\n");
+ sb.append("Subject: ").append(cert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("Serial: ").append(cert.getSerialNumber()).append("\n");
+ return sb.toString();
+ }
+
+ /**
+ * Log a message on stdout
+ *
+ * @param message The message to log
+ */
+ private static void log(String message) {
+ if (debug) {
+ System.out.println(message);
+ }
+ }
+
+ // The following two classes are Simple nested class to group a handful
+ // of configuration parameters used before starting a client or server.
+ // We'll just access the data members directly for convenience.
+ static class ClientParameters {
+ boolean enabled = true;
+ PKIXBuilderParameters pkixParams = null;
+ PKIXRevocationChecker revChecker = null;
+
+ ClientParameters() { }
+ }
+
+ static class ServerParameters {
+ boolean enabled = true;
+ int cacheSize = 256;
+ int cacheLifetime = 3600;
+ int respTimeout = 5000;
+ String respUri = "";
+ boolean respOverride = false;
+ boolean ignoreExts = false;
+
+ ServerParameters() { }
+ }
+
+ static class TestResult {
+ Exception serverExc = null;
+ Exception clientExc = null;
+ }
+
+ static class HtucSSLSocketFactory extends SSLSocketFactory {
+ SSLContext sslc = SSLContext.getInstance("TLS");
+
+ HtucSSLSocketFactory(ClientParameters cliParams)
+ throws GeneralSecurityException {
+ super();
+
+ // Create the Trust Manager Factory using the PKIX variant
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+
+ // If we have a customized pkixParameters then use it
+ if (cliParams.pkixParams != null) {
+ // LIf we have a customized PKIXRevocationChecker, add
+ // it to the PKIXBuilderParameters.
+ if (cliParams.revChecker != null) {
+ cliParams.pkixParams.addCertPathChecker(
+ cliParams.revChecker);
+ }
+
+ ManagerFactoryParameters trustParams =
+ new CertPathTrustManagerParameters(
+ cliParams.pkixParams);
+ tmf.init(trustParams);
+ } else {
+ tmf.init(trustStore);
+ }
+
+ sslc.init(null, tmf.getTrustManagers(), null);
+ }
+
+ @Override
+ public Socket createSocket(Socket s, String host, int port,
+ boolean autoClose) throws IOException {
+ Socket sock = sslc.getSocketFactory().createSocket(s, host, port,
+ autoClose);
+ setCiphers(sock);
+ return sock;
+ }
+
+ @Override
+ public Socket createSocket(InetAddress host, int port)
+ throws IOException {
+ Socket sock = sslc.getSocketFactory().createSocket(host, port);
+ setCiphers(sock);
+ return sock;
+ }
+
+ @Override
+ public Socket createSocket(InetAddress host, int port,
+ InetAddress localAddress, int localPort) throws IOException {
+ Socket sock = sslc.getSocketFactory().createSocket(host, port,
+ localAddress, localPort);
+ setCiphers(sock);
+ return sock;
+ }
+
+ @Override
+ public Socket createSocket(String host, int port)
+ throws IOException {
+ Socket sock = sslc.getSocketFactory().createSocket(host, port);
+ setCiphers(sock);
+ return sock;
+ }
+
+ @Override
+ public Socket createSocket(String host, int port,
+ InetAddress localAddress, int localPort)
+ throws IOException {
+ Socket sock = sslc.getSocketFactory().createSocket(host, port,
+ localAddress, localPort);
+ setCiphers(sock);
+ return sock;
+ }
+
+ @Override
+ public String[] getDefaultCipherSuites() {
+ return sslc.getDefaultSSLParameters().getCipherSuites();
+ }
+
+ @Override
+ public String[] getSupportedCipherSuites() {
+ return sslc.getSupportedSSLParameters().getCipherSuites();
+ }
+
+ private static void setCiphers(Socket sock) {
+ if (sock instanceof SSLSocket) {
+ String[] ciphers = { "TLS_RSA_WITH_AES_128_CBC_SHA" };
+ ((SSLSocket)sock).setEnabledCipherSuites(ciphers);
+ }
+ }
+ }
+
+}
diff --git a/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java b/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java
new file mode 100644
index 00000000000..d4264278165
--- /dev/null
+++ b/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java
@@ -0,0 +1,655 @@
+/*
+ * Copyright (c) 2003, 2013, 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS
+ * @library ../../../../java/security/testlibrary
+ * @build CertificateBuilder SimpleOCSPServer
+ * @run main/othervm SSLEngineWithStapling
+ */
+
+/**
+ * A SSLEngine usage example which simplifies the presentation
+ * by removing the I/O and multi-threading concerns.
+ *
+ * The test creates two SSLEngines, simulating a client and server.
+ * The "transport" layer consists two byte buffers: think of them
+ * as directly connected pipes.
+ *
+ * Note, this is a *very* simple example: real code will be much more
+ * involved. For example, different threading and I/O models could be
+ * used, transport mechanisms could close unexpectedly, and so on.
+ *
+ * When this application runs, notice that several messages
+ * (wrap/unwrap) pass before any application data is consumed or
+ * produced. (For more information, please see the SSL/TLS
+ * specifications.) There may several steps for a successful handshake,
+ * so it's typical to see the following series of operations:
+ *
+ * client server message
+ * ====== ====== =======
+ * wrap() ... ClientHello
+ * ... unwrap() ClientHello
+ * ... wrap() ServerHello/Certificate
+ * unwrap() ... ServerHello/Certificate
+ * wrap() ... ClientKeyExchange
+ * wrap() ... ChangeCipherSpec
+ * wrap() ... Finished
+ * ... unwrap() ClientKeyExchange
+ * ... unwrap() ChangeCipherSpec
+ * ... unwrap() Finished
+ * ... wrap() ChangeCipherSpec
+ * ... wrap() Finished
+ * unwrap() ... ChangeCipherSpec
+ * unwrap() ... Finished
+ */
+
+import javax.net.ssl.*;
+import javax.net.ssl.SSLEngineResult.*;
+import java.io.*;
+import java.math.BigInteger;
+import java.security.*;
+import java.nio.*;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.PKIXBuilderParameters;
+import java.security.cert.X509Certificate;
+import java.security.cert.X509CertSelector;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import sun.security.testlibrary.SimpleOCSPServer;
+import sun.security.testlibrary.CertificateBuilder;
+
+public class SSLEngineWithStapling {
+
+ /*
+ * Enables logging of the SSLEngine operations.
+ */
+ private static final boolean logging = true;
+
+ /*
+ * Enables the JSSE system debugging system property:
+ *
+ * -Djavax.net.debug=all
+ *
+ * This gives a lot of low-level information about operations underway,
+ * including specific handshake messages, and might be best examined
+ * after gaining some familiarity with this application.
+ */
+ private static final boolean debug = false;
+
+ private SSLEngine clientEngine; // client Engine
+ private ByteBuffer clientOut; // write side of clientEngine
+ private ByteBuffer clientIn; // read side of clientEngine
+
+ private SSLEngine serverEngine; // server Engine
+ private ByteBuffer serverOut; // write side of serverEngine
+ private ByteBuffer serverIn; // read side of serverEngine
+
+ /*
+ * For data transport, this example uses local ByteBuffers. This
+ * isn't really useful, but the purpose of this example is to show
+ * SSLEngine concepts, not how to do network transport.
+ */
+ private ByteBuffer cTOs; // "reliable" transport client->server
+ private ByteBuffer sTOc; // "reliable" transport server->client
+
+ /*
+ * The following is to set up the keystores.
+ */
+ static final String passwd = "passphrase";
+ static final String ROOT_ALIAS = "root";
+ static final String INT_ALIAS = "intermediate";
+ static final String SSL_ALIAS = "ssl";
+
+ // PKI components we will need for this test
+ static KeyStore rootKeystore; // Root CA Keystore
+ static KeyStore intKeystore; // Intermediate CA Keystore
+ static KeyStore serverKeystore; // SSL Server Keystore
+ static KeyStore trustStore; // SSL Client trust store
+ static SimpleOCSPServer rootOcsp; // Root CA OCSP Responder
+ static int rootOcspPort; // Port number for root OCSP
+ static SimpleOCSPServer intOcsp; // Intermediate CA OCSP Responder
+ static int intOcspPort; // Port number for intermed. OCSP
+
+ /*
+ * Main entry point for this test.
+ */
+ public static void main(String args[]) throws Exception {
+ if (debug) {
+ System.setProperty("javax.net.debug", "ssl");
+ }
+
+ // Create the PKI we will use for the test and start the OCSP servers
+ createPKI();
+
+ // Set the certificate entry in the intermediate OCSP responder
+ // with a revocation date of 8 hours ago.
+ X509Certificate sslCert =
+ (X509Certificate)serverKeystore.getCertificate(SSL_ALIAS);
+ Map revInfo =
+ new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_REVOKED,
+ new Date(System.currentTimeMillis() -
+ TimeUnit.HOURS.toMillis(8))));
+ intOcsp.updateStatusDb(revInfo);
+
+ SSLEngineWithStapling test = new SSLEngineWithStapling();
+ try {
+ test.runTest();
+ throw new RuntimeException("Expected failure due to revocation " +
+ "did not occur");
+ } catch (Exception e) {
+ if (!checkClientValidationFailure(e,
+ CertPathValidatorException.BasicReason.REVOKED)) {
+ System.out.println("*** Didn't find the exception we wanted");
+ throw e;
+ }
+ }
+
+ System.out.println("Test Passed.");
+ }
+
+ /*
+ * Create an initialized SSLContext to use for these tests.
+ */
+ public SSLEngineWithStapling() throws Exception {
+ System.setProperty("javax.net.ssl.keyStore", "");
+ System.setProperty("javax.net.ssl.keyStorePassword", "");
+ System.setProperty("javax.net.ssl.trustStore", "");
+ System.setProperty("javax.net.ssl.trustStorePassword", "");
+
+ // Enable OCSP Stapling on both client and server sides, but turn off
+ // client-side OCSP for revocation checking. This ensures that the
+ // revocation information from the test has to come via stapling.
+ System.setProperty("jdk.tls.client.enableStatusRequestExtension",
+ Boolean.toString(true));
+ System.setProperty("jdk.tls.server.enableStatusRequestExtension",
+ Boolean.toString(true));
+ Security.setProperty("ocsp.enable", "false");
+ }
+
+ /*
+ * Run the test.
+ *
+ * Sit in a tight loop, both engines calling wrap/unwrap regardless
+ * of whether data is available or not. We do this until both engines
+ * report back they are closed.
+ *
+ * The main loop handles all of the I/O phases of the SSLEngine's
+ * lifetime:
+ *
+ * initial handshaking
+ * application data transfer
+ * engine closing
+ *
+ * One could easily separate these phases into separate
+ * sections of code.
+ */
+ private void runTest() throws Exception {
+ boolean dataDone = false;
+
+ createSSLEngines();
+ createBuffers();
+
+ SSLEngineResult clientResult; // results from client's last operation
+ SSLEngineResult serverResult; // results from server's last operation
+
+ /*
+ * Examining the SSLEngineResults could be much more involved,
+ * and may alter the overall flow of the application.
+ *
+ * For example, if we received a BUFFER_OVERFLOW when trying
+ * to write to the output pipe, we could reallocate a larger
+ * pipe, but instead we wait for the peer to drain it.
+ */
+ while (!isEngineClosed(clientEngine) ||
+ !isEngineClosed(serverEngine)) {
+
+ log("================");
+
+ clientResult = clientEngine.wrap(clientOut, cTOs);
+ log("client wrap: ", clientResult);
+ runDelegatedTasks(clientResult, clientEngine);
+
+ serverResult = serverEngine.wrap(serverOut, sTOc);
+ log("server wrap: ", serverResult);
+ runDelegatedTasks(serverResult, serverEngine);
+
+ cTOs.flip();
+ sTOc.flip();
+
+ log("----");
+
+ clientResult = clientEngine.unwrap(sTOc, clientIn);
+ log("client unwrap: ", clientResult);
+ runDelegatedTasks(clientResult, clientEngine);
+
+ serverResult = serverEngine.unwrap(cTOs, serverIn);
+ log("server unwrap: ", serverResult);
+ runDelegatedTasks(serverResult, serverEngine);
+
+ cTOs.compact();
+ sTOc.compact();
+
+ /*
+ * After we've transfered all application data between the client
+ * and server, we close the clientEngine's outbound stream.
+ * This generates a close_notify handshake message, which the
+ * server engine receives and responds by closing itself.
+ */
+ if (!dataDone && (clientOut.limit() == serverIn.position()) &&
+ (serverOut.limit() == clientIn.position())) {
+
+ /*
+ * A sanity check to ensure we got what was sent.
+ */
+ checkTransfer(serverOut, clientIn);
+ checkTransfer(clientOut, serverIn);
+
+ log("\tClosing clientEngine's *OUTBOUND*...");
+ clientEngine.closeOutbound();
+ dataDone = true;
+ }
+ }
+ }
+
+ /*
+ * Using the SSLContext created during object creation,
+ * create/configure the SSLEngines we'll use for this test.
+ */
+ private void createSSLEngines() throws Exception {
+ // Initialize the KeyManager and TrustManager for the server
+ KeyManagerFactory servKmf = KeyManagerFactory.getInstance("PKIX");
+ servKmf.init(serverKeystore, passwd.toCharArray());
+ TrustManagerFactory servTmf =
+ TrustManagerFactory.getInstance("PKIX");
+ servTmf.init(trustStore);
+
+ // Initialize the TrustManager for the client with revocation checking
+ PKIXBuilderParameters pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ pkixParams.setRevocationEnabled(true);
+ ManagerFactoryParameters mfp =
+ new CertPathTrustManagerParameters(pkixParams);
+ TrustManagerFactory cliTmf =
+ TrustManagerFactory.getInstance("PKIX");
+ cliTmf.init(mfp);
+
+ // Create the SSLContexts from the factories
+ SSLContext servCtx = SSLContext.getInstance("TLS");
+ servCtx.init(servKmf.getKeyManagers(), servTmf.getTrustManagers(),
+ null);
+ SSLContext cliCtx = SSLContext.getInstance("TLS");
+ cliCtx.init(null, cliTmf.getTrustManagers(), null);
+
+
+ /*
+ * Configure the serverEngine to act as a server in the SSL/TLS
+ * handshake.
+ */
+ serverEngine = servCtx.createSSLEngine();
+ serverEngine.setUseClientMode(false);
+ serverEngine.setNeedClientAuth(false);
+
+ /*
+ * Similar to above, but using client mode instead.
+ */
+ clientEngine = cliCtx.createSSLEngine("client", 80);
+ clientEngine.setUseClientMode(true);
+ }
+
+ /*
+ * Create and size the buffers appropriately.
+ */
+ private void createBuffers() {
+
+ /*
+ * We'll assume the buffer sizes are the same
+ * between client and server.
+ */
+ SSLSession session = clientEngine.getSession();
+ int appBufferMax = session.getApplicationBufferSize();
+ int netBufferMax = session.getPacketBufferSize();
+
+ /*
+ * We'll make the input buffers a bit bigger than the max needed
+ * size, so that unwrap()s following a successful data transfer
+ * won't generate BUFFER_OVERFLOWS.
+ *
+ * We'll use a mix of direct and indirect ByteBuffers for
+ * tutorial purposes only. In reality, only use direct
+ * ByteBuffers when they give a clear performance enhancement.
+ */
+ clientIn = ByteBuffer.allocate(appBufferMax + 50);
+ serverIn = ByteBuffer.allocate(appBufferMax + 50);
+
+ cTOs = ByteBuffer.allocateDirect(netBufferMax);
+ sTOc = ByteBuffer.allocateDirect(netBufferMax);
+
+ clientOut = ByteBuffer.wrap("Hi Server, I'm Client".getBytes());
+ serverOut = ByteBuffer.wrap("Hello Client, I'm Server".getBytes());
+ }
+
+ /*
+ * If the result indicates that we have outstanding tasks to do,
+ * go ahead and run them in this thread.
+ */
+ private static void runDelegatedTasks(SSLEngineResult result,
+ SSLEngine engine) throws Exception {
+
+ if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
+ Runnable runnable;
+ while ((runnable = engine.getDelegatedTask()) != null) {
+ log("\trunning delegated task...");
+ runnable.run();
+ }
+ HandshakeStatus hsStatus = engine.getHandshakeStatus();
+ if (hsStatus == HandshakeStatus.NEED_TASK) {
+ throw new Exception(
+ "handshake shouldn't need additional tasks");
+ }
+ log("\tnew HandshakeStatus: " + hsStatus);
+ }
+ }
+
+ private static boolean isEngineClosed(SSLEngine engine) {
+ return (engine.isOutboundDone() && engine.isInboundDone());
+ }
+
+ /*
+ * Simple check to make sure everything came across as expected.
+ */
+ private static void checkTransfer(ByteBuffer a, ByteBuffer b)
+ throws Exception {
+ a.flip();
+ b.flip();
+
+ if (!a.equals(b)) {
+ throw new Exception("Data didn't transfer cleanly");
+ } else {
+ log("\tData transferred cleanly");
+ }
+
+ a.position(a.limit());
+ b.position(b.limit());
+ a.limit(a.capacity());
+ b.limit(b.capacity());
+ }
+
+ /*
+ * Logging code
+ */
+ private static boolean resultOnce = true;
+
+ private static void log(String str, SSLEngineResult result) {
+ if (!logging) {
+ return;
+ }
+ if (resultOnce) {
+ resultOnce = false;
+ System.out.println("The format of the SSLEngineResult is: \n" +
+ "\t\"getStatus() / getHandshakeStatus()\" +\n" +
+ "\t\"bytesConsumed() / bytesProduced()\"\n");
+ }
+ HandshakeStatus hsStatus = result.getHandshakeStatus();
+ log(str +
+ result.getStatus() + "/" + hsStatus + ", " +
+ result.bytesConsumed() + "/" + result.bytesProduced() +
+ " bytes");
+ if (hsStatus == HandshakeStatus.FINISHED) {
+ log("\t...ready for application data");
+ }
+ }
+
+ private static void log(String str) {
+ if (logging) {
+ System.out.println(str);
+ }
+ }
+
+ /**
+ * Creates the PKI components necessary for this test, including
+ * Root CA, Intermediate CA and SSL server certificates, the keystores
+ * for each entity, a client trust store, and starts the OCSP responders.
+ */
+ private static void createPKI() throws Exception {
+ CertificateBuilder cbld = new CertificateBuilder();
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+ keyGen.initialize(2048);
+ KeyStore.Builder keyStoreBuilder =
+ KeyStore.Builder.newInstance("PKCS12", null,
+ new KeyStore.PasswordProtection(passwd.toCharArray()));
+
+ // Generate Root, IntCA, EE keys
+ KeyPair rootCaKP = keyGen.genKeyPair();
+ log("Generated Root CA KeyPair");
+ KeyPair intCaKP = keyGen.genKeyPair();
+ log("Generated Intermediate CA KeyPair");
+ KeyPair sslKP = keyGen.genKeyPair();
+ log("Generated SSL Cert KeyPair");
+
+ // Set up the Root CA Cert
+ cbld.setSubjectName("CN=Root CA Cert, O=SomeCompany");
+ cbld.setPublicKey(rootCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("1"));
+ // Make a 3 year validity starting from 60 days ago
+ long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(60);
+ long end = start + TimeUnit.DAYS.toMillis(1085);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, rootCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ // Make our Root CA Cert!
+ X509Certificate rootCert = cbld.build(null, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Root CA Created:\n" + certInfo(rootCert));
+
+ // Now build a keystore and add the keys and cert
+ rootKeystore = keyStoreBuilder.getKeyStore();
+ java.security.cert.Certificate[] rootChain = {rootCert};
+ rootKeystore.setKeyEntry(ROOT_ALIAS, rootCaKP.getPrivate(),
+ passwd.toCharArray(), rootChain);
+
+ // Now fire up the OCSP responder
+ rootOcsp = new SimpleOCSPServer(rootKeystore, passwd, ROOT_ALIAS, null);
+ rootOcsp.enableLog(logging);
+ rootOcsp.setNextUpdateInterval(3600);
+ rootOcsp.start();
+ Thread.sleep(1000); // Give the server a second to start up
+ rootOcspPort = rootOcsp.getPort();
+ String rootRespURI = "http://localhost:" + rootOcspPort;
+ log("Root OCSP Responder URI is " + rootRespURI);
+
+ // Now that we have the root keystore and OCSP responder we can
+ // create our intermediate CA.
+ cbld.reset();
+ cbld.setSubjectName("CN=Intermediate CA Cert, O=SomeCompany");
+ cbld.setPublicKey(intCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("100"));
+ // Make a 2 year validity starting from 30 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30);
+ end = start + TimeUnit.DAYS.toMillis(730);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, intCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ cbld.addAIAExt(Collections.singletonList(rootRespURI));
+ // Make our Intermediate CA Cert!
+ X509Certificate intCaCert = cbld.build(rootCert, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Intermediate CA Created:\n" + certInfo(intCaCert));
+
+ // Provide intermediate CA cert revocation info to the Root CA
+ // OCSP responder.
+ Map revInfo =
+ new HashMap<>();
+ revInfo.put(intCaCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ rootOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ intKeystore = keyStoreBuilder.getKeyStore();
+ java.security.cert.Certificate[] intChain = {intCaCert, rootCert};
+ intKeystore.setKeyEntry(INT_ALIAS, intCaKP.getPrivate(),
+ passwd.toCharArray(), intChain);
+ intKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // Now fire up the Intermediate CA OCSP responder
+ intOcsp = new SimpleOCSPServer(intKeystore, passwd,
+ INT_ALIAS, null);
+ intOcsp.enableLog(logging);
+ intOcsp.setNextUpdateInterval(3600);
+ intOcsp.start();
+ Thread.sleep(1000);
+ intOcspPort = intOcsp.getPort();
+ String intCaRespURI = "http://localhost:" + intOcspPort;
+ log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
+
+ // Last but not least, let's make our SSLCert and add it to its own
+ // Keystore
+ cbld.reset();
+ cbld.setSubjectName("CN=SSLCertificate, O=SomeCompany");
+ cbld.setPublicKey(sslKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("4096"));
+ // Make a 1 year validity starting from 7 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7);
+ end = start + TimeUnit.DAYS.toMillis(365);
+ cbld.setValidity(new Date(start), new Date(end));
+
+ // Add extensions
+ addCommonExts(cbld, sslKP.getPublic(), intCaKP.getPublic());
+ boolean[] kuBits = {true, false, true, false, false, false,
+ false, false, false};
+ cbld.addKeyUsageExt(kuBits);
+ List ekuOids = new ArrayList<>();
+ ekuOids.add("1.3.6.1.5.5.7.3.1");
+ ekuOids.add("1.3.6.1.5.5.7.3.2");
+ cbld.addExtendedKeyUsageExt(ekuOids);
+ cbld.addSubjectAltNameDNSExt(Collections.singletonList("localhost"));
+ cbld.addAIAExt(Collections.singletonList(intCaRespURI));
+ // Make our SSL Server Cert!
+ X509Certificate sslCert = cbld.build(intCaCert, intCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("SSL Certificate Created:\n" + certInfo(sslCert));
+
+ // Provide SSL server cert revocation info to the Intermeidate CA
+ // OCSP responder.
+ revInfo = new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ serverKeystore = keyStoreBuilder.getKeyStore();
+ java.security.cert.Certificate[] sslChain = {sslCert, intCaCert, rootCert};
+ serverKeystore.setKeyEntry(SSL_ALIAS, sslKP.getPrivate(),
+ passwd.toCharArray(), sslChain);
+ serverKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // And finally a Trust Store for the client
+ trustStore = keyStoreBuilder.getKeyStore();
+ trustStore.setCertificateEntry(ROOT_ALIAS, rootCert);
+ }
+
+ private static void addCommonExts(CertificateBuilder cbld,
+ PublicKey subjKey, PublicKey authKey) throws IOException {
+ cbld.addSubjectKeyIdExt(subjKey);
+ cbld.addAuthorityKeyIdExt(authKey);
+ }
+
+ private static void addCommonCAExts(CertificateBuilder cbld)
+ throws IOException {
+ cbld.addBasicConstraintsExt(true, true, -1);
+ // Set key usage bits for digitalSignature, keyCertSign and cRLSign
+ boolean[] kuBitSettings = {true, false, false, false, false, true,
+ true, false, false};
+ cbld.addKeyUsageExt(kuBitSettings);
+ }
+
+ /**
+ * Helper routine that dumps only a few cert fields rather than
+ * the whole toString() output.
+ *
+ * @param cert an X509Certificate to be displayed
+ *
+ * @return the String output of the issuer, subject and
+ * serial number
+ */
+ private static String certInfo(X509Certificate cert) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Issuer: ").append(cert.getIssuerX500Principal()).
+ append("\n");
+ sb.append("Subject: ").append(cert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("Serial: ").append(cert.getSerialNumber()).append("\n");
+ return sb.toString();
+ }
+
+ /**
+ * Checks a validation failure to see if it failed for the reason we think
+ * it should. This comes in as an SSLException of some sort, but it
+ * encapsulates a ValidatorException which in turn encapsulates the
+ * CertPathValidatorException we are interested in.
+ *
+ * @param e the exception thrown at the top level
+ * @param reason the underlying CertPathValidatorException BasicReason
+ * we are expecting it to have.
+ *
+ * @return true if the reason matches up, false otherwise.
+ */
+ static boolean checkClientValidationFailure(Exception e,
+ CertPathValidatorException.BasicReason reason) {
+ boolean result = false;
+
+ if (e instanceof SSLException) {
+ Throwable sslhe = e.getCause();
+ if (sslhe instanceof SSLHandshakeException) {
+ Throwable valExc = sslhe.getCause();
+ if (valExc instanceof sun.security.validator.ValidatorException) {
+ Throwable cause = valExc.getCause();
+ if (cause instanceof CertPathValidatorException) {
+ CertPathValidatorException cpve =
+ (CertPathValidatorException)cause;
+ if (cpve.getReason() == reason) {
+ result = true;
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java b/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java
new file mode 100644
index 00000000000..8a4b50bf78a
--- /dev/null
+++ b/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java
@@ -0,0 +1,905 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS
+ * @library ../../../../java/security/testlibrary
+ * @build CertificateBuilder SimpleOCSPServer
+ * @run main/othervm SSLSocketWithStapling
+ */
+
+import java.io.*;
+import java.math.BigInteger;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import javax.net.ssl.*;
+import java.security.KeyStore;
+import java.security.PublicKey;
+import java.security.Security;
+import java.security.cert.CertPathValidator;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertPathValidatorException.BasicReason;
+import java.security.cert.Certificate;
+import java.security.cert.PKIXBuilderParameters;
+import java.security.cert.X509CertSelector;
+import java.security.cert.X509Certificate;
+import java.security.cert.PKIXRevocationChecker;
+import java.security.cert.PKIXRevocationChecker.Option;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.concurrent.TimeUnit;
+
+import sun.security.testlibrary.SimpleOCSPServer;
+import sun.security.testlibrary.CertificateBuilder;
+
+public class SSLSocketWithStapling {
+
+ /*
+ * =============================================================
+ * Set the various variables needed for the tests, then
+ * specify what tests to run on each side.
+ */
+
+ // Turn on TLS debugging
+ static boolean debug = false;
+
+ /*
+ * Should we run the client or server in a separate thread?
+ * Both sides can throw exceptions, but do you have a preference
+ * as to which side should be the main thread.
+ */
+ static boolean separateServerThread = true;
+ Thread clientThread = null;
+ Thread serverThread = null;
+
+ static String passwd = "passphrase";
+ static String ROOT_ALIAS = "root";
+ static String INT_ALIAS = "intermediate";
+ static String SSL_ALIAS = "ssl";
+
+ /*
+ * Is the server ready to serve?
+ */
+ volatile static boolean serverReady = false;
+ volatile int serverPort = 0;
+
+ volatile Exception serverException = null;
+ volatile Exception clientException = null;
+
+ // PKI components we will need for this test
+ static KeyStore rootKeystore; // Root CA Keystore
+ static KeyStore intKeystore; // Intermediate CA Keystore
+ static KeyStore serverKeystore; // SSL Server Keystore
+ static KeyStore trustStore; // SSL Client trust store
+ static SimpleOCSPServer rootOcsp; // Root CA OCSP Responder
+ static int rootOcspPort; // Port number for root OCSP
+ static SimpleOCSPServer intOcsp; // Intermediate CA OCSP Responder
+ static int intOcspPort; // Port number for intermed. OCSP
+
+ /*
+ * If the client or server is doing some kind of object creation
+ * that the other side depends on, and that thread prematurely
+ * exits, you may experience a hang. The test harness will
+ * terminate all hung threads after its timeout has expired,
+ * currently 3 minutes by default, but you might try to be
+ * smart about it....
+ */
+ public static void main(String[] args) throws Exception {
+ if (debug) {
+ System.setProperty("javax.net.debug", "ssl");
+ }
+
+ // Create the PKI we will use for the test and start the OCSP servers
+ createPKI();
+
+ testAllDefault();
+ testPKIXParametersRevEnabled();
+ testRevokedCertificate();
+ testHardFailFallback();
+ testSoftFailFallback();
+ testLatencyNoStaple(false);
+ testLatencyNoStaple(true);
+
+ // shut down the OCSP responders before finishing the test
+ intOcsp.stop();
+ rootOcsp.stop();
+ }
+
+ /**
+ * Default test using no externally-configured PKIXBuilderParameters
+ */
+ static void testAllDefault() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+ Map revInfo =
+ new HashMap<>();
+
+ // We will prove revocation checking is disabled by marking the SSL
+ // certificate as revoked. The test would only pass if revocation
+ // checking did not happen.
+ X509Certificate sslCert =
+ (X509Certificate)serverKeystore.getCertificate(SSL_ALIAS);
+ Date fiveMinsAgo = new Date(System.currentTimeMillis() -
+ TimeUnit.MINUTES.toMillis(5));
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_REVOKED,
+ fiveMinsAgo));
+ intOcsp.updateStatusDb(revInfo);
+
+ System.out.println("=======================================");
+ System.out.println("Stapling enabled, default configuration");
+ System.out.println("=======================================");
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else if (tr.serverExc != null) {
+ throw tr.serverExc;
+ }
+
+ // Return the ssl certificate to non-revoked status
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ System.out.println(" PASS");
+ System.out.println("=======================================\n");
+ }
+
+ /**
+ * Do a basic connection using PKIXParameters with revocation checking
+ * enabled and client-side OCSP disabled. It will only pass if all
+ * stapled responses are present, valid and have a GOOD status.
+ */
+ static void testPKIXParametersRevEnabled() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+
+ System.out.println("=====================================");
+ System.out.println("Stapling enabled, PKIXParameters with");
+ System.out.println("Revocation checking enabled ");
+ System.out.println("=====================================");
+
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+ Security.setProperty("ocsp.enable", "false");
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else if (tr.serverExc != null) {
+ throw tr.serverExc;
+ }
+
+ System.out.println(" PASS");
+ System.out.println("=====================================\n");
+ }
+
+ /**
+ * Perform a test where the certificate is revoked and placed in the
+ * TLS handshake. Client-side OCSP is disabled, so this test will only
+ * pass if the OCSP response is found, since we will check the
+ * CertPathValidatorException reason for revoked status.
+ */
+ static void testRevokedCertificate() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+ Map revInfo =
+ new HashMap<>();
+
+ // We will prove revocation checking is disabled by marking the SSL
+ // certificate as revoked. The test would only pass if revocation
+ // checking did not happen.
+ X509Certificate sslCert =
+ (X509Certificate)serverKeystore.getCertificate(SSL_ALIAS);
+ Date fiveMinsAgo = new Date(System.currentTimeMillis() -
+ TimeUnit.MINUTES.toMillis(5));
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_REVOKED,
+ fiveMinsAgo));
+ intOcsp.updateStatusDb(revInfo);
+
+ System.out.println("=======================================");
+ System.out.println("Stapling enabled, default configuration");
+ System.out.println("=======================================");
+
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+ Security.setProperty("ocsp.enable", "false");
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (!checkClientValidationFailure(tr.clientExc, BasicReason.REVOKED)) {
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else {
+ throw new RuntimeException(
+ "Expected client failure, but the client succeeded");
+ }
+ }
+
+ // Return the ssl certificate to non-revoked status
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ System.out.println(" PASS");
+ System.out.println("=======================================\n");
+ }
+
+ /**
+ * Test a case where client-side stapling is attempted, but does not
+ * occur because OCSP responders are unreachable. This should use a
+ * default hard-fail behavior.
+ */
+ static void testHardFailFallback() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+
+ // Stop the OCSP responders and give a 1 second delay before
+ // running the test.
+ intOcsp.stop();
+ rootOcsp.stop();
+ Thread.sleep(1000);
+
+ System.out.println("=======================================");
+ System.out.println("Stapling enbled in client and server,");
+ System.out.println("but OCSP responders disabled.");
+ System.out.println("PKIXParameters with Revocation checking");
+ System.out.println("enabled.");
+ System.out.println("=======================================");
+
+ Security.setProperty("ocsp.enable", "true");
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (!checkClientValidationFailure(tr.clientExc,
+ BasicReason.UNDETERMINED_REVOCATION_STATUS)) {
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else {
+ throw new RuntimeException(
+ "Expected client failure, but the client succeeded");
+ }
+ }
+
+ System.out.println(" PASS");
+ System.out.println("=======================================\n");
+
+ // Start the OCSP responders up again
+ intOcsp.start();
+ rootOcsp.start();
+ }
+
+ /**
+ * Test a case where client-side stapling is attempted, but does not
+ * occur because OCSP responders are unreachable. Client-side OCSP
+ * checking is enabled for this, with SOFT_FAIL.
+ */
+ static void testSoftFailFallback() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+
+ // Stop the OCSP responders and give a 1 second delay before
+ // running the test.
+ intOcsp.stop();
+ rootOcsp.stop();
+ Thread.sleep(1000);
+
+ System.out.println("=======================================");
+ System.out.println("Stapling enbled in client and server,");
+ System.out.println("but OCSP responders disabled.");
+ System.out.println("PKIXParameters with Revocation checking");
+ System.out.println("enabled and SOFT_FAIL.");
+ System.out.println("=======================================");
+
+ Security.setProperty("ocsp.enable", "true");
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+ CertPathValidator cpv = CertPathValidator.getInstance("PKIX");
+ cliParams.revChecker =
+ (PKIXRevocationChecker)cpv.getRevocationChecker();
+ cliParams.revChecker.setOptions(EnumSet.of(Option.SOFT_FAIL));
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else if (tr.serverExc != null) {
+ throw tr.serverExc;
+ }
+
+ System.out.println(" PASS");
+ System.out.println("=======================================\n");
+
+ // Start the OCSP responders up again
+ intOcsp.start();
+ rootOcsp.start();
+ }
+
+ /**
+ * This test initiates stapling from the client, but the server does not
+ * support OCSP stapling for this connection. In this case it happens
+ * because the latency of the OCSP responders is longer than the server
+ * is willing to wait. To keep the test streamlined, we will set the server
+ * latency to a 1 second wait, and set the responder latency to 3 seconds.
+ *
+ * @param fallback if we allow client-side OCSP fallback, which
+ * will change the result from the client failing with CPVE (no fallback)
+ * to a pass (fallback active).
+ */
+ static void testLatencyNoStaple(Boolean fallback) throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+
+ // Stop the OCSP responders and give a 1 second delay before
+ // running the test.
+ intOcsp.stop();
+ rootOcsp.stop();
+ Thread.sleep(1000);
+ intOcsp.setDelay(3000);
+ rootOcsp.setDelay(3000);
+ rootOcsp.start();
+ intOcsp.start();
+ Thread.sleep(1000);
+
+ System.out.println("========================================");
+ System.out.println("Stapling enbled in client. Server does");
+ System.out.println("not support stapling due to OCSP latency.");
+ System.out.println("PKIXParameters with Revocation checking");
+ System.out.println("enabled, client-side OCSP checking is.");
+ System.out.println(fallback ? "enabled" : "disabled");
+ System.out.println("========================================");
+
+ Security.setProperty("ocsp.enable", fallback.toString());
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+ servParams.respTimeout = 1000;
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+
+ if (fallback) {
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else if (tr.serverExc != null) {
+ throw tr.serverExc;
+ }
+ } else {
+ if (!checkClientValidationFailure(tr.clientExc,
+ BasicReason.UNDETERMINED_REVOCATION_STATUS)) {
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else {
+ throw new RuntimeException(
+ "Expected client failure, but the client succeeded");
+ }
+ }
+ }
+ System.out.println(" PASS");
+ System.out.println("========================================\n");
+
+ // Remove the OCSP responder latency
+ intOcsp.stop();
+ rootOcsp.stop();
+ Thread.sleep(1000);
+ intOcsp.setDelay(0);
+ rootOcsp.setDelay(0);
+ rootOcsp.start();
+ intOcsp.start();
+ }
+
+ /*
+ * Define the server side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doServerSide(ServerParameters servParams) throws Exception {
+
+ // Selectively enable or disable the feature
+ System.setProperty("jdk.tls.server.enableStatusRequestExtension",
+ Boolean.toString(servParams.enabled));
+
+ // Set all the other operating parameters
+ System.setProperty("jdk.tls.stapling.cacheSize",
+ Integer.toString(servParams.cacheSize));
+ System.setProperty("jdk.tls.stapling.cacheLifetime",
+ Integer.toString(servParams.cacheLifetime));
+ System.setProperty("jdk.tls.stapling.responseTimeout",
+ Integer.toString(servParams.respTimeout));
+ System.setProperty("jdk.tls.stapling.responderURI", servParams.respUri);
+ System.setProperty("jdk.tls.stapling.responderOverride",
+ Boolean.toString(servParams.respOverride));
+ System.setProperty("jdk.tls.stapling.ignoreExtensions",
+ Boolean.toString(servParams.ignoreExts));
+
+ // Set keystores and trust stores for the server
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(serverKeystore, passwd.toCharArray());
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+ tmf.init(trustStore);
+
+ SSLContext sslc = SSLContext.getInstance("TLS");
+ sslc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+ SSLServerSocketFactory sslssf = sslc.getServerSocketFactory();
+ SSLServerSocket sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort);
+
+ serverPort = sslServerSocket.getLocalPort();
+
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ try (SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ InputStream sslIS = sslSocket.getInputStream();
+ OutputStream sslOS = sslSocket.getOutputStream()) {
+ int numberIn = sslIS.read();
+ int numberSent = 85;
+ log("Server received number: " + numberIn);
+ sslOS.write(numberSent);
+ sslOS.flush();
+ log("Server sent number: " + numberSent);
+ }
+ }
+
+ /*
+ * Define the client side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doClientSide(ClientParameters cliParams) throws Exception {
+
+ /*
+ * Wait for server to get started.
+ */
+ while (!serverReady) {
+ Thread.sleep(50);
+ }
+
+ // Selectively enable or disable the feature
+ System.setProperty("jdk.tls.client.enableStatusRequestExtension",
+ Boolean.toString(cliParams.enabled));
+
+ // Create the Trust Manager Factory using the PKIX variant
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+
+ // If we have a customized pkixParameters then use it
+ if (cliParams.pkixParams != null) {
+ // LIf we have a customized PKIXRevocationChecker, add
+ // it to the PKIXBuilderParameters.
+ if (cliParams.revChecker != null) {
+ cliParams.pkixParams.addCertPathChecker(cliParams.revChecker);
+ }
+
+ ManagerFactoryParameters trustParams =
+ new CertPathTrustManagerParameters(cliParams.pkixParams);
+ tmf.init(trustParams);
+ } else {
+ tmf.init(trustStore);
+ }
+
+ SSLContext sslc = SSLContext.getInstance("TLS");
+ sslc.init(null, tmf.getTrustManagers(), null);
+
+ SSLSocketFactory sslsf = sslc.getSocketFactory();
+ try (SSLSocket sslSocket = (SSLSocket)sslsf.createSocket("localhost",
+ serverPort);
+ InputStream sslIS = sslSocket.getInputStream();
+ OutputStream sslOS = sslSocket.getOutputStream()) {
+ int numberSent = 80;
+ sslOS.write(numberSent);
+ sslOS.flush();
+ log("Client sent number: " + numberSent);
+ int numberIn = sslIS.read();
+ log("Client received number:" + numberIn);
+ }
+ }
+
+ /*
+ * Primary constructor, used to drive remainder of the test.
+ *
+ * Fork off the other side, then do your work.
+ */
+ SSLSocketWithStapling(ClientParameters cliParams,
+ ServerParameters servParams) throws Exception {
+ Exception startException = null;
+ try {
+ if (separateServerThread) {
+ startServer(servParams, true);
+ startClient(cliParams, false);
+ } else {
+ startClient(cliParams, true);
+ startServer(servParams, false);
+ }
+ } catch (Exception e) {
+ startException = e;
+ }
+
+ /*
+ * Wait for other side to close down.
+ */
+ if (separateServerThread) {
+ if (serverThread != null) {
+ serverThread.join();
+ }
+ } else {
+ if (clientThread != null) {
+ clientThread.join();
+ }
+ }
+ }
+
+ /**
+ * Checks a validation failure to see if it failed for the reason we think
+ * it should. This comes in as an SSLException of some sort, but it
+ * encapsulates a ValidatorException which in turn encapsulates the
+ * CertPathValidatorException we are interested in.
+ *
+ * @param e the exception thrown at the top level
+ * @param reason the underlying CertPathValidatorException BasicReason
+ * we are expecting it to have.
+ *
+ * @return true if the reason matches up, false otherwise.
+ */
+ static boolean checkClientValidationFailure(Exception e,
+ BasicReason reason) {
+ boolean result = false;
+
+ if (e instanceof SSLException) {
+ Throwable valExc = e.getCause();
+ if (valExc instanceof sun.security.validator.ValidatorException) {
+ Throwable cause = valExc.getCause();
+ if (cause instanceof CertPathValidatorException) {
+ CertPathValidatorException cpve =
+ (CertPathValidatorException)cause;
+ if (cpve.getReason() == reason) {
+ result = true;
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ TestResult getResult() {
+ TestResult tr = new TestResult();
+ tr.clientExc = clientException;
+ tr.serverExc = serverException;
+ return tr;
+ }
+
+ void startServer(ServerParameters servParams, boolean newThread)
+ throws Exception {
+ if (newThread) {
+ serverThread = new Thread() {
+ public void run() {
+ try {
+ doServerSide(servParams);
+ } catch (Exception e) {
+ /*
+ * Our server thread just died.
+ *
+ * Release the client, if not active already...
+ */
+ System.err.println("Server died...");
+ serverReady = true;
+ serverException = e;
+ }
+ }
+ };
+ serverThread.start();
+ } else {
+ try {
+ doServerSide(servParams);
+ } catch (Exception e) {
+ serverException = e;
+ } finally {
+ serverReady = true;
+ }
+ }
+ }
+
+ void startClient(ClientParameters cliParams, boolean newThread)
+ throws Exception {
+ if (newThread) {
+ clientThread = new Thread() {
+ public void run() {
+ try {
+ doClientSide(cliParams);
+ } catch (Exception e) {
+ /*
+ * Our client thread just died.
+ */
+ System.err.println("Client died...");
+ clientException = e;
+ }
+ }
+ };
+ clientThread.start();
+ } else {
+ try {
+ doClientSide(cliParams);
+ } catch (Exception e) {
+ clientException = e;
+ }
+ }
+ }
+
+ /**
+ * Creates the PKI components necessary for this test, including
+ * Root CA, Intermediate CA and SSL server certificates, the keystores
+ * for each entity, a client trust store, and starts the OCSP responders.
+ */
+ private static void createPKI() throws Exception {
+ CertificateBuilder cbld = new CertificateBuilder();
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+ keyGen.initialize(2048);
+ KeyStore.Builder keyStoreBuilder =
+ KeyStore.Builder.newInstance("PKCS12", null,
+ new KeyStore.PasswordProtection(passwd.toCharArray()));
+
+ // Generate Root, IntCA, EE keys
+ KeyPair rootCaKP = keyGen.genKeyPair();
+ log("Generated Root CA KeyPair");
+ KeyPair intCaKP = keyGen.genKeyPair();
+ log("Generated Intermediate CA KeyPair");
+ KeyPair sslKP = keyGen.genKeyPair();
+ log("Generated SSL Cert KeyPair");
+
+ // Set up the Root CA Cert
+ cbld.setSubjectName("CN=Root CA Cert, O=SomeCompany");
+ cbld.setPublicKey(rootCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("1"));
+ // Make a 3 year validity starting from 60 days ago
+ long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(60);
+ long end = start + TimeUnit.DAYS.toMillis(1085);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, rootCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ // Make our Root CA Cert!
+ X509Certificate rootCert = cbld.build(null, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Root CA Created:\n" + certInfo(rootCert));
+
+ // Now build a keystore and add the keys and cert
+ rootKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] rootChain = {rootCert};
+ rootKeystore.setKeyEntry(ROOT_ALIAS, rootCaKP.getPrivate(),
+ passwd.toCharArray(), rootChain);
+
+ // Now fire up the OCSP responder
+ rootOcsp = new SimpleOCSPServer(rootKeystore, passwd, ROOT_ALIAS, null);
+ rootOcsp.enableLog(debug);
+ rootOcsp.setNextUpdateInterval(3600);
+ rootOcsp.start();
+ Thread.sleep(1000); // Give the server a second to start up
+ rootOcspPort = rootOcsp.getPort();
+ String rootRespURI = "http://localhost:" + rootOcspPort;
+ log("Root OCSP Responder URI is " + rootRespURI);
+
+ // Now that we have the root keystore and OCSP responder we can
+ // create our intermediate CA.
+ cbld.reset();
+ cbld.setSubjectName("CN=Intermediate CA Cert, O=SomeCompany");
+ cbld.setPublicKey(intCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("100"));
+ // Make a 2 year validity starting from 30 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30);
+ end = start + TimeUnit.DAYS.toMillis(730);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, intCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ cbld.addAIAExt(Collections.singletonList(rootRespURI));
+ // Make our Intermediate CA Cert!
+ X509Certificate intCaCert = cbld.build(rootCert, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Intermediate CA Created:\n" + certInfo(intCaCert));
+
+ // Provide intermediate CA cert revocation info to the Root CA
+ // OCSP responder.
+ Map revInfo =
+ new HashMap<>();
+ revInfo.put(intCaCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ rootOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ intKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] intChain = {intCaCert, rootCert};
+ intKeystore.setKeyEntry(INT_ALIAS, intCaKP.getPrivate(),
+ passwd.toCharArray(), intChain);
+ intKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // Now fire up the Intermediate CA OCSP responder
+ intOcsp = new SimpleOCSPServer(intKeystore, passwd,
+ INT_ALIAS, null);
+ intOcsp.enableLog(debug);
+ intOcsp.setNextUpdateInterval(3600);
+ intOcsp.start();
+ Thread.sleep(1000);
+ intOcspPort = intOcsp.getPort();
+ String intCaRespURI = "http://localhost:" + intOcspPort;
+ log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
+
+ // Last but not least, let's make our SSLCert and add it to its own
+ // Keystore
+ cbld.reset();
+ cbld.setSubjectName("CN=SSLCertificate, O=SomeCompany");
+ cbld.setPublicKey(sslKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("4096"));
+ // Make a 1 year validity starting from 7 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7);
+ end = start + TimeUnit.DAYS.toMillis(365);
+ cbld.setValidity(new Date(start), new Date(end));
+
+ // Add extensions
+ addCommonExts(cbld, sslKP.getPublic(), intCaKP.getPublic());
+ boolean[] kuBits = {true, false, true, false, false, false,
+ false, false, false};
+ cbld.addKeyUsageExt(kuBits);
+ List ekuOids = new ArrayList<>();
+ ekuOids.add("1.3.6.1.5.5.7.3.1");
+ ekuOids.add("1.3.6.1.5.5.7.3.2");
+ cbld.addExtendedKeyUsageExt(ekuOids);
+ cbld.addSubjectAltNameDNSExt(Collections.singletonList("localhost"));
+ cbld.addAIAExt(Collections.singletonList(intCaRespURI));
+ // Make our SSL Server Cert!
+ X509Certificate sslCert = cbld.build(intCaCert, intCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("SSL Certificate Created:\n" + certInfo(sslCert));
+
+ // Provide SSL server cert revocation info to the Intermeidate CA
+ // OCSP responder.
+ revInfo = new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ serverKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] sslChain = {sslCert, intCaCert, rootCert};
+ serverKeystore.setKeyEntry(SSL_ALIAS, sslKP.getPrivate(),
+ passwd.toCharArray(), sslChain);
+ serverKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // And finally a Trust Store for the client
+ trustStore = keyStoreBuilder.getKeyStore();
+ trustStore.setCertificateEntry(ROOT_ALIAS, rootCert);
+ }
+
+ private static void addCommonExts(CertificateBuilder cbld,
+ PublicKey subjKey, PublicKey authKey) throws IOException {
+ cbld.addSubjectKeyIdExt(subjKey);
+ cbld.addAuthorityKeyIdExt(authKey);
+ }
+
+ private static void addCommonCAExts(CertificateBuilder cbld)
+ throws IOException {
+ cbld.addBasicConstraintsExt(true, true, -1);
+ // Set key usage bits for digitalSignature, keyCertSign and cRLSign
+ boolean[] kuBitSettings = {true, false, false, false, false, true,
+ true, false, false};
+ cbld.addKeyUsageExt(kuBitSettings);
+ }
+
+ /**
+ * Helper routine that dumps only a few cert fields rather than
+ * the whole toString() output.
+ *
+ * @param cert an X509Certificate to be displayed
+ *
+ * @return the String output of the issuer, subject and
+ * serial number
+ */
+ private static String certInfo(X509Certificate cert) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Issuer: ").append(cert.getIssuerX500Principal()).
+ append("\n");
+ sb.append("Subject: ").append(cert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("Serial: ").append(cert.getSerialNumber()).append("\n");
+ return sb.toString();
+ }
+
+ /**
+ * Log a message on stdout
+ *
+ * @param message The message to log
+ */
+ private static void log(String message) {
+ if (debug) {
+ System.out.println(message);
+ }
+ }
+
+ // The following two classes are Simple nested class to group a handful
+ // of configuration parameters used before starting a client or server.
+ // We'll just access the data members directly for convenience.
+ static class ClientParameters {
+ boolean enabled = true;
+ PKIXBuilderParameters pkixParams = null;
+ PKIXRevocationChecker revChecker = null;
+
+ ClientParameters() { }
+ }
+
+ static class ServerParameters {
+ boolean enabled = true;
+ int cacheSize = 256;
+ int cacheLifetime = 3600;
+ int respTimeout = 5000;
+ String respUri = "";
+ boolean respOverride = false;
+ boolean ignoreExts = false;
+
+ ServerParameters() { }
+ }
+
+ static class TestResult {
+ Exception serverExc = null;
+ Exception clientExc = null;
+ }
+
+}
diff --git a/jdk/test/jdk/internal/jimage/ExecutableTest.java b/jdk/test/jdk/internal/jimage/ExecutableTest.java
index 4ee9fd1f038..be24539eff5 100644
--- a/jdk/test/jdk/internal/jimage/ExecutableTest.java
+++ b/jdk/test/jdk/internal/jimage/ExecutableTest.java
@@ -27,7 +27,9 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermission;
import static java.nio.file.attribute.PosixFilePermission.*;
+import java.util.Arrays;
import java.util.EnumSet;
+import java.util.HashSet;
import java.util.Set;
/*
@@ -41,6 +43,11 @@ import java.util.Set;
public class ExecutableTest {
+ // The bin/ directory may contain non-executable files (see 8132704)
+ private static final String[] exclude = { "jmc.ini" };
+ private static final Set excludeSet =
+ new HashSet(Arrays.asList(exclude));
+
public static void main(String args[]) throws Throwable {
String JAVA_HOME = System.getProperty("java.home");
Path binPath = Paths.get(JAVA_HOME, "bin");
@@ -48,6 +55,7 @@ public class ExecutableTest {
EnumSet execPerms =
EnumSet.of(GROUP_EXECUTE, OTHERS_EXECUTE, OWNER_EXECUTE);
for (Path entry : stream) {
+ if (excludeSet.contains(entry.getFileName().toString())) continue;
if (Files.isRegularFile(entry)) {
if (!Files.isExecutable(entry)) {
throw new Error(entry + " is not executable!");
diff --git a/jdk/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java b/jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java
similarity index 58%
rename from jdk/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java
rename to jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java
index 5f069c474e5..abed0385ebe 100644
--- a/jdk/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java
+++ b/jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java
@@ -21,11 +21,18 @@
* questions.
*/
+import java.io.IOException;
import java.net.URISyntaxException;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.List;
+
+import jdk.testlibrary.Asserts;
+import jdk.testlibrary.Utils;
+import jdk.test.lib.apps.LingeredApp;
import sun.jvmstat.monitor.MonitorException;
import sun.jvmstat.monitor.MonitoredHost;
import sun.jvmstat.monitor.MonitoredVm;
+import sun.jvmstat.monitor.MonitoredVmUtil;
import sun.jvmstat.monitor.VmIdentifier;
/**
@@ -33,41 +40,41 @@ import sun.jvmstat.monitor.VmIdentifier;
* @test
* @bug 6672135
* @summary setInterval() for local MonitoredHost and local MonitoredVm
- * @author Tomas Hurka
* @modules jdk.jvmstat/sun.jvmstat.monitor
- * @run main/othervm -XX:+UsePerfData CR6672135
+ * @library /lib/testlibrary
+ * @library /../../test/lib/share/classes
+ * @build jdk.testlibrary.*
+ * @build jdk.test.lib.apps.*
+ * @run main TestPollingInterval
*/
-public class CR6672135 {
+public class TestPollingInterval {
private static final int INTERVAL = 2000;
- public static void main(String[] args) {
- int vmInterval;
- int hostInterval;
-
+ public static void main(String[] args) throws IOException,
+ MonitorException, URISyntaxException {
+ LingeredApp app = null;
try {
+ List vmArgs = new ArrayList();
+ vmArgs.add("-XX:+UsePerfData");
+ vmArgs.addAll(Utils.getVmOptions());
+ app = LingeredApp.startApp(vmArgs);
+
MonitoredHost localHost = MonitoredHost.getMonitoredHost("localhost");
- Set vms = localHost.activeVms();
- Integer vmInt = (Integer) vms.iterator().next();
- String uriString = "//" + vmInt + "?mode=r"; // NOI18N
+ String uriString = "//" + app.getPid() + "?mode=r"; // NOI18N
VmIdentifier vmId = new VmIdentifier(uriString);
MonitoredVm vm = localHost.getMonitoredVm(vmId);
+ System.out.println("Monitored vm command line: " + MonitoredVmUtil.commandLine(vm));
vm.setInterval(INTERVAL);
localHost.setInterval(INTERVAL);
- vmInterval = vm.getInterval();
- hostInterval = localHost.getInterval();
- } catch (Exception ex) {
- throw new Error ("Test failed",ex);
- }
- System.out.println("VM "+vmInterval);
- if (vmInterval != INTERVAL) {
- throw new Error("Test failed");
- }
- System.out.println("Host "+hostInterval);
- if (hostInterval != INTERVAL) {
- throw new Error("Test failed");
- }
- }
-}
+ Asserts.assertEquals(vm.getInterval(), INTERVAL, "Monitored vm interval should be equal the test value");
+ Asserts.assertEquals(localHost.getInterval(), INTERVAL, "Monitored host interval should be equal the test value");
+ } finally {
+ LingeredApp.stopApp(app);
+ }
+
+ }
+
+}
diff --git a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh
index 7ace853fcad..2e3fac89fb0 100644
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh
@@ -26,6 +26,7 @@
# @bug 6528083
# @summary Test RMI Bootstrap
#
+# @key intermittent
# @library /lib/testlibrary
# @modules java.management/sun.management
# java.management/sun.management.jmxremote
diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java
index 4d1eef69f50..3659bec98c9 100644
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java
@@ -40,6 +40,7 @@ import jdk.testlibrary.ProcessTools;
* @bug 8075926
* @summary Makes sure that the current management agent status is reflected
* in the related performance counters.
+ * @key intermittent
* @library /lib/testlibrary
* @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
* @run testng/othervm -XX:+UsePerfData JMXStatusPerfCountersTest
diff --git a/jdk/test/sun/nio/cs/NIOJISAutoDetectTest.java b/jdk/test/sun/nio/cs/NIOJISAutoDetectTest.java
index 68aacf82552..42a418027f3 100644
--- a/jdk/test/sun/nio/cs/NIOJISAutoDetectTest.java
+++ b/jdk/test/sun/nio/cs/NIOJISAutoDetectTest.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4831163 5053096 5056440
+ * @bug 4831163 5053096 5056440 8022224
* @summary NIO charset basic verification of JISAutodetect decoder
* @author Martin Buchholz
*/
@@ -239,6 +239,14 @@ public class NIOJISAutoDetectTest {
check(cb.position() == 2, "cb.position()");
}
+ // test #8022224
+ Charset cs = Charset.forName("x-JISAutoDetect");
+ ByteBuffer bb = ByteBuffer.wrap(new byte[] { 'a', 0x1b, 0x24, 0x40 });
+ CharBuffer cb = CharBuffer.wrap(new char[10]);
+ CoderResult cr = cs.newDecoder().decode(bb, cb, false);
+ bb.rewind();
+ cb.clear().limit(1);
+ check(cr == cs.newDecoder().decode(bb, cb, false), "#8022224");
if (failures > 0)
throw new RuntimeException(failures + " tests failed");
diff --git a/jdk/test/sun/security/krb5/auto/KDC.java b/jdk/test/sun/security/krb5/auto/KDC.java
index f0a664efa8c..0964e08f69f 100644
--- a/jdk/test/sun/security/krb5/auto/KDC.java
+++ b/jdk/test/sun/security/krb5/auto/KDC.java
@@ -745,9 +745,10 @@ public class KDC {
bFlags[Krb5.TKT_OPTS_FORWARDABLE] = true;
}
}
+ // We do not request for addresses for FORWARDED tickets
if (options.containsKey(Option.CHECK_ADDRESSES)
&& body.kdcOptions.get(KDCOptions.FORWARDED)
- && body.addresses == null) {
+ && body.addresses != null) {
throw new KrbException(Krb5.KDC_ERR_BADOPTION);
}
if (body.kdcOptions.get(KDCOptions.FORWARDED) ||
diff --git a/jdk/test/sun/security/provider/certpath/Extensions/OCSPNonceExtensionTests.java b/jdk/test/sun/security/provider/certpath/Extensions/OCSPNonceExtensionTests.java
new file mode 100644
index 00000000000..ed23a85f1b0
--- /dev/null
+++ b/jdk/test/sun/security/provider/certpath/Extensions/OCSPNonceExtensionTests.java
@@ -0,0 +1,458 @@
+/*
+ * Copyright (c) 2015, 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 8046321
+ * @summary Unit tests for OCSPNonceExtension objects
+ */
+
+import java.security.cert.Extension;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.*;
+
+import sun.security.util.DerValue;
+import sun.security.util.DerInputStream;
+import sun.security.util.ObjectIdentifier;
+import sun.security.provider.certpath.OCSPNonceExtension;
+import sun.security.x509.PKIXExtensions;
+
+public class OCSPNonceExtensionTests {
+ public static final boolean DEBUG = true;
+ public static final String OCSP_NONCE_OID = "1.3.6.1.5.5.7.48.1.2";
+ public static final String ELEMENT_NONCE = "nonce";
+ public static final String EXT_NAME = "OCSPNonce";
+
+ // DER encoding for OCSP nonce extension:
+ // OID = 1.3.6.1.5.5.7.48.1.2
+ // Critical = true
+ // 48 bytes of 0xDEADBEEF
+ public static final byte[] OCSP_NONCE_DER = {
+ 48, 66, 6, 9, 43, 6, 1, 5,
+ 5, 7, 48, 1, 2, 1, 1, -1,
+ 4, 50, 4, 48, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17,
+ };
+
+ // 16 bytes of 0xDEADBEEF
+ public static final byte[] DEADBEEF_16 = {
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ };
+
+ // DER encoded extension using 16 bytes of DEADBEEF
+ public static final byte[] OCSP_NONCE_DB16 = {
+ 48, 31, 6, 9, 43, 6, 1, 5,
+ 5, 7, 48, 1, 2, 4, 18, 4,
+ 16, -34, -83, -66, -17, -34, -83, -66,
+ -17, -34, -83, -66, -17, -34, -83, -66,
+ -17
+ };
+
+ public static void main(String [] args) throws Exception {
+ Map testList =
+ new LinkedHashMap() {{
+ put("CTOR Test (provide length)", testCtorByLength);
+ put("CTOR Test (provide extension DER encoding)",
+ testCtorSuperByDerValue);
+ put("Use set() call to provide random data", testResetValue);
+ put("Test get() method", testGet);
+ put("test set() method", testSet);
+ put("Test getElements() method", testGetElements);
+ put("Test getName() method", testGetName);
+ put("Test delete() method", testDelete);
+ }};
+
+ System.out.println("============ Tests ============");
+ int testNo = 0;
+ int numberFailed = 0;
+ Map.Entry result;
+ for (String testName : testList.keySet()) {
+ System.out.println("Test " + ++testNo + ": " + testName);
+ result = testList.get(testName).runTest();
+ System.out.print("Result: " + (result.getKey() ? "PASS" : "FAIL"));
+ System.out.println(" " +
+ (result.getValue() != null ? result.getValue() : ""));
+ System.out.println("-------------------------------------------");
+ if (!result.getKey()) {
+ numberFailed++;
+ }
+ }
+ System.out.println("End Results: " + (testList.size() - numberFailed) +
+ " Passed" + ", " + numberFailed + " Failed.");
+ if (numberFailed > 0) {
+ throw new RuntimeException(
+ "One or more tests failed, see test output for details");
+ }
+ }
+
+ private static void dumpHexBytes(byte[] data) {
+ if (data != null) {
+ for (int i = 0; i < data.length; i++) {
+ if (i % 16 == 0 && i != 0) {
+ System.out.print("\n");
+ }
+ System.out.print(String.format("%02X ", data[i]));
+ }
+ System.out.print("\n");
+ }
+ }
+
+ private static void debuglog(String message) {
+ if (DEBUG) {
+ System.out.println(message);
+ }
+ }
+
+ public static void verifyExtStructure(byte[] derData) throws IOException {
+ debuglog("verifyASN1Extension() received " + derData.length + " bytes");
+ DerInputStream dis = new DerInputStream(derData);
+
+ // The sequenceItems array should be either two or three elements
+ // long. If three, then the criticality bit setting has been asserted.
+ DerValue[] sequenceItems = dis.getSequence(3);
+ debuglog("Found sequence containing " + sequenceItems.length +
+ " elements");
+ if (sequenceItems.length != 2 && sequenceItems.length != 3) {
+ throw new RuntimeException("Incorrect number of items found in " +
+ "the SEQUENCE (Got " + sequenceItems.length +
+ ", expected 2 or 3 items)");
+ }
+
+ int seqIndex = 0;
+ ObjectIdentifier extOid = sequenceItems[seqIndex++].getOID();
+ debuglog("Found OID: " + extOid.toString());
+ if (!extOid.equals((Object)PKIXExtensions.OCSPNonce_Id)) {
+ throw new RuntimeException("Incorrect OID (Got " +
+ extOid.toString() + ", expected " +
+ PKIXExtensions.OCSPNonce_Id.toString() + ")");
+ }
+
+ if (sequenceItems.length == 3) {
+ // Non-default criticality bit setting should be at index 1
+ boolean isCrit = sequenceItems[seqIndex++].getBoolean();
+ debuglog("Found BOOLEAN (critical): " + isCrit);
+ }
+
+ // The extnValue is an encapsulating OCTET STRING that contains the
+ // extension's value. For the OCSP Nonce, that value itself is also
+ // an OCTET STRING consisting of the random bytes.
+ DerValue extnValue =
+ new DerValue(sequenceItems[seqIndex++].getOctetString());
+ byte[] nonceData = extnValue.getOctetString();
+ debuglog("Found " + nonceData.length + " bytes of nonce data");
+ }
+
+ public interface TestCase {
+ Map.Entry runTest();
+ }
+
+ public static final TestCase testCtorByLength = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+ Extension nonceByLen = new OCSPNonceExtension(32);
+
+ // Verify overall encoded extension structure
+ nonceByLen.encode(baos);
+ verifyExtStructure(baos.toByteArray());
+
+ // Verify the name, elements, and data conform to
+ // expected values for this specific object.
+ boolean crit = nonceByLen.isCritical();
+ String oid = nonceByLen.getId();
+ DerValue nonceData = new DerValue(nonceByLen.getValue());
+
+ if (crit) {
+ message = "Extension incorrectly marked critical";
+ } else if (!oid.equals(OCSP_NONCE_OID)) {
+ message = "Incorrect OID (Got " + oid + ", Expected " +
+ OCSP_NONCE_OID + ")";
+ } else if (nonceData.getTag() != DerValue.tag_OctetString) {
+ message = "Incorrect nonce data tag type (Got " +
+ String.format("0x%02X", nonceData.getTag()) +
+ ", Expected 0x04)";
+ } else if (nonceData.getOctetString().length != 32) {
+ message = "Incorrect nonce byte length (Got " +
+ nonceData.getOctetString().length +
+ ", Expected 32)";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testCtorSuperByDerValue = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+ Extension nonceByDer = new sun.security.x509.Extension(
+ new DerValue(OCSP_NONCE_DER));
+
+ // Verify overall encoded extension structure
+ nonceByDer.encode(baos);
+ verifyExtStructure(baos.toByteArray());
+
+ // Verify the name, elements, and data conform to
+ // expected values for this specific object.
+ boolean crit = nonceByDer.isCritical();
+ String oid = nonceByDer.getId();
+ DerValue nonceData = new DerValue(nonceByDer.getValue());
+
+ if (!crit) {
+ message = "Extension lacks expected criticality setting";
+ } else if (!oid.equals(OCSP_NONCE_OID)) {
+ message = "Incorrect OID (Got " + oid + ", Expected " +
+ OCSP_NONCE_OID + ")";
+ } else if (nonceData.getTag() != DerValue.tag_OctetString) {
+ message = "Incorrect nonce data tag type (Got " +
+ String.format("0x%02X", nonceData.getTag()) +
+ ", Expected 0x04)";
+ } else if (nonceData.getOctetString().length != 48) {
+ message = "Incorrect nonce byte length (Got " +
+ nonceData.getOctetString().length +
+ ", Expected 48)";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testResetValue = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+ OCSPNonceExtension nonce = new OCSPNonceExtension(32);
+
+ // Reset the nonce data to reflect 16 bytes of DEADBEEF
+ nonce.set(OCSPNonceExtension.NONCE, (Object)DEADBEEF_16);
+
+ // Verify overall encoded extension content
+ nonce.encode(baos);
+ dumpHexBytes(OCSP_NONCE_DB16);
+ System.out.println();
+ dumpHexBytes(baos.toByteArray());
+
+ pass = Arrays.equals(baos.toByteArray(), OCSP_NONCE_DB16);
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testSet = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ OCSPNonceExtension nonceByLen = new OCSPNonceExtension(32);
+
+ // Set the nonce data to 16 bytes of DEADBEEF
+ nonceByLen.set(ELEMENT_NONCE, DEADBEEF_16);
+ byte[] nonceData = (byte[])nonceByLen.get(ELEMENT_NONCE);
+ if (!Arrays.equals(nonceData, DEADBEEF_16)) {
+ throw new RuntimeException("Retuned nonce data does not " +
+ "match expected result");
+ }
+
+ // Now try to set a value using an object that is not a byte
+ // array
+ int[] INT_DB_16 = {
+ 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF
+ };
+ try {
+ nonceByLen.set(ELEMENT_NONCE, INT_DB_16);
+ throw new RuntimeException("Accepted get() for " +
+ "unsupported element name");
+ } catch (IOException ioe) { } // Expected result
+
+ // And try setting a value using an unknown element name
+ try {
+ nonceByLen.set("FOO", DEADBEEF_16);
+ throw new RuntimeException("Accepted get() for " +
+ "unsupported element name");
+ } catch (IOException ioe) { } // Expected result
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testGet = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ OCSPNonceExtension nonceByLen = new OCSPNonceExtension(32);
+
+ // Grab the nonce data by its correct element name
+ byte[] nonceData = (byte[])nonceByLen.get(ELEMENT_NONCE);
+ if (nonceData == null || nonceData.length != 32) {
+ throw new RuntimeException("Unexpected return value from " +
+ "get() method: either null or incorrect length");
+ }
+
+ // Now try to get any kind of data using an element name that
+ // doesn't exist for this extension.
+ try {
+ nonceByLen.get("FOO");
+ throw new RuntimeException("Accepted get() for " +
+ "unsupported element name");
+ } catch (IOException ioe) { } // Expected result
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testGetElements = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ OCSPNonceExtension nonceByLen = new OCSPNonceExtension(32);
+
+ int elementCount = 0;
+ boolean foundElement = false;
+
+ // There should be exactly one element and its name should
+ // be "nonce"
+ for (Enumeration elements = nonceByLen.getElements();
+ elements.hasMoreElements(); elementCount++) {
+ if (elements.nextElement().equals(ELEMENT_NONCE)) {
+ foundElement = true;
+ }
+ }
+
+ if (!foundElement || elementCount != 1) {
+ throw new RuntimeException("Unexpected or missing " +
+ "Enumeration element");
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testGetName = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ OCSPNonceExtension nonceByLen = new OCSPNonceExtension(32);
+ pass = new Boolean(nonceByLen.getName().equals(EXT_NAME));
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testDelete = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ OCSPNonceExtension nonceByLen = new OCSPNonceExtension(32);
+
+ // First verify that there's data to begin with
+ byte[] nonceData = (byte[])nonceByLen.get(ELEMENT_NONCE);
+ if (nonceData == null || nonceData.length != 32) {
+ throw new RuntimeException("Unexpected return value from " +
+ "get() method: either null or incorrect length");
+ }
+
+ // Attempt to delete using an element name that doesn't exist
+ // for this extension.
+ try {
+ nonceByLen.delete("FOO");
+ throw new RuntimeException("Accepted delete() for " +
+ "unsupported element name");
+ } catch (IOException ioe) { } // Expected result
+
+ // Now attempt to properly delete the extension data
+ nonceByLen.delete(ELEMENT_NONCE);
+ nonceData = (byte[])nonceByLen.get(ELEMENT_NONCE);
+ if (nonceData != null) {
+ throw new RuntimeException("Unexpected non-null return");
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+}
diff --git a/jdk/test/sun/security/provider/certpath/ResponderId/ResponderIdTests.java b/jdk/test/sun/security/provider/certpath/ResponderId/ResponderIdTests.java
new file mode 100644
index 00000000000..30aa5230698
--- /dev/null
+++ b/jdk/test/sun/security/provider/certpath/ResponderId/ResponderIdTests.java
@@ -0,0 +1,419 @@
+/*
+ * Copyright (c) 2015, 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 8046321
+ * @summary OCSP Stapling for TLS (ResponderId tests)
+ */
+
+import java.io.*;
+import java.security.cert.*;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.util.AbstractMap;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+import javax.security.auth.x500.X500Principal;
+import sun.security.x509.KeyIdentifier;
+import sun.security.provider.certpath.ResponderId;
+
+/*
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class ResponderIdTests {
+
+ private static final boolean debug = true;
+
+ // Source certificate created with the following command:
+ // keytool -genkeypair -alias test1 -keyalg rsa -keysize 2048 \
+ // -validity 7300 -keystore test1.jks \
+ // -dname "CN=SelfSignedResponder, OU=Validation Services, O=FakeCompany"
+ private static final String RESP_CERT_1 =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIIDQzCCAiugAwIBAgIEXTqCCjANBgkqhkiG9w0BAQsFADBSMRQwEgYDVQQKEwtG\n" +
+ "YWtlQ29tcGFueTEcMBoGA1UECxMTVmFsaWRhdGlvbiBTZXJ2aWNlczEcMBoGA1UE\n" +
+ "AxMTU2VsZlNpZ25lZFJlc3BvbmRlcjAeFw0xNDA4MTcwNDM2MzBaFw0zNDA4MTIw\n" +
+ "NDM2MzBaMFIxFDASBgNVBAoTC0Zha2VDb21wYW55MRwwGgYDVQQLExNWYWxpZGF0\n" +
+ "aW9uIFNlcnZpY2VzMRwwGgYDVQQDExNTZWxmU2lnbmVkUmVzcG9uZGVyMIIBIjAN\n" +
+ "BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApt2Cmw2k9tviLxaxE8aWNuoosWKL\n" +
+ "h+K4mNcDGKSoiChsqRqeJEnOxijDZqyFwfkaXvpAduFqYjz+Lij2HumvAjHDTui6\n" +
+ "bGcbsndRDPjvVo1S7f1oWsg7oiA8Lzmjl452S7UNBsDX5Dt1e84Xxwi40B1J2y8D\n" +
+ "FRPfYRWRlC1Z4kzqkBBa7JhANS+W8KDstFZxL4AwWH/byNwB5dl2j04ohg/Ar54e\n" +
+ "mu08PIH3hmi0pAu5wn9ariA7UA5lFWRJzvgGXV5J+QVEFuvKmeJ/Q6tU5OBJGw98\n" +
+ "zjd7F5B0iE+rJHTNF1aGaQfIorz04onV2WjH2VZA18AaMwqlY2br1SBdTQIDAQAB\n" +
+ "oyEwHzAdBgNVHQ4EFgQUG09HasSTYaTIh/CxxV/rcJV1LvowDQYJKoZIhvcNAQEL\n" +
+ "BQADggEBAIcUomNpZxGkocIzzybLyeyC6vLF1k0/unuPAHZLDP3o2JTstPhLHOCg\n" +
+ "FYw1VG2i23pjwKK2x/o80tJAOmW6vowbAPnNmtNIYO3gB/ZGiKeORoGKBCRDNvFa\n" +
+ "6ZrWxwTzT3EpVwRe7ameES0uP8+S4q2P5LhwMIMw7vGHoOQJgkAh/NUiCli1qRnJ\n" +
+ "FYd6cHMJJK5gF2FqQ7tdbA26pS06bkIEvil2M5wyKKWOydOa/pr1LgMf9KxljJ8J\n" +
+ "XlAOO/mGZGkYmWnQaQuBIDyWunWYlhsyCXMa8AScgs0uUeQp19tO7R0f03q/JXoZ\n" +
+ "1At1gZiMS7SdQaRWP5q+FunAeFWjsFE=\n" +
+ "-----END CERTIFICATE-----";
+
+ private static final String RESP_CERT_1_SUBJ =
+ "CN=SelfSignedResponder, OU=Validation Services, O=FakeCompany";
+
+ private static X509Certificate cert = null;
+
+ // The expected DER-encoding for a byName ResponderId derived
+ // from RESP_CERT_1
+ private static final byte[] EXP_NAME_ID_BYTES = {
+ -95, 84, 48, 82, 49, 20, 48, 18,
+ 6, 3, 85, 4, 10, 19, 11, 70,
+ 97, 107, 101, 67, 111, 109, 112, 97,
+ 110, 121, 49, 28, 48, 26, 6, 3,
+ 85, 4, 11, 19, 19, 86, 97, 108,
+ 105, 100, 97, 116, 105, 111, 110, 32,
+ 83, 101, 114, 118, 105, 99, 101, 115,
+ 49, 28, 48, 26, 6, 3, 85, 4,
+ 3, 19, 19, 83, 101, 108, 102, 83,
+ 105, 103, 110, 101, 100, 82, 101, 115,
+ 112, 111, 110, 100, 101, 114
+ };
+
+ // The expected DER-encoding for a byKey ResponderId derived
+ // from RESP_CERT_1
+ private static final byte[] EXP_KEY_ID_BYTES = {
+ -94, 22, 4, 20, 27, 79, 71, 106,
+ -60, -109, 97, -92, -56, -121, -16, -79,
+ -59, 95, -21, 112, -107, 117, 46, -6
+ };
+
+ // The DER encoding of a byKey ResponderId, but using an
+ // incorrect explicit tagging (CONTEXT CONSTRUCTED 3)
+ private static final byte[] INV_EXPLICIT_TAG_KEY_ID = {
+ -93, 22, 4, 20, 27, 79, 71, 106,
+ -60, -109, 97, -92, -56, -121, -16, -79,
+ -59, 95, -21, 112, -107, 117, 46, -6
+ };
+
+ // These two ResponderId objects will have objects attached to them
+ // after the pos_CtorByName and pos_CtorByKeyId tests run. Those
+ // two tests should always be the first two that run.
+ public static ResponderId respByName;
+ public static ResponderId respByKeyId;
+
+ public static void main(String[] args) throws Exception {
+ List testList = new ArrayList<>();
+
+ testList.add(pos_CtorByName);
+ testList.add(pos_CtorByKeyId);
+ testList.add(pos_CtorByEncoding);
+ testList.add(neg_CtorByEncoding);
+ testList.add(pos_Equality);
+ testList.add(pos_GetEncoded);
+ testList.add(pos_GetRespName);
+ testList.add(pos_GetRespKeyId);
+
+ // Load the certificate object we can use for subsequent tests
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ cert = (X509Certificate)cf.generateCertificate(
+ new ByteArrayInputStream(RESP_CERT_1.getBytes()));
+
+ System.out.println("============ Tests ============");
+ int testNo = 0;
+ int numberFailed = 0;
+ Map.Entry result;
+ for (TestCase test : testList) {
+ System.out.println("Test " + ++testNo + ": " + test.getName());
+ result = test.runTest();
+ System.out.print("Result: " + (result.getKey() ? "PASS" : "FAIL"));
+ System.out.println(" " +
+ (result.getValue() != null ? result.getValue() : ""));
+ System.out.println("-------------------------------------------");
+ if (!result.getKey()) {
+ numberFailed++;
+ }
+ }
+ System.out.println("End Results: " + (testList.size() - numberFailed) +
+ " Passed" + ", " + numberFailed + " Failed.");
+ if (numberFailed > 0) {
+ throw new RuntimeException(
+ "One or more tests failed, see test output for details");
+ }
+ }
+
+ private static void dumpHexBytes(byte[] data) {
+ if (data != null) {
+ for (int i = 0; i < data.length; i++) {
+ if (i % 16 == 0 && i != 0) {
+ System.out.print("\n");
+ }
+ System.out.print(String.format("%02X ", data[i]));
+ }
+ System.out.print("\n");
+ }
+ }
+
+ public interface TestCase {
+ String getName();
+ Map.Entry runTest();
+ }
+
+ public static final TestCase pos_CtorByName = new TestCase() {
+ @Override
+ public String getName() {
+ return "CTOR Test (by-name)";
+ }
+
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ respByName = new ResponderId(cert.getSubjectX500Principal());
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase pos_CtorByKeyId = new TestCase() {
+ @Override
+ public String getName() {
+ return "CTOR Test (by-keyID)";
+ }
+
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ respByKeyId = new ResponderId(cert.getPublicKey());
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase pos_CtorByEncoding = new TestCase() {
+ @Override
+ public String getName() {
+ return "CTOR Test (encoded bytes)";
+ }
+
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ ResponderId ridByNameBytes = new ResponderId(EXP_NAME_ID_BYTES);
+ ResponderId ridByKeyIdBytes = new ResponderId(EXP_KEY_ID_BYTES);
+
+ if (!ridByNameBytes.equals(respByName)) {
+ throw new RuntimeException(
+ "Equals failed: respNameFromBytes vs. respByName");
+ } else if (!ridByKeyIdBytes.equals(respByKeyId)) {
+ throw new RuntimeException(
+ "Equals failed: respKeyFromBytes vs. respByKeyId");
+ }
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase neg_CtorByEncoding = new TestCase() {
+ @Override
+ public String getName() {
+ return "CTOR Test (by encoding, unknown explicit tag)";
+ }
+
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ ResponderId ridByKeyIdBytes =
+ new ResponderId(INV_EXPLICIT_TAG_KEY_ID);
+ throw new RuntimeException("Expected IOException not thrown");
+ } catch (IOException ioe) {
+ // Make sure it's the IOException we're looking for
+ if (ioe.getMessage().contains("Invalid ResponderId content")) {
+ pass = Boolean.TRUE;
+ } else {
+ ioe.printStackTrace(System.out);
+ message = ioe.getClass().getName();
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+
+ public static final TestCase pos_Equality = new TestCase() {
+ @Override
+ public String getName() {
+ return "Simple Equality Test";
+ }
+
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+
+ try {
+ // byName ResponderId equality test
+ ResponderId compName =
+ new ResponderId(new X500Principal(RESP_CERT_1_SUBJ));
+ if (!respByName.equals(compName)) {
+ message = "ResponderId mismatch in byName comparison";
+ } else if (respByKeyId.equals(compName)) {
+ message = "Invalid ResponderId match in byKeyId comparison";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase pos_GetEncoded = new TestCase() {
+ @Override
+ public String getName() {
+ return "Get Encoded Value";
+ }
+
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+
+ try {
+ // Pull out byName and byKey encodings, they should match
+ // the expected values
+ if (!Arrays.equals(respByName.getEncoded(), EXP_NAME_ID_BYTES)) {
+ message = "ResponderId byName encoding did not " +
+ "match expected value";
+ } else if (!Arrays.equals(respByKeyId.getEncoded(), EXP_KEY_ID_BYTES)) {
+ message = "ResponderId byKeyId encoding did not " +
+ "match expected value";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase pos_GetRespName = new TestCase() {
+ @Override
+ public String getName() {
+ return "Get Underlying Responder Name";
+ }
+
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+
+ try {
+ // Test methods for pulling out the underlying
+ // X500Principal object
+ X500Principal testPrincipal =
+ new X500Principal(RESP_CERT_1_SUBJ);
+ if (!respByName.getResponderName().equals(testPrincipal)) {
+ message = "ResponderId Name did not match expected value";
+ } else if (respByKeyId.getResponderName() != null) {
+ message = "Non-null responder name returned from " +
+ "ResponderId constructed byKey";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase pos_GetRespKeyId = new TestCase() {
+ @Override
+ public String getName() {
+ return "Get Underlying Responder Key ID";
+ }
+
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+
+ try {
+ // Test methods for pulling out the underlying
+ // KeyIdentifier object. Note: There is a minute chance that
+ // an RSA public key, once hashed into a key ID might collide
+ // with the one extracted from the certificate used to create
+ // respByKeyId. This is so unlikely to happen it is considered
+ // virtually impossible.
+ KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
+ kpg.initialize(2048);
+ KeyPair rsaKey = kpg.generateKeyPair();
+ KeyIdentifier testKeyId = new KeyIdentifier(rsaKey.getPublic());
+
+ if (respByKeyId.getKeyIdentifier().equals(testKeyId)) {
+ message = "Unexpected match in ResponderId Key ID";
+ } else if (respByName.getKeyIdentifier() != null) {
+ message = "Non-null key ID returned from " +
+ "ResponderId constructed byName";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+}
diff --git a/jdk/test/sun/security/ssl/ExtensionType/OptimalListSize.java b/jdk/test/sun/security/ssl/ExtensionType/OptimalListSize.java
index 2b1dff93a88..06d53d1c4f5 100644
--- a/jdk/test/sun/security/ssl/ExtensionType/OptimalListSize.java
+++ b/jdk/test/sun/security/ssl/ExtensionType/OptimalListSize.java
@@ -36,6 +36,6 @@ public class OptimalListSize {
public static void main(String[] args) throws Throwable {
OptimalCapacity.ofArrayList(
Class.forName("sun.security.ssl.ExtensionType"),
- "knownExtensions", 13);
+ "knownExtensions", 14);
}
}
diff --git a/jdk/test/sun/security/ssl/StatusStapling/BogusStatusRequest.java b/jdk/test/sun/security/ssl/StatusStapling/BogusStatusRequest.java
new file mode 100644
index 00000000000..0bdbc7f1258
--- /dev/null
+++ b/jdk/test/sun/security/ssl/StatusStapling/BogusStatusRequest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2015, 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 sun.security.ssl;
+
+import java.io.IOException;
+
+final class BogusStatusRequest implements StatusRequest {
+ BogusStatusRequest() { }
+
+ @Override
+ public int length() { return 0; }
+
+ @Override
+ public void send(HandshakeOutStream s) throws IOException { }
+
+ @Override
+ public String toString() {
+ return "BogusStatusRequest";
+ }
+}
diff --git a/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqExtensionTests.java b/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqExtensionTests.java
new file mode 100644
index 00000000000..4d79876768d
--- /dev/null
+++ b/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqExtensionTests.java
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2015, 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 sun.security.ssl;
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS (CertStatusReqExtension tests)
+ * @build CertStatusReqExtensionTests BogusStatusRequest TestCase TestUtils
+ * @run main/othervm sun.security.ssl.CertStatusReqExtensionTests
+ */
+
+import java.io.IOException;
+import java.util.*;
+import java.nio.ByteBuffer;
+
+/*
+ * Checks that the hash value for a certificate's issuer name is generated
+ * correctly. Requires any certificate that is not self-signed.
+ *
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class CertStatusReqExtensionTests {
+
+ private static final boolean debug = false;
+
+ // Default status_request extension (type = ocsp, OCSPStatusRequest
+ // with no responder IDs or extensions
+ private static final byte[] CSRE_DEF_OSR = {1, 0, 0, 0, 0};
+
+ // A status_request extension using a user-defined type (0xFF) and
+ // an underlying no-Responder ID/no-extension OCSPStatusRequest
+ private static final byte[] CSRE_TYPE_FF = {-1, 0, 0, 0, 0};
+
+ // A CertStatusReqExtension with 5 ResponderIds and 1 Extension
+ private static final byte[] CSRE_REQ_RID_EXTS = {
+ 1, 0, -13, 0, 59, -95, 57, 48,
+ 55, 49, 16, 48, 14, 6, 3, 85,
+ 4, 10, 19, 7, 83, 111, 109, 101,
+ 73, 110, 99, 49, 16, 48, 14, 6,
+ 3, 85, 4, 11, 19, 7, 83, 111,
+ 109, 101, 80, 75, 73, 49, 17, 48,
+ 15, 6, 3, 85, 4, 3, 19, 8,
+ 83, 111, 109, 101, 79, 67, 83, 80,
+ 0, 68, -95, 66, 48, 64, 49, 13,
+ 48, 11, 6, 3, 85, 4, 10, 19,
+ 4, 79, 104, 77, 121, 49, 14, 48,
+ 12, 6, 3, 85, 4, 11, 19, 5,
+ 66, 101, 97, 114, 115, 49, 15, 48,
+ 13, 6, 3, 85, 4, 11, 19, 6,
+ 84, 105, 103, 101, 114, 115, 49, 14,
+ 48, 12, 6, 3, 85, 4, 3, 19,
+ 5, 76, 105, 111, 110, 115, 0, 58,
+ -95, 56, 48, 54, 49, 16, 48, 14,
+ 6, 3, 85, 4, 10, 19, 7, 67,
+ 111, 109, 112, 97, 110, 121, 49, 13,
+ 48, 11, 6, 3, 85, 4, 11, 19,
+ 4, 87, 101, 115, 116, 49, 19, 48,
+ 17, 6, 3, 85, 4, 3, 19, 10,
+ 82, 101, 115, 112, 111, 110, 100, 101,
+ 114, 49, 0, 24, -94, 22, 4, 20,
+ -67, -36, 114, 121, 92, -79, 116, -1,
+ 102, -107, 7, -21, 18, -113, 64, 76,
+ 96, -7, -66, -63, 0, 24, -94, 22,
+ 4, 20, -51, -69, 107, -82, -39, -87,
+ 45, 25, 41, 28, -76, -68, -11, -110,
+ -94, -97, 62, 47, 58, -125, 0, 51,
+ 48, 49, 48, 47, 6, 9, 43, 6,
+ 1, 5, 5, 7, 48, 1, 2, 4,
+ 34, 4, 32, -26, -81, -120, -61, -127,
+ -79, 0, -39, -54, 49, 3, -51, -57,
+ -85, 19, -126, 94, -2, 21, 26, 98,
+ 6, 105, -35, -37, -29, -73, 101, 53,
+ 44, 15, -19
+ };
+
+ public static void main(String[] args) throws Exception {
+ Map testList =
+ new LinkedHashMap() {{
+ put("CTOR (default)", testCtorDefault);
+ put("CTOR (int, StatusRequest)", testCtorStatReqs);
+ put("CTOR (HandshakeInStream, length, getReqType, getRequest)",
+ testCtorInStream);
+ }};
+
+ TestUtils.runTests(testList);
+ }
+
+ public static final TestCase testCtorDefault = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ CertStatusReqExtension csreDef = new CertStatusReqExtension();
+ HandshakeOutStream hsout =
+ new HandshakeOutStream(null);
+ csreDef.send(hsout);
+ TestUtils.valueCheck(wrapExtData(null), hsout.toByteArray());
+
+ // The length should be 4 (2 bytes for the type, 2 for the
+ // encoding of zero-length
+ if (csreDef.length() != 4) {
+ throw new RuntimeException("Incorrect length from " +
+ "default object. Expected 4, got " +
+ csreDef.length());
+ }
+
+ // Since there's no data, there are no status_type or request
+ // data fields defined. Both should return null in this case
+ if (csreDef.getType() != null) {
+ throw new RuntimeException("Default CSRE returned " +
+ "non-null status_type");
+ } else if (csreDef.getRequest() != null) {
+ throw new RuntimeException("Default CSRE returned " +
+ "non-null request object");
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testCtorStatReqs = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ HandshakeOutStream hsout =
+ new HandshakeOutStream(null);
+ StatusRequest basicStatReq = new OCSPStatusRequest();
+
+ // Create an extension using a default-style OCSPStatusRequest
+ // (no responder IDs, no extensions).
+ CertStatusReqExtension csre1 = new CertStatusReqExtension(
+ StatusRequestType.OCSP, basicStatReq);
+ csre1.send(hsout);
+ TestUtils.valueCheck(wrapExtData(CSRE_DEF_OSR),
+ hsout.toByteArray());
+ hsout.reset();
+
+ // Create the extension using a StatusRequestType not already
+ // instantiated as a static StatusRequestType
+ // (e.g. OCSP/OCSP_MULTI)
+ CertStatusReqExtension csre2 =
+ new CertStatusReqExtension(StatusRequestType.get(-1),
+ basicStatReq);
+ csre2.send(hsout);
+ TestUtils.valueCheck(wrapExtData(CSRE_TYPE_FF),
+ hsout.toByteArray());
+
+ // Create the extension using a StatusRequest that
+ // does not match the status_type field
+ // This should throw an IllegalArgumentException
+ try {
+ CertStatusReqExtension csreBadRequest =
+ new CertStatusReqExtension(StatusRequestType.OCSP,
+ new BogusStatusRequest());
+ throw new RuntimeException("Constructor accepted a " +
+ "StatusRequest that is inconsistent with " +
+ "the status_type");
+ } catch (IllegalArgumentException iae) { }
+
+ // We don't allow a null value for the StatusRequestType
+ // parameter in this constructor.
+ try {
+ CertStatusReqExtension csreBadRequest =
+ new CertStatusReqExtension(null, basicStatReq);
+ throw new RuntimeException("Constructor accepted a " +
+ "null StatusRequestType");
+ } catch (NullPointerException npe) { }
+
+ // We also don't allow a null value for the StatusRequest
+ // parameter in this constructor.
+ try {
+ CertStatusReqExtension csreBadRequest =
+ new CertStatusReqExtension(StatusRequestType.OCSP,
+ null);
+ throw new RuntimeException("Constructor accepted a " +
+ "null StatusRequest");
+ } catch (NullPointerException npe) { }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor that builds the ob ject using data from
+ // a HandshakeInStream
+ // This also tests the length, getReqType and getRequest methods
+ public static final TestCase testCtorInStream = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ OCSPStatusRequest osr;
+
+ try {
+ // To simulate the extension coming in a ServerHello, the
+ // type and length would already be read by HelloExtensions
+ // and there is no extension data
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(new byte[0]));
+ CertStatusReqExtension csre =
+ new CertStatusReqExtension(hsis, hsis.available());
+ // Verify length/type/request
+ if (csre.length() != 4) {
+ throw new RuntimeException("Invalid length: received " +
+ csre.length() + ", expected 4");
+ } else if (csre.getType() != null) {
+ throw new RuntimeException("Non-null type from default " +
+ "extension");
+ } else if (csre.getRequest() != null) {
+ throw new RuntimeException("Non-null request from default " +
+ "extension");
+ }
+
+ // Try the an extension with a default OCSPStatusRequest
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRE_DEF_OSR));
+ csre = new CertStatusReqExtension(hsis, hsis.available());
+ if (csre.length() != (CSRE_DEF_OSR.length + 4)) {
+ throw new RuntimeException("Invalid length: received " +
+ csre.length() + ", expected " +
+ CSRE_DEF_OSR.length + 4);
+ } else if (!csre.getType().equals(StatusRequestType.OCSP)) {
+ throw new RuntimeException("Unknown status_type: " +
+ String.format("0x%02X", csre.getType().id));
+ } else {
+ osr = (OCSPStatusRequest)csre.getRequest();
+ if (!osr.getResponderIds().isEmpty() ||
+ !osr.getExtensions().isEmpty()) {
+ throw new RuntimeException("Non-default " +
+ "OCSPStatusRequest found in extension");
+ }
+ }
+
+ // Try with a non-default extension
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRE_REQ_RID_EXTS));
+ csre = new CertStatusReqExtension(hsis, hsis.available());
+ if (csre.length() != (CSRE_REQ_RID_EXTS.length + 4)) {
+ throw new RuntimeException("Invalid length: received " +
+ csre.length() + ", expected " +
+ CSRE_REQ_RID_EXTS.length + 4);
+ } else if (!(csre.getType().equals(StatusRequestType.OCSP))) {
+ throw new RuntimeException("Unknown status_type: " +
+ String.format("0x%02X", csre.getType().id));
+ } else {
+ osr = (OCSPStatusRequest)csre.getRequest();
+ if (osr.getResponderIds().size() != 5 ||
+ osr.getExtensions().size() != 1) {
+ throw new RuntimeException("Incorrect number of " +
+ "ResponderIds or Extensions found in " +
+ "OCSPStatusRequest");
+ }
+ }
+
+ // Create a CSRE that asserts status_request and has the
+ // proper length, but really is a bunch of random junk inside
+ // In this case, it will create an UnknownStatusRequest to
+ // handle the unparseable data.
+ byte[] junkData = new byte[48];
+ Random r = new Random(System.currentTimeMillis());
+ r.nextBytes(junkData);
+ junkData[0] = 7; // Ensure it isn't a valid status_type
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(junkData));
+ csre = new CertStatusReqExtension(hsis, hsis.available());
+ StatusRequest sr = csre.getRequest();
+ if (!(sr instanceof UnknownStatusRequest)) {
+ throw new RuntimeException("Expected returned status " +
+ "request to be of type UnknownStatusRequest but " +
+ "received " + sr.getClass().getName());
+ } else if (csre.length() != (junkData.length + 4)) {
+ throw new RuntimeException("Invalid length: received " +
+ csre.length() + ", expected " +
+ junkData.length + 4);
+ }
+
+ // Set the leading byte to 1 (OCSP type) and run again
+ // It should pass the argument check and fail trying to parse
+ // the underlying StatusRequest.
+ junkData[0] = (byte)StatusRequestType.OCSP.id;
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(junkData));
+ try {
+ csre = new CertStatusReqExtension(hsis, hsis.available());
+ throw new RuntimeException("Expected CTOR exception did " +
+ "not occur");
+ } catch (IOException ioe) { }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Take CSRE extension data and add extension type and length decorations
+ private static byte[] wrapExtData(byte[] extData) {
+ int bufferLen = (extData != null ? extData.length : 0) + 4;
+ ByteBuffer bb = ByteBuffer.allocate(bufferLen);
+ bb.putShort((short)ExtensionType.EXT_STATUS_REQUEST.id);
+ bb.putShort((short)(extData != null ? extData.length: 0));
+ if (extData != null) {
+ bb.put(extData);
+ }
+ return bb.array();
+ }
+}
diff --git a/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqItemV2Tests.java b/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqItemV2Tests.java
new file mode 100644
index 00000000000..1238d5e5c6a
--- /dev/null
+++ b/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqItemV2Tests.java
@@ -0,0 +1,463 @@
+/*
+ * Copyright (c) 2015, 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 sun.security.ssl;
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS (CertStatusReqItemv2 tests)
+ * @build CertStatusReqItemV2Tests BogusStatusRequest TestCase TestUtils
+ * @run main/othervm sun.security.ssl.CertStatusReqItemV2Tests
+ */
+
+import java.security.cert.*;
+import java.util.*;
+import java.nio.ByteBuffer;
+import javax.net.ssl.SSLException;
+import javax.security.auth.x500.X500Principal;
+import sun.security.provider.certpath.ResponderId;
+import sun.security.provider.certpath.OCSPNonceExtension;
+
+/*
+ * Checks that the hash value for a certificate's issuer name is generated
+ * correctly. Requires any certificate that is not self-signed.
+ *
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class CertStatusReqItemV2Tests {
+
+ private static final boolean debug = false;
+
+ private static final byte[] DEF_CSRIV2_OCSP_MULTI_BYTES = {
+ 2, 0, 4, 0, 0, 0, 0
+ };
+
+ private static final byte[] DEF_CSRIV2_OCSP_BYTES = {
+ 1, 0, 4, 0, 0, 0, 0
+ };
+
+ // This is a CSRIV2 (ocsp_multi) that has a single
+ // responder ID and no extensions.
+ private static final byte[] CSRIV2_1RID = {
+ 2, 0, 32, 0, 28, 0, 26, -95,
+ 24, 48, 22, 49, 20, 48, 18, 6,
+ 3, 85, 4, 3, 19, 11, 79, 67,
+ 83, 80, 32, 83, 105, 103, 110, 101,
+ 114, 0 , 0
+ };
+
+ // This is a CSRIV2 (ocsp_multi) that has a single
+ // responder ID and no extensions. The request_length
+ // field is too short in this case.
+ private static final byte[] CSRIV2_LENGTH_TOO_SHORT = {
+ 2, 0, 27, 0, 28, 0, 26, -95,
+ 24, 48, 22, 49, 20, 48, 18, 6,
+ 3, 85, 4, 3, 19, 11, 79, 67,
+ 83, 80, 32, 83, 105, 103, 110, 101,
+ 114, 0 , 0
+ };
+
+ // This is a CSRIV2 (ocsp_multi) that has a single
+ // responder ID and no extensions. The request_length
+ // field is too long in this case.
+ private static final byte[] CSRIV2_LENGTH_TOO_LONG = {
+ 2, 0, 54, 0, 28, 0, 26, -95,
+ 24, 48, 22, 49, 20, 48, 18, 6,
+ 3, 85, 4, 3, 19, 11, 79, 67,
+ 83, 80, 32, 83, 105, 103, 110, 101,
+ 114, 0 , 0
+ };
+
+ // A CSRIV2 (ocsp) with one Responder ID (byName: CN=OCSP Signer)
+ // and a nonce extension (32 bytes).
+ private static final byte[] CSRIV2_OCSP_1RID_1EXT = {
+ 1, 0, 83, 0, 28, 0, 26, -95,
+ 24, 48, 22, 49, 20, 48, 18, 6,
+ 3, 85, 4, 3, 19, 11, 79, 67,
+ 83, 80, 32, 83, 105, 103, 110, 101,
+ 114, 0, 51, 48, 49, 48, 47, 6,
+ 9, 43, 6, 1, 5, 5, 7, 48,
+ 1, 2, 4, 34, 4, 32, -34, -83,
+ -66, -17, -34, -83, -66, -17, -34, -83,
+ -66, -17, -34, -83, -66, -17, -34, -83,
+ -66, -17, -34, -83, -66, -17, -34, -83,
+ -66, -17, -34, -83, -66, -17
+ };
+
+ public static void main(String[] args) throws Exception {
+ Map testList =
+ new LinkedHashMap() {{
+ put("CTOR (Default)", testCtorTypeStatReq);
+ put("CTOR (Byte array)", testCtorByteArray);
+ put("CTOR (invalid lengths)", testCtorInvalidLengths);
+ }};
+
+ TestUtils.runTests(testList);
+ }
+
+ public static final TestCase testCtorTypeStatReq = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ // Attempt to create CSRIv2 objects using null pointers
+ // for either parameter. In either case NPE should be thrown
+ CertStatusReqItemV2 csriNull;
+ try {
+ csriNull = new CertStatusReqItemV2(null,
+ new OCSPStatusRequest());
+ throw new RuntimeException("Did not catch expected NPE " +
+ "for null status_type parameter");
+ } catch (NullPointerException npe) { }
+
+ try {
+ csriNull = new CertStatusReqItemV2(StatusRequestType.OCSP,
+ null);
+ throw new RuntimeException("Did not catch expected NPE " +
+ "for null StatusRequest parameter");
+ } catch (NullPointerException npe) { }
+
+ // Create an "ocsp_multi" type request using a default
+ // (no Responder IDs, no Extensions) OCSPStatusRequest
+ CertStatusReqItemV2 csriMulti =
+ new CertStatusReqItemV2(StatusRequestType.OCSP_MULTI,
+ new OCSPStatusRequest());
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ csriMulti.send(hsout);
+ TestUtils.valueCheck(DEF_CSRIV2_OCSP_MULTI_BYTES,
+ hsout.toByteArray());
+ hsout.reset();
+
+ // Create an "ocsp" type request using a default
+ // (no Responder IDs, no Extensions) OCSPStatusRequest
+ CertStatusReqItemV2 csriSingle =
+ new CertStatusReqItemV2(StatusRequestType.OCSP,
+ new OCSPStatusRequest(new LinkedList<>(),
+ new LinkedList<>()));
+ csriSingle.send(hsout);
+ TestUtils.valueCheck(DEF_CSRIV2_OCSP_BYTES,
+ hsout.toByteArray());
+
+ // Create the CertStatusRequestItemV2 with a user-defined
+ // StatusRequestType value
+ CertStatusReqItemV2 csriNine =
+ new CertStatusReqItemV2(StatusRequestType.get(9),
+ new OCSPStatusRequest(null, null));
+ if (csriNine.getType().id != 9) {
+ throw new RuntimeException("Expected status_type = 9, " +
+ "got " + csriNine.getType().id);
+ } else {
+ StatusRequest sr = csriNine.getRequest();
+ if (!(sr instanceof OCSPStatusRequest)) {
+ throw new RuntimeException("Expected " +
+ "OCSPStatusRequest, got " +
+ sr.getClass().getName());
+ }
+ }
+
+ // Create the CertStatusRequestItemV2 with a StatusRequest
+ // that does not match the status_type argument.
+ // We expect IllegalArgumentException in this case.
+ try {
+ CertStatusReqItemV2 csriBadSR = new CertStatusReqItemV2(
+ StatusRequestType.OCSP_MULTI,
+ new BogusStatusRequest());
+ throw new RuntimeException("Constructor accepted a " +
+ "StatusRequest that is inconsistent with " +
+ "the status_type");
+ } catch (IllegalArgumentException iae) {
+ // The expected result...nothing to do here
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor form that takes the data from a byte array
+ public static final TestCase testCtorByteArray = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ StatusRequestType sType;
+ StatusRequest sReq;
+ ResponderId checkRid =
+ new ResponderId(new X500Principal("CN=OCSP Signer"));
+ Extension checkExt = new OCSPNonceExtension(32);
+
+ CertStatusReqItemV2 csriv =
+ new CertStatusReqItemV2(CSRIV2_OCSP_1RID_1EXT);
+ sType = csriv.getType();
+ if (sType != StatusRequestType.OCSP) {
+ throw new RuntimeException("Unexpected StatusRequestType " +
+ sType.getClass().getName());
+ }
+
+ sReq = csriv.getRequest();
+ if (sReq instanceof OCSPStatusRequest) {
+ OCSPStatusRequest osr = (OCSPStatusRequest)sReq;
+ List ridList = osr.getResponderIds();
+ List extList = osr.getExtensions();
+
+ if (ridList.size() != 1 || !ridList.contains(checkRid)) {
+ throw new RuntimeException("Responder list mismatch");
+ } else if (extList.size() != 1 ||
+ !extList.get(0).getId().equals(checkExt.getId())) {
+ throw new RuntimeException("Extension list mismatch");
+ }
+ } else {
+ throw new RuntimeException("Expected OCSPStatusRequest " +
+ "from decoded bytes, got " +
+ sReq.getClass().getName());
+ }
+
+ // Create a CSRIV2 out of random data. A non-OCSP/OCSP_MULTI
+ // type will be forcibly set and the outer length field will
+ // be correct.
+ // The constructor should create a StatusRequestType object
+ // and an UnknownStatusRequest object consisting of the
+ // data segment.
+ byte[] junkData = new byte[48];
+ Random r = new Random(System.currentTimeMillis());
+ r.nextBytes(junkData);
+ junkData[0] = 7; // status_type = 7
+ junkData[1] = 0;
+ junkData[2] = 45; // request_length = 45
+ csriv = new CertStatusReqItemV2(junkData);
+
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType.id != junkData[0]) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected 7, got " + sType.id);
+ }
+ if (sReq instanceof UnknownStatusRequest) {
+ // Verify the underlying StatusRequest bytes have been
+ // preserved correctly.
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ sReq.send(hsout);
+ byte[] srDataOut = hsout.toByteArray();
+ TestUtils.valueCheck(srDataOut, junkData, 0, 3,
+ srDataOut.length);
+ } else {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected UnknownStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ // Test the parsing of the default OCSP/OCSP_MULTI extensions
+ // and make sure the underlying StatusRequestType and
+ // StatusRequest objects are correct.
+ csriv = new CertStatusReqItemV2(DEF_CSRIV2_OCSP_MULTI_BYTES);
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType != StatusRequestType.OCSP_MULTI) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected OCSP_MULTI (2), got " + sType.id);
+ }
+ if (!(sReq instanceof OCSPStatusRequest)) {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected OCSPStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ csriv = new CertStatusReqItemV2(DEF_CSRIV2_OCSP_BYTES);
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType != StatusRequestType.OCSP) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected OCSP (1), got " + sType.id);
+ }
+ if (!(sReq instanceof OCSPStatusRequest)) {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected OCSPStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testCtorInvalidLengths = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ try {
+ CertStatusReqItemV2 csriTooShort =
+ new CertStatusReqItemV2(CSRIV2_LENGTH_TOO_SHORT);
+ throw new RuntimeException("Expected exception not thrown");
+ } catch (SSLException ssle) { }
+
+ try {
+ CertStatusReqItemV2 csriTooLong =
+ new CertStatusReqItemV2(CSRIV2_LENGTH_TOO_LONG);
+ throw new RuntimeException("Expected exception not thrown");
+ } catch (SSLException ssle) { }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor form that takes the data from HandshakeInputStream
+ public static final TestCase testCtorInputStream = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ StatusRequestType sType;
+ StatusRequest sReq;
+ ResponderId checkRid =
+ new ResponderId(new X500Principal("CN=OCSP Signer"));
+ Extension checkExt = new OCSPNonceExtension(32);
+
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRIV2_OCSP_1RID_1EXT));
+ CertStatusReqItemV2 csriv = new CertStatusReqItemV2(hsis);
+ sType = csriv.getType();
+ if (sType != StatusRequestType.OCSP) {
+ throw new RuntimeException("Unexpected StatusRequestType " +
+ sType.getClass().getName());
+ }
+
+ sReq = csriv.getRequest();
+ if (sReq instanceof OCSPStatusRequest) {
+ OCSPStatusRequest osr = (OCSPStatusRequest)sReq;
+ List ridList = osr.getResponderIds();
+ List extList = osr.getExtensions();
+
+ if (ridList.size() != 1 || !ridList.contains(checkRid)) {
+ throw new RuntimeException("Responder list mismatch");
+ } else if (extList.size() != 1 ||
+ !extList.get(0).getId().equals(checkExt.getId())) {
+ throw new RuntimeException("Extension list mismatch");
+ }
+ } else {
+ throw new RuntimeException("Expected OCSPStatusRequest " +
+ "from decoded bytes, got " +
+ sReq.getClass().getName());
+ }
+
+ // Create a CSRIV2 out of random data. A non-OCSP/OCSP_MULTI
+ // type will be forcibly set and the outer length field will
+ // be correct.
+ // The constructor should create a StatusRequestType object
+ // and an UnknownStatusRequest object consisting of the
+ // data segment.
+ byte[] junkData = new byte[48];
+ Random r = new Random(System.currentTimeMillis());
+ r.nextBytes(junkData);
+ junkData[0] = 7; // status_type = 7
+ junkData[1] = 0;
+ junkData[2] = 45; // request_length = 45
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(junkData));
+ csriv = new CertStatusReqItemV2(hsis);
+
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType.id != junkData[0]) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected 7, got " + sType.id);
+ }
+ if (sReq instanceof UnknownStatusRequest) {
+ // Verify the underlying StatusRequest bytes have been
+ // preserved correctly.
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ sReq.send(hsout);
+ byte[] srDataOut = hsout.toByteArray();
+ TestUtils.valueCheck(srDataOut, junkData, 0, 3,
+ srDataOut.length);
+ } else {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected UnknownStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ // Test the parsing of the default OCSP/OCSP_MULTI extensions
+ // and make sure the underlying StatusRequestType and
+ // StatusRequest objects are correct.
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(
+ ByteBuffer.wrap(DEF_CSRIV2_OCSP_MULTI_BYTES));
+ csriv = new CertStatusReqItemV2(hsis);
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType != StatusRequestType.OCSP_MULTI) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected OCSP_MULTI (2), got " + sType.id);
+ }
+ if (!(sReq instanceof OCSPStatusRequest)) {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected OCSPStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(DEF_CSRIV2_OCSP_BYTES));
+ csriv = new CertStatusReqItemV2(hsis);
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType != StatusRequestType.OCSP) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected OCSP (1), got " + sType.id);
+ }
+ if (!(sReq instanceof OCSPStatusRequest)) {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected OCSPStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+}
diff --git a/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqListV2ExtensionTests.java b/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqListV2ExtensionTests.java
new file mode 100644
index 00000000000..b8c8013bd94
--- /dev/null
+++ b/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqListV2ExtensionTests.java
@@ -0,0 +1,413 @@
+/*
+ * Copyright (c) 2015, 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 sun.security.ssl;
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS (CertStatusReqListV2Extension tests)
+ * @build CertStatusReqListV2ExtensionTests TestCase TestUtils
+ * @run main/othervm sun.security.ssl.CertStatusReqListV2ExtensionTests
+ */
+
+import java.io.IOException;
+import java.util.*;
+import java.nio.ByteBuffer;
+import javax.net.ssl.*;
+
+/*
+ * Checks that the hash value for a certificate's issuer name is generated
+ * correctly. Requires any certificate that is not self-signed.
+ *
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class CertStatusReqListV2ExtensionTests {
+
+ private static final boolean debug = false;
+
+ // Default status_request_v2 extension with two items
+ // 1. Type = ocsp_multi, OCSPStatusRequest is default
+ // 2. Type = ocsp, OCSPStatusRequest is default
+ private static final byte[] CSRLV2_DEF = {
+ 0, 14, 2, 0, 4, 0, 0, 0,
+ 0, 1, 0, 4, 0, 0, 0, 0
+ };
+
+ // A status_request_v2 where the item list length is
+ // longer than the provided data
+ private static final byte[] CSRLV2_LEN_TOO_LONG = {
+ 0, 18, 2, 0, 4, 0, 0, 0,
+ 0, 1, 0, 4, 0, 0, 0, 0
+ };
+
+ // A status_request_v2 where the item list length is
+ // shorter than the provided data
+ private static final byte[] CSRLV2_LEN_TOO_SHORT = {
+ 0, 11, 2, 0, 4, 0, 0, 0,
+ 0, 1, 0, 4, 0, 0, 0, 0
+ };
+
+ // A status_request_v2 extension with a zero-length
+ // certificate_status_req_list (not allowed by the spec)
+ private static final byte[] CSRLV2_INVALID_ZEROLEN = {0, 0};
+
+ // A status_request_v2 extension with two items (ocsp_multi and ocsp)
+ // using OCSPStatusRequests with 5 ResponderIds and 1 Extension each.
+ private static final byte[] CSRLV2_TWO_NON_DEF_ITEMS = {
+ 2, 90, 2, 1, 42, 0, -13, 0,
+ 59, -95, 57, 48, 55, 49, 16, 48,
+ 14, 6, 3, 85, 4, 10, 19, 7,
+ 83, 111, 109, 101, 73, 110, 99, 49,
+ 16, 48, 14, 6, 3, 85, 4, 11,
+ 19, 7, 83, 111, 109, 101, 80, 75,
+ 73, 49, 17, 48, 15, 6, 3, 85,
+ 4, 3, 19, 8, 83, 111, 109, 101,
+ 79, 67, 83, 80, 0, 68, -95, 66,
+ 48, 64, 49, 13, 48, 11, 6, 3,
+ 85, 4, 10, 19, 4, 79, 104, 77,
+ 121, 49, 14, 48, 12, 6, 3, 85,
+ 4, 11, 19, 5, 66, 101, 97, 114,
+ 115, 49, 15, 48, 13, 6, 3, 85,
+ 4, 11, 19, 6, 84, 105, 103, 101,
+ 114, 115, 49, 14, 48, 12, 6, 3,
+ 85, 4, 3, 19, 5, 76, 105, 111,
+ 110, 115, 0, 58, -95, 56, 48, 54,
+ 49, 16, 48, 14, 6, 3, 85, 4,
+ 10, 19, 7, 67, 111, 109, 112, 97,
+ 110, 121, 49, 13, 48, 11, 6, 3,
+ 85, 4, 11, 19, 4, 87, 101, 115,
+ 116, 49, 19, 48, 17, 6, 3, 85,
+ 4, 3, 19, 10, 82, 101, 115, 112,
+ 111, 110, 100, 101, 114, 49, 0, 24,
+ -94, 22, 4, 20, -67, -36, 114, 121,
+ 92, -79, 116, -1, 102, -107, 7, -21,
+ 18, -113, 64, 76, 96, -7, -66, -63,
+ 0, 24, -94, 22, 4, 20, -51, -69,
+ 107, -82, -39, -87, 45, 25, 41, 28,
+ -76, -68, -11, -110, -94, -97, 62, 47,
+ 58, -125, 0, 51, 48, 49, 48, 47,
+ 6, 9, 43, 6, 1, 5, 5, 7,
+ 48, 1, 2, 4, 34, 4, 32, -26,
+ -81, -120, -61, -127, -79, 0, -39, -54,
+ 49, 3, -51, -57, -85, 19, -126, 94,
+ -2, 21, 26, 98, 6, 105, -35, -37,
+ -29, -73, 101, 53, 44, 15, -19, 1,
+ 1, 42, 0, -13, 0, 59, -95, 57,
+ 48, 55, 49, 16, 48, 14, 6, 3,
+ 85, 4, 10, 19, 7, 83, 111, 109,
+ 101, 73, 110, 99, 49, 16, 48, 14,
+ 6, 3, 85, 4, 11, 19, 7, 83,
+ 111, 109, 101, 80, 75, 73, 49, 17,
+ 48, 15, 6, 3, 85, 4, 3, 19,
+ 8, 83, 111, 109, 101, 79, 67, 83,
+ 80, 0, 68, -95, 66, 48, 64, 49,
+ 13, 48, 11, 6, 3, 85, 4, 10,
+ 19, 4, 79, 104, 77, 121, 49, 14,
+ 48, 12, 6, 3, 85, 4, 11, 19,
+ 5, 66, 101, 97, 114, 115, 49, 15,
+ 48, 13, 6, 3, 85, 4, 11, 19,
+ 6, 84, 105, 103, 101, 114, 115, 49,
+ 14, 48, 12, 6, 3, 85, 4, 3,
+ 19, 5, 76, 105, 111, 110, 115, 0,
+ 58, -95, 56, 48, 54, 49, 16, 48,
+ 14, 6, 3, 85, 4, 10, 19, 7,
+ 67, 111, 109, 112, 97, 110, 121, 49,
+ 13, 48, 11, 6, 3, 85, 4, 11,
+ 19, 4, 87, 101, 115, 116, 49, 19,
+ 48, 17, 6, 3, 85, 4, 3, 19,
+ 10, 82, 101, 115, 112, 111, 110, 100,
+ 101, 114, 49, 0, 24, -94, 22, 4,
+ 20, -67, -36, 114, 121, 92, -79, 116,
+ -1, 102, -107, 7, -21, 18, -113, 64,
+ 76, 96, -7, -66, -63, 0, 24, -94,
+ 22, 4, 20, -51, -69, 107, -82, -39,
+ -87, 45, 25, 41, 28, -76, -68, -11,
+ -110, -94, -97, 62, 47, 58, -125, 0,
+ 51, 48, 49, 48, 47, 6, 9, 43,
+ 6, 1, 5, 5, 7, 48, 1, 2,
+ 4, 34, 4, 32, -26, -81, -120, -61,
+ -127, -79, 0, -39, -54, 49, 3, -51,
+ -57, -85, 19, -126, 94, -2, 21, 26,
+ 98, 6, 105, -35, -37, -29, -73, 101,
+ 53, 44, 15, -19
+ };
+
+ public static void main(String[] args) throws Exception {
+ Map testList =
+ new LinkedHashMap() {{
+ put("CTOR (default)", testCtorDefault);
+ put("CTOR (List runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ CertStatusReqListV2Extension csrlV2 =
+ new CertStatusReqListV2Extension();
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ csrlV2.send(hsout);
+ TestUtils.valueCheck(wrapExtData(new byte[0]),
+ hsout.toByteArray());
+
+ // The length should be 4 (2 bytes for the type, 2 for the
+ // encoding of zero-length
+ if (csrlV2.length() != 4) {
+ throw new RuntimeException("Incorrect length from " +
+ "default object. Expected 4, got " +
+ csrlV2.length());
+ }
+
+ // Since there's no data, there are no status_type or request
+ // data fields defined. An empty, unmodifiable list should be
+ // returned when obtained from the extension.
+ List itemList = csrlV2.getRequestItems();
+ if (!itemList.isEmpty()) {
+ throw new RuntimeException("Default CSRLV2 returned " +
+ "non-empty request list");
+ } else {
+ try {
+ itemList.add(new CertStatusReqItemV2(
+ StatusRequestType.OCSP_MULTI,
+ new OCSPStatusRequest()));
+ throw new RuntimeException("Returned itemList is " +
+ "modifiable!");
+ } catch (UnsupportedOperationException uoe) { }
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testCtorItemList = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ OCSPStatusRequest osr = new OCSPStatusRequest();
+ List noItems = Collections.emptyList();
+ List defList =
+ new ArrayList() {{
+ add(new CertStatusReqItemV2(StatusRequestType.OCSP_MULTI, osr));
+ add(new CertStatusReqItemV2(StatusRequestType.OCSP, osr));
+ }};
+ List unknownTypesList =
+ new ArrayList() {{
+ add(new CertStatusReqItemV2(StatusRequestType.get(8),
+ new UnknownStatusRequest(new byte[0])));
+ add(new CertStatusReqItemV2(StatusRequestType.get(12),
+ new UnknownStatusRequest(new byte[5])));
+ }};
+
+ try {
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ StatusRequest basicStatReq = new OCSPStatusRequest();
+
+ // Create an extension using a default-style OCSPStatusRequest
+ // (no responder IDs, no extensions).
+ CertStatusReqListV2Extension csrlv2 =
+ new CertStatusReqListV2Extension(defList);
+ csrlv2.send(hsout);
+ TestUtils.valueCheck(wrapExtData(CSRLV2_DEF),
+ hsout.toByteArray());
+ hsout.reset();
+
+ // Create the extension using a StatusRequestType not already
+ // instantiated as a static StatusRequestType
+ // (e.g. OCSP/OCSP_MULTI)
+ csrlv2 = new CertStatusReqListV2Extension(unknownTypesList);
+ List itemList = csrlv2.getRequestItems();
+ if (itemList.size() != unknownTypesList.size()) {
+ throw new RuntimeException("Custom CSRLV2 returned " +
+ "an incorrect number of items: expected " +
+ unknownTypesList.size() + ", got " +
+ itemList.size());
+ } else {
+ // Verify that the list is unmodifiable
+ try {
+ itemList.add(new CertStatusReqItemV2(
+ StatusRequestType.OCSP_MULTI,
+ new OCSPStatusRequest()));
+ throw new RuntimeException("Returned itemList is " +
+ "modifiable!");
+ } catch (UnsupportedOperationException uoe) { }
+ }
+
+ // Pass a null value for the item list. This should throw
+ // an exception
+ try {
+ CertStatusReqListV2Extension csrlv2Null =
+ new CertStatusReqListV2Extension(null);
+ throw new RuntimeException("Constructor accepted a " +
+ "null request list");
+ } catch (NullPointerException npe) { }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor that builds the ob ject using data from
+ // a HandshakeInStream
+ // This also tests the length, getReqType and getRequest methods
+ public static final TestCase testCtorInStream = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ OCSPStatusRequest osr;
+ CertStatusReqListV2Extension csrlv2;
+
+ try {
+ // To simulate the extension coming in a ServerHello, the
+ // type and length would already be read by HelloExtensions
+ // and there is no extension data
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(new byte[0]));
+ csrlv2 = new CertStatusReqListV2Extension(hsis,
+ hsis.available());
+
+ // Verify length/request list
+ if (csrlv2.length() != 4) {
+ throw new RuntimeException("Invalid length: received " +
+ csrlv2.length() + ", expected 4");
+ } else {
+ List itemList =
+ csrlv2.getRequestItems();
+ if (!itemList.isEmpty()) {
+ throw new RuntimeException("Default CSRLV2 returned " +
+ "non-empty request list");
+ } else {
+ try {
+ itemList.add(new CertStatusReqItemV2(
+ StatusRequestType.OCSP_MULTI,
+ new OCSPStatusRequest()));
+ throw new RuntimeException("Returned itemList is " +
+ "modifiable!");
+ } catch (UnsupportedOperationException uoe) { }
+ }
+ }
+
+ // Try the an extension with our basic client-generated
+ // status_request_v2 (2 items, ocsp_multi and ocsp, each with
+ // a default OCSPStatusRequest
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRLV2_DEF));
+ csrlv2 = new CertStatusReqListV2Extension(hsis,
+ hsis.available());
+ if (csrlv2.length() != (CSRLV2_DEF.length + 4)) {
+ throw new RuntimeException("Invalid length: received " +
+ csrlv2.length() + ", expected " +
+ CSRLV2_DEF.length + 4);
+ } else {
+ List itemList =
+ csrlv2.getRequestItems();
+ if (itemList.size() != 2) {
+ throw new RuntimeException("Unexpected number of " +
+ "items request list, expected 2, got " +
+ itemList.size());
+ } else {
+ try {
+ itemList.add(new CertStatusReqItemV2(
+ StatusRequestType.OCSP_MULTI,
+ new OCSPStatusRequest()));
+ throw new RuntimeException("Returned itemList is " +
+ "modifiable!");
+ } catch (UnsupportedOperationException uoe) { }
+ }
+ }
+
+ // Try incoming data with an illegal zero-length
+ // certificate_status_req_list
+ try {
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(
+ ByteBuffer.wrap(CSRLV2_INVALID_ZEROLEN));
+ csrlv2 = new CertStatusReqListV2Extension(hsis,
+ hsis.available());
+ throw new RuntimeException("Unxpected successful " +
+ "object construction");
+ } catch (SSLException ssle) { }
+
+ // Try extensions where the certificate_status_req_list length
+ // is either too long or too short
+ try {
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRLV2_LEN_TOO_LONG));
+ csrlv2 = new CertStatusReqListV2Extension(hsis,
+ hsis.available());
+ throw new RuntimeException("Unxpected successful " +
+ "object construction");
+ } catch (SSLException ssle) { }
+
+ try {
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRLV2_LEN_TOO_SHORT));
+ csrlv2 = new CertStatusReqListV2Extension(hsis,
+ hsis.available());
+ throw new RuntimeException("Unxpected successful " +
+ "object construction");
+ } catch (SSLException ssle) { }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Take CSRE extension data and add extension type and length decorations
+ private static byte[] wrapExtData(byte[] extData) {
+ int bufferLen = extData.length + 4;
+ ByteBuffer bb = ByteBuffer.allocate(bufferLen);
+
+ bb.putShort((short)ExtensionType.EXT_STATUS_REQUEST_V2.id);
+ bb.putShort((short)extData.length);
+ if (extData.length != 0) {
+ bb.put(extData);
+ }
+ return bb.array();
+ }
+}
diff --git a/jdk/test/sun/security/ssl/StatusStapling/OCSPStatusRequestTests.java b/jdk/test/sun/security/ssl/StatusStapling/OCSPStatusRequestTests.java
new file mode 100644
index 00000000000..eb610672d75
--- /dev/null
+++ b/jdk/test/sun/security/ssl/StatusStapling/OCSPStatusRequestTests.java
@@ -0,0 +1,340 @@
+/*
+ * Copyright (c) 2015, 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 sun.security.ssl;
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS (OCSPStatusRequestTests tests)
+ * @build OCSPStatusRequestTests TestCase TestUtils
+ * @run main/othervm sun.security.ssl.OCSPStatusRequestTests
+ */
+
+import java.security.cert.*;
+import java.util.*;
+import java.nio.ByteBuffer;
+import javax.security.auth.x500.X500Principal;
+import sun.security.provider.certpath.ResponderId;
+import sun.security.provider.certpath.OCSPNonceExtension;
+
+/*
+ * Checks that the hash value for a certificate's issuer name is generated
+ * correctly. Requires any certificate that is not self-signed.
+ *
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class OCSPStatusRequestTests {
+
+ private static final boolean debug = false;
+
+ // The default (no Responder IDs or Extensions)
+ private static final byte[] DEF_OCSPREQ_BYTES = { 0, 0, 0, 0 };
+
+ // OCSP Extension with one Responder ID (byName: CN=OCSP Signer) and
+ // a nonce extension (32 bytes).
+ private static final byte[] OCSPREQ_1RID_1EXT = {
+ 0, 28, 0, 26, -95, 24, 48, 22,
+ 49, 20, 48, 18, 6, 3, 85, 4,
+ 3, 19, 11, 79, 67, 83, 80, 32,
+ 83, 105, 103, 110, 101, 114, 0, 51,
+ 48, 49, 48, 47, 6, 9, 43, 6,
+ 1, 5, 5, 7, 48, 1, 2, 4,
+ 34, 4, 32, -34, -83, -66, -17, -34,
+ -83, -66, -17, -34, -83, -66, -17, -34,
+ -83, -66, -17, -34, -83, -66, -17, -34,
+ -83, -66, -17, -34, -83, -66, -17, -34,
+ -83, -66, -17
+ };
+
+ public static void main(String[] args) throws Exception {
+ Map testList =
+ new LinkedHashMap() {{
+ put("CTOR (default)", testCtorDefault);
+ put("CTOR (Responder Id and Extension)", testCtorRidsExts);
+ put("CTOR (HandshakeInStream)", testCtorInStream);
+ put("CTOR (byte array)", testCtorByteArray);
+ put("Length tests", testLength);
+ put("Equals tests", testEquals);
+ }};
+
+ TestUtils.runTests(testList);
+ }
+
+ // Test the default constructor and its encoding
+ public static final TestCase testCtorDefault = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ // Create a OCSPStatusRequest with a single ResponderId
+ // and Extension
+ OCSPStatusRequest osrDefault = new OCSPStatusRequest();
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ osrDefault.send(hsout);
+ System.out.println("Encoded Result:");
+ TestUtils.dumpBytes(hsout.toByteArray());
+
+ TestUtils.valueCheck(DEF_OCSPREQ_BYTES, hsout.toByteArray());
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor form that allows the user to specify zero
+ // or more ResponderId objects and/or Extensions
+ public static final TestCase testCtorRidsExts = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ List ridList = new LinkedList() {{
+ add(new ResponderId(new X500Principal("CN=OCSP Signer")));
+ }};
+ List extList = new LinkedList() {{
+ add(new OCSPNonceExtension(32));
+ }};
+
+ // Default-style OCSPStatusRequest using both empty Lists and
+ // null inputs
+ OCSPStatusRequest osrDef1 =
+ new OCSPStatusRequest(new LinkedList(),
+ null);
+ OCSPStatusRequest osrDef2 =
+ new OCSPStatusRequest(null,
+ new LinkedList());
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ osrDef1.send(hsout);
+ System.out.println("Encoded Result:");
+ TestUtils.dumpBytes(hsout.toByteArray());
+ TestUtils.valueCheck(DEF_OCSPREQ_BYTES, hsout.toByteArray());
+
+ hsout.reset();
+ osrDef2.send(hsout);
+ System.out.println("Encoded Result:");
+ TestUtils.dumpBytes(hsout.toByteArray());
+ TestUtils.valueCheck(DEF_OCSPREQ_BYTES, hsout.toByteArray());
+
+ hsout.reset();
+ OCSPStatusRequest osrWithItems =
+ new OCSPStatusRequest(ridList, extList);
+ osrWithItems.send(hsout);
+ System.out.println("Encoded Result:");
+ byte[] encodedData = hsout.toByteArray();
+ TestUtils.dumpBytes(encodedData);
+ // Check everything except the last 32 bytes (nonce data)
+ TestUtils.valueCheck(OCSPREQ_1RID_1EXT, encodedData, 0, 0,
+ encodedData.length - 32);
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor that builds the ob ject using data from
+ // a HandshakeInStream
+ public static final TestCase testCtorInStream = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ ResponderId checkRid =
+ new ResponderId(new X500Principal("CN=OCSP Signer"));
+ Extension checkExt = new OCSPNonceExtension(32);
+
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(OCSPREQ_1RID_1EXT));
+ OCSPStatusRequest osr = new OCSPStatusRequest(hsis);
+
+ List ridList = osr.getResponderIds();
+ List extList = osr.getExtensions();
+
+ if (ridList.size() != 1 || !ridList.contains(checkRid)) {
+ throw new RuntimeException("Responder list mismatch");
+ } else if (extList.size() != 1 ||
+ !extList.get(0).getId().equals(checkExt.getId())) {
+ throw new RuntimeException("Extension list mismatch");
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor form that takes the data from a byte array
+ public static final TestCase testCtorByteArray = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ ResponderId checkRid =
+ new ResponderId(new X500Principal("CN=OCSP Signer"));
+ Extension checkExt = new OCSPNonceExtension(32);
+
+ OCSPStatusRequest osr =
+ new OCSPStatusRequest(OCSPREQ_1RID_1EXT);
+
+ List ridList = osr.getResponderIds();
+ List extList = osr.getExtensions();
+
+ if (ridList.size() != 1 || !ridList.contains(checkRid)) {
+ throw new RuntimeException("Responder list mismatch");
+ } else if (extList.size() != 1 ||
+ !extList.get(0).getId().equals(checkExt.getId())) {
+ throw new RuntimeException("Extension list mismatch");
+ }
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the length functions for both default and non-default
+ // OCSPStatusRequest objects
+ public static final TestCase testLength = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(OCSPREQ_1RID_1EXT));
+ OCSPStatusRequest osr = new OCSPStatusRequest(hsis);
+ OCSPStatusRequest osrDefault = new OCSPStatusRequest();
+
+ if (osrDefault.length() != DEF_OCSPREQ_BYTES.length) {
+ throw new RuntimeException("Invalid length for default: " +
+ "Expected" + DEF_OCSPREQ_BYTES.length +
+ ", received " + osrDefault.length());
+ } else if (osr.length() != OCSPREQ_1RID_1EXT.length) {
+ throw new RuntimeException("Invalid length for default: " +
+ "Expected" + OCSPREQ_1RID_1EXT.length +
+ ", received " + osr.length());
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the equals method with default and non-default objects
+ public static final TestCase testEquals = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ // Make two different lists with the same ResponderId values
+ // and also make a extension list
+ List ridList1 = new LinkedList() {{
+ add(new ResponderId(new X500Principal("CN=OCSP Signer")));
+ }};
+ List ridList2 = new LinkedList() {{
+ add(new ResponderId(new X500Principal("CN=OCSP Signer")));
+ }};
+ List extList = new LinkedList() {{
+ add(new OCSPNonceExtension(32));
+ }};
+
+ // We expect two default OCSP objects to be equal
+ OCSPStatusRequest osrDefault = new OCSPStatusRequest();
+ if (!osrDefault.equals(new OCSPStatusRequest())) {
+ throw new RuntimeException("Default OCSPStatusRequest" +
+ " equality test failed");
+ }
+
+ // null test (expect false return)
+ if (osrDefault.equals(null)) {
+ throw new RuntimeException("OCSPStatusRequest matched" +
+ " unexpectedly");
+ }
+
+ // Self-reference test
+ OCSPStatusRequest osrSelfRef = osrDefault;
+ if (!osrDefault.equals(osrSelfRef)) {
+ throw new RuntimeException("Default OCSPStatusRequest" +
+ " equality test failed");
+ }
+
+ // Two OCSPStatusRequests with matching ResponderIds should
+ // be considered equal
+ OCSPStatusRequest osrByList1 =
+ new OCSPStatusRequest(ridList1, null);
+ OCSPStatusRequest osrByList2 = new OCSPStatusRequest(ridList2,
+ Collections.emptyList());
+ if (!osrByList1.equals(osrByList2)) {
+ throw new RuntimeException("Single Responder ID " +
+ "OCSPStatusRequest equality test failed");
+ }
+
+ // We expect OCSPStatusRequests with different nonces to be
+ // considered unequal.
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(OCSPREQ_1RID_1EXT));
+ OCSPStatusRequest osrStream = new OCSPStatusRequest(hsis);
+ OCSPStatusRequest osrRidExt = new OCSPStatusRequest(ridList1,
+ extList);
+ if (osrStream.equals(osrRidExt)) {
+ throw new RuntimeException("OCSPStatusRequest matched" +
+ " unexpectedly");
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+}
diff --git a/jdk/test/sun/security/ssl/StatusStapling/StatusResponseManagerTests.java b/jdk/test/sun/security/ssl/StatusStapling/StatusResponseManagerTests.java
new file mode 100644
index 00000000000..198657e7c0b
--- /dev/null
+++ b/jdk/test/sun/security/ssl/StatusStapling/StatusResponseManagerTests.java
@@ -0,0 +1,455 @@
+/*
+ * Copyright (c) 2015, 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 sun.security.ssl;
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS (StatusResponseManager tests)
+ * @library ../../../../java/security/testlibrary
+ * @build CertificateBuilder SimpleOCSPServer
+ * @build StatusResponseManagerTests TestCase TestUtils
+ * @run main/othervm -Djavax.net.debug=ssl:respmgr
+ * sun.security.ssl.StatusResponseManagerTests
+ */
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.security.cert.*;
+import java.util.*;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.KeyStore;
+import java.security.PublicKey;
+import java.util.concurrent.TimeUnit;
+
+import sun.security.testlibrary.SimpleOCSPServer;
+import sun.security.testlibrary.CertificateBuilder;
+
+/*
+ * Checks that the hash value for a certificate's issuer name is generated
+ * correctly. Requires any certificate that is not self-signed.
+ *
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class StatusResponseManagerTests {
+
+ private static final boolean debug = true;
+ private static final boolean ocspDebug = false;
+
+ // PKI components we will need for this test
+ static String passwd = "passphrase";
+ static String ROOT_ALIAS = "root";
+ static String INT_ALIAS = "intermediate";
+ static String SSL_ALIAS = "ssl";
+ static KeyStore rootKeystore; // Root CA Keystore
+ static KeyStore intKeystore; // Intermediate CA Keystore
+ static KeyStore serverKeystore; // SSL Server Keystore
+ static KeyStore trustStore; // SSL Client trust store
+ static X509Certificate rootCert;
+ static X509Certificate intCert;
+ static X509Certificate sslCert;
+ static SimpleOCSPServer rootOcsp; // Root CA OCSP Responder
+ static int rootOcspPort; // Port number for root OCSP
+ static SimpleOCSPServer intOcsp; // Intermediate CA OCSP Responder
+ static int intOcspPort; // Port number for intermed. OCSP
+
+ static X509Certificate[] chain;
+
+ public static void main(String[] args) throws Exception {
+ Map testList =
+ new LinkedHashMap() {{
+ put("Basic OCSP fetch test", testOcspFetch);
+ put("Clear StatusResponseManager cache", testClearSRM);
+ put("Basic OCSP_MULTI fetch test", testOcspMultiFetch);
+ put("Test Cache Expiration", testCacheExpiry);
+ }};
+
+ // Create the CAs and OCSP responders
+ createPKI();
+
+ // Grab the certificates and make a chain we can reuse for tests
+ sslCert = (X509Certificate)serverKeystore.getCertificate(SSL_ALIAS);
+ intCert = (X509Certificate)intKeystore.getCertificate(INT_ALIAS);
+ rootCert = (X509Certificate)rootKeystore.getCertificate(ROOT_ALIAS);
+ chain = new X509Certificate[3];
+ chain[0] = sslCert;
+ chain[1] = intCert;
+ chain[2] = rootCert;
+
+ TestUtils.runTests(testList);
+
+ intOcsp.stop();
+ rootOcsp.stop();
+ }
+
+ // Test a simple RFC 6066 server-side fetch
+ public static final TestCase testOcspFetch = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ StatusResponseManager srm = new StatusResponseManager();
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ StatusRequest oReq = new OCSPStatusRequest();
+
+ try {
+ // Get OCSP responses for non-root certs in the chain
+ Map responseMap = srm.get(
+ StatusRequestType.OCSP, oReq, chain, 5000,
+ TimeUnit.MILLISECONDS);
+
+ // There should be one entry in the returned map and
+ // one entry in the cache when the operation is complete.
+ if (responseMap.size() != 1) {
+ message = "Incorrect number of responses: expected 1, got "
+ + responseMap.size();
+ } else if (!responseMap.containsKey(sslCert)) {
+ message = "Response map key is incorrect, expected " +
+ sslCert.getSubjectX500Principal().toString();
+ } else if (srm.size() != 1) {
+ message = "Incorrect number of cache entries: " +
+ "expected 1, got " + srm.size();
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test clearing the StatusResponseManager cache.
+ public static final TestCase testClearSRM = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ StatusResponseManager srm = new StatusResponseManager();
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ StatusRequest oReq = new OCSPStatusRequest();
+
+ try {
+ // Get OCSP responses for non-root certs in the chain
+ srm.get(StatusRequestType.OCSP_MULTI, oReq, chain, 5000,
+ TimeUnit.MILLISECONDS);
+
+ // There should be two entries in the returned map and
+ // two entries in the cache when the operation is complete.
+ if (srm.size() != 2) {
+ message = "Incorrect number of responses: expected 2, got "
+ + srm.size();
+ } else {
+ // Next, clear the SRM, then check the size again
+ srm.clear();
+ if (srm.size() != 0) {
+ message = "Incorrect number of responses: expected 0," +
+ " got " + srm.size();
+ } else {
+ pass = Boolean.TRUE;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test a simple RFC 6961 server-side fetch
+ public static final TestCase testOcspMultiFetch = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ StatusResponseManager srm = new StatusResponseManager();
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ StatusRequest oReq = new OCSPStatusRequest();
+
+ try {
+ // Get OCSP responses for non-root certs in the chain
+ Map responseMap = srm.get(
+ StatusRequestType.OCSP_MULTI, oReq, chain, 5000,
+ TimeUnit.MILLISECONDS);
+
+ // There should be two entries in the returned map and
+ // two entries in the cache when the operation is complete.
+ if (responseMap.size() != 2) {
+ message = "Incorrect number of responses: expected 2, got "
+ + responseMap.size();
+ } else if (!responseMap.containsKey(sslCert) ||
+ !responseMap.containsKey(intCert)) {
+ message = "Response map keys are incorrect, expected " +
+ sslCert.getSubjectX500Principal().toString() +
+ " and " +
+ intCert.getSubjectX500Principal().toString();
+ } else if (srm.size() != 2) {
+ message = "Incorrect number of cache entries: " +
+ "expected 2, got " + srm.size();
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test cache expiration
+ public static final TestCase testCacheExpiry = new TestCase() {
+ @Override
+ public Map.Entry runTest() {
+ // For this test, we will set the cache expiry to 5 seconds
+ System.setProperty("jdk.tls.stapling.cacheLifetime", "5");
+ StatusResponseManager srm = new StatusResponseManager();
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ StatusRequest oReq = new OCSPStatusRequest();
+
+ try {
+ // Get OCSP responses for non-root certs in the chain
+ srm.get(StatusRequestType.OCSP_MULTI, oReq, chain, 5000,
+ TimeUnit.MILLISECONDS);
+
+ // There should be two entries in the returned map and
+ // two entries in the cache when the operation is complete.
+ if (srm.size() != 2) {
+ message = "Incorrect number of responses: expected 2, got "
+ + srm.size();
+ } else {
+ // Next, wait for more than 5 seconds so the responses
+ // in the SRM will expire.
+ Thread.sleep(7000);
+ if (srm.size() != 0) {
+ message = "Incorrect number of responses: expected 0," +
+ " got " + srm.size();
+ } else {
+ pass = Boolean.TRUE;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ // Set the cache lifetime back to the default
+ System.setProperty("jdk.tls.stapling.cacheLifetime", "");
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ /**
+ * Creates the PKI components necessary for this test, including
+ * Root CA, Intermediate CA and SSL server certificates, the keystores
+ * for each entity, a client trust store, and starts the OCSP responders.
+ */
+ private static void createPKI() throws Exception {
+ CertificateBuilder cbld = new CertificateBuilder();
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+ keyGen.initialize(2048);
+ KeyStore.Builder keyStoreBuilder =
+ KeyStore.Builder.newInstance("PKCS12", null,
+ new KeyStore.PasswordProtection(passwd.toCharArray()));
+
+ // Generate Root, IntCA, EE keys
+ KeyPair rootCaKP = keyGen.genKeyPair();
+ log("Generated Root CA KeyPair");
+ KeyPair intCaKP = keyGen.genKeyPair();
+ log("Generated Intermediate CA KeyPair");
+ KeyPair sslKP = keyGen.genKeyPair();
+ log("Generated SSL Cert KeyPair");
+
+ // Set up the Root CA Cert
+ cbld.setSubjectName("CN=Root CA Cert, O=SomeCompany");
+ cbld.setPublicKey(rootCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("1"));
+ // Make a 3 year validity starting from 60 days ago
+ long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(60);
+ long end = start + TimeUnit.DAYS.toMillis(1085);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, rootCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ // Make our Root CA Cert!
+ X509Certificate rootCert = cbld.build(null, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Root CA Created:\n" + certInfo(rootCert));
+
+ // Now build a keystore and add the keys and cert
+ rootKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] rootChain = {rootCert};
+ rootKeystore.setKeyEntry(ROOT_ALIAS, rootCaKP.getPrivate(),
+ passwd.toCharArray(), rootChain);
+
+ // Now fire up the OCSP responder
+ rootOcsp = new SimpleOCSPServer(rootKeystore, passwd, ROOT_ALIAS, null);
+ rootOcsp.enableLog(ocspDebug);
+ rootOcsp.setNextUpdateInterval(3600);
+ rootOcsp.start();
+ Thread.sleep(1000); // Give the server a second to start up
+ rootOcspPort = rootOcsp.getPort();
+ String rootRespURI = "http://localhost:" + rootOcspPort;
+ log("Root OCSP Responder URI is " + rootRespURI);
+
+ // Now that we have the root keystore and OCSP responder we can
+ // create our intermediate CA.
+ cbld.reset();
+ cbld.setSubjectName("CN=Intermediate CA Cert, O=SomeCompany");
+ cbld.setPublicKey(intCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("100"));
+ // Make a 2 year validity starting from 30 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30);
+ end = start + TimeUnit.DAYS.toMillis(730);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, intCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ cbld.addAIAExt(Collections.singletonList(rootRespURI));
+ // Make our Intermediate CA Cert!
+ X509Certificate intCaCert = cbld.build(rootCert, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Intermediate CA Created:\n" + certInfo(intCaCert));
+
+ // Provide intermediate CA cert revocation info to the Root CA
+ // OCSP responder.
+ Map revInfo =
+ new HashMap<>();
+ revInfo.put(intCaCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ rootOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ intKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] intChain = {intCaCert, rootCert};
+ intKeystore.setKeyEntry(INT_ALIAS, intCaKP.getPrivate(),
+ passwd.toCharArray(), intChain);
+ intKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // Now fire up the Intermediate CA OCSP responder
+ intOcsp = new SimpleOCSPServer(intKeystore, passwd,
+ INT_ALIAS, null);
+ intOcsp.enableLog(ocspDebug);
+ intOcsp.setNextUpdateInterval(3600);
+ intOcsp.start();
+ Thread.sleep(1000);
+ intOcspPort = intOcsp.getPort();
+ String intCaRespURI = "http://localhost:" + intOcspPort;
+ log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
+
+ // Last but not least, let's make our SSLCert and add it to its own
+ // Keystore
+ cbld.reset();
+ cbld.setSubjectName("CN=SSLCertificate, O=SomeCompany");
+ cbld.setPublicKey(sslKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("4096"));
+ // Make a 1 year validity starting from 7 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7);
+ end = start + TimeUnit.DAYS.toMillis(365);
+ cbld.setValidity(new Date(start), new Date(end));
+
+ // Add extensions
+ addCommonExts(cbld, sslKP.getPublic(), intCaKP.getPublic());
+ boolean[] kuBits = {true, false, true, false, false, false,
+ false, false, false};
+ cbld.addKeyUsageExt(kuBits);
+ List ekuOids = new ArrayList<>();
+ ekuOids.add("1.3.6.1.5.5.7.3.1");
+ ekuOids.add("1.3.6.1.5.5.7.3.2");
+ cbld.addExtendedKeyUsageExt(ekuOids);
+ cbld.addSubjectAltNameDNSExt(Collections.singletonList("localhost"));
+ cbld.addAIAExt(Collections.singletonList(intCaRespURI));
+ // Make our SSL Server Cert!
+ X509Certificate sslCert = cbld.build(intCaCert, intCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("SSL Certificate Created:\n" + certInfo(sslCert));
+
+ // Provide SSL server cert revocation info to the Intermeidate CA
+ // OCSP responder.
+ revInfo = new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ serverKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] sslChain = {sslCert, intCaCert, rootCert};
+ serverKeystore.setKeyEntry(SSL_ALIAS, sslKP.getPrivate(),
+ passwd.toCharArray(), sslChain);
+ serverKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // And finally a Trust Store for the client
+ trustStore = keyStoreBuilder.getKeyStore();
+ trustStore.setCertificateEntry(ROOT_ALIAS, rootCert);
+ }
+
+ private static void addCommonExts(CertificateBuilder cbld,
+ PublicKey subjKey, PublicKey authKey) throws IOException {
+ cbld.addSubjectKeyIdExt(subjKey);
+ cbld.addAuthorityKeyIdExt(authKey);
+ }
+
+ private static void addCommonCAExts(CertificateBuilder cbld)
+ throws IOException {
+ cbld.addBasicConstraintsExt(true, true, -1);
+ // Set key usage bits for digitalSignature, keyCertSign and cRLSign
+ boolean[] kuBitSettings = {true, false, false, false, false, true,
+ true, false, false};
+ cbld.addKeyUsageExt(kuBitSettings);
+ }
+
+ /**
+ * Helper routine that dumps only a few cert fields rather than
+ * the whole toString() output.
+ *
+ * @param cert An X509Certificate to be displayed
+ *
+ * @return The {@link String} output of the issuer, subject and
+ * serial number
+ */
+ private static String certInfo(X509Certificate cert) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Issuer: ").append(cert.getIssuerX500Principal()).
+ append("\n");
+ sb.append("Subject: ").append(cert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("Serial: ").append(cert.getSerialNumber()).append("\n");
+ return sb.toString();
+ }
+
+ /**
+ * Log a message on stdout
+ *
+ * @param message The message to log
+ */
+ private static void log(String message) {
+ if (debug) {
+ System.out.println(message);
+ }
+ }
+}
diff --git a/jdk/test/sun/security/ssl/StatusStapling/TEST.properties b/jdk/test/sun/security/ssl/StatusStapling/TEST.properties
new file mode 100644
index 00000000000..72f8b4cfd43
--- /dev/null
+++ b/jdk/test/sun/security/ssl/StatusStapling/TEST.properties
@@ -0,0 +1 @@
+bootclasspath.dirs=.
diff --git a/jdk/test/sun/security/ssl/StatusStapling/TestCase.java b/jdk/test/sun/security/ssl/StatusStapling/TestCase.java
new file mode 100644
index 00000000000..c1a564a64fc
--- /dev/null
+++ b/jdk/test/sun/security/ssl/StatusStapling/TestCase.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2015, 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 sun.security.ssl;
+
+import java.util.Map;
+
+public interface TestCase {
+ Map.Entry runTest();
+}
+
+
diff --git a/jdk/test/sun/security/ssl/StatusStapling/TestUtils.java b/jdk/test/sun/security/ssl/StatusStapling/TestUtils.java
new file mode 100644
index 00000000000..85c42e03733
--- /dev/null
+++ b/jdk/test/sun/security/ssl/StatusStapling/TestUtils.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2015, 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 sun.security.ssl;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.Map;
+
+public class TestUtils {
+
+ // private constructor to prevent instantiation for this utility class
+ private TestUtils() {
+ throw new AssertionError();
+ }
+
+ public static void runTests(Map testList) {
+ int testNo = 0;
+ int numberFailed = 0;
+ Map.Entry result;
+
+ System.out.println("============ Tests ============");
+ for (String testName : testList.keySet()) {
+ System.out.println("Test " + ++testNo + ": " + testName);
+ result = testList.get(testName).runTest();
+ System.out.print("Result: " + (result.getKey() ? "PASS" : "FAIL"));
+ System.out.println(" " +
+ (result.getValue() != null ? result.getValue() : ""));
+ System.out.println("-------------------------------------------");
+ if (!result.getKey()) {
+ numberFailed++;
+ }
+ }
+
+ System.out.println("End Results: " + (testList.size() - numberFailed) +
+ " Passed" + ", " + numberFailed + " Failed.");
+ if (numberFailed > 0) {
+ throw new RuntimeException(
+ "One or more tests failed, see test output for details");
+ }
+ }
+
+ public static void dumpBytes(byte[] data) {
+ dumpBytes(ByteBuffer.wrap(data));
+ }
+
+ public static void dumpBytes(ByteBuffer data) {
+ int i = 0;
+
+ data.mark();
+ while (data.hasRemaining()) {
+ if (i % 16 == 0 && i != 0) {
+ System.out.print("\n");
+ }
+ System.out.print(String.format("%02X ", data.get()));
+ i++;
+ }
+ System.out.print("\n");
+ data.reset();
+ }
+
+ public static void valueCheck(byte[] array1, byte[] array2) {
+ if (!Arrays.equals(array1, array2)) {
+ throw new RuntimeException("Array mismatch");
+ }
+ }
+
+ // Compares a range of bytes at specific offsets in each array
+ public static void valueCheck(byte[] array1, byte[] array2, int skip1,
+ int skip2, int length) {
+ ByteBuffer buf1 = ByteBuffer.wrap(array1);
+ ByteBuffer buf2 = ByteBuffer.wrap(array2);
+
+ // Skip past however many bytes are requested in both buffers
+ buf1.position(skip1);
+ buf2.position(skip2);
+
+ // Reset the limits on each buffer to account for the length
+ buf1.limit(buf1.position() + length);
+ buf2.limit(buf2.position() + length);
+
+ if (!buf1.equals(buf2)) {
+ throw new RuntimeException("Array range mismatch");
+ }
+ }
+
+ // Concatenate 1 or more arrays
+ public static byte[] gatherBuffers(byte[]... arrays) {
+ int totalLength = 0;
+ for (byte[] ar : arrays) {
+ totalLength += ar != null ? ar.length : 0;
+ }
+
+ byte[] resultBuf = new byte[totalLength];
+ int offset = 0;
+ for (byte[] ar : arrays) {
+ if (ar != null) {
+ System.arraycopy(ar, 0, resultBuf, offset, ar.length);
+ offset += ar.length;
+ }
+ }
+ return resultBuf;
+ }
+}
+
+
diff --git a/jdk/test/sun/text/resources/LocaleData.cldr b/jdk/test/sun/text/resources/LocaleData.cldr
index e09d6969b50..36ce58f2f98 100644
--- a/jdk/test/sun/text/resources/LocaleData.cldr
+++ b/jdk/test/sun/text/resources/LocaleData.cldr
@@ -2630,49 +2630,49 @@ LocaleNames/en_SG/TL=Timor-Leste
LocaleNames/en_SG/VC=St. Vincent & Grenadines
LocaleNames/en_SG/WF=Wallis & Futuna
#in
-FormatData/in/MonthNames/0=M01
-FormatData/in/MonthNames/1=M02
-FormatData/in/MonthNames/2=M03
-FormatData/in/MonthNames/3=M04
-FormatData/in/MonthNames/4=M05
-FormatData/in/MonthNames/5=M06
-FormatData/in/MonthNames/6=M07
-FormatData/in/MonthNames/7=M08
-FormatData/in/MonthNames/8=M09
-FormatData/in/MonthNames/9=M10
-FormatData/in/MonthNames/10=M11
-FormatData/in/MonthNames/11=M12
+FormatData/in/MonthNames/0=Januari
+FormatData/in/MonthNames/1=Februari
+FormatData/in/MonthNames/2=Maret
+FormatData/in/MonthNames/3=April
+FormatData/in/MonthNames/4=Mei
+FormatData/in/MonthNames/5=Juni
+FormatData/in/MonthNames/6=Juli
+FormatData/in/MonthNames/7=Agustus
+FormatData/in/MonthNames/8=September
+FormatData/in/MonthNames/9=Oktober
+FormatData/in/MonthNames/10=November
+FormatData/in/MonthNames/11=Desember
FormatData/in/MonthNames/12=
-FormatData/in/MonthAbbreviations/0=M01
-FormatData/in/MonthAbbreviations/1=M02
-FormatData/in/MonthAbbreviations/2=M03
-FormatData/in/MonthAbbreviations/3=M04
-FormatData/in/MonthAbbreviations/4=M05
-FormatData/in/MonthAbbreviations/5=M06
-FormatData/in/MonthAbbreviations/6=M07
-FormatData/in/MonthAbbreviations/7=M08
-FormatData/in/MonthAbbreviations/8=M09
-FormatData/in/MonthAbbreviations/9=M10
-FormatData/in/MonthAbbreviations/10=M11
-FormatData/in/MonthAbbreviations/11=M12
-FormatData/in/DayNames/0=Sun
-FormatData/in/DayNames/1=Mon
-FormatData/in/DayNames/2=Tue
-FormatData/in/DayNames/3=Wed
-FormatData/in/DayNames/4=Thu
-FormatData/in/DayNames/5=Fri
-FormatData/in/DayNames/6=Sat
-FormatData/in/DayAbbreviations/0=Sun
-FormatData/in/DayAbbreviations/1=Mon
-FormatData/in/DayAbbreviations/2=Tue
-FormatData/in/DayAbbreviations/3=Wed
-FormatData/in/DayAbbreviations/4=Thu
-FormatData/in/DayAbbreviations/5=Fri
-FormatData/in/DayAbbreviations/6=Sat
-FormatData/in/Eras/0=BCE
-FormatData/in/Eras/1=CE
+FormatData/in/MonthAbbreviations/0=Jan
+FormatData/in/MonthAbbreviations/1=Feb
+FormatData/in/MonthAbbreviations/2=Mar
+FormatData/in/MonthAbbreviations/3=Apr
+FormatData/in/MonthAbbreviations/4=Mei
+FormatData/in/MonthAbbreviations/5=Jun
+FormatData/in/MonthAbbreviations/6=Jul
+FormatData/in/MonthAbbreviations/7=Agt
+FormatData/in/MonthAbbreviations/8=Sep
+FormatData/in/MonthAbbreviations/9=Okt
+FormatData/in/MonthAbbreviations/10=Nov
+FormatData/in/MonthAbbreviations/11=Des
+FormatData/in/DayNames/0=Minggu
+FormatData/in/DayNames/1=Senin
+FormatData/in/DayNames/2=Selasa
+FormatData/in/DayNames/3=Rabu
+FormatData/in/DayNames/4=Kamis
+FormatData/in/DayNames/5=Jumat
+FormatData/in/DayNames/6=Sabtu
+FormatData/in/DayAbbreviations/0=Min
+FormatData/in/DayAbbreviations/1=Sen
+FormatData/in/DayAbbreviations/2=Sel
+FormatData/in/DayAbbreviations/3=Rab
+FormatData/in/DayAbbreviations/4=Kam
+FormatData/in/DayAbbreviations/5=Jum
+FormatData/in/DayAbbreviations/6=Sab
+FormatData/in/Eras/0=SM
+FormatData/in/Eras/1=M
FormatData/in/NumberPatterns/0=#,##0.###
-FormatData/in/NumberPatterns/1=\u00a4\u00a0#,##0.00
+FormatData/in/NumberPatterns/1=\u00a4#,##0.00
FormatData/in/NumberPatterns/2=#,##0%
#FormatData/in/NumberElements/0=
#FormatData/in/NumberElements/1=
@@ -2685,14 +2685,14 @@ FormatData/in/NumberPatterns/2=#,##0%
#FormatData/in/NumberElements/8=
#FormatData/in/NumberElements/9=
#FormatData/in/NumberElements/10=
-FormatData/in/TimePatterns/0=HH:mm:ss zzzz
-FormatData/in/TimePatterns/1=HH:mm:ss z
-FormatData/in/TimePatterns/2=HH:mm:ss
-FormatData/in/TimePatterns/3=HH:mm
-FormatData/in/DatePatterns/0=y MMMM d, EEEE
-FormatData/in/DatePatterns/1=y MMMM d
-FormatData/in/DatePatterns/2=y MMM d
-FormatData/in/DatePatterns/3=y-MM-dd
+FormatData/in/TimePatterns/0=HH.mm.ss zzzz
+FormatData/in/TimePatterns/1=HH.mm.ss z
+FormatData/in/TimePatterns/2=HH.mm.ss
+FormatData/in/TimePatterns/3=HH.mm
+FormatData/in/DatePatterns/0=EEEE, dd MMMM y
+FormatData/in/DatePatterns/1=d MMMM y
+FormatData/in/DatePatterns/2=d MMM y
+FormatData/in/DatePatterns/3=dd/MM/yy
FormatData/in/DateTimePatterns/0={1} {0}
#LocaleNames/in/ab=
#LocaleNames/in/am=
@@ -2848,14 +2848,14 @@ FormatData/in/DateTimePatterns/0={1} {0}
#LocaleNames/in/YE=
#LocaleNames/in/ZA=
#in_ID
-FormatData/in_ID/TimePatterns/0=HH:mm:ss zzzz
-FormatData/in_ID/TimePatterns/1=HH:mm:ss z
-FormatData/in_ID/TimePatterns/2=HH:mm:ss
-FormatData/in_ID/TimePatterns/3=HH:mm
-FormatData/in_ID/DatePatterns/0=y MMMM d, EEEE
-FormatData/in_ID/DatePatterns/1=y MMMM d
-FormatData/in_ID/DatePatterns/2=y MMM d
-FormatData/in_ID/DatePatterns/3=y-MM-dd
+FormatData/in_ID/TimePatterns/0=HH.mm.ss zzzz
+FormatData/in_ID/TimePatterns/1=HH.mm.ss z
+FormatData/in_ID/TimePatterns/2=HH.mm.ss
+FormatData/in_ID/TimePatterns/3=HH.mm
+FormatData/in_ID/DatePatterns/0=EEEE, dd MMMM y
+FormatData/in_ID/DatePatterns/1=d MMMM y
+FormatData/in_ID/DatePatterns/2=d MMM y
+FormatData/in_ID/DatePatterns/3=dd/MM/yy
FormatData/in_ID/DateTimePatterns/0={1} {0}
#CurrencyNames/in_ID/IDR/0=
#en_MT
@@ -5570,7 +5570,7 @@ FormatData/fi/AmPmMarkers/1=ip.
# bug 6507067
TimeZoneNames/zh_TW/Asia\/Taipei/1=\u53f0\u5317\u6a19\u6e96\u6642\u9593
-TimeZoneNames/zh_TW/Asia\/Taipei/2=TST
+TimeZoneNames/zh_TW/Asia\/Taipei/2=CST
# bug 6645271
FormatData/hr_HR/DatePatterns/2=d. MMM y.
@@ -7316,20 +7316,20 @@ FormatData/it/DayNarrows/4=G
FormatData/it/DayNarrows/5=V
FormatData/it/DayNarrows/6=S
-FormatData/iw/DayNarrows/0=S
-FormatData/iw/DayNarrows/1=M
-FormatData/iw/DayNarrows/2=T
-FormatData/iw/DayNarrows/3=W
-FormatData/iw/DayNarrows/4=T
-FormatData/iw/DayNarrows/5=F
-FormatData/iw/DayNarrows/6=S
-FormatData/iw/standalone.DayNarrows/0=S
-FormatData/iw/standalone.DayNarrows/1=M
-FormatData/iw/standalone.DayNarrows/2=T
-FormatData/iw/standalone.DayNarrows/3=W
-FormatData/iw/standalone.DayNarrows/4=T
-FormatData/iw/standalone.DayNarrows/5=F
-FormatData/iw/standalone.DayNarrows/6=S
+FormatData/iw/DayNarrows/0=\u05d0\u05f3
+FormatData/iw/DayNarrows/1=\u05d1\u05f3
+FormatData/iw/DayNarrows/2=\u05d2\u05f3
+FormatData/iw/DayNarrows/3=\u05d3\u05f3
+FormatData/iw/DayNarrows/4=\u05d4\u05f3
+FormatData/iw/DayNarrows/5=\u05d5\u05f3
+FormatData/iw/DayNarrows/6=\u05e9\u05f3
+FormatData/iw/standalone.DayNarrows/0=\u05d0\u05f3
+FormatData/iw/standalone.DayNarrows/1=\u05d1\u05f3
+FormatData/iw/standalone.DayNarrows/2=\u05d2\u05f3
+FormatData/iw/standalone.DayNarrows/3=\u05d3\u05f3
+FormatData/iw/standalone.DayNarrows/4=\u05d4\u05f3
+FormatData/iw/standalone.DayNarrows/5=\u05d5\u05f3
+FormatData/iw/standalone.DayNarrows/6=\u05e9\u05f3
FormatData/ja/DayNarrows/0=\u65e5
FormatData/ja/DayNarrows/1=\u6708
diff --git a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java
new file mode 100644
index 00000000000..4d7a81c152b
--- /dev/null
+++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2015, 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 Basic test for jhsdb launcher
+ * @library /../../test/lib/share/classes
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @build jdk.test.lib.apps.*
+ * @run main BasicLauncherTest
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Arrays;
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.Utils;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.apps.LingeredApp;
+
+public class BasicLauncherTest {
+
+ private final static String toolName = "jhsdb";
+ private static LingeredApp theApp = null;
+
+ /**
+ *
+ * @return exit code of tool
+ */
+ public static int launchCLHSDB()
+ throws IOException {
+
+ System.out.println("Starting LingeredApp");
+ try {
+ theApp = LingeredApp.startApp();
+
+ System.out.println("Starting clhsdb against " + theApp.getPid());
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
+ launcher.addToolArg("clhsdb");
+ launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
+
+ ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
+ processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
+ Process toolProcess = processBuilder.start();
+ toolProcess.getOutputStream().write("quit\n".getBytes());
+ toolProcess.getOutputStream().close();
+
+ // By default child process output stream redirected to pipe, so we are reading it in foreground.
+ BufferedReader reader = new BufferedReader(new InputStreamReader(toolProcess.getInputStream()));
+
+ String line;
+ while ((line = reader.readLine()) != null) {
+ System.out.println(line.trim());
+ }
+
+ toolProcess.waitFor();
+
+ return toolProcess.exitValue();
+ } catch (Exception ex) {
+ throw new RuntimeException("Test ERROR " + ex, ex);
+ } finally {
+ LingeredApp.stopApp(theApp);
+ }
+ }
+
+ /**
+ *
+ * @param vmArgs - vm and java arguments to launch test app
+ * @return exit code of tool
+ */
+ public static void launch(String expectedMessage, List toolArgs)
+ throws IOException {
+
+ System.out.println("Starting LingeredApp");
+ try {
+ theApp = LingeredApp.startApp();
+
+ System.out.println("Starting " + toolName + " " + toolArgs.get(0) + " against " + theApp.getPid());
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
+
+ for (String cmd : toolArgs) {
+ launcher.addToolArg(cmd);
+ }
+
+ launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
+
+ ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
+ processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
+ OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);;
+ output.shouldContain(expectedMessage);
+ output.shouldHaveExitValue(0);
+
+ } catch (Exception ex) {
+ throw new RuntimeException("Test ERROR " + ex, ex);
+ } finally {
+ LingeredApp.stopApp(theApp);
+ }
+ }
+
+ public static void launch(String expectedMessage, String... toolArgs)
+ throws IOException {
+
+ launch(expectedMessage, Arrays.asList(toolArgs));
+ }
+
+ public static void main(String[] args)
+ throws IOException {
+
+ launchCLHSDB();
+
+ launch("No deadlocks found", "jstack");
+ launch("Server compiler detected", "jmap");
+ launch("Java System Properties", "jinfo");
+
+ // The test throws RuntimeException on error.
+ // IOException is thrown if LingeredApp can't start because of some bad
+ // environment condition
+ System.out.println("Test PASSED");
+ }
+}
diff --git a/jdk/test/sun/tools/jhsdb/SAGetoptTest.java b/jdk/test/sun/tools/jhsdb/SAGetoptTest.java
new file mode 100644
index 00000000000..60ff9fffc68
--- /dev/null
+++ b/jdk/test/sun/tools/jhsdb/SAGetoptTest.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2015, 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 unit test for SAGetopt function
+ * @compile -XDignore.symbol.file SAGetoptTest.java
+ * @run main SAGetoptTest
+ */
+
+import sun.jvm.hotspot.SAGetopt;
+
+public class SAGetoptTest {
+
+ private static boolean a_opt;
+ private static boolean b_opt;
+ private static boolean c_opt;
+ private static boolean e_opt;
+ private static boolean mixed_opt;
+
+ private static String d_value;
+ private static String exe_value;
+ private static String core_value;
+
+ private static void initArgValues() {
+ a_opt = false;
+ b_opt = false;
+ c_opt = false;
+ e_opt = false;
+ mixed_opt = false;
+
+ d_value = "";
+ exe_value = "";
+ core_value = "";
+ }
+
+
+ private static void optionsTest(String[] args) {
+ initArgValues();
+
+ SAGetopt sg = new SAGetopt(args);
+
+ String[] longOpts = {"exe=","core=","mixed"};
+ String shortOpts = "abcd:e";
+ String s;
+
+ while((s = sg.next(shortOpts, longOpts)) != null) {
+ if (s.equals("a")) {
+ a_opt = true;
+ continue;
+ }
+
+ if (s.equals("b")) {
+ b_opt = true;
+ continue;
+ }
+
+ if (s.equals("c")) {
+ c_opt = true;
+ continue;
+ }
+
+ if (s.equals("e")) {
+ e_opt = true;
+ continue;
+ }
+
+ if (s.equals("mixed")) {
+ mixed_opt = true;
+ continue;
+ }
+
+ if (s.equals("d")) {
+ d_value = sg.getOptarg();
+ continue;
+ }
+
+ if (s.equals("exe")) {
+ exe_value = sg.getOptarg();
+ continue;
+ }
+
+ if (s.equals("core")) {
+ core_value = sg.getOptarg();
+ continue;
+ }
+ }
+ }
+
+ private static void badOptionsTest(int setNumber, String[] args, String expectedMessage) {
+ String msg = null;
+ try {
+ optionsTest(args);
+ } catch(RuntimeException ex) {
+ msg = ex.getMessage();
+ }
+
+ if (msg == null || !msg.equals(expectedMessage)) {
+ if (msg != null) {
+ System.err.println("Unexpected error '" + msg + "'");
+ }
+ throw new RuntimeException("Bad option test " + setNumber + " failed");
+ }
+ }
+
+ public static void main(String[] args) {
+ String[] optionSet1 = {"-abd", "bla", "-c"};
+ optionsTest(optionSet1);
+ if (!a_opt || !b_opt || !d_value.equals("bla") || !c_opt) {
+ throw new RuntimeException("Good optionSet 1 failed");
+ }
+
+ String[] optionSet2 = {"-e", "--mixed"};
+ optionsTest(optionSet2);
+ if (!e_opt || !mixed_opt) {
+ throw new RuntimeException("Good optionSet 2 failed");
+ }
+
+ String[] optionSet3 = {"--exe=bla", "--core", "bla_core", "--mixed"};
+ optionsTest(optionSet3);
+ if (!exe_value.equals("bla") || !core_value.equals("bla_core") || !mixed_opt) {
+ throw new RuntimeException("Good optionSet 3 failed");
+ }
+
+ // Bad options test
+ String[] optionSet4 = {"-abd", "-c"};
+ badOptionsTest(4, optionSet4, "Argument is expected for 'd'");
+
+ String[] optionSet5 = {"-exe", "bla", "--core"};
+ badOptionsTest(5, optionSet5, "Invalid option 'x'");
+
+ String[] optionSet6 = {"--exe", "--core", "bla_core"};
+ badOptionsTest(6, optionSet6, "Argument is expected for 'exe'");
+ }
+ }
diff --git a/jdk/test/sun/tools/jmap/BasicJMapTest.java b/jdk/test/sun/tools/jmap/BasicJMapTest.java
index 30bff00b548..f9cb1eafa02 100644
--- a/jdk/test/sun/tools/jmap/BasicJMapTest.java
+++ b/jdk/test/sun/tools/jmap/BasicJMapTest.java
@@ -36,6 +36,7 @@ import jdk.testlibrary.ProcessTools;
* @test
* @bug 6321286
* @summary Unit test for jmap utility
+ * @key intermittent
* @library /lib/testlibrary
* @library /../../test/lib/share/classes
* @modules java.management
diff --git a/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java b/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java
index 8782b2a896c..1b0011b70f5 100644
--- a/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java
+++ b/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825
+ * @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
diff --git a/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java b/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java
index acefc694f5e..9c9b564349c 100644
--- a/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java
+++ b/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825 7092186
+ * @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
diff --git a/jdk/test/sun/tools/jstatd/TestJstatdPort.java b/jdk/test/sun/tools/jstatd/TestJstatdPort.java
index c011f73653f..8443b3e1bee 100644
--- a/jdk/test/sun/tools/jstatd/TestJstatdPort.java
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPort.java
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825
+ * @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
diff --git a/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java b/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java
index 06e7a04a88b..9cce98a347d 100644
--- a/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825
+ * @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
diff --git a/jdk/test/vm/verifier/VerifyProtectedConstructor.java b/jdk/test/vm/verifier/VerifyProtectedConstructor.java
index c8b00be7b57..c47057581e9 100644
--- a/jdk/test/vm/verifier/VerifyProtectedConstructor.java
+++ b/jdk/test/vm/verifier/VerifyProtectedConstructor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, 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,7 +26,7 @@
* @test
* @bug 6490436
- * @summary Verify that protected constructor calls are not allowed for classfile version >= 50 (but that they are allowed for lesser versions).
+ * @summary Verify that protected constructor calls are not allowed for any classfile versions in either verifier.
* @author Keith McGuigan
*/
@@ -38,9 +38,10 @@ public class VerifyProtectedConstructor extends ClassLoader {
try {
t.checkClassVersion(49); // should not throw VerifyError
+ throw new Exception("FAIL: should be a VerifyError for CF version 49");
}
catch(VerifyError e) {
- throw new Exception("FAIL: should be no VerifyError for CF version 49");
+ System.out.println("PASS for CF version 49");
}
try {