--- a/jdk/make/common/Release.gmk Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/make/common/Release.gmk Tue Jul 02 15:23:23 2013 -0700
@@ -252,7 +252,7 @@
$(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \
trim-image-jre trim-image-jdk \
identify-image-jre identify-image-jdk \
- process-image-jre process-image-jdk sec-files sec-files-win jgss-files
+ process-image-jre process-image-jdk sec-files sec-files-win jgss-files
endif
# Don't use these
@@ -400,7 +400,8 @@
# classes that go into jfr.jar
JFR_CLASSES_DIRS= \
com/oracle/jrockit/jfr \
- oracle/jrockit/jfr
+ oracle/jrockit/jfr \
+ jdk/jfr
# classes that go into jsse.jar
JSSE_CLASSES_DIRS = \
@@ -612,6 +613,7 @@
$(ECHO) "oracle/jrockit/jfr/parser/" >> $@
$(ECHO) "oracle/jrockit/jfr/settings/" >> $@
$(ECHO) "oracle/jrockit/jfr/tools/" >> $@
+ $(ECHO) "jdk/jfr/" >> $@
endif
endif
--- a/jdk/make/java/java/FILES_java.gmk Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/make/java/java/FILES_java.gmk Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 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
@@ -529,7 +529,6 @@
sun/misc/JavaNioAccess.java \
sun/misc/Perf.java \
sun/misc/PerfCounter.java \
- sun/misc/Hashing.java \
sun/net/www/protocol/jar/Handler.java \
sun/net/www/protocol/jar/JarURLConnection.java \
sun/net/www/protocol/file/Handler.java \
--- a/jdk/makefiles/CreateJars.gmk Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/makefiles/CreateJars.gmk Tue Jul 02 15:23:23 2013 -0700
@@ -132,7 +132,7 @@
##########################################################################################
# Full JRE exclude list for rt.jar and resources.jar
-# This value should exclude types destined for jars other than rt.jar and resources.jar.
+# This value should exclude types destined for jars other than rt.jar and resources.jar.
# When building a Profile this value augments the profile specific exclusions
RT_JAR_EXCLUDES += \
com/oracle/security \
@@ -246,7 +246,8 @@
sun/util/resources/cldr \
$(LOCALEDATA_INCLUDES) \
com/oracle/jrockit/jfr \
- oracle/jrockit/jfr
+ oracle/jrockit/jfr \
+ jdk/jfr
ifeq ($(OPENJDK_TARGET_OS), macosx)
RT_JAR_EXCLUDES += com/sun/nio/sctp \
@@ -337,7 +338,7 @@
# Support for removing the addPropertyChangeListener and removePropertyChangeListener
-# methods from classes that only go into the profile builds.
+# methods from classes that only go into the profile builds.
BEANLESS_CLASSES = $(IMAGES_OUTPUTDIR)/beanless
# When there are $ characters in filenames we have some very subtle interactions between
@@ -352,7 +353,7 @@
java/util/jar/Pack200\$$Packer.class \
java/util/jar/Pack200\$$Unpacker.class \
com/sun/java/util/jar/pack/PackerImpl.class \
- com/sun/java/util/jar/pack/UnpackerImpl.class
+ com/sun/java/util/jar/pack/UnpackerImpl.class
ifneq ($(PROFILE),)
BEANLESS_CLASSES_TARGETS := $(addprefix $(BEANLESS_CLASSES)/, $(CLASSES_TO_DEBEAN))
@@ -428,7 +429,8 @@
SRCS:=$(JDK_OUTPUTDIR)/classes,\
SUFFIXES:=.class .jfc .xsd,\
INCLUDES:=com/oracle/jrockit/jfr \
- oracle/jrockit/jfr,\
+ oracle/jrockit/jfr \
+ jdk/jfr,\
JAR:=$(IMAGES_OUTPUTDIR)/lib/jfr.jar,\
SKIP_METAINF:=true,\
MANIFEST:=$(MAINMANIFEST), \
@@ -468,14 +470,14 @@
$(MV) $@.tmp $@
##########################################################################################
-# For security and crypto jars, always build the jar, but for closed, install the prebuilt
-# signed version instead of the newly built jar. Unsigned jars are treated as intermediate
-# targets and explicitly added to the JARS list. For open, signing is not needed. See
+# For security and crypto jars, always build the jar, but for closed, install the prebuilt
+# signed version instead of the newly built jar. Unsigned jars are treated as intermediate
+# targets and explicitly added to the JARS list. For open, signing is not needed. See
# SignJars.gmk for more information.
#
# The source for the crypto jars is not available for all licensees. The BUILD_CRYPTO
# variable is set to no if these jars can't be built to skip that step of the build.
-# Note that for OPENJDK, the build will fail if BUILD_CRYPTO=no since then there is no
+# Note that for OPENJDK, the build will fail if BUILD_CRYPTO=no since then there is no
# other way to get the jars than to build them.
SUNPKCS11_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunpkcs11.jar
@@ -738,7 +740,7 @@
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
$(install-file)
-JARS += $(UCRYPTO_JAR_UNSIGNED)
+JARS += $(UCRYPTO_JAR_UNSIGNED)
endif
endif
--- a/jdk/makefiles/profile-includes.txt Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/makefiles/profile-includes.txt Tue Jul 02 15:23:23 2013 -0700
@@ -125,13 +125,11 @@
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jaas_unix$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo.diz \
- $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jfr$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt.diz \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \
- jfr.jar \
jvm.hprof.txt \
management-agent.jar \
management/jmxremote.access \
@@ -164,6 +162,7 @@
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)fontmanager$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jdwp$(SHARED_LIBRARY_SUFFIX) \
+ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jfr$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jpeg$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsound$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsoundalsa$(SHARED_LIBRARY_SUFFIX) \
@@ -214,6 +213,7 @@
images/cursors/motif_MoveDrop32x32.gif \
images/cursors/motif_MoveNoDrop32x32.gif \
jexec \
+ jfr.jar \
oblique-fonts/LucidaSansDemiOblique.ttf \
oblique-fonts/LucidaSansOblique.ttf \
oblique-fonts/LucidaTypewriterBoldOblique.ttf \
--- a/jdk/src/share/classes/java/lang/Boolean.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Boolean.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -205,9 +205,9 @@
* Returns a hash code for a {@code boolean} value; compatible with
* {@code Boolean.hashCode()}.
*
+ * @param value the value to hash
+ * @return a hash code value for a {@code boolean} value.
* @since 1.8
- *
- * @return a hash code value for a {@code boolean} value.
*/
public static int hashCode(boolean value) {
return value ? 1231 : 1237;
--- a/jdk/src/share/classes/java/lang/Byte.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Byte.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -398,9 +398,9 @@
* Returns a hash code for a {@code byte} value; compatible with
* {@code Byte.hashCode()}.
*
+ * @param value the value to hash
+ * @return a hash code value for a {@code byte} value.
* @since 1.8
- *
- * @return a hash code value for a {@code byte} value.
*/
public static int hashCode(byte value) {
return (int)value;
--- a/jdk/src/share/classes/java/lang/Class.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Class.java Tue Jul 02 15:23:23 2013 -0700
@@ -3250,6 +3250,8 @@
* could not be checked at runtime (because generic types are implemented
* by erasure).
*
+ * @param <U> the type to cast this class object to
+ * @param clazz the class of the type to cast this class object to
* @return this {@code Class} object, cast to represent a subclass of
* the specified class object.
* @throws ClassCastException if this {@code Class} object does not
@@ -3405,6 +3407,7 @@
* If this Class represents either the Object class, an interface type, an
* array type, a primitive type, or void, the return value is null.
*
+ * @return an object representing the superclass
* @since 1.8
*/
public AnnotatedType getAnnotatedSuperclass() {
@@ -3436,6 +3439,7 @@
* If this Class represents either the Object class, an array type, a
* primitive type, or void, the return value is an array of length 0.
*
+ * @return an array representing the superinterfaces
* @since 1.8
*/
public AnnotatedType[] getAnnotatedInterfaces() {
--- a/jdk/src/share/classes/java/lang/Double.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Double.java Tue Jul 02 15:23:23 2013 -0700
@@ -453,8 +453,7 @@
* a {@code NumberFormatException} be thrown, the regular
* expression below can be used to screen the input string:
*
- * <code>
- * <pre>
+ * <pre>{@code
* final String Digits = "(\\p{Digit}+)";
* final String HexDigits = "(\\p{XDigit}+)";
* // an exponent is 'e' or 'E' followed by an optionally
@@ -474,7 +473,7 @@
* // in addition to strings of floating-point literals, the
* // two sub-patterns below are simplifications of the grammar
* // productions from section 3.10.2 of
- * // <cite>The Java™ Language Specification</cite>.
+ * // The Java Language Specification.
*
* // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt
* "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
@@ -499,8 +498,7 @@
* else {
* // Perform suitable alternative action
* }
- * </pre>
- * </code>
+ * }</pre>
*
* @param s the string to be parsed.
* @return a {@code Double} object holding the value
@@ -756,9 +754,9 @@
* Returns a hash code for a {@code double} value; compatible with
* {@code Double.hashCode()}.
*
+ * @param value the value to hash
+ * @return a hash code value for a {@code double} value.
* @since 1.8
- *
- * @return a hash code value for a {@code double} value.
*/
public static int hashCode(double value) {
long bits = doubleToLongBits(value);
--- a/jdk/src/share/classes/java/lang/Float.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Float.java Tue Jul 02 15:23:23 2013 -0700
@@ -664,9 +664,9 @@
* Returns a hash code for a {@code float} value; compatible with
* {@code Float.hashCode()}.
*
+ * @param value the value to hash
+ * @return a hash code value for a {@code float} value.
* @since 1.8
- *
- * @return a hash code value for a {@code float} value.
*/
public static int hashCode(float value) {
return floatToIntBits(value);
--- a/jdk/src/share/classes/java/lang/Integer.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Integer.java Tue Jul 02 15:23:23 2013 -0700
@@ -951,6 +951,7 @@
* Returns a hash code for a {@code int} value; compatible with
* {@code Integer.hashCode()}.
*
+ * @param value the value to hash
* @since 1.8
*
* @return a hash code value for a {@code int} value.
@@ -1336,6 +1337,7 @@
* one-bits in its two's complement binary representation, that is, if it
* is equal to zero.
*
+ * @param i the value whose highest one bit is to be computed
* @return an {@code int} value with a single one-bit, in the position
* of the highest-order one-bit in the specified value, or zero if
* the specified value is itself equal to zero.
@@ -1358,6 +1360,7 @@
* one-bits in its two's complement binary representation, that is, if it
* is equal to zero.
*
+ * @param i the value whose lowest one bit is to be computed
* @return an {@code int} value with a single one-bit, in the position
* of the lowest-order one-bit in the specified value, or zero if
* the specified value is itself equal to zero.
@@ -1382,6 +1385,7 @@
* <li>ceil(log<sub>2</sub>(x)) = {@code 32 - numberOfLeadingZeros(x - 1)}
* </ul>
*
+ * @param i the value whose number of leading zeros is to be computed
* @return the number of zero bits preceding the highest-order
* ("leftmost") one-bit in the two's complement binary representation
* of the specified {@code int} value, or 32 if the value
@@ -1408,6 +1412,7 @@
* one-bits in its two's complement representation, in other words if it is
* equal to zero.
*
+ * @param i the value whose number of trailing zeros is to be computed
* @return the number of zero bits following the lowest-order ("rightmost")
* one-bit in the two's complement binary representation of the
* specified {@code int} value, or 32 if the value is equal
@@ -1431,6 +1436,7 @@
* representation of the specified {@code int} value. This function is
* sometimes referred to as the <i>population count</i>.
*
+ * @param i the value whose bits are to be counted
* @return the number of one-bits in the two's complement binary
* representation of the specified {@code int} value.
* @since 1.5
@@ -1458,6 +1464,8 @@
* ignored, even if the distance is negative: {@code rotateLeft(val,
* distance) == rotateLeft(val, distance & 0x1F)}.
*
+ * @param i the value whose bits are to be rotated left
+ * @param distance the number of bit positions to rotate left
* @return the value obtained by rotating the two's complement binary
* representation of the specified {@code int} value left by the
* specified number of bits.
@@ -1480,6 +1488,8 @@
* ignored, even if the distance is negative: {@code rotateRight(val,
* distance) == rotateRight(val, distance & 0x1F)}.
*
+ * @param i the value whose bits are to be rotated right
+ * @param distance the number of bit positions to rotate right
* @return the value obtained by rotating the two's complement binary
* representation of the specified {@code int} value right by the
* specified number of bits.
@@ -1494,6 +1504,7 @@
* two's complement binary representation of the specified {@code int}
* value.
*
+ * @param i the value to be reversed
* @return the value obtained by reversing order of the bits in the
* specified {@code int} value.
* @since 1.5
@@ -1513,6 +1524,7 @@
* return value is -1 if the specified value is negative; 0 if the
* specified value is zero; and 1 if the specified value is positive.)
*
+ * @param i the value whose signum is to be computed
* @return the signum function of the specified {@code int} value.
* @since 1.5
*/
@@ -1525,6 +1537,7 @@
* Returns the value obtained by reversing the order of the bytes in the
* two's complement representation of the specified {@code int} value.
*
+ * @param i the value whose bytes are to be reversed
* @return the value obtained by reversing the bytes in the specified
* {@code int} value.
* @since 1.5
--- a/jdk/src/share/classes/java/lang/Long.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Long.java Tue Jul 02 15:23:23 2013 -0700
@@ -1053,9 +1053,9 @@
* Returns a hash code for a {@code long} value; compatible with
* {@code Long.hashCode()}.
*
+ * @param value the value to hash
+ * @return a hash code value for a {@code long} value.
* @since 1.8
- *
- * @return a hash code value for a {@code long} value.
*/
public static int hashCode(long value) {
return (int)(value ^ (value >>> 32));
@@ -1357,6 +1357,7 @@
* one-bits in its two's complement binary representation, that is, if it
* is equal to zero.
*
+ * @param i the value whose highest one bit is to be computed
* @return a {@code long} value with a single one-bit, in the position
* of the highest-order one-bit in the specified value, or zero if
* the specified value is itself equal to zero.
@@ -1380,6 +1381,7 @@
* one-bits in its two's complement binary representation, that is, if it
* is equal to zero.
*
+ * @param i the value whose lowest one bit is to be computed
* @return a {@code long} value with a single one-bit, in the position
* of the lowest-order one-bit in the specified value, or zero if
* the specified value is itself equal to zero.
@@ -1404,6 +1406,7 @@
* <li>ceil(log<sub>2</sub>(x)) = {@code 64 - numberOfLeadingZeros(x - 1)}
* </ul>
*
+ * @param i the value whose number of leading zeros is to be computed
* @return the number of zero bits preceding the highest-order
* ("leftmost") one-bit in the two's complement binary representation
* of the specified {@code long} value, or 64 if the value
@@ -1432,6 +1435,7 @@
* one-bits in its two's complement representation, in other words if it is
* equal to zero.
*
+ * @param i the value whose number of trailing zeros is to be computed
* @return the number of zero bits following the lowest-order ("rightmost")
* one-bit in the two's complement binary representation of the
* specified {@code long} value, or 64 if the value is equal
@@ -1456,6 +1460,7 @@
* representation of the specified {@code long} value. This function is
* sometimes referred to as the <i>population count</i>.
*
+ * @param i the value whose bits are to be counted
* @return the number of one-bits in the two's complement binary
* representation of the specified {@code long} value.
* @since 1.5
@@ -1484,6 +1489,8 @@
* ignored, even if the distance is negative: {@code rotateLeft(val,
* distance) == rotateLeft(val, distance & 0x3F)}.
*
+ * @param i the value whose bits are to be rotated left
+ * @param distance the number of bit positions to rotate left
* @return the value obtained by rotating the two's complement binary
* representation of the specified {@code long} value left by the
* specified number of bits.
@@ -1506,6 +1513,8 @@
* ignored, even if the distance is negative: {@code rotateRight(val,
* distance) == rotateRight(val, distance & 0x3F)}.
*
+ * @param i the value whose bits are to be rotated right
+ * @param distance the number of bit positions to rotate right
* @return the value obtained by rotating the two's complement binary
* representation of the specified {@code long} value right by the
* specified number of bits.
@@ -1520,6 +1529,7 @@
* two's complement binary representation of the specified {@code long}
* value.
*
+ * @param i the value to be reversed
* @return the value obtained by reversing order of the bits in the
* specified {@code long} value.
* @since 1.5
@@ -1540,6 +1550,7 @@
* return value is -1 if the specified value is negative; 0 if the
* specified value is zero; and 1 if the specified value is positive.)
*
+ * @param i the value whose signum is to be computed
* @return the signum function of the specified {@code long} value.
* @since 1.5
*/
@@ -1552,6 +1563,7 @@
* Returns the value obtained by reversing the order of the bytes in the
* two's complement representation of the specified {@code long} value.
*
+ * @param i the value whose bytes are to be reversed
* @return the value obtained by reversing the bytes in the specified
* {@code long} value.
* @since 1.5
--- a/jdk/src/share/classes/java/lang/Package.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Package.java Tue Jul 02 15:23:23 2013 -0700
@@ -77,18 +77,18 @@
* by the following formal grammar:
* <blockquote>
* <dl>
- * <dt><i>SpecificationVersion:
- * <dd>Digits RefinedVersion<sub>opt</sub></i>
+ * <dt><i>SpecificationVersion:</i>
+ * <dd><i>Digits RefinedVersion<sub>opt</sub></i>
- * <p><dt><i>RefinedVersion:</i>
+ * <dt><i>RefinedVersion:</i>
* <dd>{@code .} <i>Digits</i>
* <dd>{@code .} <i>Digits RefinedVersion</i>
*
- * <p><dt><i>Digits:
- * <dd>Digit
- * <dd>Digits</i>
+ * <dt><i>Digits:</i>
+ * <dd><i>Digit</i>
+ * <dd><i>Digits</i>
*
- * <p><dt><i>Digit:</i>
+ * <dt><i>Digit:</i>
* <dd>any character for which {@link Character#isDigit} returns {@code true},
* e.g. 0, 1, 2, ...
* </dl>
--- a/jdk/src/share/classes/java/lang/Runtime.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Runtime.java Tue Jul 02 15:23:23 2013 -0700
@@ -117,11 +117,11 @@
*
* <ul>
*
- * <p> <li> The program <i>exits</i> normally, when the last non-daemon
+ * <li> The program <i>exits</i> normally, when the last non-daemon
* thread exits or when the <tt>{@link #exit exit}</tt> (equivalently,
- * <tt>{@link System#exit(int) System.exit}</tt>) method is invoked, or
+ * {@link System#exit(int) System.exit}) method is invoked, or
*
- * <p> <li> The virtual machine is <i>terminated</i> in response to a
+ * <li> The virtual machine is <i>terminated</i> in response to a
* user interrupt, such as typing <tt>^C</tt>, or a system-wide event,
* such as user logoff or system shutdown.
*
--- a/jdk/src/share/classes/java/lang/Short.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Short.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -403,9 +403,9 @@
* Returns a hash code for a {@code short} value; compatible with
* {@code Short.hashCode()}.
*
+ * @param value the value to hash
+ * @return a hash code value for a {@code short} value.
* @since 1.8
- *
- * @return a hash code value for a {@code short} value.
*/
public static int hashCode(short value) {
return (int)value;
@@ -482,6 +482,7 @@
* Returns the value obtained by reversing the order of the bytes in the
* two's complement representation of the specified {@code short} value.
*
+ * @param i the value whose bytes are to be reversed
* @return the value obtained by reversing (or, equivalently, swapping)
* the bytes in the specified {@code short} value.
* @since 1.5
--- a/jdk/src/share/classes/java/lang/StrictMath.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/StrictMath.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -1419,6 +1419,7 @@
* {@link Float#MIN_EXPONENT} -1.
* </ul>
* @param f a {@code float} value
+ * @return the unbiased exponent of the argument
* @since 1.6
*/
public static int getExponent(float f) {
@@ -1436,6 +1437,7 @@
* {@link Double#MIN_EXPONENT} -1.
* </ul>
* @param d a {@code double} value
+ * @return the unbiased exponent of the argument
* @since 1.6
*/
public static int getExponent(double d) {
--- a/jdk/src/share/classes/java/lang/SuppressWarnings.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/SuppressWarnings.java Tue Jul 02 15:23:23 2013 -0700
@@ -66,6 +66,7 @@
* additional warning names they support in conjunction with this
* annotation type. They are encouraged to cooperate to ensure
* that the same names work across multiple compilers.
+ * @return the set of warnings to be suppressed
*/
String[] value();
}
--- a/jdk/src/share/classes/java/lang/System.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/System.java Tue Jul 02 15:23:23 2013 -0700
@@ -634,6 +634,8 @@
*
* <p>On UNIX systems, it returns {@code "\n"}; on Microsoft
* Windows systems it returns {@code "\r\n"}.
+ *
+ * @return the system-dependent line separator string
* @since 1.7
*/
public static String lineSeparator() {
--- a/jdk/src/share/classes/java/lang/Thread.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Thread.java Tue Jul 02 15:23:23 2013 -0700
@@ -1993,12 +1993,21 @@
// The following three initially uninitialized fields are exclusively
- // managed by class java.util.concurrent.ThreadLocalRandom.
+ // managed by class java.util.concurrent.ThreadLocalRandom. These
+ // fields are used to build the high-performance PRNGs in the
+ // concurrent code, and we can not risk accidental false sharing.
+ // Hence, the fields are isolated with @Contended.
+
/** The current seed for a ThreadLocalRandom */
+ @sun.misc.Contended("tlr")
long threadLocalRandomSeed;
+
/** Probe hash value; nonzero if threadLocalRandomSeed initialized */
+ @sun.misc.Contended("tlr")
int threadLocalRandomProbe;
+
/** Secondary seed isolated from public ThreadLocalRandom sequence */
+ @sun.misc.Contended("tlr")
int threadLocalRandomSecondarySeed;
/* Some private helper methods */
--- a/jdk/src/share/classes/java/lang/annotation/Annotation.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/annotation/Annotation.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -126,6 +126,7 @@
/**
* Returns the annotation type of this annotation.
+ * @return the annotation type of this annotation
*/
Class<? extends Annotation> annotationType();
}
--- a/jdk/src/share/classes/java/lang/annotation/Repeatable.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/annotation/Repeatable.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -43,6 +43,7 @@
/**
* Indicates the <em>containing annotation type</em> for the
* repeatable annotation type.
+ * @return the containing annotation type
*/
Class<? extends Annotation> value();
}
--- a/jdk/src/share/classes/java/lang/annotation/Retention.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/annotation/Retention.java Tue Jul 02 15:23:23 2013 -0700
@@ -44,5 +44,9 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Retention {
+ /**
+ * Returns the retention policy.
+ * @return the retention policy
+ */
RetentionPolicy value();
}
--- a/jdk/src/share/classes/java/lang/annotation/Target.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/annotation/Target.java Tue Jul 02 15:23:23 2013 -0700
@@ -67,5 +67,11 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Target {
+ /**
+ * Returns an array of the kinds of elements an annotation type
+ * can be applied to.
+ * @return an array of the kinds of elements an annotation type
+ * can be applied to
+ */
ElementType[] value();
}
--- a/jdk/src/share/classes/java/lang/instrument/Instrumentation.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/instrument/Instrumentation.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -363,6 +363,8 @@
* Primitive classes (for example, <code>java.lang.Integer.TYPE</code>)
* and array classes are never modifiable.
*
+ * @param theClass the class to check for being modifiable
+ * @return whether or not the argument class is modifiable
* @throws java.lang.NullPointerException if the specified class is <code>null</code>.
*
* @see #retransformClasses
@@ -549,14 +551,14 @@
* {@link java.lang.instrument.ClassFileTransformer ClassFileTransformer},
* it enables native methods to be
* instrumented.
- * <p/>
+ * <p>
* Since native methods cannot be directly instrumented
* (they have no bytecodes), they must be wrapped with
* a non-native method which can be instrumented.
* For example, if we had:
* <pre>
* native boolean foo(int x);</pre>
- * <p/>
+ * <p>
* We could transform the class file (with the
* ClassFileTransformer during the initial definition
* of the class) so that this becomes:
@@ -567,14 +569,14 @@
* }
*
* native boolean wrapped_foo(int x);</pre>
- * <p/>
+ * <p>
* Where <code>foo</code> becomes a wrapper for the actual native
* method with the appended prefix "wrapped_". Note that
* "wrapped_" would be a poor choice of prefix since it
* might conceivably form the name of an existing method
* thus something like "$$$MyAgentWrapped$$$_" would be
* better but would make these examples less readable.
- * <p/>
+ * <p>
* The wrapper will allow data to be collected on the native
* method call, but now the problem becomes linking up the
* wrapped method with the native implementation.
@@ -583,7 +585,7 @@
* which might be:
* <pre>
* Java_somePackage_someClass_foo(JNIEnv* env, jint x)</pre>
- * <p/>
+ * <p>
* This function allows the prefix to be specified and the
* proper resolution to occur.
* Specifically, when the standard resolution fails, the
@@ -596,29 +598,29 @@
* <pre>{@code
* method(foo) -> nativeImplementation(foo)
* }</pre>
- * <p/>
+ * <p>
* When this fails, the resolution will be retried with
* the specified prefix prepended to the method name,
* yielding the correct resolution:
* <pre>{@code
* method(wrapped_foo) -> nativeImplementation(foo)
* }</pre>
- * <p/>
+ * <p>
* For automatic resolution, the JVM will attempt:
* <pre>{@code
* method(wrapped_foo) -> nativeImplementation(wrapped_foo)
* }</pre>
- * <p/>
+ * <p>
* When this fails, the resolution will be retried with
* the specified prefix deleted from the implementation name,
* yielding the correct resolution:
* <pre>{@code
* method(wrapped_foo) -> nativeImplementation(foo)
* }</pre>
- * <p/>
+ * <p>
* Note that since the prefix is only used when standard
* resolution fails, native methods can be wrapped selectively.
- * <p/>
+ * <p>
* Since each <code>ClassFileTransformer</code>
* can do its own transformation of the bytecodes, more
* than one layer of wrappers may be applied. Thus each
--- a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Tue Jul 02 15:23:23 2013 -0700
@@ -112,7 +112,9 @@
implMethodDesc = implMethodType.toMethodDescriptorString();
Type implMethodAsmType = Type.getMethodType(implMethodDesc);
implMethodArgumentTypes = implMethodAsmType.getArgumentTypes();
- implMethodReturnType = implMethodAsmType.getReturnType();
+ implMethodReturnType = (implKind == MethodHandleInfo.REF_newInvokeSpecial)
+ ? Type.getObjectType(implMethodClassName)
+ : implMethodAsmType.getReturnType();
constructorType = invokedType.changeReturnType(Void.TYPE);
constructorDesc = constructorType.toMethodDescriptorString();
lambdaClassName = targetClass.getName().replace('.', '/') + "$$Lambda$" + counter.incrementAndGet();
--- a/jdk/src/share/classes/java/lang/invoke/LambdaConversionException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/LambdaConversionException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -29,21 +29,45 @@
* LambdaConversionException
*/
public class LambdaConversionException extends Exception {
+ /**
+ * Constructs a {@code LambdaConversionException}.
+ */
public LambdaConversionException() {
}
+ /**
+ * Constructs a {@code LambdaConversionException} with a message.
+ * @param message the detail message
+ */
public LambdaConversionException(String message) {
super(message);
}
+ /**
+ * Constructs a {@code LambdaConversionException} with a message and cause.
+ * @param message the detail message
+ * @param cause the cause
+ */
public LambdaConversionException(String message, Throwable cause) {
super(message, cause);
}
+ /**
+ * Constructs a {@code LambdaConversionException} with a cause.
+ * @param cause the cause
+ */
public LambdaConversionException(Throwable cause) {
super(cause);
}
+ /**
+ * Constructs a {@code LambdaConversionException} with a message,
+ * cause, and other settings.
+ * @param message the detail message
+ * @param cause the cause
+ * @param enableSuppression whether or not suppressed exceptions are enabled
+ * @param writableStackTrace whether or not the stack trace is writable
+ */
public LambdaConversionException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
--- a/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java Tue Jul 02 15:23:23 2013 -0700
@@ -111,7 +111,7 @@
* done on return type, while a strict version is applied to arguments.
*
* <p>A type Q is considered adaptable to S as follows:
- * <table>
+ * <table summary="adaptable types">
* <tr><th>Q</th><th>S</th><th>Link-time checks</th><th>Capture-time checks</th></tr>
* <tr>
* <td>Primitive</td><td>Primitive</td>
@@ -155,7 +155,7 @@
private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0];
-/**
+ /**
* Standard meta-factory for conversion of lambda expressions or method references to functional interfaces.
*
* @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges
@@ -174,7 +174,7 @@
* @param instantiatedMethodType The signature of the primary functional interface method after type variables
* are substituted with their instantiation from the capture site
* @return a CallSite, which, when invoked, will return an instance of the functional interface
- * @throws ReflectiveOperationException
+ * @throws ReflectiveOperationException if the caller is not able to reconstruct one of the method handles
* @throws LambdaConversionException If any of the meta-factory protocol invariants are violated
*/
public static CallSite metaFactory(MethodHandles.Lookup caller,
@@ -226,7 +226,7 @@
* the first argument in the invocation signature will correspond to the receiver.
* @param args argument to pass, flags, marker interface count, and marker interfaces as described above
* @return a CallSite, which, when invoked, will return an instance of the functional interface
- * @throws ReflectiveOperationException
+ * @throws ReflectiveOperationException if the caller is not able to reconstruct one of the method handles
* @throws LambdaConversionException If any of the meta-factory protocol invariants are violated
*/
public static CallSite altMetaFactory(MethodHandles.Lookup caller,
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java Tue Jul 02 15:23:23 2013 -0700
@@ -44,7 +44,7 @@
* {@linkplain java.lang.invoke.MethodHandles#dropArguments deletion},
* and {@linkplain java.lang.invoke.MethodHandles#filterArguments substitution}.
*
- * <h3>Method handle contents</h3>
+ * <h1>Method handle contents</h1>
* Method handles are dynamically and strongly typed according to their parameter and return types.
* They are not distinguished by the name or the defining class of their underlying methods.
* A method handle must be invoked using a symbolic type descriptor which matches
@@ -81,7 +81,7 @@
* from its specific class, as the method handle class hierarchy (if any)
* may change from time to time or across implementations from different vendors.
*
- * <h3>Method handle compilation</h3>
+ * <h1>Method handle compilation</h1>
* A Java method call expression naming {@code invokeExact} or {@code invoke}
* can invoke a method handle from Java source code.
* From the viewpoint of source code, these methods can take any arguments
@@ -111,7 +111,7 @@
* The ambiguity with the type {@code Void} is harmless, since there are no references of type
* {@code Void} except the null reference.
*
- * <h3>Method handle invocation</h3>
+ * <h1>Method handle invocation</h1>
* The first time a {@code invokevirtual} instruction is executed
* it is linked, by symbolically resolving the names in the instruction
* and verifying that the method call is statically legal.
@@ -154,7 +154,7 @@
* (<em>Note:</em> The adjusted method handle {@code M2} is not directly observable,
* and implementations are therefore not required to materialize it.)
*
- * <h3>Invocation checking</h3>
+ * <h1>Invocation checking</h1>
* In typical programs, method handle type matching will usually succeed.
* But if a match fails, the JVM will throw a {@link WrongMethodTypeException},
* either directly (in the case of {@code invokeExact}) or indirectly as if
@@ -195,7 +195,7 @@
* They should not be passed to untrusted code unless their use from
* the untrusted code would be harmless.
*
- * <h3>Method handle creation</h3>
+ * <h1>Method handle creation</h1>
* Java code can create a method handle that directly accesses
* any method, constructor, or field that is accessible to that code.
* This is done via a reflective, capability-based API called
@@ -249,7 +249,7 @@
* receiver type. Such a method handle simulates the effect of
* an {@code invokespecial} instruction to the same method.
*
- * <h3>Usage examples</h3>
+ * <h1>Usage examples</h1>
* Here are some examples of usage:
* <p><blockquote><pre>{@code
Object x, y; String s; int i;
@@ -295,7 +295,7 @@
* be a method which calls {@link java.util.Objects#equals(Object,Object) Objects.equals }
* on its arguments, and asserts that the result is true.
*
- * <h3>Exceptions</h3>
+ * <h1>Exceptions</h1>
* The methods {@code invokeExact} and {@code invoke} are declared
* to throw {@link java.lang.Throwable Throwable},
* which is to say that there is no static restriction on what a method handle
@@ -308,7 +308,7 @@
* throwables locally, rethrowing only those which are legal in the context,
* and wrapping ones which are illegal.
*
- * <h3><a name="sigpoly"></a>Signature polymorphism</h3>
+ * <h1><a name="sigpoly"></a>Signature polymorphism</h1>
* The unusual compilation and linkage behavior of
* {@code invokeExact} and plain {@code invoke}
* is referenced by the term <em>signature polymorphism</em>.
@@ -333,7 +333,7 @@
* Tools which determine symbolic linkage are required to accept such
* untransformed descriptors, without reporting linkage errors.
*
- * <h3>Interoperation between method handles and the Core Reflection API</h3>
+ * <h1>Interoperation between method handles and the Core Reflection API</h1>
* Using factory methods in the {@link java.lang.invoke.MethodHandles.Lookup Lookup} API,
* any class member represented by a Core Reflection API object
* can be converted to a behaviorally equivalent method handle.
@@ -375,7 +375,7 @@
* to call {@code invokeExact} or plain {@code invoke},
* for any specified type descriptor .
*
- * <h3>Interoperation between method handles and Java generics</h3>
+ * <h1>Interoperation between method handles and Java generics</h1>
* A method handle can be obtained on a method, constructor, or field
* which is declared with Java generic types.
* As with the Core Reflection API, the type of the method handle
@@ -457,6 +457,8 @@
* {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}, via JNI,
* or indirectly via {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect},
* it will throw an {@code UnsupportedOperationException}.
+ * @param args the signature-polymorphic parameter list, statically represented using varargs
+ * @return the signature-polymorphic result, statically represented using {@code Object}
* @throws WrongMethodTypeException if the target's type is not identical with the caller's symbolic type descriptor
* @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call
*/
@@ -491,6 +493,8 @@
* {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}, via JNI,
* or indirectly via {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect},
* it will throw an {@code UnsupportedOperationException}.
+ * @param args the signature-polymorphic parameter list, statically represented using varargs
+ * @return the signature-polymorphic result, statically represented using {@code Object}
* @throws WrongMethodTypeException if the target's type cannot be adjusted to the caller's symbolic type descriptor
* @throws ClassCastException if the target's type can be adjusted to the caller, but a reference cast fails
* @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call
@@ -511,15 +515,26 @@
* operations on outgoing argument values.)
* The caller can assume that the incoming result value is part of the range
* of the callee's return type.
+ * @param args the signature-polymorphic parameter list, statically represented using varargs
+ * @return the signature-polymorphic result, statically represented using {@code Object}
*/
/*non-public*/ final native @PolymorphicSignature Object invokeBasic(Object... args) throws Throwable;
+ /**
+ * Private method for trusted invocation of a MemberName of kind {@code REF_invokeVirtual}.
+ * The caller signature is restricted to basic types as with {@code invokeBasic}.
+ * The trailing (not leading) argument must be a MemberName.
+ * @param args the signature-polymorphic parameter list, statically represented using varargs
+ * @return the signature-polymorphic result, statically represented using {@code Object}
+ */
/*non-public*/ static native @PolymorphicSignature Object linkToVirtual(Object... args) throws Throwable;
/**
* Private method for trusted invocation of a MemberName of kind {@code REF_invokeStatic}.
* The caller signature is restricted to basic types as with {@code invokeBasic}.
* The trailing (not leading) argument must be a MemberName.
+ * @param args the signature-polymorphic parameter list, statically represented using varargs
+ * @return the signature-polymorphic result, statically represented using {@code Object}
*/
/*non-public*/ static native @PolymorphicSignature Object linkToStatic(Object... args) throws Throwable;
@@ -527,6 +542,8 @@
* Private method for trusted invocation of a MemberName of kind {@code REF_invokeSpecial}.
* The caller signature is restricted to basic types as with {@code invokeBasic}.
* The trailing (not leading) argument must be a MemberName.
+ * @param args the signature-polymorphic parameter list, statically represented using varargs
+ * @return the signature-polymorphic result, statically represented using {@code Object}
*/
/*non-public*/ static native @PolymorphicSignature Object linkToSpecial(Object... args) throws Throwable;
@@ -534,6 +551,8 @@
* Private method for trusted invocation of a MemberName of kind {@code REF_invokeInterface}.
* The caller signature is restricted to basic types as with {@code invokeBasic}.
* The trailing (not leading) argument must be a MemberName.
+ * @param args the signature-polymorphic parameter list, statically represented using varargs
+ * @return the signature-polymorphic result, statically represented using {@code Object}
*/
/*non-public*/ static native @PolymorphicSignature Object linkToInterface(Object... args) throws Throwable;
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java Tue Jul 02 15:23:23 2013 -0700
@@ -108,8 +108,9 @@
* Future versions of this API may also equip wrapper instances
* with one or more additional public "marker" interfaces.
*
+ * @param <T> the desired type of the wrapper, a single-method interface
+ * @param intfc a class object representing {@code T}
* @param target the method handle to invoke from the wrapper
- * @param intfc the desired type of the wrapper, a single-method interface
* @return a correctly-typed wrapper for the given target
* @throws NullPointerException if either argument is null
* @throws IllegalArgumentException if the {@code intfc} is not a
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java Tue Jul 02 15:23:23 2013 -0700
@@ -70,6 +70,7 @@
* including direct method handles to private fields and methods.
* This lookup object is a <em>capability</em> which may be delegated to trusted agents.
* Do not store it in place where untrusted code can access it.
+ * @return a lookup object for the caller of this method
*/
@CallerSensitive
public static Lookup lookup() {
@@ -88,6 +89,7 @@
* {@linkplain Lookup#in <code>publicLookup().in(C.class)</code>}.
* Since all classes have equal access to public names,
* such a change would confer no new access rights.
+ * @return a lookup object which is trusted minimally
*/
public static Lookup publicLookup() {
return Lookup.PUBLIC_LOOKUP;
@@ -111,72 +113,74 @@
* on the {@code Lookup} object to create method handles for access-checked members.
* This includes all methods, constructors, and fields which are allowed to the lookup class,
* even private ones.
- * <p>
+ *
+ * <h1><a name="lookups"></a>Lookup Factory Methods</h1>
* The factory methods on a {@code Lookup} object correspond to all major
* use cases for methods, constructors, and fields.
* Here is a summary of the correspondence between these factory methods and
* the behavior the resulting method handles:
- * <code>
* <table border=1 cellpadding=5 summary="lookup method behaviors">
* <tr><th>lookup expression</th><th>member</th><th>behavior</th></tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findGetter lookup.findGetter(C.class,"f",FT.class)}</td>
- * <td>FT f;</td><td>(T) this.f;</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#findGetter lookup.findGetter(C.class,"f",FT.class)}</td>
+ * <td>{@code FT f;}</td><td>{@code (T) this.f;}</td>
* </tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStaticGetter lookup.findStaticGetter(C.class,"f",FT.class)}</td>
- * <td>static<br>FT f;</td><td>(T) C.f;</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#findStaticGetter lookup.findStaticGetter(C.class,"f",FT.class)}</td>
+ * <td>{@code static}<br>{@code FT f;}</td><td>{@code (T) C.f;}</td>
* </tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findSetter lookup.findSetter(C.class,"f",FT.class)}</td>
- * <td>FT f;</td><td>this.f = x;</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#findSetter lookup.findSetter(C.class,"f",FT.class)}</td>
+ * <td>{@code FT f;}</td><td>{@code this.f = x;}</td>
* </tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStaticSetter lookup.findStaticSetter(C.class,"f",FT.class)}</td>
- * <td>static<br>FT f;</td><td>C.f = arg;</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#findStaticSetter lookup.findStaticSetter(C.class,"f",FT.class)}</td>
+ * <td>{@code static}<br>{@code FT f;}</td><td>{@code C.f = arg;}</td>
* </tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findVirtual lookup.findVirtual(C.class,"m",MT)}</td>
- * <td>T m(A*);</td><td>(T) this.m(arg*);</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#findVirtual lookup.findVirtual(C.class,"m",MT)}</td>
+ * <td>{@code T m(A*);}</td><td>{@code (T) this.m(arg*);}</td>
* </tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStatic lookup.findStatic(C.class,"m",MT)}</td>
- * <td>static<br>T m(A*);</td><td>(T) C.m(arg*);</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#findStatic lookup.findStatic(C.class,"m",MT)}</td>
+ * <td>{@code static}<br>{@code T m(A*);}</td><td>{@code (T) C.m(arg*);}</td>
* </tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findSpecial lookup.findSpecial(C.class,"m",MT,this.class)}</td>
- * <td>T m(A*);</td><td>(T) super.m(arg*);</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#findSpecial lookup.findSpecial(C.class,"m",MT,this.class)}</td>
+ * <td>{@code T m(A*);}</td><td>{@code (T) super.m(arg*);}</td>
* </tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findConstructor lookup.findConstructor(C.class,MT)}</td>
- * <td>C(A*);</td><td>(T) new C(arg*);</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#findConstructor lookup.findConstructor(C.class,MT)}</td>
+ * <td>{@code C(A*);}</td><td>{@code new C(arg*);}</td>
* </tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectGetter lookup.unreflectGetter(aField)}</td>
- * <td>(static)?<br>FT f;</td><td>(FT) aField.get(thisOrNull);</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#unreflectGetter lookup.unreflectGetter(aField)}</td>
+ * <td>({@code static})?<br>{@code FT f;}</td><td>{@code (FT) aField.get(thisOrNull);}</td>
* </tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectSetter lookup.unreflectSetter(aField)}</td>
- * <td>(static)?<br>FT f;</td><td>aField.set(thisOrNull, arg);</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#unreflectSetter lookup.unreflectSetter(aField)}</td>
+ * <td>({@code static})?<br>{@code FT f;}</td><td>{@code aField.set(thisOrNull, arg);}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td>
+ * <td>({@code static})?<br>{@code T m(A*);}</td><td>{@code (T) aMethod.invoke(thisOrNull, arg*);}</td>
* </tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td>
- * <td>(static)?<br>T m(A*);</td><td>(T) aMethod.invoke(thisOrNull, arg*);</td>
- * </tr>
- * <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectConstructor lookup.unreflectConstructor(aConstructor)}</td>
- * <td>C(A*);</td><td>(C) aConstructor.newInstance(arg*);</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#unreflectConstructor lookup.unreflectConstructor(aConstructor)}</td>
+ * <td>{@code C(A*);}</td><td>{@code (C) aConstructor.newInstance(arg*);}</td>
* </tr>
* <tr>
- * <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td>
- * <td>(static)?<br>T m(A*);</td><td>(T) aMethod.invoke(thisOrNull, arg*);</td>
+ * <td>{@link java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td>
+ * <td>({@code static})?<br>{@code T m(A*);}</td><td>{@code (T) aMethod.invoke(thisOrNull, arg*);}</td>
* </tr>
* </table>
- * </code>
+ *
* Here, the type {@code C} is the class or interface being searched for a member,
* documented as a parameter named {@code refc} in the lookup methods.
- * The method or constructor type {@code MT} is composed from the return type {@code T}
+ * The method type {@code MT} is composed from the return type {@code T}
* and the sequence of argument types {@code A*}.
+ * The constructor also has a sequence of argument types {@code A*} and
+ * is deemed to return the newly-created object of type {@code C}.
* Both {@code MT} and the field type {@code FT} are documented as a parameter named {@code type}.
* The formal parameter {@code this} stands for the self-reference of type {@code C};
* if it is present, it is always the leading argument to the method handle invocation.
@@ -210,7 +214,7 @@
* security manager checks.
* </ul>
*
- * <h3><a name="access"></a>Access checking</h3>
+ * <h1><a name="access"></a>Access checking</h1>
* Access checks are applied in the factory methods of {@code Lookup},
* when a method handle is created.
* This is a key difference from the Core Reflection API, since
@@ -297,7 +301,7 @@
* with static methods of {@link MethodHandles},
* independently of any {@code Lookup} object.
*
- * <h3>Security manager interactions</h3>
+ * <h1>Security manager interactions</h1>
* <a name="secmgr"></a>
* If a security manager is present, member lookups are subject to
* additional checks.
@@ -388,6 +392,7 @@
* but the permissions may be additionally limited by the bitmask
* {@link #lookupModes lookupModes}, which controls whether non-public members
* can be accessed.
+ * @return the lookup class, on behalf of which this lookup object finds members
*/
public Class<?> lookupClass() {
return lookupClass;
@@ -414,6 +419,7 @@
* The purpose of this is to restrict access via the new lookup object,
* so that it can access only names which can be reached by the original
* lookup object, and also by the new lookup class.
+ * @return the lookup modes, which limit the kinds of access performed by this lookup object
*/
public int lookupModes() {
return allowedModes & ALL_MODES;
@@ -1352,6 +1358,7 @@
* The type of the method handle will have a void return type.
* Its last argument will be the array's element type.
* The first and second arguments will be the array type and int.
+ * @param arrayClass the class of an array
* @return a method handle which can store values into the array type
* @throws NullPointerException if the argument is null
* @throws IllegalArgumentException if arrayClass is not an array type
@@ -1580,12 +1587,12 @@
...
MethodType intfn1 = methodType(int.class, int.class);
MethodType intfn2 = methodType(int.class, int.class, int.class);
-MethodHandle sub = ... {int x, int y => x-y} ...;
+MethodHandle sub = ... (int x, int y) -> (x-y) ...;
assert(sub.type().equals(intfn2));
MethodHandle sub1 = permuteArguments(sub, intfn2, 0, 1);
MethodHandle rsub = permuteArguments(sub, intfn2, 1, 0);
assert((int)rsub.invokeExact(1, 100) == 99);
-MethodHandle add = ... {int x, int y => x+y} ...;
+MethodHandle add = ... (int x, int y) -> (x+y) ...;
assert(add.type().equals(intfn2));
MethodHandle twice = permuteArguments(add, intfn1, 0, 0);
assert(twice.type().equals(intfn1));
@@ -2261,6 +2268,8 @@
* The method type will nominally specify a return of {@code returnType}.
* The return type may be anything convenient: It doesn't matter to the
* method handle's behavior, since it will never return normally.
+ * @param returnType the return type of the desired method handle
+ * @param exType the parameter type of the desired method handle
* @return method handle which can throw the given exceptions
* @throws NullPointerException if either argument is null
*/
--- a/jdk/src/share/classes/java/lang/invoke/MethodType.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MethodType.java Tue Jul 02 15:23:23 2013 -0700
@@ -194,6 +194,8 @@
/**
* Finds or creates a method type with the given components.
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
+ * @param rtype the return type
+ * @param ptypes the parameter types
* @return a method type with the given components
* @throws NullPointerException if {@code rtype} or {@code ptypes} or any element of {@code ptypes} is null
* @throws IllegalArgumentException if any element of {@code ptypes} is {@code void.class}
@@ -214,6 +216,9 @@
* Finds or creates a method type with the given components.
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
* The leading parameter type is prepended to the remaining array.
+ * @param rtype the return type
+ * @param ptype0 the first parameter type
+ * @param ptypes the remaining parameter types
* @return a method type with the given components
* @throws NullPointerException if {@code rtype} or {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is null
* @throws IllegalArgumentException if {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is {@code void.class}
@@ -230,6 +235,7 @@
* Finds or creates a method type with the given components.
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
* The resulting method has no parameter types.
+ * @param rtype the return type
* @return a method type with the given return value
* @throws NullPointerException if {@code rtype} is null
*/
@@ -242,6 +248,8 @@
* Finds or creates a method type with the given components.
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
* The resulting method has the single given parameter type.
+ * @param rtype the return type
+ * @param ptype0 the parameter type
* @return a method type with the given return value and parameter type
* @throws NullPointerException if {@code rtype} or {@code ptype0} is null
* @throws IllegalArgumentException if {@code ptype0} is {@code void.class}
@@ -256,6 +264,9 @@
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
* The resulting method has the same parameter types as {@code ptypes},
* and the specified return type.
+ * @param rtype the return type
+ * @param ptypes the method type which supplies the parameter types
+ * @return a method type with the given components
* @throws NullPointerException if {@code rtype} or {@code ptypes} is null
*/
public static
@@ -938,7 +949,8 @@
* provided to the factory method {@link #methodType(Class,Class[]) methodType}.
* For example, null values, or {@code void} parameter types,
* will lead to exceptions during deserialization.
- * @param the stream to write the object to
+ * @param s the stream to write the object to
+ * @throws java.io.IOException if there is a problem writing the object
*/
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
s.defaultWriteObject(); // requires serialPersistentFields to be an empty array
@@ -953,7 +965,9 @@
* It provides the parameters to the factory method called by
* {@link #readResolve readResolve}.
* After that call it is discarded.
- * @param the stream to read the object from
+ * @param s the stream to read the object from
+ * @throws java.io.IOException if there is a problem reading the object
+ * @throws ClassNotFoundException if one of the component classes cannot be resolved
* @see #MethodType()
* @see #readResolve
* @see #writeObject
--- a/jdk/src/share/classes/java/lang/invoke/MutableCallSite.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MutableCallSite.java Tue Jul 02 15:23:23 2013 -0700
@@ -195,7 +195,7 @@
* processed before the method returns abnormally.
* Which elements these are (if any) is implementation-dependent.
*
- * <h3>Java Memory Model details</h3>
+ * <h1>Java Memory Model details</h1>
* In terms of the Java Memory Model, this operation performs a synchronization
* action which is comparable in effect to the writing of a volatile variable
* by the current thread, and an eventual volatile read by every other thread
--- a/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -97,66 +97,113 @@
this.capturedArgs = Objects.requireNonNull(capturedArgs).clone();
}
- /** Get the name of the class that captured this lambda */
+ /**
+ * Get the name of the class that captured this lambda.
+ * @return the name of the class that captured this lambda
+ */
public String getCapturingClass() {
return capturingClass.getName().replace('.', '/');
}
- /** Get the name of the functional interface class to which this lambda has been converted */
+ /**
+ * Get the name of the functional interface class to which this
+ * lambda has been converted
+ * @return the name of the functional interface this lambda has
+ * been converted to
+ */
public String getFunctionalInterfaceClass() {
return functionalInterfaceClass;
}
- /** Get the name of the primary method for the functional interface to which this lambda has been converted */
+ /**
+ * Get the name of the primary method for the functional interface
+ * to which this lambda has been converted.
+ * @return the name of the primary methods of the functional interface
+ */
public String getFunctionalInterfaceMethodName() {
return functionalInterfaceMethodName;
}
- /** Get the signature of the primary method for the functional interface to which this lambda has been converted */
+ /**
+ * Get the signature of the primary method for the functional
+ * interface to which this lambda has been converted.
+ * @return the signature of the primary method of the functional
+ * interface
+ */
public String getFunctionalInterfaceMethodSignature() {
return functionalInterfaceMethodSignature;
}
- /** Get the method handle kind (see {@link MethodHandleInfo}) of the primary method for the functional interface
- * to which this lambda has been converted */
+ /**
+ * Get the method handle kind (see {@link MethodHandleInfo}) of
+ * the primary method for the functional interface to which this
+ * lambda has been converted
+ * @return the method handle kind of the primary method of
+ * functional interface
+ */
public int getFunctionalInterfaceMethodKind() {
return functionalInterfaceMethodKind;
}
- /** Get the name of the class containing the implementation method */
+ /**
+ * Get the name of the class containing the implementation
+ * method.
+ * @return the name of the class containing the implementation
+ * method
+ */
public String getImplClass() {
return implClass;
}
- /** Get the name of the implementation method */
+ /**
+ * Get the name of the implementation method.
+ * @return the name of the implementation method
+ */
public String getImplMethodName() {
return implMethodName;
}
- /** Get the signature of the implementation method */
+ /**
+ * Get the signature of the implementation method.
+ * @return the signature of the implementation method
+ */
public String getImplMethodSignature() {
return implMethodSignature;
}
- /** Get the method handle kind (see {@link MethodHandleInfo}) of the implementation method */
+ /**
+ * Get the method handle kind (see {@link MethodHandleInfo}) of
+ * the implementation method.
+ * @return the method handle kind of the implementation method
+ */
public int getImplMethodKind() {
return implMethodKind;
}
/**
- * Get the signature of the primary functional interface method after type variables are substituted with
- * their instantiation from the capture site
+ * Get the signature of the primary functional interface method
+ * after type variables are substituted with their instantiation
+ * from the capture site.
+ * @return the signature of the primary functional interface method
+ * after type variable processing
*/
public final String getInstantiatedMethodType() {
return instantiatedMethodType;
}
- /** Get the count of dynamic arguments to the lambda capture site */
+ /**
+ * Get the count of dynamic arguments to the lambda capture site.
+ * @return the count of dynamic arguments to the lambda capture site
+ */
public int getCapturedArgCount() {
return capturedArgs.length;
}
- /** Get a dynamic argument to the lambda capture site */
+ /**
+ * Get a dynamic argument to the lambda capture site.
+ * @param i the argument to capture
+ * @return a dynamic argument to the lambda capture site
+ */
public Object getCapturedArg(int i) {
return capturedArgs[i];
}
--- a/jdk/src/share/classes/java/lang/invoke/package-info.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/package-info.java Tue Jul 02 15:23:23 2013 -0700
@@ -43,13 +43,13 @@
* </li>
* </ul>
*
- * <h2><a name="jvm_mods"></a>Summary of relevant Java Virtual Machine changes</h2>
+ * <h1><a name="jvm_mods"></a>Summary of relevant Java Virtual Machine changes</h1>
* The following low-level information summarizes relevant parts of the
* Java Virtual Machine specification. For full details, please see the
* current version of that specification.
*
* Each occurrence of an {@code invokedynamic} instruction is called a <em>dynamic call site</em>.
- * <h3><a name="indyinsn"></a>{@code invokedynamic} instructions</h3>
+ * <h2><a name="indyinsn"></a>{@code invokedynamic} instructions</h2>
* A dynamic call site is originally in an unlinked state. In this state, there is
* no target method for the call site to invoke.
* <p>
@@ -97,7 +97,7 @@
* If this happens, the same error will the thrown for all subsequent
* attempts to execute the dynamic call site.
*
- * <h3>timing of linkage</h3>
+ * <h2>timing of linkage</h2>
* A dynamic call site is linked just before its first execution.
* The bootstrap method call implementing the linkage occurs within
* a thread that is attempting a first execution.
@@ -131,7 +131,7 @@
* just before its first invocation.
* There is no way to undo the effect of a completed bootstrap method call.
*
- * <h3>types of bootstrap methods</h3>
+ * <h2>types of bootstrap methods</h2>
* As long as each bootstrap method can be correctly invoked
* by {@code MethodHandle.invoke}, its detailed type is arbitrary.
* For example, the first argument could be {@code Object}
--- a/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java Tue Jul 02 15:23:23 2013 -0700
@@ -130,6 +130,7 @@
* Returns this element's annotation for the specified type if
* such an annotation is present, else null.
*
+ * @param <T> the type of the annotation to query for and return if present
* @param annotationClass the Class object corresponding to the
* annotation type
* @return this element's annotation for the specified annotation type if
@@ -154,6 +155,7 @@
* The caller of this method is free to modify the returned array; it will
* have no effect on the arrays returned to other callers.
*
+ * @param <T> the type of the annotation to query for and return if present
* @param annotationClass the Class object corresponding to the
* annotation type
* @return all this element's annotations for the specified annotation type if
@@ -184,6 +186,7 @@
* This method ignores inherited annotations. (Returns null if no
* annotations are directly present on this element.)
*
+ * @param <T> the type of the annotation to query for and return if present
* @param annotationClass the Class object corresponding to the
* annotation type
* @return this element's annotation for the specified annotation type if
@@ -209,6 +212,8 @@
* The caller of this method is free to modify the returned array; it will
* have no effect on the arrays returned to other callers.
*
+ * @param <T> the type of the annotation to query for and return
+ * if directly present
* @param annotationClass the Class object corresponding to the
* annotation type
* @return all this element's annotations for the specified annotation type if
--- a/jdk/src/share/classes/java/lang/reflect/Executable.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Executable.java Tue Jul 02 15:23:23 2013 -0700
@@ -384,6 +384,8 @@
/**
* Returns a string describing this {@code Executable}, including
* any type parameters.
+ * @return a string describing this {@code Executable}, including
+ * any type parameters
*/
public abstract String toGenericString();
@@ -496,6 +498,8 @@
* If this Executable represents a method, the AnnotatedType object
* represents the use of a type to specify the return type of the method.
*
+ * @return an object representing the return type of this method
+ * or constructor
* @since 1.8
*/
public abstract AnnotatedType getAnnotatedReturnType();
@@ -531,6 +535,9 @@
*
* Returns null if this Executable represents a static method.
*
+ * @return an object representing the receiver type of the
+ * method or constructor represented by this Executable
+ *
* @since 1.8
*/
public AnnotatedType getAnnotatedReceiverType() {
@@ -553,6 +560,9 @@
* Returns an array of length 0 if the method/constructor declares no
* parameters.
*
+ * @return an array of objects representing the types of the
+ * formal parameters of this method or constructor
+ *
* @since 1.8
*/
public AnnotatedType[] getAnnotatedParameterTypes() {
@@ -575,6 +585,9 @@
* Returns an array of length 0 if the method/constructor declares no
* exceptions.
*
+ * @return an array of objects representing the declared
+ * exceptions of this method or constructor
+ *
* @since 1.8
*/
public AnnotatedType[] getAnnotatedExceptionTypes() {
--- a/jdk/src/share/classes/java/lang/reflect/Field.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Field.java Tue Jul 02 15:23:23 2013 -0700
@@ -1151,6 +1151,8 @@
/**
* Returns an AnnotatedType object that represents the use of a type to specify
* the declared type of the field represented by this Field.
+ * @return an object representing the declared type of the field
+ * represented by this Field
*
* @since 1.8
*/
--- a/jdk/src/share/classes/java/lang/reflect/Parameter.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java Tue Jul 02 15:23:23 2013 -0700
@@ -152,6 +152,8 @@
* defined in a class file, then that name will be returned by
* this method. Otherwise, this method will synthesize a name of
* the form argN, where N is the index of the parameter.
+ *
+ * @return the name of the parameter
*/
public String getName() {
// Note: empty strings as paramete names are now outlawed.
--- a/jdk/src/share/classes/java/lang/reflect/TypeVariable.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/TypeVariable.java Tue Jul 02 15:23:23 2013 -0700
@@ -95,6 +95,7 @@
*
* Returns an array of length 0 if the type parameter declares no bounds.
*
+ * @return an array of objects representing the upper bounds of the type variable
* @since 1.8
*/
AnnotatedType[] getAnnotatedBounds();
--- a/jdk/src/share/classes/java/math/BigDecimal.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/math/BigDecimal.java Tue Jul 02 15:23:23 2013 -0700
@@ -2572,6 +2572,9 @@
* ({@code this} * 10<sup>n</sup>). The scale of
* the result is {@code (this.scale() - n)}.
*
+ * @param n the exponent power of ten to scale by
+ * @return a BigDecimal whose numerical value is equal to
+ * ({@code this} * 10<sup>n</sup>)
* @throws ArithmeticException if the scale would be
* outside the range of a 32-bit integer.
*
--- a/jdk/src/share/classes/java/math/BigInteger.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/math/BigInteger.java Tue Jul 02 15:23:23 2013 -0700
@@ -33,8 +33,11 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamField;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
+import sun.misc.DoubleConsts;
+import sun.misc.FloatConsts;
/**
* Immutable arbitrary-precision integers. All operations behave as if
@@ -211,6 +214,16 @@
*/
private static final int TOOM_COOK_SQUARE_THRESHOLD = 140;
+ /**
+ * The threshold value for using Schoenhage recursive base conversion. If
+ * the number of ints in the number are larger than this value,
+ * the Schoenhage algorithm will be used. In practice, it appears that the
+ * Schoenhage routine is faster for any threshold down to 2, and is
+ * relatively flat for thresholds between 2-25, so this choice may be
+ * varied within this range for very small effect.
+ */
+ private static final int SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 8;
+
//Constructors
/**
@@ -1024,6 +1037,19 @@
private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1];
private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1];
+ /**
+ * The cache of powers of each radix. This allows us to not have to
+ * recalculate powers of radix^(2^n) more than once. This speeds
+ * Schoenhage recursive base conversion significantly.
+ */
+ private static volatile BigInteger[][] powerCache;
+
+ /** The cache of logarithms of radices for base conversion. */
+ private static final double[] logCache;
+
+ /** The natural log of 2. This is used in computing cache indices. */
+ private static final double LOG_TWO = Math.log(2.0);
+
static {
for (int i = 1; i <= MAX_CONSTANT; i++) {
int[] magnitude = new int[1];
@@ -1031,6 +1057,20 @@
posConst[i] = new BigInteger(magnitude, 1);
negConst[i] = new BigInteger(magnitude, -1);
}
+
+ /*
+ * Initialize the cache of radix^(2^x) values used for base conversion
+ * with just the very first value. Additional values will be created
+ * on demand.
+ */
+ powerCache = new BigInteger[Character.MAX_RADIX+1][];
+ logCache = new double[Character.MAX_RADIX+1];
+
+ for (int i=Character.MIN_RADIX; i<=Character.MAX_RADIX; i++)
+ {
+ powerCache[i] = new BigInteger[] { BigInteger.valueOf(i) };
+ logCache[i] = Math.log(i);
+ }
}
/**
@@ -1355,7 +1395,7 @@
if ((xlen < TOOM_COOK_THRESHOLD) && (ylen < TOOM_COOK_THRESHOLD))
return multiplyKaratsuba(this, val);
else
- return multiplyToomCook3(this, val);
+ return multiplyToomCook3(this, val);
}
private static BigInteger multiplyByInt(int[] x, int y, int sign) {
@@ -3297,6 +3337,28 @@
if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
radix = 10;
+ // If it's small enough, use smallToString.
+ if (mag.length <= SCHOENHAGE_BASE_CONVERSION_THRESHOLD)
+ return smallToString(radix);
+
+ // Otherwise use recursive toString, which requires positive arguments.
+ // The results will be concatenated into this StringBuilder
+ StringBuilder sb = new StringBuilder();
+ if (signum < 0) {
+ toString(this.negate(), sb, radix, 0);
+ sb.insert(0, '-');
+ }
+ else
+ toString(this, sb, radix, 0);
+
+ return sb.toString();
+ }
+
+ /** This method is used to perform toString when arguments are small. */
+ private String smallToString(int radix) {
+ if (signum == 0)
+ return "0";
+
// Compute upper bound on number of digit groups and allocate space
int maxNumDigitGroups = (4*mag.length + 6)/7;
String digitGroup[] = new String[maxNumDigitGroups];
@@ -3335,6 +3397,81 @@
return buf.toString();
}
+ /**
+ * Converts the specified BigInteger to a string and appends to
+ * <code>sb</code>. This implements the recursive Schoenhage algorithm
+ * for base conversions.
+ * <p/>
+ * See Knuth, Donald, _The Art of Computer Programming_, Vol. 2,
+ * Answers to Exercises (4.4) Question 14.
+ *
+ * @param u The number to convert to a string.
+ * @param sb The StringBuilder that will be appended to in place.
+ * @param radix The base to convert to.
+ * @param digits The minimum number of digits to pad to.
+ */
+ private static void toString(BigInteger u, StringBuilder sb, int radix,
+ int digits) {
+ /* If we're smaller than a certain threshold, use the smallToString
+ method, padding with leading zeroes when necessary. */
+ if (u.mag.length <= SCHOENHAGE_BASE_CONVERSION_THRESHOLD) {
+ String s = u.smallToString(radix);
+
+ // Pad with internal zeros if necessary.
+ // Don't pad if we're at the beginning of the string.
+ if ((s.length() < digits) && (sb.length() > 0))
+ for (int i=s.length(); i<digits; i++) // May be a faster way to
+ sb.append('0'); // do this?
+
+ sb.append(s);
+ return;
+ }
+
+ int b, n;
+ b = u.bitLength();
+
+ // Calculate a value for n in the equation radix^(2^n) = u
+ // and subtract 1 from that value. This is used to find the
+ // cache index that contains the best value to divide u.
+ n = (int) Math.round(Math.log(b * LOG_TWO / logCache[radix]) / LOG_TWO - 1.0);
+ BigInteger v = getRadixConversionCache(radix, n);
+ BigInteger[] results;
+ results = u.divideAndRemainder(v);
+
+ int expectedDigits = 1 << n;
+
+ // Now recursively build the two halves of each number.
+ toString(results[0], sb, radix, digits-expectedDigits);
+ toString(results[1], sb, radix, expectedDigits);
+ }
+
+ /**
+ * Returns the value radix^(2^exponent) from the cache.
+ * If this value doesn't already exist in the cache, it is added.
+ * <p/>
+ * This could be changed to a more complicated caching method using
+ * <code>Future</code>.
+ */
+ private static BigInteger getRadixConversionCache(int radix, int exponent) {
+ BigInteger[] cacheLine = powerCache[radix]; // volatile read
+ if (exponent < cacheLine.length) {
+ return cacheLine[exponent];
+ }
+
+ int oldLength = cacheLine.length;
+ cacheLine = Arrays.copyOf(cacheLine, exponent + 1);
+ for (int i = oldLength; i <= exponent; i++) {
+ cacheLine[i] = cacheLine[i - 1].pow(2);
+ }
+
+ BigInteger[][] pc = powerCache; // volatile read again
+ if (exponent >= pc[radix].length) {
+ pc = pc.clone();
+ pc[radix] = cacheLine;
+ powerCache = pc; // volatile write, publish
+ }
+ return cacheLine[exponent];
+ }
/* zero[i] is a string of i consecutive zeros. */
private static String zeros[] = new String[64];
@@ -3452,8 +3589,72 @@
* @return this BigInteger converted to a {@code float}.
*/
public float floatValue() {
- // Somewhat inefficient, but guaranteed to work.
- return Float.parseFloat(this.toString());
+ if (signum == 0) {
+ return 0.0f;
+ }
+
+ int exponent = ((mag.length - 1) << 5) + bitLengthForInt(mag[0]) - 1;
+
+ // exponent == floor(log2(abs(this)))
+ if (exponent < Long.SIZE - 1) {
+ return longValue();
+ } else if (exponent > Float.MAX_EXPONENT) {
+ return signum > 0 ? Float.POSITIVE_INFINITY : Float.NEGATIVE_INFINITY;
+ }
+
+ /*
+ * We need the top SIGNIFICAND_WIDTH bits, including the "implicit"
+ * one bit. To make rounding easier, we pick out the top
+ * SIGNIFICAND_WIDTH + 1 bits, so we have one to help us round up or
+ * down. twiceSignifFloor will contain the top SIGNIFICAND_WIDTH + 1
+ * bits, and signifFloor the top SIGNIFICAND_WIDTH.
+ *
+ * It helps to consider the real number signif = abs(this) *
+ * 2^(SIGNIFICAND_WIDTH - 1 - exponent).
+ */
+ int shift = exponent - FloatConsts.SIGNIFICAND_WIDTH;
+
+ int twiceSignifFloor;
+ // twiceSignifFloor will be == abs().shiftRight(shift).intValue()
+ // We do the shift into an int directly to improve performance.
+
+ int nBits = shift & 0x1f;
+ int nBits2 = 32 - nBits;
+
+ if (nBits == 0) {
+ twiceSignifFloor = mag[0];
+ } else {
+ twiceSignifFloor = mag[0] >>> nBits;
+ if (twiceSignifFloor == 0) {
+ twiceSignifFloor = (mag[0] << nBits2) | (mag[1] >>> nBits);
+ }
+ }
+
+ int signifFloor = twiceSignifFloor >> 1;
+ signifFloor &= FloatConsts.SIGNIF_BIT_MASK; // remove the implied bit
+
+ /*
+ * We round up if either the fractional part of signif is strictly
+ * greater than 0.5 (which is true if the 0.5 bit is set and any lower
+ * bit is set), or if the fractional part of signif is >= 0.5 and
+ * signifFloor is odd (which is true if both the 0.5 bit and the 1 bit
+ * are set). This is equivalent to the desired HALF_EVEN rounding.
+ */
+ boolean increment = (twiceSignifFloor & 1) != 0
+ && ((signifFloor & 1) != 0 || abs().getLowestSetBit() < shift);
+ int signifRounded = increment ? signifFloor + 1 : signifFloor;
+ int bits = ((exponent + FloatConsts.EXP_BIAS))
+ << (FloatConsts.SIGNIFICAND_WIDTH - 1);
+ bits += signifRounded;
+ /*
+ * If signifRounded == 2^24, we'd need to set all of the significand
+ * bits to zero and add 1 to the exponent. This is exactly the behavior
+ * we get from just adding signifRounded to bits directly. If the
+ * exponent is Float.MAX_EXPONENT, we round up (correctly) to
+ * Float.POSITIVE_INFINITY.
+ */
+ bits |= signum & FloatConsts.SIGN_BIT_MASK;
+ return Float.intBitsToFloat(bits);
}
/**
@@ -3472,8 +3673,80 @@
* @return this BigInteger converted to a {@code double}.
*/
public double doubleValue() {
- // Somewhat inefficient, but guaranteed to work.
- return Double.parseDouble(this.toString());
+ if (signum == 0) {
+ return 0.0;
+ }
+
+ int exponent = ((mag.length - 1) << 5) + bitLengthForInt(mag[0]) - 1;
+
+ // exponent == floor(log2(abs(this))Double)
+ if (exponent < Long.SIZE - 1) {
+ return longValue();
+ } else if (exponent > Double.MAX_EXPONENT) {
+ return signum > 0 ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY;
+ }
+
+ /*
+ * We need the top SIGNIFICAND_WIDTH bits, including the "implicit"
+ * one bit. To make rounding easier, we pick out the top
+ * SIGNIFICAND_WIDTH + 1 bits, so we have one to help us round up or
+ * down. twiceSignifFloor will contain the top SIGNIFICAND_WIDTH + 1
+ * bits, and signifFloor the top SIGNIFICAND_WIDTH.
+ *
+ * It helps to consider the real number signif = abs(this) *
+ * 2^(SIGNIFICAND_WIDTH - 1 - exponent).
+ */
+ int shift = exponent - DoubleConsts.SIGNIFICAND_WIDTH;
+
+ long twiceSignifFloor;
+ // twiceSignifFloor will be == abs().shiftRight(shift).longValue()
+ // We do the shift into a long directly to improve performance.
+
+ int nBits = shift & 0x1f;
+ int nBits2 = 32 - nBits;
+
+ int highBits;
+ int lowBits;
+ if (nBits == 0) {
+ highBits = mag[0];
+ lowBits = mag[1];
+ } else {
+ highBits = mag[0] >>> nBits;
+ lowBits = (mag[0] << nBits2) | (mag[1] >>> nBits);
+ if (highBits == 0) {
+ highBits = lowBits;
+ lowBits = (mag[1] << nBits2) | (mag[2] >>> nBits);
+ }
+ }
+
+ twiceSignifFloor = ((highBits & LONG_MASK) << 32)
+ | (lowBits & LONG_MASK);
+
+ long signifFloor = twiceSignifFloor >> 1;
+ signifFloor &= DoubleConsts.SIGNIF_BIT_MASK; // remove the implied bit
+
+ /*
+ * We round up if either the fractional part of signif is strictly
+ * greater than 0.5 (which is true if the 0.5 bit is set and any lower
+ * bit is set), or if the fractional part of signif is >= 0.5 and
+ * signifFloor is odd (which is true if both the 0.5 bit and the 1 bit
+ * are set). This is equivalent to the desired HALF_EVEN rounding.
+ */
+ boolean increment = (twiceSignifFloor & 1) != 0
+ && ((signifFloor & 1) != 0 || abs().getLowestSetBit() < shift);
+ long signifRounded = increment ? signifFloor + 1 : signifFloor;
+ long bits = (long) ((exponent + DoubleConsts.EXP_BIAS))
+ << (DoubleConsts.SIGNIFICAND_WIDTH - 1);
+ bits += signifRounded;
+ /*
+ * If signifRounded == 2^53, we'd need to set all of the significand
+ * bits to zero and add 1 to the exponent. This is exactly the behavior
+ * we get from just adding signifRounded to bits directly. If the
+ * exponent is Double.MAX_EXPONENT, we round up (correctly) to
+ * Double.POSITIVE_INFINITY.
+ */
+ bits |= signum & DoubleConsts.SIGN_BIT_MASK;
+ return Double.longBitsToDouble(bits);
}
/**
--- a/jdk/src/share/classes/java/math/RoundingMode.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/math/RoundingMode.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -101,6 +101,7 @@
*
*<p>Example:
*<table border>
+ * <caption><b>Rounding mode UP Examples</b></caption>
*<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code UP} rounding
*<tr align=right><td>5.5</td> <td>6</td>
@@ -124,6 +125,7 @@
*
*<p>Example:
*<table border>
+ * <caption><b>Rounding mode DOWN Examples</b></caption>
*<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code DOWN} rounding
*<tr align=right><td>5.5</td> <td>5</td>
@@ -148,6 +150,7 @@
*
*<p>Example:
*<table border>
+ * <caption><b>Rounding mode CEILING Examples</b></caption>
*<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code CEILING} rounding
*<tr align=right><td>5.5</td> <td>6</td>
@@ -172,6 +175,7 @@
*
*<p>Example:
*<table border>
+ * <caption><b>Rounding mode FLOOR Examples</b></caption>
*<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code FLOOR} rounding
*<tr align=right><td>5.5</td> <td>5</td>
@@ -198,6 +202,7 @@
*
*<p>Example:
*<table border>
+ * <caption><b>Rounding mode HALF_UP Examples</b></caption>
*<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code HALF_UP} rounding
*<tr align=right><td>5.5</td> <td>6</td>
@@ -223,6 +228,7 @@
*
*<p>Example:
*<table border>
+ * <caption><b>Rounding mode HALF_DOWN Examples</b></caption>
*<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code HALF_DOWN} rounding
*<tr align=right><td>5.5</td> <td>5</td>
@@ -255,6 +261,7 @@
*
*<p>Example:
*<table border>
+ * <caption><b>Rounding mode HALF_EVEN Examples</b></caption>
*<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code HALF_EVEN} rounding
*<tr align=right><td>5.5</td> <td>6</td>
@@ -278,6 +285,7 @@
* {@code ArithmeticException} is thrown.
*<p>Example:
*<table border>
+ * <caption><b>Rounding mode UNNECESSARY Examples</b></caption>
*<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code UNNECESSARY} rounding
*<tr align=right><td>5.5</td> <td>throw {@code ArithmeticException}</td>
--- a/jdk/src/share/classes/java/nio/Buffer.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/Buffer.java Tue Jul 02 15:23:23 2013 -0700
@@ -52,7 +52,7 @@
* <p> There is one subclass of this class for each non-boolean primitive type.
*
*
- * <h4> Transferring data </h4>
+ * <h2> Transferring data </h2>
*
* <p> Each subclass of this class defines two categories of <i>get</i> and
* <i>put</i> operations: </p>
@@ -78,7 +78,7 @@
* current position.
*
*
- * <h4> Marking and resetting </h4>
+ * <h2> Marking and resetting </h2>
*
* <p> A buffer's <i>mark</i> is the index to which its position will be reset
* when the {@link #reset reset} method is invoked. The mark is not always
@@ -89,7 +89,7 @@
* {@link InvalidMarkException} to be thrown.
*
*
- * <h4> Invariants </h4>
+ * <h2> Invariants </h2>
*
* <p> The following invariant holds for the mark, position, limit, and
* capacity values:
@@ -109,7 +109,7 @@
* to zero.
*
*
- * <h4> Clearing, flipping, and rewinding </h4>
+ * <h2> Clearing, flipping, and rewinding </h2>
*
* <p> In addition to methods for accessing the position, limit, and capacity
* values and for marking and resetting, this class also defines the following
@@ -132,7 +132,7 @@
* </ul>
*
*
- * <h4> Read-only buffers </h4>
+ * <h2> Read-only buffers </h2>
*
* <p> Every buffer is readable, but not every buffer is writable. The
* mutation methods of each buffer class are specified as <i>optional
@@ -143,14 +143,14 @@
* {@link #isReadOnly isReadOnly} method.
*
*
- * <h4> Thread safety </h4>
+ * <h2> Thread safety </h2>
*
* <p> Buffers are not safe for use by multiple concurrent threads. If a
* buffer is to be used by more than one thread then access to the buffer
* should be controlled by appropriate synchronization.
*
*
- * <h4> Invocation chaining </h4>
+ * <h2> Invocation chaining </h2>
*
* <p> Methods in this class that do not otherwise have a value to return are
* specified to return the buffer upon which they are invoked. This allows
--- a/jdk/src/share/classes/java/nio/MappedByteBuffer.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/MappedByteBuffer.java Tue Jul 02 15:23:23 2013 -0700
@@ -45,7 +45,7 @@
* this program or another. Whether or not such changes occur, and when they
* occur, is operating-system dependent and therefore unspecified.
*
- * <a name="inaccess"><p> All or part of a mapped byte buffer may become
+ * <a name="inaccess"></a><p> All or part of a mapped byte buffer may become
* inaccessible at any time, for example if the mapped file is truncated. An
* attempt to access an inaccessible region of a mapped byte buffer will not
* change the buffer's content and will cause an unspecified exception to be
--- a/jdk/src/share/classes/java/nio/X-Buffer.java.template Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/X-Buffer.java.template Tue Jul 02 15:23:23 2013 -0700
@@ -44,23 +44,23 @@
*
* <ul>
*
- * <li><p> Absolute and relative {@link #get() </code><i>get</i><code>} and
- * {@link #put($type$) </code><i>put</i><code>} methods that read and write
+ * <li><p> Absolute and relative {@link #get() <i>get</i>} and
+ * {@link #put($type$) <i>put</i>} methods that read and write
* single $type$s; </p></li>
*
- * <li><p> Relative {@link #get($type$[]) </code><i>bulk get</i><code>}
+ * <li><p> Relative {@link #get($type$[]) <i>bulk get</i>}
* methods that transfer contiguous sequences of $type$s from this buffer
* into an array; {#if[!byte]?and}</p></li>
*
- * <li><p> Relative {@link #put($type$[]) </code><i>bulk put</i><code>}
+ * <li><p> Relative {@link #put($type$[]) <i>bulk put</i>}
* methods that transfer contiguous sequences of $type$s from $a$
* $type$ array{#if[char]?, a string,} or some other $type$
* buffer into this buffer;{#if[!byte]? and} </p></li>
*
#if[byte]
*
- * <li><p> Absolute and relative {@link #getChar() </code><i>get</i><code>}
- * and {@link #putChar(char) </code><i>put</i><code>} methods that read and
+ * <li><p> Absolute and relative {@link #getChar() <i>get</i>}
+ * and {@link #putChar(char) <i>put</i>} methods that read and
* write values of other primitive types, translating them to and from
* sequences of bytes in a particular byte order; </p></li>
*
@@ -70,23 +70,23 @@
*
#end[byte]
*
- * <li><p> Methods for {@link #compact </code>compacting<code>}, {@link
- * #duplicate </code>duplicating<code>}, and {@link #slice
- * </code>slicing<code>} $a$ $type$ buffer. </p></li>
+ * <li><p> Methods for {@link #compact compacting}, {@link
+ * #duplicate duplicating}, and {@link #slice slicing}
+ * $a$ $type$ buffer. </p></li>
*
* </ul>
*
* <p> $Type$ buffers can be created either by {@link #allocate
- * </code><i>allocation</i><code>}, which allocates space for the buffer's
+ * <i>allocation</i>}, which allocates space for the buffer's
*
#if[byte]
*
- * content, or by {@link #wrap($type$[]) </code><i>wrapping</i><code>} an
+ * content, or by {@link #wrap($type$[]) <i>wrapping</i>} an
* existing $type$ array {#if[char]?or string} into a buffer.
*
#else[byte]
*
- * content, by {@link #wrap($type$[]) </code><i>wrapping</i><code>} an existing
+ * content, by {@link #wrap($type$[]) <i>wrapping</i>} an existing
* $type$ array {#if[char]?or string} into a buffer, or by creating a
* <a href="ByteBuffer.html#views"><i>view</i></a> of an existing byte buffer.
*
@@ -94,8 +94,8 @@
*
#if[byte]
*
- * <a name="direct">
- * <h4> Direct <i>vs.</i> non-direct buffers </h4>
+ * <a name="direct"></a>
+ * <h2> Direct <i>vs.</i> non-direct buffers </h2>
*
* <p> A byte buffer is either <i>direct</i> or <i>non-direct</i>. Given a
* direct byte buffer, the Java virtual machine will make a best effort to
@@ -116,7 +116,7 @@
* buffers only when they yield a measureable gain in program performance.
*
* <p> A direct byte buffer may also be created by {@link
- * java.nio.channels.FileChannel#map </code>mapping<code>} a region of a file
+ * java.nio.channels.FileChannel#map mapping} a region of a file
* directly into memory. An implementation of the Java platform may optionally
* support the creation of direct byte buffers from native code via JNI. If an
* instance of one of these kinds of buffers refers to an inaccessible region
@@ -129,8 +129,8 @@
* that explicit buffer management can be done in performance-critical code.
*
*
- * <a name="bin">
- * <h4> Access to binary data </h4>
+ * <a name="bin"></a>
+ * <h2> Access to binary data </h2>
*
* <p> This class defines methods for reading and writing values of all other
* primitive types, except <tt>boolean</tt>. Primitive values are translated
@@ -156,7 +156,7 @@
* parameters of the absolute <i>get</i> and <i>put</i> methods are in terms of
* bytes rather than of the type being read or written.
*
- * <a name="views">
+ * <a name="views"></a>
*
* <p> For access to homogeneous binary data, that is, sequences of values of
* the same type, this class defines methods that can create <i>views</i> of a
@@ -214,7 +214,7 @@
#end[char]
*
#if[byte]
- * <h4> Invocation chaining </h4>
+ * <h2> Invocation chaining </h2>
#end[byte]
*
* <p> Methods in this class that do not otherwise have a value to return are
@@ -297,7 +297,7 @@
* <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
* initialized to zero. Whether or not it has a
- * {@link #hasArray </code>backing array<code>} is unspecified.
+ * {@link #hasArray backing array} is unspecified.
*
* @param capacity
* The new buffer's capacity, in $type$s
@@ -318,9 +318,8 @@
*
* <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
- * initialized to zero. It will have a {@link #array
- * </code>backing array<code>}, and its {@link #arrayOffset </code>array
- * offset<code>} will be zero.
+ * initialized to zero. It will have a {@link #array backing array},
+ * and its {@link #arrayOffset array offset} will be zero.
*
* @param capacity
* The new buffer's capacity, in $type$s
@@ -344,8 +343,8 @@
* and vice versa. The new buffer's capacity will be
* <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit
* will be <tt>offset + length</tt>, and its mark will be undefined. Its
- * {@link #array </code>backing array<code>} will be the given array, and
- * its {@link #arrayOffset </code>array offset<code>} will be zero. </p>
+ * {@link #array backing array} will be the given array, and
+ * its {@link #arrayOffset array offset} will be zero. </p>
*
* @param array
* The array that will back the new buffer
@@ -384,8 +383,8 @@
* that is, modifications to the buffer will cause the array to be modified
* and vice versa. The new buffer's capacity and limit will be
* <tt>array.length</tt>, its position will be zero, and its mark will be
- * undefined. Its {@link #array </code>backing array<code>} will be the
- * given array, and its {@link #arrayOffset </code>array offset<code>} will
+ * undefined. Its {@link #array backing array} will be the
+ * given array, and its {@link #arrayOffset array offset>} will
* be zero. </p>
*
* @param array
@@ -703,6 +702,9 @@
* <pre>
* src.get(a, 0, a.length) </pre>
*
+ * @param dst
+ * The destination array
+ *
* @return This buffer
*
* @throws BufferUnderflowException
@@ -842,6 +844,9 @@
* <pre>
* dst.put(a, 0, a.length) </pre>
*
+ * @param src
+ * The source array
+ *
* @return This buffer
*
* @throws BufferOverflowException
@@ -930,6 +935,9 @@
* <pre>
* dst.put(s, 0, s.length()) </pre>
*
+ * @param src
+ * The source string
+ *
* @return This buffer
*
* @throws BufferOverflowException
@@ -1419,7 +1427,7 @@
*
* <p> The byte order of $a$ $type$ buffer created by allocation or by
* wrapping an existing <tt>$type$</tt> array is the {@link
- * ByteOrder#nativeOrder </code>native order<code>} of the underlying
+ * ByteOrder#nativeOrder native order} of the underlying
* hardware. The byte order of $a$ $type$ buffer created as a <a
* href="ByteBuffer.html#views">view</a> of a byte buffer is that of the
* byte buffer at the moment that the view is created. </p>
--- a/jdk/src/share/classes/java/nio/channels/AsynchronousByteChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/AsynchronousByteChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -87,6 +87,8 @@
* initiates a read operation before a previous read operation has
* completed then a {@link ReadPendingException} will be thrown.
*
+ * @param <A>
+ * The type of the attachment
* @param dst
* The buffer into which bytes are to be transferred
* @param attachment
@@ -166,6 +168,8 @@
* initiates a write operation before a previous write operation has
* completed then a {@link WritePendingException} will be thrown.
*
+ * @param <A>
+ * The type of the attachment
* @param src
* The buffer from which bytes are to be retrieved
* @param attachment
--- a/jdk/src/share/classes/java/nio/channels/AsynchronousChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/AsynchronousChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -61,7 +61,7 @@
* may not allow more than one read and one write operation to be outstanding at
* any given time.
*
- * <h4>Cancellation</h4>
+ * <h2>Cancellation</h2>
*
* <p> The {@code Future} interface defines the {@link Future#cancel cancel}
* method to cancel execution. This causes all threads waiting on the result of
--- a/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java Tue Jul 02 15:23:23 2013 -0700
@@ -60,7 +60,7 @@
* default group is not configured then the pooled threads of the default group
* are {@link Thread#isDaemon daemon} threads.
*
- * <table border>
+ * <table border summary="System properties">
* <tr>
* <th>System property</th>
* <th>Description</th>
@@ -89,7 +89,7 @@
* </tr>
* </table>
*
- * <a name="threading"><h4>Threading</h4></a>
+ * <a name="threading"></a><h2>Threading</h2>
*
* <p> The completion handler for an I/O operation initiated on a channel bound
* to a group is guaranteed to be invoked by one of the pooled threads in the
@@ -104,7 +104,7 @@
* handler directly by the initiating thread (see {@link
* AsynchronousServerSocketChannel#accept(Object,CompletionHandler) accept}).
*
- * <a name="shutdown"><h4>Shutdown and Termination</h4></a>
+ * <a name="shutdown"></a><h2>Shutdown and Termination</h2>
*
* <p> The {@link #shutdown() shutdown} method is used to initiate an <em>orderly
* shutdown</em> of a group. An orderly shutdown marks the group as shutdown;
--- a/jdk/src/share/classes/java/nio/channels/AsynchronousFileChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/AsynchronousFileChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -425,6 +425,8 @@
* They are not suitable for controlling access to a file by multiple
* threads within the same virtual machine.
*
+ * @param <A>
+ * The type of the attachment
* @param position
* The position at which the locked region is to start; must be
* non-negative
@@ -473,6 +475,8 @@
* ch.{@link #lock(long,long,boolean,Object,CompletionHandler) lock}(0L, Long.MAX_VALUE, false, att, handler)
* </pre>
*
+ * @param <A>
+ * The type of the attachment
* @param attachment
* The object to attach to the I/O operation; can be {@code null}
* @param handler
@@ -652,6 +656,8 @@
* If the given file position is greater than the file's size at the time
* that the read is attempted then no bytes are read.
*
+ * @param <A>
+ * The type of the attachment
* @param dst
* The buffer into which bytes are to be transferred
* @param position
@@ -716,6 +722,8 @@
* bytes; the values of any bytes between the previous end-of-file and the
* newly-written bytes are unspecified.
*
+ * @param <A>
+ * The type of the attachment
* @param src
* The buffer from which bytes are to be transferred
* @param position
--- a/jdk/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -52,7 +52,7 @@
* <p> Socket options are configured using the {@link #setOption(SocketOption,Object)
* setOption} method. Channels of this type support the following options:
* <blockquote>
- * <table border>
+ * <table border summary="Socket options">
* <tr>
* <th>Option Name</th>
* <th>Description</th>
@@ -98,6 +98,9 @@
/**
* Initializes a new instance of this class.
+ *
+ * @param provider
+ * The provider that created this channel
*/
protected AsynchronousServerSocketChannel(AsynchronousChannelProvider provider) {
this.provider = provider;
@@ -105,6 +108,8 @@
/**
* Returns the provider that created this channel.
+ *
+ * @return The provider that created this channel
*/
public final AsynchronousChannelProvider provider() {
return provider;
@@ -263,6 +268,8 @@
* the connection is closed and the operation completes with a {@link
* SecurityException}.
*
+ * @param <A>
+ * The type of the attachment
* @param attachment
* The object to attach to the I/O operation; can be {@code null}
* @param handler
--- a/jdk/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -62,7 +62,7 @@
* <p> Socket options are configured using the {@link #setOption(SocketOption,Object)
* setOption} method. Asynchronous socket channels support the following options:
* <blockquote>
- * <table border>
+ * <table border summary="Socket options">
* <tr>
* <th>Option Name</th>
* <th>Description</th>
@@ -91,7 +91,7 @@
* </blockquote>
* Additional (implementation specific) options may also be supported.
*
- * <h4>Timeouts</h4>
+ * <h2>Timeouts</h2>
*
* <p> The {@link #read(ByteBuffer,long,TimeUnit,Object,CompletionHandler) read}
* and {@link #write(ByteBuffer,long,TimeUnit,Object,CompletionHandler) write}
@@ -123,6 +123,9 @@
/**
* Initializes a new instance of this class.
+ *
+ * @param provider
+ * The provider that created this channel
*/
protected AsynchronousSocketChannel(AsynchronousChannelProvider provider) {
this.provider = provider;
@@ -130,6 +133,8 @@
/**
* Returns the provider that created this channel.
+ *
+ * @return The provider that created this channel
*/
public final AsynchronousChannelProvider provider() {
return provider;
@@ -287,6 +292,8 @@
* java.lang.SecurityManager#checkConnect checkConnect} method permits
* connecting to the address and port number of the given remote endpoint.
*
+ * @param <A>
+ * The type of the attachment
* @param remote
* The remote address to which this channel is to be connected
* @param attachment
@@ -365,6 +372,8 @@
* AsynchronousByteChannel#read(ByteBuffer,Object,CompletionHandler)}
* method.
*
+ * @param <A>
+ * The type of the attachment
* @param dst
* The buffer into which bytes are to be transferred
* @param timeout
@@ -461,6 +470,8 @@
* read from the channel will cause an unspecific runtime exception to be
* thrown.
*
+ * @param <A>
+ * The type of the attachment
* @param dsts
* The buffers into which bytes are to be transferred
* @param offset
@@ -520,6 +531,8 @@
* AsynchronousByteChannel#write(ByteBuffer,Object,CompletionHandler)}
* method.
*
+ * @param <A>
+ * The type of the attachment
* @param src
* The buffer from which bytes are to be retrieved
* @param timeout
@@ -610,6 +623,8 @@
* to write to the channel will cause an unspecific runtime exception to be
* thrown.
*
+ * @param <A>
+ * The type of the attachment
* @param srcs
* The buffers from which bytes are to be retrieved
* @param offset
--- a/jdk/src/share/classes/java/nio/channels/DatagramChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/DatagramChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -57,7 +57,7 @@
* setOption} method. A datagram channel to an Internet Protocol socket supports
* the following options:
* <blockquote>
- * <table border>
+ * <table border summary="Socket options">
* <tr>
* <th>Option Name</th>
* <th>Description</th>
@@ -117,6 +117,9 @@
/**
* Initializes a new instance of this class.
+ *
+ * @param provider
+ * The provider that created this channel
*/
protected DatagramChannel(SelectorProvider provider) {
super(provider);
--- a/jdk/src/share/classes/java/nio/channels/FileChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/FileChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -46,7 +46,7 @@
* of bytes that can be read and written and whose current {@link #size
* <i>size</i>} can be queried. The size of the file increases
* when bytes are written beyond its current size; the size of the file
- * decreases when it is {@link #truncate </code><i>truncated</i><code>}. The
+ * decreases when it is {@link #truncate <i>truncated</i>}. The
* file may also have some associated <i>metadata</i> such as access
* permissions, content type, and last-modification time; this class does not
* define methods for metadata access.
@@ -830,7 +830,7 @@
* <p> A region of a file may be mapped into memory in one of three modes:
* </p>
*
- * <ul type=disc>
+ * <ul>
*
* <li><p> <i>Read-only:</i> Any attempt to modify the resulting buffer
* will cause a {@link java.nio.ReadOnlyBufferException} to be thrown.
--- a/jdk/src/share/classes/java/nio/channels/FileLock.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/FileLock.java Tue Jul 02 15:23:23 2013 -0700
@@ -72,7 +72,7 @@
* <p> File-lock objects are safe for use by multiple concurrent threads.
*
*
- * <a name="pdep"><h4> Platform dependencies </h4></a>
+ * <a name="pdep"></a><h2> Platform dependencies </h2>
*
* <p> This file-locking API is intended to map directly to the native locking
* facility of the underlying operating system. Thus the locks held on a file
@@ -261,6 +261,11 @@
/**
* Tells whether or not this lock overlaps the given lock range.
*
+ * @param position
+ * The starting position of the lock range
+ * @param size
+ * The size of the lock range
+ *
* @return <tt>true</tt> if, and only if, this lock and the given lock
* range overlap by at least one byte
*/
--- a/jdk/src/share/classes/java/nio/channels/MulticastChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/MulticastChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -71,7 +71,7 @@
* MembershipKey#drop drop} method drops membership so that datagrams from the
* source address can no longer be received.
*
- * <h4>Platform dependencies</h4>
+ * <h2>Platform dependencies</h2>
*
* The multicast implementation is intended to map directly to the native
* multicasting facility. Consequently, the following items should be considered
--- a/jdk/src/share/classes/java/nio/channels/NetworkChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/NetworkChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -106,6 +106,8 @@
/**
* Sets the value of a socket option.
*
+ * @param <T>
+ * The type of the socket option value
* @param name
* The socket option
* @param value
@@ -130,6 +132,8 @@
/**
* Returns the value of a socket option.
*
+ * @param <T>
+ * The type of the socket option value
* @param name
* The socket option
*
--- a/jdk/src/share/classes/java/nio/channels/Pipe.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/Pipe.java Tue Jul 02 15:23:23 2013 -0700
@@ -33,10 +33,9 @@
* A pair of channels that implements a unidirectional pipe.
*
* <p> A pipe consists of a pair of channels: A writable {@link
- * Pipe.SinkChannel </code>sink<code>} channel and a readable {@link
- * Pipe.SourceChannel </code>source<code>} channel. Once some bytes are
- * written to the sink channel they can be read from source channel in exactly
- * the order in which they were written.
+ * Pipe.SinkChannel sink} channel and a readable {@link Pipe.SourceChannel source}
+ * channel. Once some bytes are written to the sink channel they can be read
+ * from source channel in exactlyAthe order in which they were written.
*
* <p> Whether or not a thread writing bytes to a pipe will block until another
* thread reads those bytes, or some previously-written bytes, from the pipe is
@@ -63,6 +62,9 @@
{
/**
* Constructs a new instance of this class.
+ *
+ * @param provider
+ * The selector provider
*/
protected SourceChannel(SelectorProvider provider) {
super(provider);
@@ -94,6 +96,9 @@
{
/**
* Initializes a new instance of this class.
+ *
+ * @param provider
+ * The selector provider
*/
protected SinkChannel(SelectorProvider provider) {
super(provider);
--- a/jdk/src/share/classes/java/nio/channels/SelectableChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/SelectableChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -64,8 +64,8 @@
* threads. </p>
*
*
- * <a name="bm">
- * <h4>Blocking mode</h4>
+ * <a name="bm"></a>
+ * <h2>Blocking mode</h2>
*
* A selectable channel is either in <i>blocking</i> mode or in
* <i>non-blocking</i> mode. In blocking mode, every I/O operation invoked
@@ -142,6 +142,9 @@
* Retrieves the key representing the channel's registration with the given
* selector.
*
+ * @param sel
+ * The selector
+ *
* @return The key returned when this channel was last registered with the
* given selector, or <tt>null</tt> if this channel is not
* currently registered with that selector
--- a/jdk/src/share/classes/java/nio/channels/SelectionKey.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/SelectionKey.java Tue Jul 02 15:23:23 2013 -0700
@@ -42,7 +42,7 @@
* next selection operation. The validity of a key may be tested by invoking
* its {@link #isValid isValid} method.
*
- * <a name="opsets">
+ * <a name="opsets"></a>
*
* <p> A selection key contains two <i>operation sets</i> represented as
* integer values. Each bit of an operation set denotes a category of
--- a/jdk/src/share/classes/java/nio/channels/Selector.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/Selector.java Tue Jul 02 15:23:23 2013 -0700
@@ -36,13 +36,13 @@
*
* <p> A selector may be created by invoking the {@link #open open} method of
* this class, which will use the system's default {@link
- * java.nio.channels.spi.SelectorProvider </code>selector provider<code>} to
+ * java.nio.channels.spi.SelectorProvider selector provider} to
* create a new selector. A selector may also be created by invoking the
* {@link java.nio.channels.spi.SelectorProvider#openSelector openSelector}
* method of a custom selector provider. A selector remains open until it is
* closed via its {@link #close close} method.
*
- * <a name="ks">
+ * <a name="ks"></a>
*
* <p> A selectable channel's registration with a selector is represented by a
* {@link SelectionKey} object. A selector maintains three sets of selection
@@ -80,18 +80,18 @@
* during the next selection operation, at which time the key will removed from
* all of the selector's key sets.
*
- * <a name="sks"><p> Keys are added to the selected-key set by selection
+ * <a name="sks"></a><p> Keys are added to the selected-key set by selection
* operations. A key may be removed directly from the selected-key set by
* invoking the set's {@link java.util.Set#remove(java.lang.Object) remove}
* method or by invoking the {@link java.util.Iterator#remove() remove} method
- * of an {@link java.util.Iterator </code>iterator<code>} obtained from the
+ * of an {@link java.util.Iterator iterator} obtained from the
* set. Keys are never removed from the selected-key set in any other way;
* they are not, in particular, removed as a side effect of selection
* operations. Keys may not be added directly to the selected-key set. </p>
*
*
- * <a name="selop">
- * <h4>Selection</h4>
+ * <a name="selop"></a>
+ * <h2>Selection</h2>
*
* <p> During each selection operation, keys may be added to and removed from a
* selector's selected-key set and may be removed from its key and
@@ -111,7 +111,7 @@
* operation began. For a channel that is ready for at least one such
* operation, one of the following two actions is performed: </p>
*
- * <ol type=a>
+ * <ol>
*
* <li><p> If the channel's key is not already in the selected-key set then
* it is added to that set and its ready-operation set is modified to
@@ -126,7 +126,7 @@
* words, the ready set returned by the underlying system is
* bitwise-disjoined into the key's current ready set. </p></li>
*
- * </ol></li>
+ * </ol>
*
* If all of the keys in the key set at the start of this step have empty
* interest sets then neither the selected-key set nor any of the keys'
@@ -142,7 +142,7 @@
* difference between the three selection methods. </p>
*
*
- * <h4>Concurrency</h4>
+ * <h2>Concurrency</h2>
*
* <p> Selectors are themselves safe for use by multiple concurrent threads;
* their key sets, however, are not.
@@ -183,7 +183,7 @@
* <p> The {@link #close close} method synchronizes on the selector and all
* three key sets in the same order as in a selection operation.
*
- * <a name="ksc">
+ * <a name="ksc"></a>
*
* <p> A selector's key and selected-key sets are not, in general, safe for use
* by multiple concurrent threads. If such a thread might modify one of these
--- a/jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -46,7 +46,7 @@
* <p> Socket options are configured using the {@link #setOption(SocketOption,Object)
* setOption} method. Server-socket channels support the following options:
* <blockquote>
- * <table border>
+ * <table border summary="Socket options">
* <tr>
* <th>Option Name</th>
* <th>Description</th>
@@ -78,6 +78,9 @@
/**
* Initializes a new instance of this class.
+ *
+ * @param provider
+ * The provider that created this channel
*/
protected ServerSocketChannel(SelectorProvider provider) {
super(provider);
--- a/jdk/src/share/classes/java/nio/channels/SocketChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/SocketChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -66,7 +66,7 @@
* <p> Socket options are configured using the {@link #setOption(SocketOption,Object)
* setOption} method. Socket channels support the following options:
* <blockquote>
- * <table border>
+ * <table border summary="Socket options">
* <tr>
* <th>Option Name</th>
* <th>Description</th>
@@ -120,6 +120,9 @@
/**
* Initializes a new instance of this class.
+ *
+ * @param provider
+ * The provider that created this channel
*/
protected SocketChannel(SelectorProvider provider) {
super(provider);
@@ -153,6 +156,8 @@
* @param remote
* The remote address to which the new channel is to be connected
*
+ * @return A new, and connected, socket channel
+ *
* @throws AsynchronousCloseException
* If another thread closes this channel
* while the connect operation is in progress
--- a/jdk/src/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -46,7 +46,7 @@
* before and after, respectively, invoking an I/O operation that might block
* indefinitely. In order to ensure that the {@link #end end} method is always
* invoked, these methods should be used within a
- * <tt>try</tt> ... <tt>finally</tt> block: <a name="be">
+ * <tt>try</tt> ... <tt>finally</tt> block:
*
* <blockquote><pre>
* boolean completed = false;
--- a/jdk/src/share/classes/java/nio/channels/spi/AbstractSelectableChannel.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/spi/AbstractSelectableChannel.java Tue Jul 02 15:23:23 2013 -0700
@@ -72,6 +72,9 @@
/**
* Initializes a new instance of this class.
+ *
+ * @param provider
+ * The provider that created this channel
*/
protected AbstractSelectableChannel(SelectorProvider provider) {
this.provider = provider;
@@ -251,6 +254,9 @@
* that is blocked in an I/O operation upon this channel to return
* immediately, either by throwing an exception or by returning normally.
* </p>
+ *
+ * @throws IOException
+ * If an I/O error occurs
*/
protected abstract void implCloseSelectableChannel() throws IOException;
@@ -299,6 +305,10 @@
* changing the blocking mode. This method is only invoked if the new mode
* is different from the current mode. </p>
*
+ * @param block If <tt>true</tt> then this channel will be placed in
+ * blocking mode; if <tt>false</tt> then it will be placed
+ * non-blocking mode
+ *
* @throws IOException
* If an I/O error occurs
*/
--- a/jdk/src/share/classes/java/nio/channels/spi/AbstractSelector.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/spi/AbstractSelector.java Tue Jul 02 15:23:23 2013 -0700
@@ -43,7 +43,7 @@
* after, respectively, invoking an I/O operation that might block
* indefinitely. In order to ensure that the {@link #end end} method is always
* invoked, these methods should be used within a
- * <tt>try</tt> ... <tt>finally</tt> block: <a name="be">
+ * <tt>try</tt> ... <tt>finally</tt> block:
*
* <blockquote><pre>
* try {
@@ -77,6 +77,9 @@
/**
* Initializes a new instance of this class.
+ *
+ * @param provider
+ * The provider that created this selector
*/
protected AbstractSelector(SelectorProvider provider) {
this.provider = provider;
--- a/jdk/src/share/classes/java/nio/channels/spi/AsynchronousChannelProvider.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/spi/AsynchronousChannelProvider.java Tue Jul 02 15:23:23 2013 -0700
@@ -174,6 +174,8 @@
* @param threadFactory
* The factory to use when creating new threads
*
+ * @return A new asynchronous channel group
+ *
* @throws IllegalArgumentException
* If {@code nThreads <= 0}
* @throws IOException
@@ -193,6 +195,8 @@
* A value {@code >=0} or a negative value for implementation
* specific default
*
+ * @return A new asynchronous channel group
+ *
* @throws IOException
* If an I/O error occurs
*
--- a/jdk/src/share/classes/java/nio/channels/spi/SelectorProvider.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/spi/SelectorProvider.java Tue Jul 02 15:23:23 2013 -0700
@@ -183,6 +183,9 @@
* Opens a datagram channel.
*
* @return The new channel
+ *
+ * @throws IOException
+ * If an I/O error occurs
*/
public abstract DatagramChannel openDatagramChannel()
throws IOException;
@@ -209,6 +212,9 @@
* Opens a pipe.
*
* @return The new pipe
+ *
+ * @throws IOException
+ * If an I/O error occurs
*/
public abstract Pipe openPipe()
throws IOException;
@@ -217,6 +223,9 @@
* Opens a selector.
*
* @return The new selector
+ *
+ * @throws IOException
+ * If an I/O error occurs
*/
public abstract AbstractSelector openSelector()
throws IOException;
@@ -225,6 +234,9 @@
* Opens a server-socket channel.
*
* @return The new channel
+ *
+ * @throws IOException
+ * If an I/O error occurs
*/
public abstract ServerSocketChannel openServerSocketChannel()
throws IOException;
@@ -233,6 +245,9 @@
* Opens a socket channel.
*
* @return The new channel
+ *
+ * @throws IOException
+ * If an I/O error occurs
*/
public abstract SocketChannel openSocketChannel()
throws IOException;
--- a/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java.template Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java.template Tue Jul 02 15:23:23 2013 -0700
@@ -163,6 +163,9 @@
* Initializes a new $coder$. The new $coder$ will have the given
* $otypes-per-itype$ and replacement values.
*
+ * @param cs
+ * The charset that created this $coder$
+ *
* @param average$ItypesPerOtype$
* A positive float value indicating the expected number of
* $otype$s that will be produced for each input $itype$
@@ -209,6 +212,9 @@
* $otypes-per-itype$ values and its replacement will be the
* $replTypeName$ $defaultReplName$.
*
+ * @param cs
+ * The charset that created this $coder$
+ *
* @param average$ItypesPerOtype$
* A positive float value indicating the expected number of
* $otype$s that will be produced for each input $itype$
@@ -386,6 +392,8 @@
* <p> The default implementation of this method does nothing. This method
* should be overridden by $coder$s that require notification of changes to
* the malformed-input action. </p>
+ *
+ * @param newAction The new action
*/
protected void implOnMalformedInput(CodingErrorAction newAction) { }
@@ -428,6 +436,8 @@
* <p> The default implementation of this method does nothing. This method
* should be overridden by $coder$s that require notification of changes to
* the unmappable-character action. </p>
+ *
+ * @param newAction The new action
*/
protected void implOnUnmappableCharacter(CodingErrorAction newAction) { }
@@ -925,6 +935,9 @@
* <p> The default implementation of this method is not very efficient; it
* should generally be overridden to improve performance. </p>
*
+ * @param c
+ * The given character
+ *
* @return <tt>true</tt> if, and only if, this encoder can encode
* the given character
*
@@ -953,6 +966,9 @@
* <p> The default implementation of this method is not very efficient; it
* should generally be overridden to improve performance. </p>
*
+ * @param cs
+ * The given character sequence
+ *
* @return <tt>true</tt> if, and only if, this encoder can encode
* the given character without throwing any exceptions and without
* performing any replacements
--- a/jdk/src/share/classes/java/nio/charset/Charset.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/charset/Charset.java Tue Jul 02 15:23:23 2013 -0700
@@ -66,7 +66,7 @@
*
*
* <a name="names"><a name="charenc">
- * <h4>Charset names</h4>
+ * <h2>Charset names</h2>
*
* <p> Charsets are named by strings composed of the following characters:
*
@@ -140,7 +140,7 @@
* previous canonical name be made into an alias.
*
*
- * <h4>Standard charsets</h4>
+ * <h2>Standard charsets</h2>
*
* <a name="standard">
*
@@ -217,7 +217,7 @@
* <p>The {@link StandardCharsets} class defines constants for each of the
* standard charsets.
*
- * <h4>Terminology</h4>
+ * <h2>Terminology</h2>
*
* <p> The name of this class is taken from the terms used in
* <a href="http://www.ietf.org/rfc/rfc2278.txt"><i>RFC 2278</i></a>.
@@ -737,6 +737,9 @@
* it is not necessarily the case that the given charset is not contained
* in this charset.
*
+ * @param cs
+ * The given charset
+ *
* @return <tt>true</tt> if the given charset is contained in this charset
*/
public abstract boolean contains(Charset cs);
--- a/jdk/src/share/classes/java/nio/charset/CoderResult.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/charset/CoderResult.java Tue Jul 02 15:23:23 2013 -0700
@@ -227,6 +227,9 @@
* Static factory method that returns the unique object describing a
* malformed-input error of the given length.
*
+ * @param length
+ * The given length
+ *
* @return The requested coder-result object
*/
public static CoderResult malformedForLength(int length) {
@@ -243,6 +246,9 @@
* Static factory method that returns the unique result object describing
* an unmappable-character error of the given length.
*
+ * @param length
+ * The given length
+ *
* @return The requested coder-result object
*/
public static CoderResult unmappableForLength(int length) {
--- a/jdk/src/share/classes/java/nio/charset/spi/CharsetProvider.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/charset/spi/CharsetProvider.java Tue Jul 02 15:23:23 2013 -0700
@@ -39,8 +39,8 @@
* the usual extension directories. Providers may also be made available by
* adding them to the applet or application class path or by some other
* platform-specific means. Charset providers are looked up via the current
- * thread's {@link java.lang.Thread#getContextClassLoader() </code>context
- * class loader<code>}.
+ * thread's {@link java.lang.Thread#getContextClassLoader() context class
+ * loader}.
*
* <p> A charset provider identifies itself with a provider-configuration file
* named <tt>java.nio.charset.spi.CharsetProvider</tt> in the resource
--- a/jdk/src/share/classes/java/nio/file/FileStore.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/FileStore.java Tue Jul 02 15:23:23 2013 -0700
@@ -173,6 +173,8 @@
* The {@code type} parameter is the type of the attribute view required and
* the method returns an instance of that type if supported.
*
+ * @param <V>
+ * The {@code FileStoreAttributeView} type
* @param type
* the {@code Class} object corresponding to the attribute view
*
--- a/jdk/src/share/classes/java/nio/file/FileSystem.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/FileSystem.java Tue Jul 02 15:23:23 2013 -0700
@@ -315,7 +315,7 @@
* that resembles regular expressions but with a simpler syntax. For example:
*
* <blockquote>
- * <table border="0">
+ * <table border="0" summary="Pattern Language">
* <tr>
* <td>{@code *.java}</td>
* <td>Matches a path that represents a file name ending in {@code .java}</td>
--- a/jdk/src/share/classes/java/nio/file/FileSystems.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/FileSystems.java Tue Jul 02 15:23:23 2013 -0700
@@ -200,6 +200,10 @@
* existing file system. In the case of the {@link FileSystems#getDefault
* default} file system, no permission check is required.
*
+ * @param uri the URI to locate the file system
+ *
+ * @return the reference to the file system
+ *
* @throws IllegalArgumentException
* if the pre-conditions for the {@code uri} parameter are not met
* @throws FileSystemNotFoundException
--- a/jdk/src/share/classes/java/nio/file/Files.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/Files.java Tue Jul 02 15:23:23 2013 -0700
@@ -194,7 +194,7 @@
* <p> In the addition to {@code READ} and {@code WRITE}, the following
* options may be present:
*
- * <table border=1 cellpadding=5 summary="">
+ * <table border=1 cellpadding=5 summary="Options">
* <tr> <th>Option</th> <th>Description</th> </tr>
* <tr>
* <td> {@link StandardOpenOption#APPEND APPEND} </td>
@@ -1616,7 +1616,8 @@
* }
* </pre>
*
- *
+ * @param <V>
+ * The {@code FileAttributeView} type
* @param path
* the path to the file
* @param type
@@ -1665,6 +1666,8 @@
* PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class, NOFOLLOW_LINKS);
* </pre>
*
+ * @param <A>
+ * The {@code BasicFileAttributes} type
* @param path
* the path to the file
* @param type
@@ -1863,7 +1866,7 @@
* attributes} parameter:
*
* <blockquote>
- * <table border="0">
+ * <table border="0" summary="Possible values">
* <tr>
* <td> {@code "*"} </td>
* <td> Read all {@link BasicFileAttributes basic-file-attributes}. </td>
@@ -1971,10 +1974,12 @@
* System Interface (POSIX) family of standards.
*
* @param path
- * A file reference that locates the file
+ * The path to the file
* @param perms
* The new set of permissions
*
+ * @return The path
+ *
* @throws UnsupportedOperationException
* if the associated file system does not support the {@code
* PosixFileAttributeView}
@@ -2009,7 +2014,7 @@
* access to a file attribute that is the owner of the file.
*
* @param path
- * A file reference that locates the file
+ * The path to the file
* @param options
* options indicating how symbolic links are handled
*
@@ -2052,10 +2057,12 @@
* </pre>
*
* @param path
- * A file reference that locates the file
+ * The path to the file
* @param owner
* The new file owner
*
+ * @return The path
+ *
* @throws UnsupportedOperationException
* if the associated file system does not support the {@code
* FileOwnerAttributeView}
@@ -2090,6 +2097,8 @@
* readAttributes} method and the file type tested with the {@link
* BasicFileAttributes#isSymbolicLink} method.
*
+ * @param path The path to the file
+ *
* @return {@code true} if the file is a symbolic link; {@code false} if
* the file does not exist, is not a symbolic link, or it cannot
* be determined if the file is a symbolic link or not.
@@ -2239,7 +2248,7 @@
* @param time
* the new last modified time
*
- * @return the file
+ * @return the path
*
* @throws IOException
* if an I/O error occurs
--- a/jdk/src/share/classes/java/nio/file/Path.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/Path.java Tue Jul 02 15:23:23 2013 -0700
@@ -64,7 +64,7 @@
* those developing custom file system implementations. Methods may be added to
* this interface in future releases. </p>
*
- * <h4>Accessing Files</h4>
+ * <h2>Accessing Files</h2>
* <p> Paths may be used with the {@link Files} class to operate on files,
* directories, and other types of files. For example, suppose we want a {@link
* java.io.BufferedReader} to read text from a file "{@code access.log}". The
@@ -75,7 +75,7 @@
* BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
* </pre>
*
- * <a name="interop"><h4>Interoperability</h4></a>
+ * <a name="interop"></a><h2>Interoperability</h2>
* <p> Paths associated with the default {@link
* java.nio.file.spi.FileSystemProvider provider} are generally interoperable
* with the {@link java.io.File java.io.File} class. Paths created by other
@@ -87,7 +87,7 @@
* addition, the {@link #toFile toFile} method is useful to construct a {@code
* File} from the {@code String} representation of a {@code Path}.
*
- * <h4>Concurrency</h4>
+ * <h2>Concurrency</h2>
* <p> Implementations of this interface are immutable and safe for use by
* multiple concurrent threads.
*
--- a/jdk/src/share/classes/java/nio/file/SecureDirectoryStream.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/SecureDirectoryStream.java Tue Jul 02 15:23:23 2013 -0700
@@ -122,6 +122,8 @@
* an optional list of attributes to set atomically when creating
* the file
*
+ * @return the seekable byte channel
+ *
* @throws ClosedDirectoryStreamException
* if the directory stream is closed
* @throws IllegalArgumentException
@@ -260,6 +262,8 @@
* then all methods to read or update attributes will throw {@link
* ClosedDirectoryStreamException ClosedDirectoryStreamException}.
*
+ * @param <V>
+ * The {@code FileAttributeView} type
* @param type
* the {@code Class} object corresponding to the file attribute view
*
@@ -288,6 +292,8 @@
* is created but methods to read or update attributes of the file will
* fail when invoked and the file does not exist.
*
+ * @param <V>
+ * The {@code FileAttributeView} type
* @param path
* the path of the file
* @param type
--- a/jdk/src/share/classes/java/nio/file/WatchEvent.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/WatchEvent.java Tue Jul 02 15:23:23 2013 -0700
@@ -55,11 +55,16 @@
public static interface Kind<T> {
/**
* Returns the name of the event kind.
+ *
+ * @return the name of the event kind
*/
String name();
/**
* Returns the type of the {@link WatchEvent#context context} value.
+ *
+ *
+ * @return the type of the context value
*/
Class<T> type();
}
@@ -76,6 +81,8 @@
public static interface Modifier {
/**
* Returns the name of the modifier.
+ *
+ * @return the name of the modifier
*/
String name();
}
--- a/jdk/src/share/classes/java/nio/file/WatchService.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/WatchService.java Tue Jul 02 15:23:23 2013 -0700
@@ -78,7 +78,7 @@
* The {@link java.nio.channels.FileChannel FileChannel} class defines methods
* to lock regions of a file against access by other programs.
*
- * <h4>Platform dependencies</h4>
+ * <h2>Platform dependencies</h2>
*
* <p> The implementation that observes events from the file system is intended
* to map directly on to the native file event notification facility where
--- a/jdk/src/share/classes/java/nio/file/attribute/AclEntry.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/AclEntry.java Tue Jul 02 15:23:23 2013 -0700
@@ -134,6 +134,7 @@
/**
* Sets the type component of this builder.
*
+ * @param type the component type
* @return this builder
*/
public Builder setType(AclEntryType type) {
@@ -146,6 +147,7 @@
/**
* Sets the principal component of this builder.
*
+ * @param who the principal component
* @return this builder
*/
public Builder setPrincipal(UserPrincipal who) {
@@ -168,6 +170,7 @@
* Sets the permissions component of this builder. On return, the
* permissions component of this builder is a copy of the given set.
*
+ * @param perms the permissions component
* @return this builder
*
* @throws ClassCastException
@@ -193,6 +196,7 @@
* permissions component of this builder is a copy of the permissions in
* the given array.
*
+ * @param perms the permissions component
* @return this builder
*/
public Builder setPermissions(AclEntryPermission... perms) {
@@ -211,6 +215,7 @@
* Sets the flags component of this builder. On return, the flags
* component of this builder is a copy of the given set.
*
+ * @param flags the flags component
* @return this builder
*
* @throws ClassCastException
@@ -236,6 +241,7 @@
* component of this builder is a copy of the flags in the given
* array.
*
+ * @param flags the flags component
* @return this builder
*/
public Builder setFlags(AclEntryFlag... flags) {
@@ -267,9 +273,7 @@
/**
* Constructs a new builder with the components of an existing ACL entry.
*
- * @param entry
- * an ACL entry
- *
+ * @param entry an ACL entry
* @return a new builder
*/
public static Builder newBuilder(AclEntry entry) {
@@ -278,6 +282,8 @@
/**
* Returns the ACL entry type.
+ *
+ * @return the ACL entry type
*/
public AclEntryType type() {
return type;
@@ -285,6 +291,8 @@
/**
* Returns the principal component.
+ *
+ * @return the principal component
*/
public UserPrincipal principal() {
return who;
@@ -294,6 +302,8 @@
* Returns a copy of the permissions component.
*
* <p> The returned set is a modifiable copy of the permissions.
+ *
+ * @return the permissions component
*/
public Set<AclEntryPermission> permissions() {
return new HashSet<AclEntryPermission>(perms);
@@ -303,6 +313,8 @@
* Returns a copy of the flags component.
*
* <p> The returned set is a modifiable copy of the flags.
+ *
+ * @return the flags component
*/
public Set<AclEntryFlag> flags() {
return new HashSet<AclEntryFlag>(flags);
--- a/jdk/src/share/classes/java/nio/file/attribute/AclFileAttributeView.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/AclFileAttributeView.java Tue Jul 02 15:23:23 2013 -0700
@@ -54,7 +54,7 @@
* supportsFileAttributeView} method can be used to test if a file system
* supports ACLs.
*
- * <a name="interop"><h4>Interoperability</h4></a>
+ * <h2>Interoperability</h2>
*
* RFC 3530 allows for special user identities to be used on platforms that
* support the POSIX defined access permissions. The special user identities
@@ -65,7 +65,7 @@
* UserPrincipalLookupService} may be used to obtain a {@link UserPrincipal}
* to represent these special identities by invoking the {@link
* UserPrincipalLookupService#lookupPrincipalByName lookupPrincipalByName}
- * method. </p>
+ * method.
*
* <p> <b>Usage Example:</b>
* Suppose we wish to add an entry to an existing ACL to grant "joe" access:
@@ -90,11 +90,11 @@
* view.setAcl(acl);
* </pre>
*
- * <h4> Dynamic Access </h4>
+ * <h2> Dynamic Access </h2>
* <p> Where dynamic access to file attributes is required, the attributes
* supported by this attribute view are as follows:
* <blockquote>
- * <table border="1" cellpadding="8">
+ * <table border="1" cellpadding="8" summary="Supported attributes">
* <tr>
* <th> Name </th>
* <th> Type </th>
@@ -118,7 +118,7 @@
* update the ACL or owner attributes as if by invoking the {@link #setAcl setAcl}
* or {@link #setOwner setOwner} methods.
*
- * <h4> Setting the ACL when creating a file </h4>
+ * <h2> Setting the ACL when creating a file </h2>
*
* <p> Implementations supporting this attribute view may also support setting
* the initial ACL when creating a file or directory. The initial ACL
--- a/jdk/src/share/classes/java/nio/file/attribute/AttributeView.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/AttributeView.java Tue Jul 02 15:23:23 2013 -0700
@@ -38,6 +38,8 @@
public interface AttributeView {
/**
* Returns the name of the attribute view.
+ *
+ * @return the name of the attribute view
*/
String name();
}
--- a/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java Tue Jul 02 15:23:23 2013 -0700
@@ -41,7 +41,7 @@
* <p> Where dynamic access to file attributes is required, the attributes
* supported by this attribute view have the following names and types:
* <blockquote>
- * <table border="1" cellpadding="8">
+ * <table border="1" cellpadding="8" summary="Supported attributes">
* <tr>
* <th> Name </th>
* <th> Type </th>
--- a/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributes.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributes.java Tue Jul 02 15:23:23 2013 -0700
@@ -87,22 +87,31 @@
/**
* Tells whether the file is a regular file with opaque content.
+ *
+ * @return {@code true} if the file is a regular file with opaque content
*/
boolean isRegularFile();
/**
* Tells whether the file is a directory.
+ *
+ * @return {@code true} if the file is a directory
*/
boolean isDirectory();
/**
* Tells whether the file is a symbolic link.
+ *
+ * @return {@code true} if the file is a symbolic link
*/
boolean isSymbolicLink();
/**
* Tells whether the file is something other than a regular file, directory,
* or symbolic link.
+ *
+ * @return {@code true} if the file something other than a regular file,
+ * directory or symbolic link
*/
boolean isOther();
@@ -138,6 +147,8 @@
* and two files are the {@link java.nio.file.Files#isSameFile same} with
* non-{@code null} file keys, then their file keys are equal.
*
+ * @return an object that uniquely identifies the given file, or {@code null}
+ *
* @see java.nio.file.Files#walkFileTree
*/
Object fileKey();
--- a/jdk/src/share/classes/java/nio/file/attribute/DosFileAttributeView.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/DosFileAttributeView.java Tue Jul 02 15:23:23 2013 -0700
@@ -41,7 +41,7 @@
* BasicFileAttributeView}, and in addition, the following attributes are
* supported:
* <blockquote>
- * <table border="1" cellpadding="8">
+ * <table border="1" cellpadding="8" summary="Supported attributes">
* <tr>
* <th> Name </th>
* <th> Type </th>
--- a/jdk/src/share/classes/java/nio/file/attribute/FileAttribute.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/FileAttribute.java Tue Jul 02 15:23:23 2013 -0700
@@ -40,11 +40,15 @@
public interface FileAttribute<T> {
/**
* Returns the attribute name.
+ *
+ * @return The attribute name
*/
String name();
/**
* Returns the attribute value.
+ *
+ * @return The attribute value
*/
T value();
}
--- a/jdk/src/share/classes/java/nio/file/attribute/PosixFileAttributeView.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/PosixFileAttributeView.java Tue Jul 02 15:23:23 2013 -0700
@@ -68,13 +68,13 @@
* PosixFilePermissions.toString(attrs.permissions()));
* </pre>
*
- * <h4> Dynamic Access </h4>
+ * <h2> Dynamic Access </h2>
* <p> Where dynamic access to file attributes is required, the attributes
* supported by this attribute view are as defined by {@link
* BasicFileAttributeView} and {@link FileOwnerAttributeView}, and in addition,
* the following attributes are supported:
* <blockquote>
- * <table border="1" cellpadding="8">
+ * <table border="1" cellpadding="8" summary="Supported attributes">
* <tr>
* <th> Name </th>
* <th> Type </th>
@@ -102,7 +102,7 @@
* #setPermissions setPermissions}, {@link #setOwner setOwner}, and {@link
* #setGroup setGroup} methods respectively.
*
- * <h4> Setting Initial Permissions </h4>
+ * <h2> Setting Initial Permissions </h2>
* <p> Implementations supporting this attribute view may also support setting
* the initial permissions when creating a file or directory. The
* initial permissions are provided to the {@link Files#createFile createFile}
--- a/jdk/src/share/classes/java/nio/file/spi/FileSystemProvider.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/spi/FileSystemProvider.java Tue Jul 02 15:23:23 2013 -0700
@@ -287,6 +287,8 @@
* @param uri
* The URI to convert
*
+ * @return The resulting {@code Path}
+ *
* @throws IllegalArgumentException
* If the URI scheme does not identify this provider or other
* preconditions on the uri parameter do not hold
@@ -751,6 +753,8 @@
* @param link
* the path to the symbolic link
*
+ * @return The target of the symbolic link
+ *
* @throws UnsupportedOperationException
* if the implementation does not support symbolic links
* @throws NotLinkException
@@ -984,6 +988,8 @@
* exactly the manner specified by the {@link Files#getFileAttributeView}
* method.
*
+ * @param <V>
+ * The {@code FileAttributeView} type
* @param path
* the path to the file
* @param type
@@ -1002,6 +1008,8 @@
* exactly the manner specified by the {@link
* Files#readAttributes(Path,Class,LinkOption[])} method.
*
+ * @param <A>
+ * The {@code BasicFileAttributes} type
* @param path
* the path to the file
* @param type
--- a/jdk/src/share/classes/java/rmi/server/RMIClassLoader.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/rmi/server/RMIClassLoader.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -424,7 +424,7 @@
*
* <ul>
*
- * <p><li>If the class loader is the system class loader (see
+ * <li><p>If the class loader is the system class loader (see
* {@link ClassLoader#getSystemClassLoader}), a parent of the
* system class loader such as the loader used for installed
* extensions, or the bootstrap class loader (which may be
@@ -433,7 +433,7 @@
* earlier cached value) is returned, or
* <code>null</code> is returned if that property is not set.
*
- * <p><li>Otherwise, if the class loader is an instance of
+ * <li><p>Otherwise, if the class loader is an instance of
* <code>URLClassLoader</code>, then the returned string is a
* space-separated list of the external forms of the URLs returned
* by invoking the <code>getURLs</code> methods of the loader. If
@@ -452,7 +452,7 @@
* property (or possibly an earlier cached value) is returned, or
* <code>null</code> is returned if that property is not set.
*
- * <p><li>Finally, if the class loader is not an instance of
+ * <li><p>Finally, if the class loader is not an instance of
* <code>URLClassLoader</code>, then the value of the
* <code>java.rmi.server.codebase</code> property (or possibly an
* earlier cached value) is returned, or
--- a/jdk/src/share/classes/java/security/AccessControlContext.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/AccessControlContext.java Tue Jul 02 15:23:23 2013 -0700
@@ -36,10 +36,10 @@
* based on the context it encapsulates.
*
* <p>More specifically, it encapsulates a context and
- * has a single method, <code>checkPermission</code>,
- * that is equivalent to the <code>checkPermission</code> method
+ * has a single method, {@code checkPermission},
+ * that is equivalent to the {@code checkPermission} method
* in the AccessController class, with one difference: The AccessControlContext
- * <code>checkPermission</code> method makes access decisions based on the
+ * {@code checkPermission} method makes access decisions based on the
* context it encapsulates,
* rather than that of the current execution thread.
*
@@ -49,8 +49,8 @@
* <i>different</i> context (for example, from within a worker thread).
*
* <p> An AccessControlContext is created by calling the
- * <code>AccessController.getContext</code> method.
- * The <code>getContext</code> method takes a "snapshot"
+ * {@code AccessController.getContext} method.
+ * The {@code getContext} method takes a "snapshot"
* of the current calling context, and places
* it in an AccessControlContext object, which it returns. A sample call is
* the following:
@@ -61,7 +61,7 @@
*
* <p>
* Code within a different context can subsequently call the
- * <code>checkPermission</code> method on the
+ * {@code checkPermission} method on the
* previously-saved AccessControlContext object. A sample call is the
* following:
*
@@ -121,7 +121,7 @@
* @param context the ProtectionDomains associated with this context.
* The non-duplicate domains are copied from the array. Subsequent
* changes to the array will not affect this AccessControlContext.
- * @throws NullPointerException if <code>context</code> is <code>null</code>
+ * @throws NullPointerException if {@code context} is {@code null}
*/
public AccessControlContext(ProtectionDomain context[])
{
@@ -147,22 +147,22 @@
}
/**
- * Create a new <code>AccessControlContext</code> with the given
- * <code>AccessControlContext</code> and <code>DomainCombiner</code>.
+ * Create a new {@code AccessControlContext} with the given
+ * {@code AccessControlContext} and {@code DomainCombiner}.
* This constructor associates the provided
- * <code>DomainCombiner</code> with the provided
- * <code>AccessControlContext</code>.
+ * {@code DomainCombiner} with the provided
+ * {@code AccessControlContext}.
*
* <p>
*
- * @param acc the <code>AccessControlContext</code> associated
- * with the provided <code>DomainCombiner</code>.
+ * @param acc the {@code AccessControlContext} associated
+ * with the provided {@code DomainCombiner}.
*
- * @param combiner the <code>DomainCombiner</code> to be associated
- * with the provided <code>AccessControlContext</code>.
+ * @param combiner the {@code DomainCombiner} to be associated
+ * with the provided {@code AccessControlContext}.
*
* @exception NullPointerException if the provided
- * <code>context</code> is <code>null</code>.
+ * {@code context} is {@code null}.
*
* @exception SecurityException if a security manager is installed and the
* caller does not have the "createAccessControlContext"
@@ -320,13 +320,13 @@
}
/**
- * Get the <code>DomainCombiner</code> associated with this
- * <code>AccessControlContext</code>.
+ * Get the {@code DomainCombiner} associated with this
+ * {@code AccessControlContext}.
*
* <p>
*
- * @return the <code>DomainCombiner</code> associated with this
- * <code>AccessControlContext</code>, or <code>null</code>
+ * @return the {@code DomainCombiner} associated with this
+ * {@code AccessControlContext}, or {@code null}
* if there is none.
*
* @exception SecurityException if a security manager is installed and
--- a/jdk/src/share/classes/java/security/AccessControlException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/AccessControlException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -48,7 +48,7 @@
private Permission perm;
/**
- * Constructs an <code>AccessControlException</code> with the
+ * Constructs an {@code AccessControlException} with the
* specified, detailed message.
*
* @param s the detail message.
@@ -58,7 +58,7 @@
}
/**
- * Constructs an <code>AccessControlException</code> with the
+ * Constructs an {@code AccessControlException} with the
* specified, detailed message, and the requested permission that caused
* the exception.
*
--- a/jdk/src/share/classes/java/security/AccessController.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/AccessController.java Tue Jul 02 15:23:23 2013 -0700
@@ -49,7 +49,7 @@
* <p> The {@link #checkPermission(Permission) checkPermission} method
* determines whether the access request indicated by a specified
* permission should be granted or denied. A sample call appears
- * below. In this example, <code>checkPermission</code> will determine
+ * below. In this example, {@code checkPermission} will determine
* whether or not to grant "read" access to the file named "testFile" in
* the "/temp" directory.
*
@@ -61,7 +61,7 @@
* </pre>
*
* <p> If a requested access is allowed,
- * <code>checkPermission</code> returns quietly. If denied, an
+ * {@code checkPermission} returns quietly. If denied, an
* AccessControlException is
* thrown. AccessControlException can also be thrown if the requested
* permission is of an incorrect type or contains an invalid value.
@@ -69,8 +69,8 @@
*
* Suppose the current thread traversed m callers, in the order of caller 1
* to caller 2 to caller m. Then caller m invoked the
- * <code>checkPermission</code> method.
- * The <code>checkPermission </code>method determines whether access
+ * {@code checkPermission} method.
+ * The {@code checkPermission} method determines whether access
* is granted or denied based on the following algorithm:
*
* <pre> {@code
@@ -102,20 +102,20 @@
*
* <p> A caller can be marked as being "privileged"
* (see {@link #doPrivileged(PrivilegedAction) doPrivileged} and below).
- * When making access control decisions, the <code>checkPermission</code>
+ * When making access control decisions, the {@code checkPermission}
* method stops checking if it reaches a caller that
- * was marked as "privileged" via a <code>doPrivileged</code>
+ * was marked as "privileged" via a {@code doPrivileged}
* call without a context argument (see below for information about a
* context argument). If that caller's domain has the
* specified permission and at least one limiting permission argument (if any)
* implies the requested permission, no further checking is done and
- * <code>checkPermission</code>
+ * {@code checkPermission}
* returns quietly, indicating that the requested access is allowed.
* If that domain does not have the specified permission, an exception
* is thrown, as usual. If the caller's domain had the specified permission
* but it was not implied by any limiting permission arguments given in the call
- * to <code>doPrivileged</code> then the permission checking continues
- * until there are no more callers or another <code>doPrivileged</code>
+ * to {@code doPrivileged} then the permission checking continues
+ * until there are no more callers or another {@code doPrivileged}
* call matches the requested permission and returns normally.
*
* <p> The normal use of the "privileged" feature is as follows. If you
@@ -137,17 +137,17 @@
*
* <p>
* PrivilegedAction is an interface with a single method, named
- * <code>run</code>.
+ * {@code run}.
* The above example shows creation of an implementation
* of that interface; a concrete implementation of the
- * <code>run</code> method is supplied.
- * When the call to <code>doPrivileged</code> is made, an
+ * {@code run} method is supplied.
+ * When the call to {@code doPrivileged} is made, an
* instance of the PrivilegedAction implementation is passed
- * to it. The <code>doPrivileged</code> method calls the
- * <code>run</code> method from the PrivilegedAction
+ * to it. The {@code doPrivileged} method calls the
+ * {@code run} method from the PrivilegedAction
* implementation after enabling privileges, and returns the
- * <code>run</code> method's return value as the
- * <code>doPrivileged</code> return value (which is
+ * {@code run} method's return value as the
+ * {@code doPrivileged} return value (which is
* ignored in this example).
*
* <p> If you need to return a value, you can do something like the following:
@@ -164,11 +164,11 @@
* ...normal code here...
* }}</pre>
*
- * <p>If the action performed in your <code>run</code> method could
- * throw a "checked" exception (those listed in the <code>throws</code> clause
+ * <p>If the action performed in your {@code run} method could
+ * throw a "checked" exception (those listed in the {@code throws} clause
* of a method), then you need to use the
- * <code>PrivilegedExceptionAction</code> interface instead of the
- * <code>PrivilegedAction</code> interface:
+ * {@code PrivilegedExceptionAction} interface instead of the
+ * {@code PrivilegedAction} interface:
*
* <pre> {@code
* somemethod() throws FileNotFoundException {
@@ -191,18 +191,18 @@
*
* <p> Be *very* careful in your use of the "privileged" construct, and
* always remember to make the privileged code section as small as possible.
- * You can pass <code>Permission</code> arguments to further limit the
+ * You can pass {@code Permission} arguments to further limit the
* scope of the "privilege" (see below).
*
*
- * <p> Note that <code>checkPermission</code> always performs security checks
+ * <p> Note that {@code checkPermission} always performs security checks
* within the context of the currently executing thread.
* Sometimes a security check that should be made within a given context
* will actually need to be done from within a
* <i>different</i> context (for example, from within a worker thread).
* The {@link #getContext() getContext} method and
* AccessControlContext class are provided
- * for this situation. The <code>getContext</code> method takes a "snapshot"
+ * for this situation. The {@code getContext} method takes a "snapshot"
* of the current calling context, and places
* it in an AccessControlContext object, which it returns. A sample call is
* the following:
@@ -214,7 +214,7 @@
* </pre>
*
* <p>
- * AccessControlContext itself has a <code>checkPermission</code> method
+ * AccessControlContext itself has a {@code checkPermission} method
* that makes access decisions based on the context <i>it</i> encapsulates,
* rather than that of the current execution thread.
* Code within a different context can thus call that method on the
@@ -230,7 +230,7 @@
* <p> There are also times where you don't know a priori which permissions
* to check the context against. In these cases you can use the
* doPrivileged method that takes a context. You can also limit the scope
- * of the privileged code by passing additional <code>Permission</code>
+ * of the privileged code by passing additional {@code Permission}
* parameters.
*
* <pre> {@code
@@ -248,12 +248,12 @@
* }, acc, new FilePermission("/temp/*", read));
* ...normal code here...
* }}</pre>
- * <p> Passing a limiting <code>Permission</code> argument of an instance of
- * <code>AllPermission</code> is equivalent to calling the equivalent
- * <code>doPrivileged</code> method without limiting <code>Permission</code>
- * arguments. Passing a zero length array of <code>Permission</code> disables
+ * <p> Passing a limiting {@code Permission} argument of an instance of
+ * {@code AllPermission} is equivalent to calling the equivalent
+ * {@code doPrivileged} method without limiting {@code Permission}
+ * arguments. Passing a zero length array of {@code Permission} disables
* the code privileges so that checking always continues beyond the caller of
- * that <code>doPrivileged</code> method.
+ * that {@code doPrivileged} method.
*
* @see AccessControlContext
*
@@ -269,11 +269,11 @@
private AccessController() { }
/**
- * Performs the specified <code>PrivilegedAction</code> with privileges
+ * Performs the specified {@code PrivilegedAction} with privileges
* enabled. The action is performed with <i>all</i> of the permissions
* possessed by the caller's protection domain.
*
- * <p> If the action's <code>run</code> method throws an (unchecked)
+ * <p> If the action's {@code run} method throws an (unchecked)
* exception, it will propagate through this method.
*
* <p> Note that any DomainCombiner associated with the current
@@ -281,9 +281,9 @@
*
* @param action the action to be performed.
*
- * @return the value returned by the action's <code>run</code> method.
+ * @return the value returned by the action's {@code run} method.
*
- * @exception NullPointerException if the action is <code>null</code>
+ * @exception NullPointerException if the action is {@code null}
*
* @see #doPrivileged(PrivilegedAction,AccessControlContext)
* @see #doPrivileged(PrivilegedExceptionAction)
@@ -295,11 +295,11 @@
public static native <T> T doPrivileged(PrivilegedAction<T> action);
/**
- * Performs the specified <code>PrivilegedAction</code> with privileges
+ * Performs the specified {@code PrivilegedAction} with privileges
* enabled. The action is performed with <i>all</i> of the permissions
* possessed by the caller's protection domain.
*
- * <p> If the action's <code>run</code> method throws an (unchecked)
+ * <p> If the action's {@code run} method throws an (unchecked)
* exception, it will propagate through this method.
*
* <p> This method preserves the current AccessControlContext's
@@ -307,9 +307,9 @@
*
* @param action the action to be performed.
*
- * @return the value returned by the action's <code>run</code> method.
+ * @return the value returned by the action's {@code run} method.
*
- * @exception NullPointerException if the action is <code>null</code>
+ * @exception NullPointerException if the action is {@code null}
*
* @see #doPrivileged(PrivilegedAction)
* @see java.security.DomainCombiner
@@ -364,17 +364,17 @@
/**
- * Performs the specified <code>PrivilegedAction</code> with privileges
+ * Performs the specified {@code PrivilegedAction} with privileges
* enabled and restricted by the specified
- * <code>AccessControlContext</code> and with a privilege scope limited
- * by specified <code>Permission</code> arguments.
+ * {@code AccessControlContext} and with a privilege scope limited
+ * by specified {@code Permission} arguments.
*
* The action is performed with the intersection of the permissions
* possessed by the caller's protection domain, and those possessed
* by the domains represented by the specified
- * <code>AccessControlContext</code>.
+ * {@code AccessControlContext}.
* <p>
- * If the action's <code>run</code> method throws an (unchecked) exception,
+ * If the action's {@code run} method throws an (unchecked) exception,
* it will propagate through this method.
*
* @param action the action to be performed.
@@ -382,16 +382,16 @@
* representing the restriction to be applied to the
* caller's domain's privileges before performing
* the specified action. If the context is
- * <code>null</code>,
+ * {@code null},
* then no additional restriction is applied.
- * @param perms the <code>Permission</code> arguments which limit the
+ * @param perms the {@code Permission} arguments which limit the
* scope of the caller's privileges. The number of arguments
* is variable.
*
- * @return the value returned by the action's <code>run</code> method.
+ * @return the value returned by the action's {@code run} method.
*
* @throws NullPointerException if action or perms or any element of
- * perms is <code>null</code>
+ * perms is {@code null}
*
* @see #doPrivileged(PrivilegedAction)
* @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext)
@@ -413,17 +413,17 @@
/**
- * Performs the specified <code>PrivilegedAction</code> with privileges
+ * Performs the specified {@code PrivilegedAction} with privileges
* enabled and restricted by the specified
- * <code>AccessControlContext</code> and with a privilege scope limited
- * by specified <code>Permission</code> arguments.
+ * {@code AccessControlContext} and with a privilege scope limited
+ * by specified {@code Permission} arguments.
*
* The action is performed with the intersection of the permissions
* possessed by the caller's protection domain, and those possessed
* by the domains represented by the specified
- * <code>AccessControlContext</code>.
+ * {@code AccessControlContext}.
* <p>
- * If the action's <code>run</code> method throws an (unchecked) exception,
+ * If the action's {@code run} method throws an (unchecked) exception,
* it will propagate through this method.
*
* <p> This method preserves the current AccessControlContext's
@@ -434,16 +434,16 @@
* representing the restriction to be applied to the
* caller's domain's privileges before performing
* the specified action. If the context is
- * <code>null</code>,
+ * {@code null},
* then no additional restriction is applied.
- * @param perms the <code>Permission</code> arguments which limit the
+ * @param perms the {@code Permission} arguments which limit the
* scope of the caller's privileges. The number of arguments
* is variable.
*
- * @return the value returned by the action's <code>run</code> method.
+ * @return the value returned by the action's {@code run} method.
*
* @throws NullPointerException if action or perms or any element of
- * perms is <code>null</code>
+ * perms is {@code null}
*
* @see #doPrivileged(PrivilegedAction)
* @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext)
@@ -469,11 +469,11 @@
}
/**
- * Performs the specified <code>PrivilegedExceptionAction</code> with
+ * Performs the specified {@code PrivilegedExceptionAction} with
* privileges enabled. The action is performed with <i>all</i> of the
* permissions possessed by the caller's protection domain.
*
- * <p> If the action's <code>run</code> method throws an <i>unchecked</i>
+ * <p> If the action's {@code run} method throws an <i>unchecked</i>
* exception, it will propagate through this method.
*
* <p> Note that any DomainCombiner associated with the current
@@ -481,11 +481,11 @@
*
* @param action the action to be performed
*
- * @return the value returned by the action's <code>run</code> method
+ * @return the value returned by the action's {@code run} method
*
* @exception PrivilegedActionException if the specified action's
- * <code>run</code> method threw a <i>checked</i> exception
- * @exception NullPointerException if the action is <code>null</code>
+ * {@code run} method threw a <i>checked</i> exception
+ * @exception NullPointerException if the action is {@code null}
*
* @see #doPrivileged(PrivilegedAction)
* @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext)
@@ -499,11 +499,11 @@
/**
- * Performs the specified <code>PrivilegedExceptionAction</code> with
+ * Performs the specified {@code PrivilegedExceptionAction} with
* privileges enabled. The action is performed with <i>all</i> of the
* permissions possessed by the caller's protection domain.
*
- * <p> If the action's <code>run</code> method throws an <i>unchecked</i>
+ * <p> If the action's {@code run} method throws an <i>unchecked</i>
* exception, it will propagate through this method.
*
* <p> This method preserves the current AccessControlContext's
@@ -511,11 +511,11 @@
*
* @param action the action to be performed.
*
- * @return the value returned by the action's <code>run</code> method
+ * @return the value returned by the action's {@code run} method
*
* @exception PrivilegedActionException if the specified action's
- * <code>run</code> method threw a <i>checked</i> exception
- * @exception NullPointerException if the action is <code>null</code>
+ * {@code run} method threw a <i>checked</i> exception
+ * @exception NullPointerException if the action is {@code null}
*
* @see #doPrivileged(PrivilegedAction)
* @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext)
@@ -609,17 +609,17 @@
/**
- * Performs the specified <code>PrivilegedExceptionAction</code> with
+ * Performs the specified {@code PrivilegedExceptionAction} with
* privileges enabled and restricted by the specified
- * <code>AccessControlContext</code> and with a privilege scope limited by
- * specified <code>Permission</code> arguments.
+ * {@code AccessControlContext} and with a privilege scope limited by
+ * specified {@code Permission} arguments.
*
* The action is performed with the intersection of the permissions
* possessed by the caller's protection domain, and those possessed
* by the domains represented by the specified
- * <code>AccessControlContext</code>.
+ * {@code AccessControlContext}.
* <p>
- * If the action's <code>run</code> method throws an (unchecked) exception,
+ * If the action's {@code run} method throws an (unchecked) exception,
* it will propagate through this method.
*
* @param action the action to be performed.
@@ -627,18 +627,18 @@
* representing the restriction to be applied to the
* caller's domain's privileges before performing
* the specified action. If the context is
- * <code>null</code>,
+ * {@code null},
* then no additional restriction is applied.
- * @param perms the <code>Permission</code> arguments which limit the
+ * @param perms the {@code Permission} arguments which limit the
* scope of the caller's privileges. The number of arguments
* is variable.
*
- * @return the value returned by the action's <code>run</code> method.
+ * @return the value returned by the action's {@code run} method.
*
* @throws PrivilegedActionException if the specified action's
- * <code>run</code> method threw a <i>checked</i> exception
+ * {@code run} method threw a <i>checked</i> exception
* @throws NullPointerException if action or perms or any element of
- * perms is <code>null</code>
+ * perms is {@code null}
*
* @see #doPrivileged(PrivilegedAction)
* @see #doPrivileged(PrivilegedAction,AccessControlContext)
@@ -660,17 +660,17 @@
/**
- * Performs the specified <code>PrivilegedExceptionAction</code> with
+ * Performs the specified {@code PrivilegedExceptionAction} with
* privileges enabled and restricted by the specified
- * <code>AccessControlContext</code> and with a privilege scope limited by
- * specified <code>Permission</code> arguments.
+ * {@code AccessControlContext} and with a privilege scope limited by
+ * specified {@code Permission} arguments.
*
* The action is performed with the intersection of the permissions
* possessed by the caller's protection domain, and those possessed
* by the domains represented by the specified
- * <code>AccessControlContext</code>.
+ * {@code AccessControlContext}.
* <p>
- * If the action's <code>run</code> method throws an (unchecked) exception,
+ * If the action's {@code run} method throws an (unchecked) exception,
* it will propagate through this method.
*
* <p> This method preserves the current AccessControlContext's
@@ -681,18 +681,18 @@
* representing the restriction to be applied to the
* caller's domain's privileges before performing
* the specified action. If the context is
- * <code>null</code>,
+ * {@code null},
* then no additional restriction is applied.
- * @param perms the <code>Permission</code> arguments which limit the
+ * @param perms the {@code Permission} arguments which limit the
* scope of the caller's privileges. The number of arguments
* is variable.
*
- * @return the value returned by the action's <code>run</code> method.
+ * @return the value returned by the action's {@code run} method.
*
* @throws PrivilegedActionException if the specified action's
- * <code>run</code> method threw a <i>checked</i> exception
+ * {@code run} method threw a <i>checked</i> exception
* @throws NullPointerException if action or perms or any element of
- * perms is <code>null</code>
+ * perms is {@code null}
*
* @see #doPrivileged(PrivilegedAction)
* @see #doPrivileged(PrivilegedAction,AccessControlContext)
@@ -770,14 +770,14 @@
* This method quietly returns if the access request
* is permitted, or throws an AccessControlException otherwise. The
* getPermission method of the AccessControlException returns the
- * <code>perm</code> Permission object instance.
+ * {@code perm} Permission object instance.
*
* @param perm the requested permission.
*
* @exception AccessControlException if the specified permission
* is not permitted, based on the current security policy.
* @exception NullPointerException if the specified permission
- * is <code>null</code> and is checked based on the
+ * is {@code null} and is checked based on the
* security policy currently in effect.
*/
--- a/jdk/src/share/classes/java/security/AlgorithmParameterGenerator.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/AlgorithmParameterGenerator.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,10 +28,10 @@
import java.security.spec.AlgorithmParameterSpec;
/**
- * The <code>AlgorithmParameterGenerator</code> class is used to generate a
+ * The {@code AlgorithmParameterGenerator} class is used to generate a
* set of
* parameters to be used with a certain algorithm. Parameter generators
- * are constructed using the <code>getInstance</code> factory methods
+ * are constructed using the {@code getInstance} factory methods
* (static methods that return instances of a given class).
*
* <P>The object that will generate the parameters can be initialized
@@ -61,17 +61,17 @@
*
* <P>In case the client does not explicitly initialize the
* AlgorithmParameterGenerator
- * (via a call to an <code>init</code> method), each provider must supply (and
+ * (via a call to an {@code init} method), each provider must supply (and
* document) a default initialization. For example, the Sun provider uses a
* default modulus prime size of 1024 bits for the generation of DSA
* parameters.
*
* <p> Every implementation of the Java platform is required to support the
- * following standard <code>AlgorithmParameterGenerator</code> algorithms and
+ * following standard {@code AlgorithmParameterGenerator} algorithms and
* keysizes in parentheses:
* <ul>
- * <li><tt>DiffieHellman</tt> (1024)</li>
- * <li><tt>DSA</tt> (1024)</li>
+ * <li>{@code DiffieHellman} (1024)</li>
+ * <li>{@code DSA} (1024)</li>
* </ul>
* These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameterGenerator">
@@ -272,11 +272,11 @@
/**
* Initializes this parameter generator for a certain size.
- * To create the parameters, the <code>SecureRandom</code>
+ * To create the parameters, the {@code SecureRandom}
* implementation of the highest-priority installed provider is used as
* the source of randomness.
* (If none of the installed providers supply an implementation of
- * <code>SecureRandom</code>, a system-provided source of randomness is
+ * {@code SecureRandom}, a system-provided source of randomness is
* used.)
*
* @param size the size (number of bits).
@@ -299,11 +299,11 @@
/**
* Initializes this parameter generator with a set of algorithm-specific
* parameter generation values.
- * To generate the parameters, the <code>SecureRandom</code>
+ * To generate the parameters, the {@code SecureRandom}
* implementation of the highest-priority installed provider is used as
* the source of randomness.
* (If none of the installed providers supply an implementation of
- * <code>SecureRandom</code>, a system-provided source of randomness is
+ * {@code SecureRandom}, a system-provided source of randomness is
* used.)
*
* @param genParamSpec the set of algorithm-specific parameter generation values.
--- a/jdk/src/share/classes/java/security/AlgorithmParameterGeneratorSpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/AlgorithmParameterGeneratorSpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -29,7 +29,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>AlgorithmParameterGenerator</code> class, which
+ * for the {@code AlgorithmParameterGenerator} class, which
* is used to generate a set of parameters to be used with a certain algorithm.
*
* <p> All the abstract methods in this class must be implemented by each
@@ -37,7 +37,7 @@
* of a parameter generator for a particular algorithm.
*
* <p> In case the client does not explicitly initialize the
- * AlgorithmParameterGenerator (via a call to an <code>engineInit</code>
+ * AlgorithmParameterGenerator (via a call to an {@code engineInit}
* method), each provider must supply (and document) a default initialization.
* For example, the Sun provider uses a default modulus prime size of 1024
* bits for the generation of DSA parameters.
--- a/jdk/src/share/classes/java/security/AlgorithmParameters.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/AlgorithmParameters.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -32,28 +32,28 @@
/**
* This class is used as an opaque representation of cryptographic parameters.
*
- * <p>An <code>AlgorithmParameters</code> object for managing the parameters
+ * <p>An {@code AlgorithmParameters} object for managing the parameters
* for a particular algorithm can be obtained by
- * calling one of the <code>getInstance</code> factory methods
+ * calling one of the {@code getInstance} factory methods
* (static methods that return instances of a given class).
*
- * <p>Once an <code>AlgorithmParameters</code> object is obtained, it must be
- * initialized via a call to <code>init</code>, using an appropriate parameter
+ * <p>Once an {@code AlgorithmParameters} object is obtained, it must be
+ * initialized via a call to {@code init}, using an appropriate parameter
* specification or parameter encoding.
*
* <p>A transparent parameter specification is obtained from an
- * <code>AlgorithmParameters</code> object via a call to
- * <code>getParameterSpec</code>, and a byte encoding of the parameters is
- * obtained via a call to <code>getEncoded</code>.
+ * {@code AlgorithmParameters} object via a call to
+ * {@code getParameterSpec}, and a byte encoding of the parameters is
+ * obtained via a call to {@code getEncoded}.
*
* <p> Every implementation of the Java platform is required to support the
- * following standard <code>AlgorithmParameters</code> algorithms:
+ * following standard {@code AlgorithmParameters} algorithms:
* <ul>
- * <li><tt>AES</tt></li>
- * <li><tt>DES</tt></li>
- * <li><tt>DESede</tt></li>
- * <li><tt>DiffieHellman</tt></li>
- * <li><tt>DSA</tt></li>
+ * <li>{@code AES}</li>
+ * <li>{@code DES}</li>
+ * <li>{@code DESede}</li>
+ * <li>{@code DiffieHellman}</li>
+ * <li>{@code DSA}</li>
* </ul>
* These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameters">
@@ -123,7 +123,7 @@
* the {@link Security#getProviders() Security.getProviders()} method.
*
* <p> The returned parameter object must be initialized via a call to
- * <code>init</code>, using an appropriate parameter specification or
+ * {@code init}, using an appropriate parameter specification or
* parameter encoding.
*
* @param algorithm the name of the algorithm requested.
@@ -165,7 +165,7 @@
* the {@link Security#getProviders() Security.getProviders()} method.
*
* <p>The returned parameter object must be initialized via a call to
- * <code>init</code>, using an appropriate parameter specification or
+ * {@code init}, using an appropriate parameter specification or
* parameter encoding.
*
* @param algorithm the name of the algorithm requested.
@@ -212,7 +212,7 @@
* does not have to be registered in the provider list.
*
* <p>The returned parameter object must be initialized via a call to
- * <code>init</code>, using an appropriate parameter specification or
+ * {@code init}, using an appropriate parameter specification or
* parameter encoding.
*
* @param algorithm the name of the algorithm requested.
@@ -259,7 +259,7 @@
/**
* Initializes this parameter object using the parameters
- * specified in <code>paramSpec</code>.
+ * specified in {@code paramSpec}.
*
* @param paramSpec the parameter specification.
*
@@ -295,9 +295,9 @@
}
/**
- * Imports the parameters from <code>params</code> and decodes them
+ * Imports the parameters from {@code params} and decodes them
* according to the specified decoding scheme.
- * If <code>format</code> is null, the
+ * If {@code format} is null, the
* primary decoding format for parameters is used. The primary decoding
* format is ASN.1, if an ASN.1 specification for these parameters
* exists.
@@ -318,11 +318,11 @@
/**
* Returns a (transparent) specification of this parameter object.
- * <code>paramSpec</code> identifies the specification class in which
+ * {@code paramSpec} identifies the specification class in which
* the parameters should be returned. It could, for example, be
- * <code>DSAParameterSpec.class</code>, to indicate that the
+ * {@code DSAParameterSpec.class}, to indicate that the
* parameters should be returned in an instance of the
- * <code>DSAParameterSpec</code> class.
+ * {@code DSAParameterSpec} class.
*
* @param paramSpec the specification class in which
* the parameters should be returned.
@@ -363,7 +363,7 @@
/**
* Returns the parameters encoded in the specified scheme.
- * If <code>format</code> is null, the
+ * If {@code format} is null, the
* primary encoding format for parameters is used. The primary encoding
* format is ASN.1, if an ASN.1 specification for these parameters
* exists.
--- a/jdk/src/share/classes/java/security/AlgorithmParametersSpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/AlgorithmParametersSpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -31,7 +31,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>AlgorithmParameters</code> class, which is used to manage
+ * for the {@code AlgorithmParameters} class, which is used to manage
* algorithm parameters.
*
* <p> All the abstract methods in this class must be implemented by each
@@ -52,7 +52,7 @@
/**
* Initializes this parameters object using the parameters
- * specified in <code>paramSpec</code>.
+ * specified in {@code paramSpec}.
*
* @param paramSpec the parameter specification.
*
@@ -77,9 +77,9 @@
throws IOException;
/**
- * Imports the parameters from <code>params</code> and
+ * Imports the parameters from {@code params} and
* decodes them according to the specified decoding format.
- * If <code>format</code> is null, the
+ * If {@code format} is null, the
* primary decoding format for parameters is used. The primary decoding
* format is ASN.1, if an ASN.1 specification for these parameters
* exists.
@@ -96,11 +96,11 @@
/**
* Returns a (transparent) specification of this parameters
* object.
- * <code>paramSpec</code> identifies the specification class in which
+ * {@code paramSpec} identifies the specification class in which
* the parameters should be returned. It could, for example, be
- * <code>DSAParameterSpec.class</code>, to indicate that the
+ * {@code DSAParameterSpec.class}, to indicate that the
* parameters should be returned in an instance of the
- * <code>DSAParameterSpec</code> class.
+ * {@code DSAParameterSpec} class.
*
* @param paramSpec the specification class in which
* the parameters should be returned.
@@ -128,7 +128,7 @@
/**
* Returns the parameters encoded in the specified format.
- * If <code>format</code> is null, the
+ * If {@code format} is null, the
* primary encoding format for parameters is used. The primary encoding
* format is ASN.1, if an ASN.1 specification for these parameters
* exists.
--- a/jdk/src/share/classes/java/security/AllPermission.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/AllPermission.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -69,7 +69,7 @@
/**
* Creates a new AllPermission object. This
- * constructor exists for use by the <code>Policy</code> object
+ * constructor exists for use by the {@code Policy} object
* to instantiate new Permission objects.
*
* @param name ignored
--- a/jdk/src/share/classes/java/security/AuthProvider.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/AuthProvider.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -32,8 +32,8 @@
/**
* This class defines login and logout methods for a provider.
*
- * <p> While callers may invoke <code>login</code> directly,
- * the provider may also invoke <code>login</code> on behalf of callers
+ * <p> While callers may invoke {@code login} directly,
+ * the provider may also invoke {@code login} on behalf of callers
* if it determines that a login must be performed
* prior to certain operations.
*
@@ -56,11 +56,11 @@
/**
* Log in to this provider.
*
- * <p> The provider relies on a <code>CallbackHandler</code>
+ * <p> The provider relies on a {@code CallbackHandler}
* to obtain authentication information from the caller
- * (a PIN, for example). If the caller passes a <code>null</code>
+ * (a PIN, for example). If the caller passes a {@code null}
* handler to this method, the provider uses the handler set in the
- * <code>setCallbackHandler</code> method.
+ * {@code setCallbackHandler} method.
* If no handler was set in that method, the provider queries the
* <i>auth.login.defaultCallbackHandler</i> security property
* for the fully qualified class name of a default handler implementation.
@@ -68,21 +68,21 @@
* the provider is assumed to have alternative means
* for obtaining authentication information.
*
- * @param subject the <code>Subject</code> which may contain
+ * @param subject the {@code Subject} which may contain
* principals/credentials used for authentication,
* or may be populated with additional principals/credentials
* after successful authentication has completed.
- * This parameter may be <code>null</code>.
- * @param handler the <code>CallbackHandler</code> used by
+ * This parameter may be {@code null}.
+ * @param handler the {@code CallbackHandler} used by
* this provider to obtain authentication information
- * from the caller, which may be <code>null</code>
+ * from the caller, which may be {@code null}
*
* @exception LoginException if the login operation fails
* @exception SecurityException if the caller does not pass a
* security check for
- * <code>SecurityPermission("authProvider.<i>name</i>")</code>,
- * where <i>name</i> is the value returned by
- * this provider's <code>getName</code> method
+ * {@code SecurityPermission("authProvider.name")},
+ * where {@code name} is the value returned by
+ * this provider's {@code getName} method
*/
public abstract void login(Subject subject, CallbackHandler handler)
throws LoginException;
@@ -93,18 +93,18 @@
* @exception LoginException if the logout operation fails
* @exception SecurityException if the caller does not pass a
* security check for
- * <code>SecurityPermission("authProvider.<i>name</i>")</code>,
- * where <i>name</i> is the value returned by
- * this provider's <code>getName</code> method
+ * {@code SecurityPermission("authProvider.name")},
+ * where {@code name} is the value returned by
+ * this provider's {@code getName} method
*/
public abstract void logout() throws LoginException;
/**
- * Set a <code>CallbackHandler</code>.
+ * Set a {@code CallbackHandler}.
*
* <p> The provider uses this handler if one is not passed to the
- * <code>login</code> method. The provider also uses this handler
- * if it invokes <code>login</code> on behalf of callers.
+ * {@code login} method. The provider also uses this handler
+ * if it invokes {@code login} on behalf of callers.
* In either case if a handler is not set via this method,
* the provider queries the
* <i>auth.login.defaultCallbackHandler</i> security property
@@ -113,14 +113,14 @@
* the provider is assumed to have alternative means
* for obtaining authentication information.
*
- * @param handler a <code>CallbackHandler</code> for obtaining
- * authentication information, which may be <code>null</code>
+ * @param handler a {@code CallbackHandler} for obtaining
+ * authentication information, which may be {@code null}
*
* @exception SecurityException if the caller does not pass a
* security check for
- * <code>SecurityPermission("authProvider.<i>name</i>")</code>,
- * where <i>name</i> is the value returned by
- * this provider's <code>getName</code> method
+ * {@code SecurityPermission("authProvider.name")},
+ * where {@code name} is the value returned by
+ * this provider's {@code getName} method
*/
public abstract void setCallbackHandler(CallbackHandler handler);
}
--- a/jdk/src/share/classes/java/security/BasicPermission.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/BasicPermission.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -124,8 +124,8 @@
*
* @param name the name of the BasicPermission.
*
- * @throws NullPointerException if <code>name</code> is <code>null</code>.
- * @throws IllegalArgumentException if <code>name</code> is empty.
+ * @throws NullPointerException if {@code name} is {@code null}.
+ * @throws IllegalArgumentException if {@code name} is empty.
*/
public BasicPermission(String name) {
super(name);
@@ -141,8 +141,8 @@
* @param name the name of the BasicPermission.
* @param actions ignored.
*
- * @throws NullPointerException if <code>name</code> is <code>null</code>.
- * @throws IllegalArgumentException if <code>name</code> is empty.
+ * @throws NullPointerException if {@code name} is {@code null}.
+ * @throws IllegalArgumentException if {@code name} is empty.
*/
public BasicPermission(String name, String actions) {
super(name);
@@ -217,7 +217,7 @@
/**
* Returns the hash code value for this object.
* The hash code used is the hash code of the name, that is,
- * <code>getName().hashCode()</code>, where <code>getName</code> is
+ * {@code getName().hashCode()}, where {@code getName} is
* from the Permission superclass.
*
* @return a hash code value for this object.
@@ -243,7 +243,7 @@
*
* <p>BasicPermission objects must be stored in a manner that allows them
* to be inserted in any order, but that also enables the
- * PermissionCollection <code>implies</code> method
+ * PermissionCollection {@code implies} method
* to be implemented in an efficient (and consistent) manner.
*
* @return a new PermissionCollection object suitable for
@@ -312,7 +312,7 @@
private transient Map<String, Permission> perms;
/**
- * This is set to <code>true</code> if this BasicPermissionCollection
+ * This is set to {@code true} if this BasicPermissionCollection
* contains a BasicPermission with '*' as its permission name.
*
* @see #serialPersistentFields
@@ -477,7 +477,7 @@
* The Hashtable is indexed by the BasicPermission name; the value
* of the Hashtable entry is the permission.
* @serialField all_allowed boolean
- * This is set to <code>true</code> if this BasicPermissionCollection
+ * This is set to {@code true} if this BasicPermissionCollection
* contains a BasicPermission with '*' as its permission name.
* @serialField permClass java.lang.Class
* The class to which all BasicPermissions in this
--- a/jdk/src/share/classes/java/security/Certificate.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/Certificate.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -96,7 +96,7 @@
/**
* Encodes the certificate to an output stream in a format that can
- * be decoded by the <code>decode</code> method.
+ * be decoded by the {@code decode} method.
*
* @param stream the output stream to which to encode the
* certificate.
@@ -115,8 +115,8 @@
/**
* Decodes a certificate from an input stream. The format should be
- * that returned by <code>getFormat</code> and produced by
- * <code>encode</code>.
+ * that returned by {@code getFormat} and produced by
+ * {@code encode}.
*
* @param stream the input stream from which to fetch the data
* being decoded.
@@ -137,8 +137,8 @@
/**
* Returns the name of the coding format. This is used as a hint to find
* an appropriate parser. It could be "X.509", "PGP", etc. This is
- * the format produced and understood by the <code>encode</code>
- * and <code>decode</code> methods.
+ * the format produced and understood by the {@code encode}
+ * and {@code decode} methods.
*
* @return the name of the coding format.
*/
--- a/jdk/src/share/classes/java/security/CodeSigner.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/CodeSigner.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -63,12 +63,12 @@
* Constructs a CodeSigner object.
*
* @param signerCertPath The signer's certificate path.
- * It must not be <code>null</code>.
+ * It must not be {@code null}.
* @param timestamp A signature timestamp.
- * If <code>null</code> then no timestamp was generated
+ * If {@code null} then no timestamp was generated
* for the signature.
- * @throws NullPointerException if <code>signerCertPath</code> is
- * <code>null</code>.
+ * @throws NullPointerException if {@code signerCertPath} is
+ * {@code null}.
*/
public CodeSigner(CertPath signerCertPath, Timestamp timestamp) {
if (signerCertPath == null) {
@@ -90,7 +90,7 @@
/**
* Returns the signature timestamp.
*
- * @return The timestamp or <code>null</code> if none is present.
+ * @return The timestamp or {@code null} if none is present.
*/
public Timestamp getTimestamp() {
return timestamp;
--- a/jdk/src/share/classes/java/security/CodeSource.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/CodeSource.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -485,13 +485,13 @@
/**
* Writes this object out to a stream (i.e., serializes it).
*
- * @serialData An initial <code>URL</code> is followed by an
- * <code>int</code> indicating the number of certificates to follow
+ * @serialData An initial {@code URL} is followed by an
+ * {@code int} indicating the number of certificates to follow
* (a value of "zero" denotes that there are no certificates associated
* with this object).
- * Each certificate is written out starting with a <code>String</code>
+ * Each certificate is written out starting with a {@code String}
* denoting the certificate type, followed by an
- * <code>int</code> specifying the length of the certificate encoding,
+ * {@code int} specifying the length of the certificate encoding,
* followed by the certificate encoding itself which is written out as an
* array of bytes. Finally, if any code signers are present then the array
* of code signers is serialized and written out too.
--- a/jdk/src/share/classes/java/security/DigestException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/DigestException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -55,13 +55,13 @@
}
/**
- * Creates a <code>DigestException</code> with the specified
+ * Creates a {@code DigestException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -70,13 +70,13 @@
}
/**
- * Creates a <code>DigestException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code DigestException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/DigestInputStream.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/DigestInputStream.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -37,13 +37,13 @@
* the bits going through the stream.
*
* <p>To complete the message digest computation, call one of the
- * <code>digest</code> methods on the associated message
+ * {@code digest} methods on the associated message
* digest after your calls to one of this digest input stream's
* {@link #read() read} methods.
*
* <p>It is possible to turn this stream on or off (see
* {@link #on(boolean) on}). When it is on, a call to one of the
- * <code>read</code> methods
+ * {@code read} methods
* results in an update on the message digest. But when it is off,
* the message digest is not updated. The default is for the stream
* to be on.
@@ -111,7 +111,7 @@
* function is on). That is, this method reads a byte from the
* input stream, blocking until the byte is actually read. If the
* digest function is on (see {@link #on(boolean) on}), this method
- * will then call <code>update</code> on the message digest associated
+ * will then call {@code update} on the message digest associated
* with this stream, passing it the byte read.
*
* @return the byte read.
@@ -131,25 +131,25 @@
/**
* Reads into a byte array, and updates the message digest (if the
* digest function is on). That is, this method reads up to
- * <code>len</code> bytes from the input stream into the array
- * <code>b</code>, starting at offset <code>off</code>. This method
+ * {@code len} bytes from the input stream into the array
+ * {@code b}, starting at offset {@code off}. This method
* blocks until the data is actually
* read. If the digest function is on (see
- * {@link #on(boolean) on}), this method will then call <code>update</code>
+ * {@link #on(boolean) on}), this method will then call {@code update}
* on the message digest associated with this stream, passing it
* the data.
*
* @param b the array into which the data is read.
*
- * @param off the starting offset into <code>b</code> of where the
+ * @param off the starting offset into {@code b} of where the
* data should be placed.
*
* @param len the maximum number of bytes to be read from the input
- * stream into b, starting at offset <code>off</code>.
+ * stream into b, starting at offset {@code off}.
*
* @return the actual number of bytes read. This is less than
- * <code>len</code> if the end of the stream is reached prior to
- * reading <code>len</code> bytes. -1 is returned if no bytes were
+ * {@code len} if the end of the stream is reached prior to
+ * reading {@code len} bytes. -1 is returned if no bytes were
* read because the end of the stream had already been reached when
* the call was made.
*
@@ -167,7 +167,7 @@
/**
* Turns the digest function on or off. The default is on. When
- * it is on, a call to one of the <code>read</code> methods results in an
+ * it is on, a call to one of the {@code read} methods results in an
* update on the message digest. But when it is off, the message
* digest is not updated.
*
--- a/jdk/src/share/classes/java/security/DigestOutputStream.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/DigestOutputStream.java Tue Jul 02 15:23:23 2013 -0700
@@ -37,13 +37,13 @@
* the bits going through the stream.
*
* <p>To complete the message digest computation, call one of the
- * <code>digest</code> methods on the associated message
+ * {@code digest} methods on the associated message
* digest after your calls to one of this digest ouput stream's
* {@link #write(int) write} methods.
*
* <p>It is possible to turn this stream on or off (see
* {@link #on(boolean) on}). When it is on, a call to one of the
- * <code>write</code> methods results in
+ * {@code write} methods results in
* an update on the message digest. But when it is off, the message
* digest is not updated. The default is for the stream to be on.
*
@@ -99,8 +99,8 @@
* the specified byte, and in any case writes the byte
* to the output stream. That is, if the digest function is on
* (see {@link #on(boolean) on}), this method calls
- * <code>update</code> on the message digest associated with this
- * stream, passing it the byte <code>b</code>. This method then
+ * {@code update} on the message digest associated with this
+ * stream, passing it the byte {@code b}. This method then
* writes the byte to the output stream, blocking until the byte
* is actually written.
*
@@ -122,7 +122,7 @@
* Updates the message digest (if the digest function is on) using
* the specified subarray, and in any case writes the subarray to
* the output stream. That is, if the digest function is on (see
- * {@link #on(boolean) on}), this method calls <code>update</code>
+ * {@link #on(boolean) on}), this method calls {@code update}
* on the message digest associated with this stream, passing it
* the subarray specifications. This method then writes the subarray
* bytes to the output stream, blocking until the bytes are actually
@@ -131,11 +131,11 @@
* @param b the array containing the subarray to be used for updating
* and writing to the output stream.
*
- * @param off the offset into <code>b</code> of the first byte to
+ * @param off the offset into {@code b} of the first byte to
* be updated and written.
*
* @param len the number of bytes of data to be updated and written
- * from <code>b</code>, starting at offset <code>off</code>.
+ * from {@code b}, starting at offset {@code off}.
*
* @exception IOException if an I/O error occurs.
*
@@ -150,7 +150,7 @@
/**
* Turns the digest function on or off. The default is on. When
- * it is on, a call to one of the <code>write</code> methods results in an
+ * it is on, a call to one of the {@code write} methods results in an
* update on the message digest. But when it is off, the message
* digest is not updated.
*
--- a/jdk/src/share/classes/java/security/DomainCombiner.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/DomainCombiner.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,27 +26,27 @@
package java.security;
/**
- * A <code>DomainCombiner</code> provides a means to dynamically
+ * A {@code DomainCombiner} provides a means to dynamically
* update the ProtectionDomains associated with the current
- * <code>AccessControlContext</code>.
+ * {@code AccessControlContext}.
*
- * <p> A <code>DomainCombiner</code> is passed as a parameter to the
- * appropriate constructor for <code>AccessControlContext</code>.
+ * <p> A {@code DomainCombiner} is passed as a parameter to the
+ * appropriate constructor for {@code AccessControlContext}.
* The newly constructed context is then passed to the
- * <code>AccessController.doPrivileged(..., context)</code> method
- * to bind the provided context (and associated <code>DomainCombiner</code>)
+ * {@code AccessController.doPrivileged(..., context)} method
+ * to bind the provided context (and associated {@code DomainCombiner})
* with the current execution Thread. Subsequent calls to
- * <code>AccessController.getContext</code> or
- * <code>AccessController.checkPermission</code>
- * cause the <code>DomainCombiner.combine</code> to get invoked.
+ * {@code AccessController.getContext} or
+ * {@code AccessController.checkPermission}
+ * cause the {@code DomainCombiner.combine} to get invoked.
*
* <p> The combine method takes two arguments. The first argument represents
* an array of ProtectionDomains from the current execution Thread,
- * since the most recent call to <code>AccessController.doPrivileged</code>.
+ * since the most recent call to {@code AccessController.doPrivileged}.
* If no call to doPrivileged was made, then the first argument will contain
* all the ProtectionDomains from the current execution Thread.
* The second argument represents an array of inherited ProtectionDomains,
- * which may be <code>null</code>. ProtectionDomains may be inherited
+ * which may be {@code null}. ProtectionDomains may be inherited
* from a parent Thread, or from a privileged context. If no call to
* doPrivileged was made, then the second argument will contain the
* ProtectionDomains inherited from the parent Thread. If one or more calls
@@ -54,25 +54,25 @@
* doPrivileged(action, context), then the second argument will contain the
* ProtectionDomains from the privileged context. If the most recent call
* was to doPrivileged(action), then there is no privileged context,
- * and the second argument will be <code>null</code>.
+ * and the second argument will be {@code null}.
*
- * <p> The <code>combine</code> method investigates the two input arrays
+ * <p> The {@code combine} method investigates the two input arrays
* of ProtectionDomains and returns a single array containing the updated
- * ProtectionDomains. In the simplest case, the <code>combine</code>
+ * ProtectionDomains. In the simplest case, the {@code combine}
* method merges the two stacks into one. In more complex cases,
- * the <code>combine</code> method returns a modified
+ * the {@code combine} method returns a modified
* stack of ProtectionDomains. The modification may have added new
* ProtectionDomains, removed certain ProtectionDomains, or simply
* updated existing ProtectionDomains. Re-ordering and other optimizations
* to the ProtectionDomains are also permitted. Typically the
- * <code>combine</code> method bases its updates on the information
- * encapsulated in the <code>DomainCombiner</code>.
+ * {@code combine} method bases its updates on the information
+ * encapsulated in the {@code DomainCombiner}.
*
- * <p> After the <code>AccessController.getContext</code> method
+ * <p> After the {@code AccessController.getContext} method
* receives the combined stack of ProtectionDomains back from
- * the <code>DomainCombiner</code>, it returns a new
+ * the {@code DomainCombiner}, it returns a new
* AccessControlContext that has both the combined ProtectionDomains
- * as well as the <code>DomainCombiner</code>.
+ * as well as the {@code DomainCombiner}.
*
* @see AccessController
* @see AccessControlContext
@@ -91,21 +91,21 @@
*
* @param currentDomains the ProtectionDomains associated with the
* current execution Thread, up to the most recent
- * privileged <code>ProtectionDomain</code>.
+ * privileged {@code ProtectionDomain}.
* The ProtectionDomains are are listed in order of execution,
- * with the most recently executing <code>ProtectionDomain</code>
+ * with the most recently executing {@code ProtectionDomain}
* residing at the beginning of the array. This parameter may
- * be <code>null</code> if the current execution Thread
+ * be {@code null} if the current execution Thread
* has no associated ProtectionDomains.<p>
*
* @param assignedDomains an array of inherited ProtectionDomains.
* ProtectionDomains may be inherited from a parent Thread,
- * or from a privileged <code>AccessControlContext</code>.
- * This parameter may be <code>null</code>
+ * or from a privileged {@code AccessControlContext}.
+ * This parameter may be {@code null}
* if there are no inherited ProtectionDomains.
*
* @return a new array consisting of the updated ProtectionDomains,
- * or <code>null</code>.
+ * or {@code null}.
*/
ProtectionDomain[] combine(ProtectionDomain[] currentDomains,
ProtectionDomain[] assignedDomains);
--- a/jdk/src/share/classes/java/security/GeneralSecurityException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/GeneralSecurityException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,7 +26,7 @@
package java.security;
/**
- * The <code>GeneralSecurityException</code> class is a generic
+ * The {@code GeneralSecurityException} class is a generic
* security exception class that provides type safety for all the
* security-related exception classes that extend from it.
*
@@ -57,13 +57,13 @@
}
/**
- * Creates a <code>GeneralSecurityException</code> with the specified
+ * Creates a {@code GeneralSecurityException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -72,13 +72,13 @@
}
/**
- * Creates a <code>GeneralSecurityException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code GeneralSecurityException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/Guard.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/Guard.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -29,9 +29,9 @@
* <p> This interface represents a guard, which is an object that is used
* to protect access to another object.
*
- * <p>This interface contains a single method, <code>checkGuard</code>,
- * with a single <code>object</code> argument. <code>checkGuard</code> is
- * invoked (by the GuardedObject <code>getObject</code> method)
+ * <p>This interface contains a single method, {@code checkGuard},
+ * with a single {@code object} argument. {@code checkGuard} is
+ * invoked (by the GuardedObject {@code getObject} method)
* to determine whether or not to allow access to the object.
*
* @see GuardedObject
@@ -44,7 +44,7 @@
/**
* Determines whether or not to allow access to the guarded object
- * <code>object</code>. Returns silently if access is allowed.
+ * {@code object}. Returns silently if access is allowed.
* Otherwise, throws a SecurityException.
*
* @param object the object being protected by the guard.
--- a/jdk/src/share/classes/java/security/GuardedObject.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/GuardedObject.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -33,9 +33,9 @@
* such that access to the target object is possible
* only if the Guard object allows it.
* Once an object is encapsulated by a GuardedObject,
- * access to that object is controlled by the <code>getObject</code>
+ * access to that object is controlled by the {@code getObject}
* method, which invokes the
- * <code>checkGuard</code> method on the Guard object that is
+ * {@code checkGuard} method on the Guard object that is
* guarding access. If access is not allowed,
* an exception is thrown.
*
--- a/jdk/src/share/classes/java/security/Identity.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/Identity.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -52,9 +52,9 @@
*
* @author Benjamin Renaud
* @deprecated This class is no longer used. Its functionality has been
- * replaced by <code>java.security.KeyStore</code>, the
- * <code>java.security.cert</code> package, and
- * <code>java.security.Principal</code>.
+ * replaced by {@code java.security.KeyStore}, the
+ * {@code java.security.cert} package, and
+ * {@code java.security.Principal}.
*/
@Deprecated
public abstract class Identity implements Principal, Serializable {
@@ -164,8 +164,8 @@
* Sets this identity's public key. The old key and all of this
* identity's certificates are removed by this operation.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"setIdentityPublicKey"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "setIdentityPublicKey"}
* as its argument to see if it's ok to set the public key.
*
* @param key the public key for this identity.
@@ -174,7 +174,7 @@
* identity's scope has the same public key, or if another exception occurs.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* setting the public key.
*
* @see #getPublicKey
@@ -191,14 +191,14 @@
/**
* Specifies a general information string for this identity.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"setIdentityInfo"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "setIdentityInfo"}
* as its argument to see if it's ok to specify the information string.
*
* @param info the information string.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* setting the information string.
*
* @see #getInfo
@@ -226,8 +226,8 @@
* the identity does not have a public key, the identity's
* public key is set to be that specified in the certificate.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"addIdentityCertificate"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "addIdentityCertificate"}
* as its argument to see if it's ok to add a certificate.
*
* @param certificate the certificate to be added.
@@ -237,7 +237,7 @@
* this identity's public key, or if another exception occurs.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* adding a certificate.
*
* @see SecurityManager#checkSecurityAccess
@@ -277,8 +277,8 @@
/**
* Removes a certificate from this identity.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"removeIdentityCertificate"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "removeIdentityCertificate"}
* as its argument to see if it's ok to remove a certificate.
*
* @param certificate the certificate to be removed.
@@ -287,7 +287,7 @@
* missing, or if another exception occurs.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* removing a certificate.
*
* @see SecurityManager#checkSecurityAccess
@@ -390,15 +390,15 @@
* Returns a short string describing this identity, telling its
* name and its scope (if any).
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"printIdentity"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "printIdentity"}
* as its argument to see if it's ok to return the string.
*
* @return information about this identity, such as its name and the
* name of its scope (if any).
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* returning a string describing this identity.
*
* @see SecurityManager#checkSecurityAccess
@@ -415,20 +415,20 @@
/**
* Returns a string representation of this identity, with
* optionally more details than that provided by the
- * <code>toString</code> method without any arguments.
+ * {@code toString} method without any arguments.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"printIdentity"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "printIdentity"}
* as its argument to see if it's ok to return the string.
*
* @param detailed whether or not to provide detailed information.
*
- * @return information about this identity. If <code>detailed</code>
+ * @return information about this identity. If {@code detailed}
* is true, then this method returns more information than that
- * provided by the <code>toString</code> method without any arguments.
+ * provided by the {@code toString} method without any arguments.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* returning a string describing this identity.
*
* @see #toString
--- a/jdk/src/share/classes/java/security/IdentityScope.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/IdentityScope.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -57,9 +57,9 @@
* @author Benjamin Renaud
*
* @deprecated This class is no longer used. Its functionality has been
- * replaced by <code>java.security.KeyStore</code>, the
- * <code>java.security.cert</code> package, and
- * <code>java.security.Principal</code>.
+ * replaced by {@code java.security.KeyStore}, the
+ * {@code java.security.cert} package, and
+ * {@code java.security.Principal}.
*/
@Deprecated
public abstract
@@ -146,14 +146,14 @@
* Sets the system's identity scope.
*
* <p>First, if there is a security manager, its
- * <code>checkSecurityAccess</code>
- * method is called with <code>"setSystemScope"</code>
+ * {@code checkSecurityAccess}
+ * method is called with {@code "setSystemScope"}
* as its argument to see if it's ok to set the identity scope.
*
* @param scope the scope to set.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* setting the identity scope.
*
* @see #getSystemScope
@@ -176,8 +176,8 @@
*
* @param name the name of the identity to be retrieved.
*
- * @return the identity named <code>name</code>, or null if there are
- * no identities named <code>name</code> in this scope.
+ * @return the identity named {@code name}, or null if there are
+ * no identities named {@code name} in this scope.
*/
public abstract Identity getIdentity(String name);
--- a/jdk/src/share/classes/java/security/InvalidAlgorithmParameterException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/InvalidAlgorithmParameterException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -65,13 +65,13 @@
}
/**
- * Creates a <code>InvalidAlgorithmParameterException</code> with the
+ * Creates a {@code InvalidAlgorithmParameterException} with the
* specified detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -80,14 +80,14 @@
}
/**
- * Creates a <code>InvalidAlgorithmParameterException</code> with the
+ * Creates a {@code InvalidAlgorithmParameterException} with the
* specified cause and a detail message of
- * <tt>(cause==null ? null : cause.toString())</tt>
+ * {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/InvalidKeyException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/InvalidKeyException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -58,13 +58,13 @@
}
/**
- * Creates a <code>InvalidKeyException</code> with the specified
+ * Creates a {@code InvalidKeyException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -73,13 +73,13 @@
}
/**
- * Creates a <code>InvalidKeyException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code InvalidKeyException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/Key.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/Key.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -47,9 +47,9 @@
* representation of the key is needed outside the Java Virtual Machine,
* as when transmitting the key to some other party. The key
* is encoded according to a standard format (such as
- * X.509 <code>SubjectPublicKeyInfo</code> or PKCS#8), and
+ * X.509 {@code SubjectPublicKeyInfo} or PKCS#8), and
* is returned using the {@link #getEncoded() getEncoded} method.
- * Note: The syntax of the ASN.1 type <code>SubjectPublicKeyInfo</code>
+ * Note: The syntax of the ASN.1 type {@code SubjectPublicKeyInfo}
* is defined as follows:
*
* <pre>
@@ -132,11 +132,11 @@
* For example, the name of the ASN.1 data format for public
* keys is <I>SubjectPublicKeyInfo</I>, as
* defined by the X.509 standard; in this case, the returned format is
- * <code>"X.509"</code>. Similarly,
+ * {@code "X.509"}. Similarly,
* the name of the ASN.1 data format for private keys is
* <I>PrivateKeyInfo</I>,
* as defined by the PKCS #8 standard; in this case, the returned format is
- * <code>"PKCS#8"</code>.
+ * {@code "PKCS#8"}.
*
* @return the primary encoding format of the key.
*/
--- a/jdk/src/share/classes/java/security/KeyException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -59,13 +59,13 @@
}
/**
- * Creates a <code>KeyException</code> with the specified
+ * Creates a {@code KeyException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -74,13 +74,13 @@
}
/**
- * Creates a <code>KeyException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code KeyException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/KeyFactory.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyFactory.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -37,7 +37,7 @@
/**
* Key factories are used to convert <I>keys</I> (opaque
- * cryptographic keys of type <code>Key</code>) into <I>key specifications</I>
+ * cryptographic keys of type {@code Key}) into <I>key specifications</I>
* (transparent representations of the underlying key material), and vice
* versa.
*
@@ -47,8 +47,8 @@
*
* <P> Multiple compatible key specifications may exist for the same key.
* For example, a DSA public key may be specified using
- * <code>DSAPublicKeySpec</code> or
- * <code>X509EncodedKeySpec</code>. A key factory can be used to translate
+ * {@code DSAPublicKeySpec} or
+ * {@code X509EncodedKeySpec}. A key factory can be used to translate
* between compatible key specifications.
*
* <P> The following is an example of how to use a key factory in order to
@@ -68,11 +68,11 @@
* </pre>
*
* <p> Every implementation of the Java platform is required to support the
- * following standard <code>KeyFactory</code> algorithms:
+ * following standard {@code KeyFactory} algorithms:
* <ul>
- * <li><tt>DiffieHellman</tt></li>
- * <li><tt>DSA</tt></li>
- * <li><tt>RSA</tt></li>
+ * <li>{@code DiffieHellman}</li>
+ * <li>{@code DSA}</li>
+ * <li>{@code RSA}</li>
* </ul>
* These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyFactory">
@@ -120,7 +120,7 @@
* @param keyFacSpi the delegate
* @param provider the provider
* @param algorithm the name of the algorithm
- * to associate with this <tt>KeyFactory</tt>
+ * to associate with this {@code KeyFactory}
*/
protected KeyFactory(KeyFactorySpi keyFacSpi, Provider provider,
String algorithm) {
@@ -266,10 +266,10 @@
/**
* Gets the name of the algorithm
- * associated with this <tt>KeyFactory</tt>.
+ * associated with this {@code KeyFactory}.
*
* @return the name of the algorithm associated with this
- * <tt>KeyFactory</tt>
+ * {@code KeyFactory}
*/
public final String getAlgorithm() {
return this.algorithm;
@@ -389,11 +389,11 @@
/**
* Returns a specification (key material) of the given key object.
- * <code>keySpec</code> identifies the specification class in which
+ * {@code keySpec} identifies the specification class in which
* the key material should be returned. It could, for example, be
- * <code>DSAPublicKeySpec.class</code>, to indicate that the
+ * {@code DSAPublicKeySpec.class}, to indicate that the
* key material should be returned in an instance of the
- * <code>DSAPublicKeySpec</code> class.
+ * {@code DSAPublicKeySpec} class.
*
* @param key the key.
*
--- a/jdk/src/share/classes/java/security/KeyFactorySpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyFactorySpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -30,13 +30,13 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>KeyFactory</code> class.
+ * for the {@code KeyFactory} class.
* All the abstract methods in this class must be implemented by each
* cryptographic service provider who wishes to supply the implementation
* of a key factory for a particular algorithm.
*
* <P> Key factories are used to convert <I>keys</I> (opaque
- * cryptographic keys of type <code>Key</code>) into <I>key specifications</I>
+ * cryptographic keys of type {@code Key}) into <I>key specifications</I>
* (transparent representations of the underlying key material), and vice
* versa.
*
@@ -46,8 +46,8 @@
*
* <P> Multiple compatible key specifications may exist for the same key.
* For example, a DSA public key may be specified using
- * <code>DSAPublicKeySpec</code> or
- * <code>X509EncodedKeySpec</code>. A key factory can be used to translate
+ * {@code DSAPublicKeySpec} or
+ * {@code X509EncodedKeySpec}. A key factory can be used to translate
* between compatible key specifications.
*
* <P> A provider should document all the key specifications supported by its
@@ -100,11 +100,11 @@
/**
* Returns a specification (key material) of the given key
* object.
- * <code>keySpec</code> identifies the specification class in which
+ * {@code keySpec} identifies the specification class in which
* the key material should be returned. It could, for example, be
- * <code>DSAPublicKeySpec.class</code>, to indicate that the
+ * {@code DSAPublicKeySpec.class}, to indicate that the
* key material should be returned in an instance of the
- * <code>DSAPublicKeySpec</code> class.
+ * {@code DSAPublicKeySpec} class.
*
* @param key the key.
*
--- a/jdk/src/share/classes/java/security/KeyManagementException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyManagementException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -68,13 +68,13 @@
}
/**
- * Creates a <code>KeyManagementException</code> with the specified
+ * Creates a {@code KeyManagementException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -83,13 +83,13 @@
}
/**
- * Creates a <code>KeyManagementException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code KeyManagementException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/KeyPair.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyPair.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -50,7 +50,7 @@
*
* <p>Note that this constructor only stores references to the public
* and private key components in the generated key pair. This is safe,
- * because <code>Key</code> objects are immutable.
+ * because {@code Key} objects are immutable.
*
* @param publicKey the public key.
*
--- a/jdk/src/share/classes/java/security/KeyPairGenerator.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyPairGenerator.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -37,7 +37,7 @@
/**
* The KeyPairGenerator class is used to generate pairs of
* public and private keys. Key pair generators are constructed using the
- * <code>getInstance</code> factory methods (static methods that
+ * {@code getInstance} factory methods (static methods that
* return instances of a given class).
*
* <p>A Key pair generator for a particular algorithm creates a public/private
@@ -58,21 +58,21 @@
* {@link #initialize(int, java.security.SecureRandom) initialize}
* method in this KeyPairGenerator class that takes these two universally
* shared types of arguments. There is also one that takes just a
- * <code>keysize</code> argument, and uses the <code>SecureRandom</code>
+ * {@code keysize} argument, and uses the {@code SecureRandom}
* implementation of the highest-priority installed provider as the source
* of randomness. (If none of the installed providers supply an implementation
- * of <code>SecureRandom</code>, a system-provided source of randomness is
+ * of {@code SecureRandom}, a system-provided source of randomness is
* used.)
*
* <p>Since no other parameters are specified when you call the above
- * algorithm-independent <code>initialize</code> methods, it is up to the
+ * algorithm-independent {@code initialize} methods, it is up to the
* provider what to do about the algorithm-specific parameters (if any) to be
* associated with each of the keys.
*
* <p>If the algorithm is the <i>DSA</i> algorithm, and the keysize (modulus
* size) is 512, 768, or 1024, then the <i>Sun</i> provider uses a set of
- * precomputed values for the <code>p</code>, <code>q</code>, and
- * <code>g</code> parameters. If the modulus size is not one of the above
+ * precomputed values for the {@code p}, {@code q}, and
+ * {@code g} parameters. If the modulus size is not one of the above
* values, the <i>Sun</i> provider creates a new set of parameters. Other
* providers might have precomputed parameter sets for more than just the
* three modulus sizes mentioned above. Still others might not have a list of
@@ -83,35 +83,35 @@
* <p>For situations where a set of algorithm-specific parameters already
* exists (e.g., so-called <i>community parameters</i> in DSA), there are two
* {@link #initialize(java.security.spec.AlgorithmParameterSpec)
- * initialize} methods that have an <code>AlgorithmParameterSpec</code>
- * argument. One also has a <code>SecureRandom</code> argument, while the
- * the other uses the <code>SecureRandom</code>
+ * initialize} methods that have an {@code AlgorithmParameterSpec}
+ * argument. One also has a {@code SecureRandom} argument, while the
+ * the other uses the {@code SecureRandom}
* implementation of the highest-priority installed provider as the source
* of randomness. (If none of the installed providers supply an implementation
- * of <code>SecureRandom</code>, a system-provided source of randomness is
+ * of {@code SecureRandom}, a system-provided source of randomness is
* used.)
* </ul>
*
* <p>In case the client does not explicitly initialize the KeyPairGenerator
- * (via a call to an <code>initialize</code> method), each provider must
+ * (via a call to an {@code initialize} method), each provider must
* supply (and document) a default initialization.
* For example, the <i>Sun</i> provider uses a default modulus size (keysize)
* of 1024 bits.
*
* <p>Note that this class is abstract and extends from
- * <code>KeyPairGeneratorSpi</code> for historical reasons.
+ * {@code KeyPairGeneratorSpi} for historical reasons.
* Application developers should only take notice of the methods defined in
- * this <code>KeyPairGenerator</code> class; all the methods in
+ * this {@code KeyPairGenerator} class; all the methods in
* the superclass are intended for cryptographic service providers who wish to
* supply their own implementations of key pair generators.
*
* <p> Every implementation of the Java platform is required to support the
- * following standard <code>KeyPairGenerator</code> algorithms and keysizes in
+ * following standard {@code KeyPairGenerator} algorithms and keysizes in
* parentheses:
* <ul>
- * <li><tt>DiffieHellman</tt> (1024)</li>
- * <li><tt>DSA</tt> (1024)</li>
- * <li><tt>RSA</tt> (1024, 2048)</li>
+ * <li>{@code DiffieHellman} (1024)</li>
+ * <li>{@code DSA} (1024)</li>
+ * <li>{@code RSA} (1024, 2048)</li>
* </ul>
* These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyPairGenerator">
@@ -322,18 +322,18 @@
/**
* Initializes the key pair generator for a certain keysize using
- * a default parameter set and the <code>SecureRandom</code>
+ * a default parameter set and the {@code SecureRandom}
* implementation of the highest-priority installed provider as the source
* of randomness.
* (If none of the installed providers supply an implementation of
- * <code>SecureRandom</code>, a system-provided source of randomness is
+ * {@code SecureRandom}, a system-provided source of randomness is
* used.)
*
* @param keysize the keysize. This is an
* algorithm-specific metric, such as modulus length, specified in
* number of bits.
*
- * @exception InvalidParameterException if the <code>keysize</code> is not
+ * @exception InvalidParameterException if the {@code keysize} is not
* supported by this KeyPairGenerator object.
*/
public void initialize(int keysize) {
@@ -349,7 +349,7 @@
* number of bits.
* @param random the source of randomness.
*
- * @exception InvalidParameterException if the <code>keysize</code> is not
+ * @exception InvalidParameterException if the {@code keysize} is not
* supported by this KeyPairGenerator object.
*
* @since 1.2
@@ -369,11 +369,11 @@
/**
* Initializes the key pair generator using the specified parameter
- * set and the <code>SecureRandom</code>
+ * set and the {@code SecureRandom}
* implementation of the highest-priority installed provider as the source
* of randomness.
* (If none of the installed providers supply an implementation of
- * <code>SecureRandom</code>, a system-provided source of randomness is
+ * {@code SecureRandom}, a system-provided source of randomness is
* used.).
*
* <p>This concrete method has been added to this previously-defined
@@ -382,10 +382,10 @@
* {@link KeyPairGeneratorSpi#initialize(
* java.security.spec.AlgorithmParameterSpec,
* java.security.SecureRandom) initialize} method,
- * passing it <code>params</code> and a source of randomness (obtained
+ * passing it {@code params} and a source of randomness (obtained
* from the highest-priority installed provider or system-provided if none
* of the installed providers supply one).
- * That <code>initialize</code> method always throws an
+ * That {@code initialize} method always throws an
* UnsupportedOperationException if it is not overridden by the provider.
*
* @param params the parameter set used to generate the keys.
@@ -410,8 +410,8 @@
* KeyPairGeneratorSpi#initialize(
* java.security.spec.AlgorithmParameterSpec,
* java.security.SecureRandom) initialize} method,
- * passing it <code>params</code> and <code>random</code>.
- * That <code>initialize</code>
+ * passing it {@code params} and {@code random}.
+ * That {@code initialize}
* method always throws an
* UnsupportedOperationException if it is not overridden by the provider.
*
--- a/jdk/src/share/classes/java/security/KeyPairGeneratorSpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyPairGeneratorSpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -29,7 +29,7 @@
/**
* <p> This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>KeyPairGenerator</code> class, which is used to generate
+ * for the {@code KeyPairGenerator} class, which is used to generate
* pairs of public and private keys.
*
* <p> All the abstract methods in this class must be implemented by each
@@ -37,7 +37,7 @@
* of a key pair generator for a particular algorithm.
*
* <p> In case the client does not explicitly initialize the KeyPairGenerator
- * (via a call to an <code>initialize</code> method), each provider must
+ * (via a call to an {@code initialize} method), each provider must
* supply (and document) a default initialization.
* For example, the <i>Sun</i> provider uses a default modulus size (keysize)
* of 1024 bits.
@@ -61,7 +61,7 @@
*
* @param random the source of randomness for this generator.
*
- * @exception InvalidParameterException if the <code>keysize</code> is not
+ * @exception InvalidParameterException if the {@code keysize} is not
* supported by this KeyPairGeneratorSpi object.
*/
public abstract void initialize(int keysize, SecureRandom random);
@@ -100,7 +100,7 @@
* will be used. This will generate a new key pair every time it
* is called.
*
- * @return the newly generated <tt>KeyPair</tt>
+ * @return the newly generated {@code KeyPair}
*/
public abstract KeyPair generateKeyPair();
}
--- a/jdk/src/share/classes/java/security/KeyRep.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyRep.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -116,17 +116,17 @@
*
* @param type either one of Type.SECRET, Type.PUBLIC, or Type.PRIVATE
* @param algorithm the algorithm returned from
- * <code>Key.getAlgorithm()</code>
+ * {@code Key.getAlgorithm()}
* @param format the encoding format returned from
- * <code>Key.getFormat()</code>
+ * {@code Key.getFormat()}
* @param encoded the encoded bytes returned from
- * <code>Key.getEncoded()</code>
+ * {@code Key.getEncoded()}
*
* @exception NullPointerException
- * if type is <code>null</code>,
- * if algorithm is <code>null</code>,
- * if format is <code>null</code>,
- * or if encoded is <code>null</code>
+ * if type is {@code null},
+ * if algorithm is {@code null},
+ * if format is {@code null},
+ * or if encoded is {@code null}
*/
public KeyRep(Type type, String algorithm,
String format, byte[] encoded) {
--- a/jdk/src/share/classes/java/security/KeyStore.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyStore.java Tue Jul 02 15:23:23 2013 -0700
@@ -41,13 +41,13 @@
* This class represents a storage facility for cryptographic
* keys and certificates.
*
- * <p> A <code>KeyStore</code> manages different types of entries.
- * Each type of entry implements the <code>KeyStore.Entry</code> interface.
- * Three basic <code>KeyStore.Entry</code> implementations are provided:
+ * <p> A {@code KeyStore} manages different types of entries.
+ * Each type of entry implements the {@code KeyStore.Entry} interface.
+ * Three basic {@code KeyStore.Entry} implementations are provided:
*
* <ul>
* <li><b>KeyStore.PrivateKeyEntry</b>
- * <p> This type of entry holds a cryptographic <code>PrivateKey</code>,
+ * <p> This type of entry holds a cryptographic {@code PrivateKey},
* which is optionally stored in a protected format to prevent
* unauthorized access. It is also accompanied by a certificate chain
* for the corresponding public key.
@@ -58,12 +58,12 @@
* and/or licensing software.
*
* <li><b>KeyStore.SecretKeyEntry</b>
- * <p> This type of entry holds a cryptographic <code>SecretKey</code>,
+ * <p> This type of entry holds a cryptographic {@code SecretKey},
* which is optionally stored in a protected format to prevent
* unauthorized access.
*
* <li><b>KeyStore.TrustedCertificateEntry</b>
- * <p> This type of entry contains a single public key <code>Certificate</code>
+ * <p> This type of entry contains a single public key {@code Certificate}
* belonging to another party. It is called a <i>trusted certificate</i>
* because the keystore owner trusts that the public key in the certificate
* indeed belongs to the identity identified by the <i>subject</i> (owner)
@@ -121,8 +121,8 @@
* }
* </pre>
*
- * To create an empty keystore using the above <code>load</code> method,
- * pass <code>null</code> as the <code>InputStream</code> argument.
+ * To create an empty keystore using the above {@code load} method,
+ * pass {@code null} as the {@code InputStream} argument.
*
* <p> Once the keystore has been loaded, it is possible
* to read existing entries from the keystore, or to write new entries
@@ -156,9 +156,9 @@
* may also be used.
*
* <p> Every implementation of the Java platform is required to support
- * the following standard <code>KeyStore</code> type:
+ * the following standard {@code KeyStore} type:
* <ul>
- * <li><tt>PKCS12</tt></li>
+ * <li>{@code PKCS12}</li>
* </ul>
* This type is described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyStore">
@@ -201,7 +201,7 @@
private boolean initialized = false;
/**
- * A marker interface for <code>KeyStore</code>
+ * A marker interface for {@code KeyStore}
* {@link #load(KeyStore.LoadStoreParameter) load}
* and
* {@link #store(KeyStore.LoadStoreParameter) store}
@@ -227,15 +227,13 @@
* {@link #store(KeyStore.LoadStoreParameter) store} operations.
* <p>
* The following syntax is supported for configuration data:
- * <pre>
- *
+ * <pre>{@code
* domain <domainName> [<property> ...] {
* keystore <keystoreName> [<property> ...] ;
* ...
* };
* ...
- *
- * </pre>
+ * }</pre>
* where {@code domainName} and {@code keystoreName} are identifiers
* and {@code property} is a key/value pairing. The key and value are
* separated by an 'equals' symbol and the value is enclosed in double
@@ -365,19 +363,19 @@
/**
* A marker interface for keystore protection parameters.
*
- * <p> The information stored in a <code>ProtectionParameter</code>
+ * <p> The information stored in a {@code ProtectionParameter}
* object protects the contents of a keystore.
* For example, protection parameters may be used to check
* the integrity of keystore data, or to protect the
* confidentiality of sensitive keystore data
- * (such as a <code>PrivateKey</code>).
+ * (such as a {@code PrivateKey}).
*
* @since 1.5
*/
public static interface ProtectionParameter { }
/**
- * A password-based implementation of <code>ProtectionParameter</code>.
+ * A password-based implementation of {@code ProtectionParameter}.
*
* @since 1.5
*/
@@ -392,10 +390,10 @@
/**
* Creates a password parameter.
*
- * <p> The specified <code>password</code> is cloned before it is stored
- * in the new <code>PasswordProtection</code> object.
+ * <p> The specified {@code password} is cloned before it is stored
+ * in the new {@code PasswordProtection} object.
*
- * @param password the password, which may be <code>null</code>
+ * @param password the password, which may be {@code null}
*/
public PasswordProtection(char[] password) {
this.password = (password == null) ? null : password.clone();
@@ -476,7 +474,7 @@
* after it is no longer needed.
*
* @see #destroy()
- * @return the password, which may be <code>null</code>
+ * @return the password, which may be {@code null}
* @exception IllegalStateException if the password has
* been cleared (destroyed)
*/
@@ -546,7 +544,7 @@
}
/**
- * A marker interface for <code>KeyStore</code> entry types.
+ * A marker interface for {@code KeyStore} entry types.
*
* @since 1.5
*/
@@ -590,7 +588,7 @@
}
/**
- * A <code>KeyStore</code> entry that holds a <code>PrivateKey</code>
+ * A {@code KeyStore} entry that holds a {@code PrivateKey}
* and corresponding certificate chain.
*
* @since 1.5
@@ -602,28 +600,28 @@
private final Set<Attribute> attributes;
/**
- * Constructs a <code>PrivateKeyEntry</code> with a
- * <code>PrivateKey</code> and corresponding certificate chain.
+ * Constructs a {@code PrivateKeyEntry} with a
+ * {@code PrivateKey} and corresponding certificate chain.
*
- * <p> The specified <code>chain</code> is cloned before it is stored
- * in the new <code>PrivateKeyEntry</code> object.
+ * <p> The specified {@code chain} is cloned before it is stored
+ * in the new {@code PrivateKeyEntry} object.
*
- * @param privateKey the <code>PrivateKey</code>
- * @param chain an array of <code>Certificate</code>s
+ * @param privateKey the {@code PrivateKey}
+ * @param chain an array of {@code Certificate}s
* representing the certificate chain.
* The chain must be ordered and contain a
- * <code>Certificate</code> at index 0
+ * {@code Certificate} at index 0
* corresponding to the private key.
*
* @exception NullPointerException if
- * <code>privateKey</code> or <code>chain</code>
- * is <code>null</code>
+ * {@code privateKey} or {@code chain}
+ * is {@code null}
* @exception IllegalArgumentException if the specified chain has a
* length of 0, if the specified chain does not contain
- * <code>Certificate</code>s of the same type,
- * or if the <code>PrivateKey</code> algorithm
- * does not match the algorithm of the <code>PublicKey</code>
- * in the end entity <code>Certificate</code> (at index 0)
+ * {@code Certificate}s of the same type,
+ * or if the {@code PrivateKey} algorithm
+ * does not match the algorithm of the {@code PublicKey}
+ * in the end entity {@code Certificate} (at index 0)
*/
public PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain) {
this(privateKey, chain, Collections.<Attribute>emptySet());
@@ -699,38 +697,38 @@
}
/**
- * Gets the <code>PrivateKey</code> from this entry.
+ * Gets the {@code PrivateKey} from this entry.
*
- * @return the <code>PrivateKey</code> from this entry
+ * @return the {@code PrivateKey} from this entry
*/
public PrivateKey getPrivateKey() {
return privKey;
}
/**
- * Gets the <code>Certificate</code> chain from this entry.
+ * Gets the {@code Certificate} chain from this entry.
*
* <p> The stored chain is cloned before being returned.
*
- * @return an array of <code>Certificate</code>s corresponding
+ * @return an array of {@code Certificate}s corresponding
* to the certificate chain for the public key.
* If the certificates are of type X.509,
* the runtime type of the returned array is
- * <code>X509Certificate[]</code>.
+ * {@code X509Certificate[]}.
*/
public Certificate[] getCertificateChain() {
return chain.clone();
}
/**
- * Gets the end entity <code>Certificate</code>
+ * Gets the end entity {@code Certificate}
* from the certificate chain in this entry.
*
- * @return the end entity <code>Certificate</code> (at index 0)
+ * @return the end entity {@code Certificate} (at index 0)
* from the certificate chain in this entry.
* If the certificate is of type X.509,
* the runtime type of the returned certificate is
- * <code>X509Certificate</code>.
+ * {@code X509Certificate}.
*/
public Certificate getCertificate() {
return chain[0];
@@ -767,7 +765,7 @@
}
/**
- * A <code>KeyStore</code> entry that holds a <code>SecretKey</code>.
+ * A {@code KeyStore} entry that holds a {@code SecretKey}.
*
* @since 1.5
*/
@@ -777,13 +775,13 @@
private final Set<Attribute> attributes;
/**
- * Constructs a <code>SecretKeyEntry</code> with a
- * <code>SecretKey</code>.
+ * Constructs a {@code SecretKeyEntry} with a
+ * {@code SecretKey}.
*
- * @param secretKey the <code>SecretKey</code>
+ * @param secretKey the {@code SecretKey}
*
- * @exception NullPointerException if <code>secretKey</code>
- * is <code>null</code>
+ * @exception NullPointerException if {@code secretKey}
+ * is {@code null}
*/
public SecretKeyEntry(SecretKey secretKey) {
if (secretKey == null) {
@@ -819,9 +817,9 @@
}
/**
- * Gets the <code>SecretKey</code> from this entry.
+ * Gets the {@code SecretKey} from this entry.
*
- * @return the <code>SecretKey</code> from this entry
+ * @return the {@code SecretKey} from this entry
*/
public SecretKey getSecretKey() {
return sKey;
@@ -850,8 +848,8 @@
}
/**
- * A <code>KeyStore</code> entry that holds a trusted
- * <code>Certificate</code>.
+ * A {@code KeyStore} entry that holds a trusted
+ * {@code Certificate}.
*
* @since 1.5
*/
@@ -861,13 +859,13 @@
private final Set<Attribute> attributes;
/**
- * Constructs a <code>TrustedCertificateEntry</code> with a
- * trusted <code>Certificate</code>.
+ * Constructs a {@code TrustedCertificateEntry} with a
+ * trusted {@code Certificate}.
*
- * @param trustedCert the trusted <code>Certificate</code>
+ * @param trustedCert the trusted {@code Certificate}
*
* @exception NullPointerException if
- * <code>trustedCert</code> is <code>null</code>
+ * {@code trustedCert} is {@code null}
*/
public TrustedCertificateEntry(Certificate trustedCert) {
if (trustedCert == null) {
@@ -903,9 +901,9 @@
}
/**
- * Gets the trusted <code>Certficate</code> from this entry.
+ * Gets the trusted {@code Certficate} from this entry.
*
- * @return the trusted <code>Certificate</code> from this entry
+ * @return the trusted {@code Certificate} from this entry
*/
public Certificate getTrustedCertificate() {
return cert;
@@ -1129,9 +1127,9 @@
/**
* Returns the key associated with the given alias, using the given
* password to recover it. The key must have been associated with
- * the alias by a call to <code>setKeyEntry</code>,
- * or by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code> or <code>SecretKeyEntry</code>.
+ * the alias by a call to {@code setKeyEntry},
+ * or by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry} or {@code SecretKeyEntry}.
*
* @param alias the alias name
* @param password the password for recovering the key
@@ -1159,9 +1157,9 @@
/**
* Returns the certificate chain associated with the given alias.
* The certificate chain must have been associated with the alias
- * by a call to <code>setKeyEntry</code>,
- * or by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code>.
+ * by a call to {@code setKeyEntry},
+ * or by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry}.
*
* @param alias the alias name
*
@@ -1185,15 +1183,15 @@
* Returns the certificate associated with the given alias.
*
* <p> If the given alias name identifies an entry
- * created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>,
+ * created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry},
* then the trusted certificate contained in that entry is returned.
*
* <p> If the given alias name identifies an entry
- * created by a call to <code>setKeyEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code>,
+ * created by a call to {@code setKeyEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry},
* then the first element of the certificate chain in that entry
* is returned.
*
@@ -1238,7 +1236,7 @@
* Assigns the given key to the given alias, protecting it with the given
* password.
*
- * <p>If the given key is of type <code>java.security.PrivateKey</code>,
+ * <p>If the given key is of type {@code java.security.PrivateKey},
* it must be accompanied by a certificate chain certifying the
* corresponding public key.
*
@@ -1251,7 +1249,7 @@
* @param password the password to protect the key
* @param chain the certificate chain for the corresponding public
* key (only required if the given key is of type
- * <code>java.security.PrivateKey</code>).
+ * {@code java.security.PrivateKey}).
*
* @exception KeyStoreException if the keystore has not been initialized
* (loaded), the given key cannot be protected, or this operation fails
@@ -1278,11 +1276,11 @@
* alias.
*
* <p>If the protected key is of type
- * <code>java.security.PrivateKey</code>, it must be accompanied by a
+ * {@code java.security.PrivateKey}, it must be accompanied by a
* certificate chain certifying the corresponding public key. If the
- * underlying keystore implementation is of type <code>jks</code>,
- * <code>key</code> must be encoded as an
- * <code>EncryptedPrivateKeyInfo</code> as defined in the PKCS #8 standard.
+ * underlying keystore implementation is of type {@code jks},
+ * {@code key} must be encoded as an
+ * {@code EncryptedPrivateKeyInfo} as defined in the PKCS #8 standard.
*
* <p>If the given alias already exists, the keystore information
* associated with it is overridden by the given key (and possibly
@@ -1292,7 +1290,7 @@
* @param key the key (in protected format) to be associated with the alias
* @param chain the certificate chain for the corresponding public
* key (only useful if the protected key is of type
- * <code>java.security.PrivateKey</code>).
+ * {@code java.security.PrivateKey}).
*
* @exception KeyStoreException if the keystore has not been initialized
* (loaded), or if this operation fails for some other reason.
@@ -1311,9 +1309,9 @@
* Assigns the given trusted certificate to the given alias.
*
* <p> If the given alias identifies an existing entry
- * created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>,
+ * created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry},
* the trusted certificate in the existing entry
* is overridden by the given certificate.
*
@@ -1406,9 +1404,9 @@
/**
* Returns true if the entry identified by the given alias
- * was created by a call to <code>setKeyEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code> or a <code>SecretKeyEntry</code>.
+ * was created by a call to {@code setKeyEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry} or a {@code SecretKeyEntry}.
*
* @param alias the alias for the keystore entry to be checked
*
@@ -1429,9 +1427,9 @@
/**
* Returns true if the entry identified by the given alias
- * was created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>.
+ * was created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry}.
*
* @param alias the alias for the keystore entry to be checked
*
@@ -1456,15 +1454,15 @@
*
* <p> This method attempts to match the given certificate with each
* keystore entry. If the entry being considered was
- * created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>,
+ * created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry},
* then the given certificate is compared to that entry's certificate.
*
* <p> If the entry being considered was
- * created by a call to <code>setKeyEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code>,
+ * created by a call to {@code setKeyEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry},
* then the given certificate is compared to the first
* element of that entry's certificate chain.
*
@@ -1511,14 +1509,14 @@
}
/**
- * Stores this keystore using the given <code>LoadStoreParameter</code>.
+ * Stores this keystore using the given {@code LoadStoreParameter}.
*
- * @param param the <code>LoadStoreParameter</code>
+ * @param param the {@code LoadStoreParameter}
* that specifies how to store the keystore,
- * which may be <code>null</code>
+ * which may be {@code null}
*
* @exception IllegalArgumentException if the given
- * <code>LoadStoreParameter</code>
+ * {@code LoadStoreParameter}
* input is not recognized
* @exception KeyStoreException if the keystore has not been initialized
* (loaded)
@@ -1549,24 +1547,24 @@
* then integrity checking is not performed.
*
* <p>In order to create an empty keystore, or if the keystore cannot
- * be initialized from a stream, pass <code>null</code>
- * as the <code>stream</code> argument.
+ * be initialized from a stream, pass {@code null}
+ * as the {@code stream} argument.
*
* <p> Note that if this keystore has already been loaded, it is
* reinitialized and loaded again from the given input stream.
*
* @param stream the input stream from which the keystore is loaded,
- * or <code>null</code>
+ * or {@code null}
* @param password the password used to check the integrity of
* the keystore, the password used to unlock the keystore,
- * or <code>null</code>
+ * or {@code null}
*
* @exception IOException if there is an I/O or format problem with the
* keystore data, if a password is required but not given,
* or if the given password was incorrect. If the error is due to a
* wrong password, the {@link Throwable#getCause cause} of the
- * <code>IOException</code> should be an
- * <code>UnrecoverableKeyException</code>
+ * {@code IOException} should be an
+ * {@code UnrecoverableKeyException}
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
@@ -1580,24 +1578,24 @@
}
/**
- * Loads this keystore using the given <code>LoadStoreParameter</code>.
+ * Loads this keystore using the given {@code LoadStoreParameter}.
*
* <p> Note that if this KeyStore has already been loaded, it is
* reinitialized and loaded again from the given parameter.
*
- * @param param the <code>LoadStoreParameter</code>
+ * @param param the {@code LoadStoreParameter}
* that specifies how to load the keystore,
- * which may be <code>null</code>
+ * which may be {@code null}
*
* @exception IllegalArgumentException if the given
- * <code>LoadStoreParameter</code>
+ * {@code LoadStoreParameter}
* input is not recognized
* @exception IOException if there is an I/O or format problem with the
* keystore data. If the error is due to an incorrect
- * <code>ProtectionParameter</code> (e.g. wrong password)
+ * {@code ProtectionParameter} (e.g. wrong password)
* the {@link Throwable#getCause cause} of the
- * <code>IOException</code> should be an
- * <code>UnrecoverableKeyException</code>
+ * {@code IOException} should be an
+ * {@code UnrecoverableKeyException}
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
@@ -1614,26 +1612,26 @@
}
/**
- * Gets a keystore <code>Entry</code> for the specified alias
+ * Gets a keystore {@code Entry} for the specified alias
* with the specified protection parameter.
*
- * @param alias get the keystore <code>Entry</code> for this alias
- * @param protParam the <code>ProtectionParameter</code>
- * used to protect the <code>Entry</code>,
- * which may be <code>null</code>
+ * @param alias get the keystore {@code Entry} for this alias
+ * @param protParam the {@code ProtectionParameter}
+ * used to protect the {@code Entry},
+ * which may be {@code null}
*
- * @return the keystore <code>Entry</code> for the specified alias,
- * or <code>null</code> if there is no such entry
+ * @return the keystore {@code Entry} for the specified alias,
+ * or {@code null} if there is no such entry
*
* @exception NullPointerException if
- * <code>alias</code> is <code>null</code>
+ * {@code alias} is {@code null}
* @exception NoSuchAlgorithmException if the algorithm for recovering the
* entry cannot be found
* @exception UnrecoverableEntryException if the specified
- * <code>protParam</code> were insufficient or invalid
+ * {@code protParam} were insufficient or invalid
* @exception UnrecoverableKeyException if the entry is a
- * <code>PrivateKeyEntry</code> or <code>SecretKeyEntry</code>
- * and the specified <code>protParam</code> does not contain
+ * {@code PrivateKeyEntry} or {@code SecretKeyEntry}
+ * and the specified {@code protParam} does not contain
* the information needed to recover the key (e.g. wrong password)
* @exception KeyStoreException if the keystore has not been initialized
* (loaded).
@@ -1655,22 +1653,22 @@
}
/**
- * Saves a keystore <code>Entry</code> under the specified alias.
+ * Saves a keystore {@code Entry} under the specified alias.
* The protection parameter is used to protect the
- * <code>Entry</code>.
+ * {@code Entry}.
*
* <p> If an entry already exists for the specified alias,
* it is overridden.
*
- * @param alias save the keystore <code>Entry</code> under this alias
- * @param entry the <code>Entry</code> to save
- * @param protParam the <code>ProtectionParameter</code>
- * used to protect the <code>Entry</code>,
- * which may be <code>null</code>
+ * @param alias save the keystore {@code Entry} under this alias
+ * @param entry the {@code Entry} to save
+ * @param protParam the {@code ProtectionParameter}
+ * used to protect the {@code Entry},
+ * which may be {@code null}
*
* @exception NullPointerException if
- * <code>alias</code> or <code>entry</code>
- * is <code>null</code>
+ * {@code alias} or {@code entry}
+ * is {@code null}
* @exception KeyStoreException if the keystore has not been initialized
* (loaded), or if this operation fails for some other reason
*
@@ -1691,20 +1689,20 @@
}
/**
- * Determines if the keystore <code>Entry</code> for the specified
- * <code>alias</code> is an instance or subclass of the specified
- * <code>entryClass</code>.
+ * Determines if the keystore {@code Entry} for the specified
+ * {@code alias} is an instance or subclass of the specified
+ * {@code entryClass}.
*
* @param alias the alias name
* @param entryClass the entry class
*
- * @return true if the keystore <code>Entry</code> for the specified
- * <code>alias</code> is an instance or subclass of the
- * specified <code>entryClass</code>, false otherwise
+ * @return true if the keystore {@code Entry} for the specified
+ * {@code alias} is an instance or subclass of the
+ * specified {@code entryClass}, false otherwise
*
* @exception NullPointerException if
- * <code>alias</code> or <code>entryClass</code>
- * is <code>null</code>
+ * {@code alias} or {@code entryClass}
+ * is {@code null}
* @exception KeyStoreException if the keystore has not been
* initialized (loaded)
*
@@ -1764,7 +1762,7 @@
/**
* Returns the ProtectionParameters that should be used to obtain
* the {@link KeyStore.Entry Entry} with the given alias.
- * The <code>getKeyStore</code> method must be invoked before this
+ * The {@code getKeyStore} method must be invoked before this
* method may be called.
*
* @return the ProtectionParameters that should be used to obtain
@@ -1782,9 +1780,9 @@
/**
* Returns a new Builder that encapsulates the given KeyStore.
* The {@linkplain #getKeyStore} method of the returned object
- * will return <code>keyStore</code>, the {@linkplain
+ * will return {@code keyStore}, the {@linkplain
* #getProtectionParameter getProtectionParameter()} method will
- * return <code>protectionParameters</code>.
+ * return {@code protectionParameters}.
*
* <p> This is useful if an existing KeyStore object needs to be
* used with Builder-based APIs.
@@ -1832,15 +1830,15 @@
* Returns a new Builder object.
*
* <p>The first call to the {@link #getKeyStore} method on the returned
- * builder will create a KeyStore of type <code>type</code> and call
+ * builder will create a KeyStore of type {@code type} and call
* its {@link KeyStore#load load()} method.
- * The <code>inputStream</code> argument is constructed from
- * <code>file</code>.
- * If <code>protection</code> is a
- * <code>PasswordProtection</code>, the password is obtained by
- * calling the <code>getPassword</code> method.
- * Otherwise, if <code>protection</code> is a
- * <code>CallbackHandlerProtection</code>, the password is obtained
+ * The {@code inputStream} argument is constructed from
+ * {@code file}.
+ * If {@code protection} is a
+ * {@code PasswordProtection}, the password is obtained by
+ * calling the {@code getPassword} method.
+ * Otherwise, if {@code protection} is a
+ * {@code CallbackHandlerProtection}, the password is obtained
* by invoking the CallbackHandler.
*
* <p>Subsequent calls to {@link #getKeyStore} return the same object
@@ -1848,13 +1846,13 @@
* KeyStoreException, subsequent calls also throw a
* KeyStoreException.
*
- * <p>The KeyStore is instantiated from <code>provider</code> if
+ * <p>The KeyStore is instantiated from {@code provider} if
* non-null. Otherwise, all installed providers are searched.
*
* <p>Calls to {@link #getProtectionParameter getProtectionParameter()}
* will return a {@link KeyStore.PasswordProtection PasswordProtection}
* object encapsulating the password that was used to invoke the
- * <code>load</code> method.
+ * {@code load} method.
*
* <p><em>Note</em> that the {@link #getKeyStore} method is executed
* within the {@link AccessControlContext} of the code invoking this
@@ -2013,17 +2011,17 @@
* Returns a new Builder object.
*
* <p>Each call to the {@link #getKeyStore} method on the returned
- * builder will return a new KeyStore object of type <code>type</code>.
+ * builder will return a new KeyStore object of type {@code type}.
* Its {@link KeyStore#load(KeyStore.LoadStoreParameter) load()}
* method is invoked using a
- * <code>LoadStoreParameter</code> that encapsulates
- * <code>protection</code>.
+ * {@code LoadStoreParameter} that encapsulates
+ * {@code protection}.
*
- * <p>The KeyStore is instantiated from <code>provider</code> if
+ * <p>The KeyStore is instantiated from {@code provider} if
* non-null. Otherwise, all installed providers are searched.
*
* <p>Calls to {@link #getProtectionParameter getProtectionParameter()}
- * will return <code>protection</code>.
+ * will return {@code protection}.
*
* <p><em>Note</em> that the {@link #getKeyStore} method is executed
* within the {@link AccessControlContext} of the code invoking this
--- a/jdk/src/share/classes/java/security/KeyStoreException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyStoreException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -59,13 +59,13 @@
}
/**
- * Creates a <code>KeyStoreException</code> with the specified
+ * Creates a {@code KeyStoreException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -74,13 +74,13 @@
}
/**
- * Creates a <code>KeyStoreException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code KeyStoreException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/KeyStoreSpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyStoreSpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -38,7 +38,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>KeyStore</code> class.
+ * for the {@code KeyStore} class.
* All the abstract methods in this class must be implemented by each
* cryptographic service provider who wishes to supply the implementation
* of a keystore for a particular keystore type.
@@ -56,9 +56,9 @@
/**
* Returns the key associated with the given alias, using the given
* password to recover it. The key must have been associated with
- * the alias by a call to <code>setKeyEntry</code>,
- * or by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code> or <code>SecretKeyEntry</code>.
+ * the alias by a call to {@code setKeyEntry},
+ * or by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry} or {@code SecretKeyEntry}.
*
* @param alias the alias name
* @param password the password for recovering the key
@@ -77,9 +77,9 @@
/**
* Returns the certificate chain associated with the given alias.
* The certificate chain must have been associated with the alias
- * by a call to <code>setKeyEntry</code>,
- * or by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code>.
+ * by a call to {@code setKeyEntry},
+ * or by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry}.
*
* @param alias the alias name
*
@@ -93,15 +93,15 @@
* Returns the certificate associated with the given alias.
*
* <p> If the given alias name identifies an entry
- * created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>,
+ * created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry},
* then the trusted certificate contained in that entry is returned.
*
* <p> If the given alias name identifies an entry
- * created by a call to <code>setKeyEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code>,
+ * created by a call to {@code setKeyEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry},
* then the first element of the certificate chain in that entry
* (if a chain exists) is returned.
*
@@ -126,7 +126,7 @@
* Assigns the given key to the given alias, protecting it with the given
* password.
*
- * <p>If the given key is of type <code>java.security.PrivateKey</code>,
+ * <p>If the given key is of type {@code java.security.PrivateKey},
* it must be accompanied by a certificate chain certifying the
* corresponding public key.
*
@@ -139,7 +139,7 @@
* @param password the password to protect the key
* @param chain the certificate chain for the corresponding public
* key (only required if the given key is of type
- * <code>java.security.PrivateKey</code>).
+ * {@code java.security.PrivateKey}).
*
* @exception KeyStoreException if the given key cannot be protected, or
* this operation fails for some other reason
@@ -154,7 +154,7 @@
* alias.
*
* <p>If the protected key is of type
- * <code>java.security.PrivateKey</code>,
+ * {@code java.security.PrivateKey},
* it must be accompanied by a certificate chain certifying the
* corresponding public key.
*
@@ -166,7 +166,7 @@
* @param key the key (in protected format) to be associated with the alias
* @param chain the certificate chain for the corresponding public
* key (only useful if the protected key is of type
- * <code>java.security.PrivateKey</code>).
+ * {@code java.security.PrivateKey}).
*
* @exception KeyStoreException if this operation fails.
*/
@@ -178,9 +178,9 @@
* Assigns the given certificate to the given alias.
*
* <p> If the given alias identifies an existing entry
- * created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>,
+ * created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry},
* the trusted certificate in the existing entry
* is overridden by the given certificate.
*
@@ -230,9 +230,9 @@
/**
* Returns true if the entry identified by the given alias
- * was created by a call to <code>setKeyEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code> or a <code>SecretKeyEntry</code>.
+ * was created by a call to {@code setKeyEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry} or a {@code SecretKeyEntry}.
*
* @param alias the alias for the keystore entry to be checked
*
@@ -243,9 +243,9 @@
/**
* Returns true if the entry identified by the given alias
- * was created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>.
+ * was created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry}.
*
* @param alias the alias for the keystore entry to be checked
*
@@ -260,15 +260,15 @@
*
* <p>This method attempts to match the given certificate with each
* keystore entry. If the entry being considered was
- * created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>,
+ * created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry},
* then the given certificate is compared to that entry's certificate.
*
* <p> If the entry being considered was
- * created by a call to <code>setKeyEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code>,
+ * created by a call to {@code setKeyEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry},
* then the given certificate is compared to the first
* element of that entry's certificate chain.
*
@@ -297,14 +297,14 @@
/**
* Stores this keystore using the given
- * <code>KeyStore.LoadStoreParmeter</code>.
+ * {@code KeyStore.LoadStoreParmeter}.
*
- * @param param the <code>KeyStore.LoadStoreParmeter</code>
+ * @param param the {@code KeyStore.LoadStoreParmeter}
* that specifies how to store the keystore,
- * which may be <code>null</code>
+ * which may be {@code null}
*
* @exception IllegalArgumentException if the given
- * <code>KeyStore.LoadStoreParmeter</code>
+ * {@code KeyStore.LoadStoreParmeter}
* input is not recognized
* @exception IOException if there was an I/O problem with data
* @exception NoSuchAlgorithmException if the appropriate data integrity
@@ -330,17 +330,17 @@
* then integrity checking is not performed.
*
* @param stream the input stream from which the keystore is loaded,
- * or <code>null</code>
+ * or {@code null}
* @param password the password used to check the integrity of
* the keystore, the password used to unlock the keystore,
- * or <code>null</code>
+ * or {@code null}
*
* @exception IOException if there is an I/O or format problem with the
* keystore data, if a password is required but not given,
* or if the given password was incorrect. If the error is due to a
* wrong password, the {@link Throwable#getCause cause} of the
- * <code>IOException</code> should be an
- * <code>UnrecoverableKeyException</code>
+ * {@code IOException} should be an
+ * {@code UnrecoverableKeyException}
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
@@ -351,24 +351,24 @@
/**
* Loads the keystore using the given
- * <code>KeyStore.LoadStoreParameter</code>.
+ * {@code KeyStore.LoadStoreParameter}.
*
* <p> Note that if this KeyStore has already been loaded, it is
* reinitialized and loaded again from the given parameter.
*
- * @param param the <code>KeyStore.LoadStoreParameter</code>
+ * @param param the {@code KeyStore.LoadStoreParameter}
* that specifies how to load the keystore,
- * which may be <code>null</code>
+ * which may be {@code null}
*
* @exception IllegalArgumentException if the given
- * <code>KeyStore.LoadStoreParameter</code>
+ * {@code KeyStore.LoadStoreParameter}
* input is not recognized
* @exception IOException if there is an I/O or format problem with the
* keystore data. If the error is due to an incorrect
- * <code>ProtectionParameter</code> (e.g. wrong password)
+ * {@code ProtectionParameter} (e.g. wrong password)
* the {@link Throwable#getCause cause} of the
- * <code>IOException</code> should be an
- * <code>UnrecoverableKeyException</code>
+ * {@code IOException} should be an
+ * {@code UnrecoverableKeyException}
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
@@ -419,25 +419,25 @@
}
/**
- * Gets a <code>KeyStore.Entry</code> for the specified alias
+ * Gets a {@code KeyStore.Entry} for the specified alias
* with the specified protection parameter.
*
- * @param alias get the <code>KeyStore.Entry</code> for this alias
- * @param protParam the <code>ProtectionParameter</code>
- * used to protect the <code>Entry</code>,
- * which may be <code>null</code>
+ * @param alias get the {@code KeyStore.Entry} for this alias
+ * @param protParam the {@code ProtectionParameter}
+ * used to protect the {@code Entry},
+ * which may be {@code null}
*
- * @return the <code>KeyStore.Entry</code> for the specified alias,
- * or <code>null</code> if there is no such entry
+ * @return the {@code KeyStore.Entry} for the specified alias,
+ * or {@code null} if there is no such entry
*
* @exception KeyStoreException if the operation failed
* @exception NoSuchAlgorithmException if the algorithm for recovering the
* entry cannot be found
* @exception UnrecoverableEntryException if the specified
- * <code>protParam</code> were insufficient or invalid
+ * {@code protParam} were insufficient or invalid
* @exception UnrecoverableKeyException if the entry is a
- * <code>PrivateKeyEntry</code> or <code>SecretKeyEntry</code>
- * and the specified <code>protParam</code> does not contain
+ * {@code PrivateKeyEntry} or {@code SecretKeyEntry}
+ * and the specified {@code protParam} does not contain
* the information needed to recover the key (e.g. wrong password)
*
* @since 1.5
@@ -484,18 +484,18 @@
}
/**
- * Saves a <code>KeyStore.Entry</code> under the specified alias.
+ * Saves a {@code KeyStore.Entry} under the specified alias.
* The specified protection parameter is used to protect the
- * <code>Entry</code>.
+ * {@code Entry}.
*
* <p> If an entry already exists for the specified alias,
* it is overridden.
*
- * @param alias save the <code>KeyStore.Entry</code> under this alias
- * @param entry the <code>Entry</code> to save
- * @param protParam the <code>ProtectionParameter</code>
- * used to protect the <code>Entry</code>,
- * which may be <code>null</code>
+ * @param alias save the {@code KeyStore.Entry} under this alias
+ * @param entry the {@code Entry} to save
+ * @param protParam the {@code ProtectionParameter}
+ * used to protect the {@code Entry},
+ * which may be {@code null}
*
* @exception KeyStoreException if this operation fails
*
@@ -560,16 +560,16 @@
}
/**
- * Determines if the keystore <code>Entry</code> for the specified
- * <code>alias</code> is an instance or subclass of the specified
- * <code>entryClass</code>.
+ * Determines if the keystore {@code Entry} for the specified
+ * {@code alias} is an instance or subclass of the specified
+ * {@code entryClass}.
*
* @param alias the alias name
* @param entryClass the entry class
*
- * @return true if the keystore <code>Entry</code> for the specified
- * <code>alias</code> is an instance or subclass of the
- * specified <code>entryClass</code>, false otherwise
+ * @return true if the keystore {@code Entry} for the specified
+ * {@code alias} is an instance or subclass of the
+ * specified {@code entryClass}, false otherwise
*
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/MessageDigest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/MessageDigest.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -48,8 +48,8 @@
* updated, one of the {@link #digest() digest} methods should
* be called to complete the hash computation.
*
- * <p>The <code>digest</code> method can be called once for a given number
- * of updates. After <code>digest</code> has been called, the MessageDigest
+ * <p>The {@code digest} method can be called once for a given number
+ * of updates. After {@code digest} has been called, the MessageDigest
* object is reset to its initialized state.
*
* <p>Implementations are free to implement the Cloneable interface.
@@ -75,18 +75,18 @@
* several instances, if the number of digests is known in advance.
*
* <p>Note that this class is abstract and extends from
- * <code>MessageDigestSpi</code> for historical reasons.
+ * {@code MessageDigestSpi} for historical reasons.
* Application developers should only take notice of the methods defined in
- * this <code>MessageDigest</code> class; all the methods in
+ * this {@code MessageDigest} class; all the methods in
* the superclass are intended for cryptographic service providers who wish to
* supply their own implementations of message digest algorithms.
*
* <p> Every implementation of the Java platform is required to support
- * the following standard <code>MessageDigest</code> algorithms:
+ * the following standard {@code MessageDigest} algorithms:
* <ul>
- * <li><tt>MD5</tt></li>
- * <li><tt>SHA-1</tt></li>
- * <li><tt>SHA-256</tt></li>
+ * <li>{@code MD5}</li>
+ * <li>{@code SHA-1}</li>
+ * <li>{@code SHA-256}</li>
* </ul>
* These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#MessageDigest">
@@ -301,7 +301,7 @@
* @param offset the offset to start from in the array of bytes.
*
* @param len the number of bytes to use, starting at
- * <code>offset</code>.
+ * {@code offset}.
*/
public void update(byte[] input, int offset, int len) {
if (input == null) {
@@ -326,8 +326,8 @@
/**
* Update the digest using the specified ByteBuffer. The digest is
- * updated using the <code>input.remaining()</code> bytes starting
- * at <code>input.position()</code>.
+ * updated using the {@code input.remaining()} bytes starting
+ * at {@code input.position()}.
* Upon return, the buffer's position will be equal to its limit;
* its limit will not have changed.
*
@@ -365,7 +365,7 @@
*
* @param len number of bytes within buf allotted for the digest
*
- * @return the number of bytes placed into <code>buf</code>
+ * @return the number of bytes placed into {@code buf}
*
* @exception DigestException if an error occurs.
*/
@@ -386,7 +386,7 @@
* Performs a final update on the digest using the specified array
* of bytes, then completes the digest computation. That is, this
* method first calls {@link #update(byte[]) update(input)},
- * passing the <i>input</i> array to the <code>update</code> method,
+ * passing the <i>input</i> array to the {@code update} method,
* then calls {@link #digest() digest()}.
*
* @param input the input to be updated before the digest is
@@ -492,7 +492,7 @@
* @return a clone if the implementation is cloneable.
*
* @exception CloneNotSupportedException if this is called on an
- * implementation that does not support <code>Cloneable</code>.
+ * implementation that does not support {@code Cloneable}.
*/
public Object clone() throws CloneNotSupportedException {
if (this instanceof Cloneable) {
@@ -536,7 +536,7 @@
* @return a clone if the delegate is cloneable.
*
* @exception CloneNotSupportedException if this is called on a
- * delegate that does not support <code>Cloneable</code>.
+ * delegate that does not support {@code Cloneable}.
*/
public Object clone() throws CloneNotSupportedException {
if (digestSpi instanceof Cloneable) {
--- a/jdk/src/share/classes/java/security/MessageDigestSpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/MessageDigestSpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -31,7 +31,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>MessageDigest</code> class, which provides the functionality
+ * for the {@code MessageDigest} class, which provides the functionality
* of a message digest algorithm, such as MD5 or SHA. Message digests are
* secure one-way hash functions that take arbitrary-sized data and output a
* fixed-length hash value.
@@ -88,14 +88,14 @@
* @param offset the offset to start from in the array of bytes.
*
* @param len the number of bytes to use, starting at
- * <code>offset</code>.
+ * {@code offset}.
*/
protected abstract void engineUpdate(byte[] input, int offset, int len);
/**
* Update the digest using the specified ByteBuffer. The digest is
- * updated using the <code>input.remaining()</code> bytes starting
- * at <code>input.position()</code>.
+ * updated using the {@code input.remaining()} bytes starting
+ * at {@code input.position()}.
* Upon return, the buffer's position will be equal to its limit;
* its limit will not have changed.
*
@@ -130,7 +130,7 @@
/**
* Completes the hash computation by performing final
- * operations such as padding. Once <code>engineDigest</code> has
+ * operations such as padding. Once {@code engineDigest} has
* been called, the engine should be reset (see
* {@link #engineReset() engineReset}).
* Resetting is the responsibility of the
@@ -142,7 +142,7 @@
/**
* Completes the hash computation by performing final
- * operations such as padding. Once <code>engineDigest</code> has
+ * operations such as padding. Once {@code engineDigest} has
* been called, the engine should be reset (see
* {@link #engineReset() engineReset}).
* Resetting is the responsibility of the
@@ -194,7 +194,7 @@
* @return a clone if the implementation is cloneable.
*
* @exception CloneNotSupportedException if this is called on an
- * implementation that does not support <code>Cloneable</code>.
+ * implementation that does not support {@code Cloneable}.
*/
public Object clone() throws CloneNotSupportedException {
if (this instanceof Cloneable) {
--- a/jdk/src/share/classes/java/security/NoSuchAlgorithmException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/NoSuchAlgorithmException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -58,13 +58,13 @@
}
/**
- * Creates a <code>NoSuchAlgorithmException</code> with the specified
+ * Creates a {@code NoSuchAlgorithmException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -73,13 +73,13 @@
}
/**
- * Creates a <code>NoSuchAlgorithmException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code NoSuchAlgorithmException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/Permission.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/Permission.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -33,17 +33,17 @@
*
* <p>Most Permission objects also include an "actions" list that tells the actions
* that are permitted for the object. For example,
- * for a <code>java.io.FilePermission</code> object, the permission name is
+ * for a {@code java.io.FilePermission} object, the permission name is
* the pathname of a file (or directory), and the actions list
* (such as "read, write") specifies which actions are granted for the
* specified file (or for files in the specified directory).
* The actions list is optional for Permission objects, such as
- * <code>java.lang.RuntimePermission</code>,
+ * {@code java.lang.RuntimePermission},
* that don't need such a list; you either have the named permission (such
* as "system.exit") or you don't.
*
* <p>An important method that must be implemented by each subclass is
- * the <code>implies</code> method to compare Permissions. Basically,
+ * the {@code implies} method to compare Permissions. Basically,
* "permission p1 implies permission p2" means that
* if one is granted permission p1, one is naturally granted permission p2.
* Thus, this is not an equality test, but rather more of a
@@ -81,7 +81,7 @@
/**
* Implements the guard interface for a permission. The
- * <code>SecurityManager.checkPermission</code> method is called,
+ * {@code SecurityManager.checkPermission} method is called,
* passing this permission object as the permission to check.
* Returns silently if access is granted. Otherwise, throws
* a SecurityException.
@@ -90,7 +90,7 @@
*
* @throws SecurityException
* if a security manager exists and its
- * <code>checkPermission</code> method doesn't allow access.
+ * {@code checkPermission} method doesn't allow access.
*
* @see Guard
* @see GuardedObject
@@ -109,7 +109,7 @@
* This must be implemented by subclasses of Permission, as they are the
* only ones that can impose semantics on a Permission object.
*
- * <p>The <code>implies</code> method is used by the AccessController to determine
+ * <p>The {@code implies} method is used by the AccessController to determine
* whether or not a requested permission is implied by another permission that
* is known to be valid in the current execution context.
*
@@ -124,8 +124,8 @@
/**
* Checks two Permission objects for equality.
* <P>
- * Do not use the <code>equals</code> method for making access control
- * decisions; use the <code>implies</code> method.
+ * Do not use the {@code equals} method for making access control
+ * decisions; use the {@code implies} method.
*
* @param obj the object we are testing for equality with this object.
*
@@ -137,18 +137,18 @@
/**
* Returns the hash code value for this Permission object.
* <P>
- * The required <code>hashCode</code> behavior for Permission Objects is
+ * The required {@code hashCode} behavior for Permission Objects is
* the following: <p>
* <ul>
* <li>Whenever it is invoked on the same Permission object more than
* once during an execution of a Java application, the
- * <code>hashCode</code> method
+ * {@code hashCode} method
* must consistently return the same integer. This integer need not
* remain consistent from one execution of an application to another
* execution of the same application. <p>
* <li>If two Permission objects are equal according to the
- * <code>equals</code>
- * method, then calling the <code>hashCode</code> method on each of the
+ * {@code equals}
+ * method, then calling the {@code hashCode} method on each of the
* two Permission objects must produce the same integer result.
* </ul>
*
@@ -159,7 +159,7 @@
/**
* Returns the name of this Permission.
- * For example, in the case of a <code>java.io.FilePermission</code>,
+ * For example, in the case of a {@code java.io.FilePermission},
* the name will be a pathname.
*
* @return the name of this Permission.
@@ -184,7 +184,7 @@
* </pre>
*
* both return
- * "read,write" when the <code>getActions</code> method is invoked.
+ * "read,write" when the {@code getActions} method is invoked.
*
* @return the actions of this Permission.
*
@@ -197,7 +197,7 @@
* one is not defined. Subclasses of class Permission should
* override this if they need to store their permissions in a particular
* PermissionCollection object in order to provide the correct semantics
- * when the <code>PermissionCollection.implies</code> method is called.
+ * when the {@code PermissionCollection.implies} method is called.
* If null is returned,
* then the caller of this method is free to store permissions of this
* type in any PermissionCollection they choose (one that uses a Hashtable,
--- a/jdk/src/share/classes/java/security/PermissionCollection.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/PermissionCollection.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -32,29 +32,29 @@
*
* <p>With a PermissionCollection, you can:
* <UL>
- * <LI> add a permission to the collection using the <code>add</code> method.
+ * <LI> add a permission to the collection using the {@code add} method.
* <LI> check to see if a particular permission is implied in the
- * collection, using the <code>implies</code> method.
- * <LI> enumerate all the permissions, using the <code>elements</code> method.
+ * collection, using the {@code implies} method.
+ * <LI> enumerate all the permissions, using the {@code elements} method.
* </UL>
* <P>
*
* <p>When it is desirable to group together a number of Permission objects
- * of the same type, the <code>newPermissionCollection</code> method on that
+ * of the same type, the {@code newPermissionCollection} method on that
* particular type of Permission object should first be called. The default
* behavior (from the Permission class) is to simply return null.
* Subclasses of class Permission override the method if they need to store
* their permissions in a particular PermissionCollection object in order
* to provide the correct semantics when the
- * <code>PermissionCollection.implies</code> method is called.
+ * {@code PermissionCollection.implies} method is called.
* If a non-null value is returned, that PermissionCollection must be used.
- * If null is returned, then the caller of <code>newPermissionCollection</code>
+ * If null is returned, then the caller of {@code newPermissionCollection}
* is free to store permissions of the
* given type in any PermissionCollection they choose
* (one that uses a Hashtable, one that uses a Vector, etc).
*
* <p>The PermissionCollection returned by the
- * <code>Permission.newPermissionCollection</code>
+ * {@code Permission.newPermissionCollection}
* method is a homogeneous collection, which stores only Permission objects
* for a given Permission type. A PermissionCollection may also be
* heterogeneous. For example, Permissions is a PermissionCollection
@@ -62,16 +62,16 @@
* That is, its members are each a homogeneous PermissionCollection.
* For example, a Permissions object might have a FilePermissionCollection
* for all the FilePermission objects, a SocketPermissionCollection for all the
- * SocketPermission objects, and so on. Its <code>add</code> method adds a
+ * SocketPermission objects, and so on. Its {@code add} method adds a
* permission to the appropriate collection.
*
* <p>Whenever a permission is added to a heterogeneous PermissionCollection
* such as Permissions, and the PermissionCollection doesn't yet contain a
* PermissionCollection of the specified permission's type, the
* PermissionCollection should call
- * the <code>newPermissionCollection</code> method on the permission's class
+ * the {@code newPermissionCollection} method on the permission's class
* to see if it requires a special PermissionCollection. If
- * <code>newPermissionCollection</code>
+ * {@code newPermissionCollection}
* returns null, the PermissionCollection
* is free to store the permission in any type of PermissionCollection it
* desires (one using a Hashtable, one using a Vector, etc.). For example,
@@ -81,7 +81,7 @@
* <p> Subclass implementations of PermissionCollection should assume
* that they may be called simultaneously from multiple threads,
* and therefore should be synchronized properly. Furthermore,
- * Enumerations returned via the <code>elements</code> method are
+ * Enumerations returned via the {@code elements} method are
* not <em>fail-fast</em>. Modifications to a collection should not be
* performed while enumerating over that collection.
*
@@ -134,7 +134,7 @@
* Marks this PermissionCollection object as "readonly". After
* a PermissionCollection object
* is marked as readonly, no new Permission objects can be added to it
- * using <code>add</code>.
+ * using {@code add}.
*/
public void setReadOnly() {
readOnly = true;
@@ -143,10 +143,10 @@
/**
* Returns true if this PermissionCollection object is marked as readonly.
* If it is readonly, no new Permission objects can be added to it
- * using <code>add</code>.
+ * using {@code add}.
*
* <p>By default, the object is <i>not</i> readonly. It can be set to
- * readonly by a call to <code>setReadOnly</code>.
+ * readonly by a call to {@code setReadOnly}.
*
* @return true if this PermissionCollection object is marked as readonly,
* false otherwise.
@@ -166,7 +166,7 @@
* // one per line..
* )</pre>
*
- * <code>super.toString</code> is a call to the <code>toString</code>
+ * {@code super.toString} is a call to the {@code toString}
* method of this
* object's superclass, which is Object. The result is
* this PermissionCollection's type name followed by this object's
--- a/jdk/src/share/classes/java/security/Permissions.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/Permissions.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -44,26 +44,26 @@
* This class represents a heterogeneous collection of Permissions. That is,
* it contains different types of Permission objects, organized into
* PermissionCollections. For example, if any
- * <code>java.io.FilePermission</code> objects are added to an instance of
+ * {@code java.io.FilePermission} objects are added to an instance of
* this class, they are all stored in a single
* PermissionCollection. It is the PermissionCollection returned by a call to
- * the <code>newPermissionCollection</code> method in the FilePermission class.
- * Similarly, any <code>java.lang.RuntimePermission</code> objects are
+ * the {@code newPermissionCollection} method in the FilePermission class.
+ * Similarly, any {@code java.lang.RuntimePermission} objects are
* stored in the PermissionCollection returned by a call to the
- * <code>newPermissionCollection</code> method in the
+ * {@code newPermissionCollection} method in the
* RuntimePermission class. Thus, this class represents a collection of
* PermissionCollections.
*
- * <p>When the <code>add</code> method is called to add a Permission, the
+ * <p>When the {@code add} method is called to add a Permission, the
* Permission is stored in the appropriate PermissionCollection. If no such
* collection exists yet, the Permission object's class is determined and the
- * <code>newPermissionCollection</code> method is called on that class to create
+ * {@code newPermissionCollection} method is called on that class to create
* the PermissionCollection and add it to the Permissions object. If
- * <code>newPermissionCollection</code> returns null, then a default
+ * {@code newPermissionCollection} returns null, then a default
* PermissionCollection that uses a hashtable will be created and used. Each
* hashtable entry stores a Permission object as both the key and the value.
*
- * <p> Enumerations returned via the <code>elements</code> method are
+ * <p> Enumerations returned via the {@code elements} method are
* not <em>fail-fast</em>. Modifications to a collection should not be
* performed while enumerating over that collection.
*
@@ -155,9 +155,9 @@
* "read" access for all files in all subdirectories of the "/tmp"
* directory, and another FilePermission that specifies "write" access
* for all files in the "/tmp/scratch/foo" directory.
- * Then if the <code>implies</code> method
+ * Then if the {@code implies} method
* is called with a permission specifying both "read" and "write" access
- * to files in the "/tmp/scratch/foo" directory, <code>true</code> is
+ * to files in the "/tmp/scratch/foo" directory, {@code true} is
* returned.
*
* <p>Additionally, if this PermissionCollection contains the
@@ -214,11 +214,11 @@
* If createEmpty is true,
* this method creates a new PermissionCollection object for the specified
* type of permission objects if one does not yet exist.
- * To do so, it first calls the <code>newPermissionCollection</code> method
+ * To do so, it first calls the {@code newPermissionCollection} method
* on <i>p</i>. Subclasses of class Permission
* override that method if they need to store their permissions in a
* particular PermissionCollection object in order to provide the
- * correct semantics when the <code>PermissionCollection.implies</code>
+ * correct semantics when the {@code PermissionCollection.implies}
* method is called.
* If the call returns a PermissionCollection, that collection is stored
* in this Permissions object. If the call returns null and createEmpty
--- a/jdk/src/share/classes/java/security/Policy.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/Policy.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -41,11 +41,11 @@
*
* <p> There is only one Policy object installed in the runtime at any
* given time. A Policy object can be installed by calling the
- * <code>setPolicy</code> method. The installed Policy object can be
- * obtained by calling the <code>getPolicy</code> method.
+ * {@code setPolicy} method. The installed Policy object can be
+ * obtained by calling the {@code getPolicy} method.
*
* <p> If no Policy object has been installed in the runtime, a call to
- * <code>getPolicy</code> installs an instance of the default Policy
+ * {@code getPolicy} installs an instance of the default Policy
* implementation (a default subclass implementation of this abstract class).
* The default Policy implementation can be changed by setting the value
* of the {@code policy.provider} security property to the fully qualified
@@ -53,26 +53,26 @@
*
* <p> Application code can directly subclass Policy to provide a custom
* implementation. In addition, an instance of a Policy object can be
- * constructed by invoking one of the <code>getInstance</code> factory methods
+ * constructed by invoking one of the {@code getInstance} factory methods
* with a standard type. The default policy type is "JavaPolicy".
*
* <p> Once a Policy instance has been installed (either by default, or by
- * calling <code>setPolicy</code>), the Java runtime invokes its
- * <code>implies</code> method when it needs to
+ * calling {@code setPolicy}), the Java runtime invokes its
+ * {@code implies} method when it needs to
* determine whether executing code (encapsulated in a ProtectionDomain)
* can perform SecurityManager-protected operations. How a Policy object
* retrieves its policy data is up to the Policy implementation itself.
* The policy data may be stored, for example, in a flat ASCII file,
* in a serialized binary file of the Policy class, or in a database.
*
- * <p> The <code>refresh</code> method causes the policy object to
+ * <p> The {@code refresh} method causes the policy object to
* refresh/reload its data. This operation is implementation-dependent.
* For example, if the policy object stores its data in configuration files,
- * calling <code>refresh</code> will cause it to re-read the configuration
+ * calling {@code refresh} will cause it to re-read the configuration
* policy files. If a refresh operation is not supported, this method does
* nothing. Note that refreshed policy may not have an effect on classes
* in a particular ProtectionDomain. This is dependent on the Policy
- * provider's implementation of the <code>implies</code>
+ * provider's implementation of the {@code implies}
* method and its PermissionCollection caching strategy.
*
* @author Roland Schemers
@@ -130,17 +130,17 @@
/**
* Returns the installed Policy object. This value should not be cached,
- * as it may be changed by a call to <code>setPolicy</code>.
+ * as it may be changed by a call to {@code setPolicy}.
* This method first calls
- * <code>SecurityManager.checkPermission</code> with a
- * <code>SecurityPermission("getPolicy")</code> permission
+ * {@code SecurityManager.checkPermission} with a
+ * {@code SecurityPermission("getPolicy")} permission
* to ensure it's ok to get the Policy object.
*
* @return the installed Policy.
*
* @throws SecurityException
* if a security manager exists and its
- * <code>checkPermission</code> method doesn't allow
+ * {@code checkPermission} method doesn't allow
* getting the Policy object.
*
* @see SecurityManager#checkPermission(Permission)
@@ -246,15 +246,15 @@
/**
* Sets the system-wide Policy object. This method first calls
- * <code>SecurityManager.checkPermission</code> with a
- * <code>SecurityPermission("setPolicy")</code>
+ * {@code SecurityManager.checkPermission} with a
+ * {@code SecurityPermission("setPolicy")}
* permission to ensure it's ok to set the Policy.
*
* @param p the new system Policy object.
*
* @throws SecurityException
* if a security manager exists and its
- * <code>checkPermission</code> method doesn't allow
+ * {@code checkPermission} method doesn't allow
* setting the Policy.
*
* @see SecurityManager#checkPermission(Permission)
@@ -536,7 +536,7 @@
* Return the Provider of this Policy.
*
* <p> This Policy instance will only have a Provider if it
- * was obtained via a call to <code>Policy.getInstance</code>.
+ * was obtained via a call to {@code Policy.getInstance}.
* Otherwise this method returns null.
*
* @return the Provider of this Policy, or null.
@@ -551,7 +551,7 @@
* Return the type of this Policy.
*
* <p> This Policy instance will only have a type if it
- * was obtained via a call to <code>Policy.getInstance</code>.
+ * was obtained via a call to {@code Policy.getInstance}.
* Otherwise this method returns null.
*
* @return the type of this Policy, or null.
@@ -566,7 +566,7 @@
* Return Policy parameters.
*
* <p> This Policy instance will only have parameters if it
- * was obtained via a call to <code>Policy.getInstance</code>.
+ * was obtained via a call to {@code Policy.getInstance}.
* Otherwise this method returns null.
*
* @return Policy parameters, or null.
@@ -583,10 +583,10 @@
*
* <p> Applications are discouraged from calling this method
* since this operation may not be supported by all policy implementations.
- * Applications should solely rely on the <code>implies</code> method
+ * Applications should solely rely on the {@code implies} method
* to perform policy checks. If an application absolutely must call
* a getPermissions method, it should call
- * <code>getPermissions(ProtectionDomain)</code>.
+ * {@code getPermissions(ProtectionDomain)}.
*
* <p> The default implementation of this method returns
* Policy.UNSUPPORTED_EMPTY_COLLECTION. This method can be
@@ -613,15 +613,15 @@
*
* <p> Applications are discouraged from calling this method
* since this operation may not be supported by all policy implementations.
- * Applications should rely on the <code>implies</code> method
+ * Applications should rely on the {@code implies} method
* to perform policy checks.
*
* <p> The default implementation of this method first retrieves
- * the permissions returned via <code>getPermissions(CodeSource)</code>
+ * the permissions returned via {@code getPermissions(CodeSource)}
* (the CodeSource is taken from the specified ProtectionDomain),
* as well as the permissions located inside the specified ProtectionDomain.
* All of these permissions are then combined and returned in a new
- * PermissionCollection object. If <code>getPermissions(CodeSource)</code>
+ * PermissionCollection object. If {@code getPermissions(CodeSource)}
* returns Policy.UNSUPPORTED_EMPTY_COLLECTION, then this method
* returns the permissions contained inside the specified ProtectionDomain
* in a new PermissionCollection object.
@@ -733,7 +733,7 @@
/**
* Refreshes/reloads the policy configuration. The behavior of this method
- * depends on the implementation. For example, calling <code>refresh</code>
+ * depends on the implementation. For example, calling {@code refresh}
* on a file-based policy will cause the file to be re-read.
*
* <p> The default implementation of this method does nothing.
@@ -794,8 +794,8 @@
/**
* This class represents a read-only empty PermissionCollection object that
- * is returned from the <code>getPermissions(CodeSource)</code> and
- * <code>getPermissions(ProtectionDomain)</code>
+ * is returned from the {@code getPermissions(CodeSource)} and
+ * {@code getPermissions(ProtectionDomain)}
* methods in the Policy class when those operations are not
* supported by the Policy implementation.
*/
--- a/jdk/src/share/classes/java/security/PolicySpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/PolicySpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -28,15 +28,15 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>Policy</code> class.
+ * for the {@code Policy} class.
* All the abstract methods in this class must be implemented by each
* service provider who wishes to supply a Policy implementation.
*
* <p> Subclass implementations of this abstract class must provide
- * a public constructor that takes a <code>Policy.Parameters</code>
+ * a public constructor that takes a {@code Policy.Parameters}
* object as an input parameter. This constructor also must throw
* an IllegalArgumentException if it does not understand the
- * <code>Policy.Parameters</code> input.
+ * {@code Policy.Parameters} input.
*
*
* @since 1.6
@@ -59,7 +59,7 @@
/**
* Refreshes/reloads the policy configuration. The behavior of this method
- * depends on the implementation. For example, calling <code>refresh</code>
+ * depends on the implementation. For example, calling {@code refresh}
* on a file-based policy will cause the file to be re-read.
*
* <p> The default implementation of this method does nothing.
--- a/jdk/src/share/classes/java/security/PrivilegedAction.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/PrivilegedAction.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -28,10 +28,10 @@
/**
* A computation to be performed with privileges enabled. The computation is
- * performed by invoking <code>AccessController.doPrivileged</code> on the
- * <code>PrivilegedAction</code> object. This interface is used only for
+ * performed by invoking {@code AccessController.doPrivileged} on the
+ * {@code PrivilegedAction} object. This interface is used only for
* computations that do not throw checked exceptions; computations that
- * throw checked exceptions must use <code>PrivilegedExceptionAction</code>
+ * throw checked exceptions must use {@code PrivilegedExceptionAction}
* instead.
*
* @see AccessController
@@ -42,11 +42,11 @@
public interface PrivilegedAction<T> {
/**
* Performs the computation. This method will be called by
- * <code>AccessController.doPrivileged</code> after enabling privileges.
+ * {@code AccessController.doPrivileged} after enabling privileges.
*
* @return a class-dependent value that may represent the results of the
* computation. Each class that implements
- * <code>PrivilegedAction</code>
+ * {@code PrivilegedAction}
* should document what (if anything) this value represents.
* @see AccessController#doPrivileged(PrivilegedAction)
* @see AccessController#doPrivileged(PrivilegedAction,
--- a/jdk/src/share/classes/java/security/PrivilegedActionException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/PrivilegedActionException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -27,13 +27,13 @@
/**
* This exception is thrown by
- * <code>doPrivileged(PrivilegedExceptionAction)</code> and
- * <code>doPrivileged(PrivilegedExceptionAction,
- * AccessControlContext context)</code> to indicate
+ * {@code doPrivileged(PrivilegedExceptionAction)} and
+ * {@code doPrivileged(PrivilegedExceptionAction,
+ * AccessControlContext context)} to indicate
* that the action being performed threw a checked exception. The exception
* thrown by the action can be obtained by calling the
- * <code>getException</code> method. In effect, an
- * <code>PrivilegedActionException</code> is a "wrapper"
+ * {@code getException} method. In effect, an
+ * {@code PrivilegedActionException} is a "wrapper"
* for an exception thrown by a privileged action.
*
* <p>As of release 1.4, this exception has been retrofitted to conform to
@@ -69,14 +69,14 @@
/**
* Returns the exception thrown by the privileged computation that
- * resulted in this <code>PrivilegedActionException</code>.
+ * resulted in this {@code PrivilegedActionException}.
*
* <p>This method predates the general-purpose exception chaining facility.
* The {@link Throwable#getCause()} method is now the preferred means of
* obtaining this information.
*
* @return the exception thrown by the privileged computation that
- * resulted in this <code>PrivilegedActionException</code>.
+ * resulted in this {@code PrivilegedActionException}.
* @see PrivilegedExceptionAction
* @see AccessController#doPrivileged(PrivilegedExceptionAction)
* @see AccessController#doPrivileged(PrivilegedExceptionAction,
@@ -89,7 +89,7 @@
/**
* Returns the cause of this exception (the exception thrown by
* the privileged computation that resulted in this
- * <code>PrivilegedActionException</code>).
+ * {@code PrivilegedActionException}).
*
* @return the cause of this exception.
* @since 1.4
--- a/jdk/src/share/classes/java/security/PrivilegedExceptionAction.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/PrivilegedExceptionAction.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -29,11 +29,11 @@
/**
* A computation to be performed with privileges enabled, that throws one or
* more checked exceptions. The computation is performed by invoking
- * <code>AccessController.doPrivileged</code> on the
- * <code>PrivilegedExceptionAction</code> object. This interface is
+ * {@code AccessController.doPrivileged} on the
+ * {@code PrivilegedExceptionAction} object. This interface is
* used only for computations that throw checked exceptions;
* computations that do not throw
- * checked exceptions should use <code>PrivilegedAction</code> instead.
+ * checked exceptions should use {@code PrivilegedAction} instead.
*
* @see AccessController
* @see AccessController#doPrivileged(PrivilegedExceptionAction)
@@ -45,14 +45,14 @@
public interface PrivilegedExceptionAction<T> {
/**
* Performs the computation. This method will be called by
- * <code>AccessController.doPrivileged</code> after enabling privileges.
+ * {@code AccessController.doPrivileged} after enabling privileges.
*
* @return a class-dependent value that may represent the results of the
* computation. Each class that implements
- * <code>PrivilegedExceptionAction</code> should document what
+ * {@code PrivilegedExceptionAction} should document what
* (if anything) this value represents.
* @throws Exception an exceptional condition has occurred. Each class
- * that implements <code>PrivilegedExceptionAction</code> should
+ * that implements {@code PrivilegedExceptionAction} should
* document the exceptions that its run method can throw.
* @see AccessController#doPrivileged(PrivilegedExceptionAction)
* @see AccessController#doPrivileged(PrivilegedExceptionAction,AccessControlContext)
--- a/jdk/src/share/classes/java/security/ProtectionDomain.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/ProtectionDomain.java Tue Jul 02 15:23:23 2013 -0700
@@ -119,7 +119,7 @@
/**
* Creates a new ProtectionDomain with the given CodeSource and
* Permissions. If the permissions object is not null, then
- * <code>setReadOnly())</code> will be called on the passed in
+ * {@code setReadOnly())} will be called on the passed in
* Permissions object. The only permissions granted to this domain
* are the ones specified; the current Policy will not be consulted.
*
@@ -145,7 +145,7 @@
/**
* Creates a new ProtectionDomain qualified by the given CodeSource,
* Permissions, ClassLoader and array of Principals. If the
- * permissions object is not null, then <code>setReadOnly()</code>
+ * permissions object is not null, then {@code setReadOnly()}
* will be called on the passed in Permissions object.
* The permissions granted to this domain are dynamic; they include
* both the static permissions passed to this constructor, and any
@@ -155,7 +155,7 @@
* This constructor is typically used by
* {@link SecureClassLoader ClassLoaders}
* and {@link DomainCombiner DomainCombiners} which delegate to
- * <code>Policy</code> to actively associate the permissions granted to
+ * {@code Policy} to actively associate the permissions granted to
* this domain. This constructor affords the
* Policy provider the opportunity to augment the supplied
* PermissionCollection to reflect policy changes.
--- a/jdk/src/share/classes/java/security/Provider.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/Provider.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -62,20 +62,21 @@
* security token. A {@link ProviderException} should be used to indicate
* such errors.
*
- * <p>The service type <code>Provider</code> is reserved for use by the
+ * <p>The service type {@code Provider} is reserved for use by the
* security framework. Services of this type cannot be added, removed,
* or modified by applications.
* The following attributes are automatically placed in each Provider object:
* <table cellspacing=4>
+ * <caption><b>Attributes Automatically Placed in a Provider Object</b></caption>
* <tr><th>Name</th><th>Value</th>
- * <tr><td><code>Provider.id name</code></td>
- * <td><code>String.valueOf(provider.getName())</code></td>
- * <tr><td><code>Provider.id version</code></td>
- * <td><code>String.valueOf(provider.getVersion())</code></td>
- * <tr><td><code>Provider.id info</code></td>
- <td><code>String.valueOf(provider.getInfo())</code></td>
- * <tr><td><code>Provider.id className</code></td>
- * <td><code>provider.getClass().getName()</code></td>
+ * <tr><td>{@code Provider.id name}</td>
+ * <td>{@code String.valueOf(provider.getName())}</td>
+ * <tr><td>{@code Provider.id version}</td>
+ * <td>{@code String.valueOf(provider.getVersion())}</td>
+ * <tr><td>{@code Provider.id info}</td>
+ <td>{@code String.valueOf(provider.getInfo())}</td>
+ * <tr><td>{@code Provider.id className}</td>
+ * <td>{@code provider.getClass().getName()}</td>
* </table>
*
* @author Benjamin Renaud
@@ -185,18 +186,18 @@
* used to look up facilities implemented by the provider.
*
* <p>First, if there is a security manager, its
- * <code>checkSecurityAccess</code> method is called with the string
- * <code>"clearProviderProperties."+name</code> (where <code>name</code>
+ * {@code checkSecurityAccess} method is called with the string
+ * {@code "clearProviderProperties."+name} (where {@code name}
* is the provider name) to see if it's ok to clear this provider.
- * If the default implementation of <code>checkSecurityAccess</code>
+ * If the default implementation of {@code checkSecurityAccess}
* is used (that is, that method is not overriden), then this results in
- * a call to the security manager's <code>checkPermission</code> method
- * with a <code>SecurityPermission("clearProviderProperties."+name)</code>
+ * a call to the security manager's {@code checkPermission} method
+ * with a {@code SecurityPermission("clearProviderProperties."+name)}
* permission.
*
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkSecurityAccess}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkSecurityAccess} method
* denies access to clear this provider
*
* @since 1.2
@@ -292,17 +293,17 @@
}
/**
- * Sets the <code>key</code> property to have the specified
- * <code>value</code>.
+ * Sets the {@code key} property to have the specified
+ * {@code value}.
*
* <p>First, if there is a security manager, its
- * <code>checkSecurityAccess</code> method is called with the string
- * <code>"putProviderProperty."+name</code>, where <code>name</code> is the
+ * {@code checkSecurityAccess} method is called with the string
+ * {@code "putProviderProperty."+name}, where {@code name} is the
* provider name, to see if it's ok to set this provider's property values.
- * If the default implementation of <code>checkSecurityAccess</code>
+ * If the default implementation of {@code checkSecurityAccess}
* is used (that is, that method is not overriden), then this results in
- * a call to the security manager's <code>checkPermission</code> method
- * with a <code>SecurityPermission("putProviderProperty."+name)</code>
+ * a call to the security manager's {@code checkPermission} method
+ * with a {@code SecurityPermission("putProviderProperty."+name)}
* permission.
*
* @param key the property key.
@@ -310,11 +311,11 @@
* @param value the property value.
*
* @return the previous value of the specified property
- * (<code>key</code>), or null if it did not have one.
+ * ({@code key}), or null if it did not have one.
*
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkSecurityAccess}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkSecurityAccess} method
* denies access to set property values.
*
* @since 1.2
@@ -329,18 +330,18 @@
}
/**
- * Removes the <code>key</code> property (and its corresponding
- * <code>value</code>).
+ * Removes the {@code key} property (and its corresponding
+ * {@code value}).
*
* <p>First, if there is a security manager, its
- * <code>checkSecurityAccess</code> method is called with the string
- * <code>"removeProviderProperty."+name</code>, where <code>name</code> is
+ * {@code checkSecurityAccess} method is called with the string
+ * {@code "removeProviderProperty."+name}, where {@code name} is
* the provider name, to see if it's ok to remove this provider's
* properties. If the default implementation of
- * <code>checkSecurityAccess</code> is used (that is, that method is not
+ * {@code checkSecurityAccess} is used (that is, that method is not
* overriden), then this results in a call to the security manager's
- * <code>checkPermission</code> method with a
- * <code>SecurityPermission("removeProviderProperty."+name)</code>
+ * {@code checkPermission} method with a
+ * {@code SecurityPermission("removeProviderProperty."+name)}
* permission.
*
* @param key the key for the property to be removed.
@@ -349,8 +350,8 @@
* or null if the key did not have a mapping.
*
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkSecurityAccess}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkSecurityAccess} method
* denies access to remove this provider's properties.
*
* @since 1.2
@@ -662,9 +663,9 @@
* the service added via {@link #putService putService()} is returned.
*
* @param type the type of {@link Service service} requested
- * (for example, <code>MessageDigest</code>)
+ * (for example, {@code MessageDigest})
* @param algorithm the case insensitive algorithm name (or alternate
- * alias) of the service requested (for example, <code>SHA-1</code>)
+ * alias) of the service requested (for example, {@code SHA-1})
*
* @return the service describing this Provider's matching service
* or null if no such service exists
@@ -739,20 +740,20 @@
* Java Cryptography Architecture API Specification & Reference </a>.
*
* <p>Also, if there is a security manager, its
- * <code>checkSecurityAccess</code> method is called with the string
- * <code>"putProviderProperty."+name</code>, where <code>name</code> is
+ * {@code checkSecurityAccess} method is called with the string
+ * {@code "putProviderProperty."+name}, where {@code name} is
* the provider name, to see if it's ok to set this provider's property
- * values. If the default implementation of <code>checkSecurityAccess</code>
+ * values. If the default implementation of {@code checkSecurityAccess}
* is used (that is, that method is not overriden), then this results in
- * a call to the security manager's <code>checkPermission</code> method with
- * a <code>SecurityPermission("putProviderProperty."+name)</code>
+ * a call to the security manager's {@code checkPermission} method with
+ * a {@code SecurityPermission("putProviderProperty."+name)}
* permission.
*
* @param s the Service to add
*
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkSecurityAccess}</code> method denies
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkSecurityAccess} method denies
* access to set property values.
* @throws NullPointerException if s is null
*
@@ -830,21 +831,21 @@
* from this provider's Hashtable.
*
* <p>Also, if there is a security manager, its
- * <code>checkSecurityAccess</code> method is called with the string
- * <code>"removeProviderProperty."+name</code>, where <code>name</code> is
+ * {@code checkSecurityAccess} method is called with the string
+ * {@code "removeProviderProperty."+name}, where {@code name} is
* the provider name, to see if it's ok to remove this provider's
* properties. If the default implementation of
- * <code>checkSecurityAccess</code> is used (that is, that method is not
+ * {@code checkSecurityAccess} is used (that is, that method is not
* overriden), then this results in a call to the security manager's
- * <code>checkPermission</code> method with a
- * <code>SecurityPermission("removeProviderProperty."+name)</code>
+ * {@code checkPermission} method with a
+ * {@code SecurityPermission("removeProviderProperty."+name)}
* permission.
*
* @param s the Service to be removed
*
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkSecurityAccess}</code> method denies
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkSecurityAccess} method denies
* access to remove this provider's properties.
* @throws NullPointerException if s is null
*
@@ -1122,7 +1123,7 @@
}
/**
- * Get the type of this service. For example, <code>MessageDigest</code>.
+ * Get the type of this service. For example, {@code MessageDigest}.
*
* @return the type of this service
*/
@@ -1132,7 +1133,7 @@
/**
* Return the name of the algorithm of this service. For example,
- * <code>SHA-1</code>.
+ * {@code SHA-1}.
*
* @return the algorithm of this service
*/
--- a/jdk/src/share/classes/java/security/ProviderException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/ProviderException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -58,13 +58,13 @@
}
/**
- * Creates a <code>ProviderException</code> with the specified
+ * Creates a {@code ProviderException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -73,13 +73,13 @@
}
/**
- * Creates a <code>ProviderException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code ProviderException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/PublicKey.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/PublicKey.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -32,7 +32,7 @@
*
* Note: The specialized public key interfaces extend this interface.
* See, for example, the DSAPublicKey interface in
- * <code>java.security.interfaces</code>.
+ * {@code java.security.interfaces}.
*
* @see Key
* @see PrivateKey
--- a/jdk/src/share/classes/java/security/SecureClassLoader.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/SecureClassLoader.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -63,12 +63,12 @@
* class loader for delegation.
*
* <p>If there is a security manager, this method first
- * calls the security manager's <code>checkCreateClassLoader</code>
+ * calls the security manager's {@code checkCreateClassLoader}
* method to ensure creation of a class loader is allowed.
* <p>
* @param parent the parent ClassLoader
* @exception SecurityException if a security manager exists and its
- * <code>checkCreateClassLoader</code> method doesn't allow
+ * {@code checkCreateClassLoader} method doesn't allow
* creation of a class loader.
* @see SecurityManager#checkCreateClassLoader
*/
@@ -87,11 +87,11 @@
* loader for delegation.
*
* <p>If there is a security manager, this method first
- * calls the security manager's <code>checkCreateClassLoader</code>
+ * calls the security manager's {@code checkCreateClassLoader}
* method to ensure creation of a class loader is allowed.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkCreateClassLoader</code> method doesn't allow
+ * {@code checkCreateClassLoader} method doesn't allow
* creation of a class loader.
* @see SecurityManager#checkCreateClassLoader
*/
@@ -113,22 +113,22 @@
* If a non-null CodeSource is supplied a ProtectionDomain is
* constructed and associated with the class being defined.
* <p>
- * @param name the expected name of the class, or <code>null</code>
+ * @param name the expected name of the class, or {@code null}
* if not known, using '.' and not '/' as the separator
* and without a trailing ".class" suffix.
* @param b the bytes that make up the class data. The bytes in
- * positions <code>off</code> through <code>off+len-1</code>
+ * positions {@code off} through {@code off+len-1}
* should have the format of a valid class file as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
- * @param off the start offset in <code>b</code> of the class data
+ * @param off the start offset in {@code b} of the class data
* @param len the length of the class data
- * @param cs the associated CodeSource, or <code>null</code> if none
- * @return the <code>Class</code> object created from the data,
+ * @param cs the associated CodeSource, or {@code null} if none
+ * @return the {@code Class} object created from the data,
* and optional CodeSource.
* @exception ClassFormatError if the data did not contain a valid class
- * @exception IndexOutOfBoundsException if either <code>off</code> or
- * <code>len</code> is negative, or if
- * <code>off+len</code> is greater than <code>b.length</code>.
+ * @exception IndexOutOfBoundsException if either {@code off} or
+ * {@code len} is negative, or if
+ * {@code off+len} is greater than {@code b.length}.
*
* @exception SecurityException if an attempt is made to add this class
* to a package that contains classes that were signed by
@@ -143,22 +143,22 @@
}
/**
- * Converts a {@link java.nio.ByteBuffer <tt>ByteBuffer</tt>}
- * into an instance of class <tt>Class</tt>, with an optional CodeSource.
+ * Converts a {@link java.nio.ByteBuffer ByteBuffer}
+ * into an instance of class {@code Class}, with an optional CodeSource.
* Before the class can be used it must be resolved.
* <p>
* If a non-null CodeSource is supplied a ProtectionDomain is
* constructed and associated with the class being defined.
* <p>
- * @param name the expected name of the class, or <code>null</code>
+ * @param name the expected name of the class, or {@code null}
* if not known, using '.' and not '/' as the separator
* and without a trailing ".class" suffix.
* @param b the bytes that make up the class data. The bytes from positions
- * <tt>b.position()</tt> through <tt>b.position() + b.limit() -1</tt>
+ * {@code b.position()} through {@code b.position() + b.limit() -1}
* should have the format of a valid class file as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
- * @param cs the associated CodeSource, or <code>null</code> if none
- * @return the <code>Class</code> object created from the data,
+ * @param cs the associated CodeSource, or {@code null} if none
+ * @return the {@code Class} object created from the data,
* and optional CodeSource.
* @exception ClassFormatError if the data did not contain a valid class
* @exception SecurityException if an attempt is made to add this class
--- a/jdk/src/share/classes/java/security/SecureRandom.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/SecureRandom.java Tue Jul 02 15:23:23 2013 -0700
@@ -50,7 +50,7 @@
* <i>RFC 1750: Randomness Recommendations for Security</i></a>.
*
* <p>A caller obtains a SecureRandom instance via the
- * no-argument constructor or one of the <code>getInstance</code> methods:
+ * no-argument constructor or one of the {@code getInstance} methods:
*
* <pre>
* SecureRandom random = new SecureRandom();
@@ -71,15 +71,15 @@
* random.nextBytes(bytes);
* </pre>
*
- * <p> Callers may also invoke the <code>generateSeed</code> method
+ * <p> Callers may also invoke the {@code generateSeed} method
* to generate a given number of seed bytes (to seed other random number
* generators, for example):
* <pre>
* byte seed[] = random.generateSeed(20);
* </pre>
*
- * Note: Depending on the implementation, the <code>generateSeed</code> and
- * <code>nextBytes</code> methods may block as entropy is being gathered,
+ * Note: Depending on the implementation, the {@code generateSeed} and
+ * {@code nextBytes} methods may block as entropy is being gathered,
* for example, if they need to read from /dev/random on various Unix-like
* operating systems.
*
@@ -140,16 +140,16 @@
* for information about standard RNG algorithm names.
*
* <p> The returned SecureRandom object has not been seeded. To seed the
- * returned object, call the <code>setSeed</code> method.
- * If <code>setSeed</code> is not called, the first call to
- * <code>nextBytes</code> will force the SecureRandom object to seed itself.
- * This self-seeding will not occur if <code>setSeed</code> was
+ * returned object, call the {@code setSeed} method.
+ * If {@code setSeed} is not called, the first call to
+ * {@code nextBytes} will force the SecureRandom object to seed itself.
+ * This self-seeding will not occur if {@code setSeed} was
* previously called.
*/
public SecureRandom() {
/*
* This call to our superclass constructor will result in a call
- * to our own <code>setSeed</code> method, which will return
+ * to our own {@code setSeed} method, which will return
* immediately when it is passed zero.
*/
super(0);
@@ -250,10 +250,10 @@
* the {@link Security#getProviders() Security.getProviders()} method.
*
* <p> The returned SecureRandom object has not been seeded. To seed the
- * returned object, call the <code>setSeed</code> method.
- * If <code>setSeed</code> is not called, the first call to
- * <code>nextBytes</code> will force the SecureRandom object to seed itself.
- * This self-seeding will not occur if <code>setSeed</code> was
+ * returned object, call the {@code setSeed} method.
+ * If {@code setSeed} is not called, the first call to
+ * {@code nextBytes} will force the SecureRandom object to seed itself.
+ * This self-seeding will not occur if {@code setSeed} was
* previously called.
*
* @param algorithm the name of the RNG algorithm.
@@ -293,10 +293,10 @@
* the {@link Security#getProviders() Security.getProviders()} method.
*
* <p> The returned SecureRandom object has not been seeded. To seed the
- * returned object, call the <code>setSeed</code> method.
- * If <code>setSeed</code> is not called, the first call to
- * <code>nextBytes</code> will force the SecureRandom object to seed itself.
- * This self-seeding will not occur if <code>setSeed</code> was
+ * returned object, call the {@code setSeed} method.
+ * If {@code setSeed} is not called, the first call to
+ * {@code nextBytes} will force the SecureRandom object to seed itself.
+ * This self-seeding will not occur if {@code setSeed} was
* previously called.
*
* @param algorithm the name of the RNG algorithm.
@@ -341,10 +341,10 @@
* does not have to be registered in the provider list.
*
* <p> The returned SecureRandom object has not been seeded. To seed the
- * returned object, call the <code>setSeed</code> method.
- * If <code>setSeed</code> is not called, the first call to
- * <code>nextBytes</code> will force the SecureRandom object to seed itself.
- * This self-seeding will not occur if <code>setSeed</code> was
+ * returned object, call the {@code setSeed} method.
+ * If {@code setSeed} is not called, the first call to
+ * {@code nextBytes} will force the SecureRandom object to seed itself.
+ * This self-seeding will not occur if {@code setSeed} was
* previously called.
*
* @param algorithm the name of the RNG algorithm.
@@ -395,7 +395,7 @@
* Returns the name of the algorithm implemented by this SecureRandom
* object.
*
- * @return the name of the algorithm or <code>unknown</code>
+ * @return the name of the algorithm or {@code unknown}
* if the algorithm name cannot be determined.
* @since 1.5
*/
@@ -418,12 +418,12 @@
/**
* Reseeds this random object, using the eight bytes contained
- * in the given <code>long seed</code>. The given seed supplements,
+ * in the given {@code long seed}. The given seed supplements,
* rather than replaces, the existing seed. Thus, repeated calls
* are guaranteed never to reduce randomness.
*
* <p>This method is defined for compatibility with
- * <code>java.util.Random</code>.
+ * {@code java.util.Random}.
*
* @param seed the seed.
*
@@ -445,10 +445,10 @@
/**
* Generates a user-specified number of random bytes.
*
- * <p> If a call to <code>setSeed</code> had not occurred previously,
+ * <p> If a call to {@code setSeed} had not occurred previously,
* the first call to this method forces this SecureRandom object
* to seed itself. This self-seeding will not occur if
- * <code>setSeed</code> was previously called.
+ * {@code setSeed} was previously called.
*
* @param bytes the array to be filled in with random bytes.
*/
@@ -460,15 +460,15 @@
/**
* Generates an integer containing the user-specified number of
* pseudo-random bits (right justified, with leading zeros). This
- * method overrides a <code>java.util.Random</code> method, and serves
+ * method overrides a {@code java.util.Random} method, and serves
* to provide a source of random bits to all of the methods inherited
- * from that class (for example, <code>nextInt</code>,
- * <code>nextLong</code>, and <code>nextFloat</code>).
+ * from that class (for example, {@code nextInt},
+ * {@code nextLong}, and {@code nextFloat}).
*
* @param numBits number of pseudo-random bits to be generated, where
* {@code 0 <= numBits <= 32}.
*
- * @return an <code>int</code> containing the user-specified number
+ * @return an {@code int} containing the user-specified number
* of pseudo-random bits (right justified, with leading zeros).
*/
@Override
@@ -492,8 +492,8 @@
*
* <p>This method is only included for backwards compatibility.
* The caller is encouraged to use one of the alternative
- * <code>getInstance</code> methods to obtain a SecureRandom object, and
- * then call the <code>generateSeed</code> method to obtain seed bytes
+ * {@code getInstance} methods to obtain a SecureRandom object, and
+ * then call the {@code generateSeed} method to obtain seed bytes
* from that object.
*
* @param numBytes the number of seed bytes to generate.
--- a/jdk/src/share/classes/java/security/SecureRandomSpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/SecureRandomSpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -27,7 +27,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>SecureRandom</code> class.
+ * for the {@code SecureRandom} class.
* All the abstract methods in this class must be implemented by each
* service provider who wishes to supply the implementation
* of a cryptographically strong pseudo-random number generator.
@@ -53,10 +53,10 @@
/**
* Generates a user-specified number of random bytes.
*
- * <p> If a call to <code>engineSetSeed</code> had not occurred previously,
+ * <p> If a call to {@code engineSetSeed} had not occurred previously,
* the first call to this method forces this SecureRandom implementation
* to seed itself. This self-seeding will not occur if
- * <code>engineSetSeed</code> was previously called.
+ * {@code engineSetSeed} was previously called.
*
* @param bytes the array to be filled in with random bytes.
*/
--- a/jdk/src/share/classes/java/security/Security.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/Security.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -298,7 +298,7 @@
* property in the master file of the "SUN" Cryptographic Service
* Provider in order to determine how to parse algorithm-specific
* parameters. Use the new provider-based and algorithm-independent
- * <code>AlgorithmParameters</code> and <code>KeyFactory</code> engine
+ * {@code AlgorithmParameters} and {@code KeyFactory} engine
* classes (introduced in the J2SE version 1.2 platform) instead.
*/
@Deprecated
@@ -321,21 +321,21 @@
*
* <p>If the given provider is installed at the requested position,
* the provider that used to be at that position, and all providers
- * with a position greater than <code>position</code>, are shifted up
+ * with a position greater than {@code position}, are shifted up
* one position (towards the end of the list of installed providers).
*
* <p>A provider cannot be added if it is already installed.
*
* <p>First, if there is a security manager, its
- * <code>checkSecurityAccess</code>
+ * {@code checkSecurityAccess}
* method is called with the string
- * <code>"insertProvider."+provider.getName()</code>
+ * {@code "insertProvider."+provider.getName()}
* to see if it's ok to add a new provider.
- * If the default implementation of <code>checkSecurityAccess</code>
+ * If the default implementation of {@code checkSecurityAccess}
* is used (i.e., that method is not overriden), then this will result in
- * a call to the security manager's <code>checkPermission</code> method
+ * a call to the security manager's {@code checkPermission} method
* with a
- * <code>SecurityPermission("insertProvider."+provider.getName())</code>
+ * {@code SecurityPermission("insertProvider."+provider.getName())}
* permission.
*
* @param provider the provider to be added.
@@ -349,8 +349,8 @@
*
* @throws NullPointerException if provider is null
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkSecurityAccess}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkSecurityAccess} method
* denies access to add a new provider
*
* @see #getProvider
@@ -374,15 +374,15 @@
* Adds a provider to the next position available.
*
* <p>First, if there is a security manager, its
- * <code>checkSecurityAccess</code>
+ * {@code checkSecurityAccess}
* method is called with the string
- * <code>"insertProvider."+provider.getName()</code>
+ * {@code "insertProvider."+provider.getName()}
* to see if it's ok to add a new provider.
- * If the default implementation of <code>checkSecurityAccess</code>
+ * If the default implementation of {@code checkSecurityAccess}
* is used (i.e., that method is not overriden), then this will result in
- * a call to the security manager's <code>checkPermission</code> method
+ * a call to the security manager's {@code checkPermission} method
* with a
- * <code>SecurityPermission("insertProvider."+provider.getName())</code>
+ * {@code SecurityPermission("insertProvider."+provider.getName())}
* permission.
*
* @param provider the provider to be added.
@@ -393,8 +393,8 @@
*
* @throws NullPointerException if provider is null
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkSecurityAccess}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkSecurityAccess} method
* denies access to add a new provider
*
* @see #getProvider
@@ -423,20 +423,20 @@
* if name is null.
*
* <p>First, if there is a security manager, its
- * <code>checkSecurityAccess</code>
- * method is called with the string <code>"removeProvider."+name</code>
+ * {@code checkSecurityAccess}
+ * method is called with the string {@code "removeProvider."+name}
* to see if it's ok to remove the provider.
- * If the default implementation of <code>checkSecurityAccess</code>
+ * If the default implementation of {@code checkSecurityAccess}
* is used (i.e., that method is not overriden), then this will result in
- * a call to the security manager's <code>checkPermission</code> method
- * with a <code>SecurityPermission("removeProvider."+name)</code>
+ * a call to the security manager's {@code checkPermission} method
+ * with a {@code SecurityPermission("removeProvider."+name)}
* permission.
*
* @param name the name of the provider to remove.
*
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkSecurityAccess}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkSecurityAccess} method
* denies
* access to remove the provider
*
@@ -480,8 +480,8 @@
* Returns an array containing all installed providers that satisfy the
* specified selection criterion, or null if no such providers have been
* installed. The returned providers are ordered
- * according to their <a href=
- * "#insertProviderAt(java.security.Provider, int)">preference order</a>.
+ * according to their
+ * {@linkplain #insertProviderAt(java.security.Provider, int) preference order}.
*
* <p> A cryptographic service is always associated with a particular
* algorithm or type. For example, a digital signature service is
@@ -492,8 +492,8 @@
* <p>The selection criterion must be specified in one of the following two
* formats:
* <ul>
- * <li> <i><crypto_service>.<algorithm_or_type></i> <p> The
- * cryptographic service name must not contain any dots.
+ * <li> <i>{@literal <crypto_service>.<algorithm_or_type>}</i>
+ * <p> The cryptographic service name must not contain any dots.
* <p> A
* provider satisfies the specified selection criterion iff the provider
* implements the
@@ -501,11 +501,12 @@
* <p> For example, "CertificateFactory.X.509"
* would be satisfied by any provider that supplied
* a CertificateFactory implementation for X.509 certificates.
- * <li> <i><crypto_service>.<algorithm_or_type>
- * <attribute_name>:< attribute_value></i>
+ * <li> <i>{@literal <crypto_service>.<algorithm_or_type>
+ * <attribute_name>:<attribute_value>}</i>
* <p> The cryptographic service name must not contain any dots. There
* must be one or more space charaters between the
- * <i><algorithm_or_type></i> and the <i><attribute_name></i>.
+ * <i>{@literal <algorithm_or_type>}</i> and the
+ * <i>{@literal <attribute_name>}</i>.
* <p> A provider satisfies this selection criterion iff the
* provider implements the specified algorithm or type for the specified
* cryptographic service and its implementation meets the
@@ -558,8 +559,9 @@
* Returns an array containing all installed providers that satisfy the
* specified* selection criteria, or null if no such providers have been
* installed. The returned providers are ordered
- * according to their <a href=
- * "#insertProviderAt(java.security.Provider, int)">preference order</a>.
+ * according to their
+ * {@linkplain #insertProviderAt(java.security.Provider, int)
+ * preference order}.
*
* <p>The selection criteria are represented by a map.
* Each map entry represents a selection criterion.
@@ -567,16 +569,18 @@
* criteria. The key for any entry in such a map must be in one of the
* following two formats:
* <ul>
- * <li> <i><crypto_service>.<algorithm_or_type></i>
+ * <li> <i>{@literal <crypto_service>.<algorithm_or_type>}</i>
* <p> The cryptographic service name must not contain any dots.
* <p> The value associated with the key must be an empty string.
* <p> A provider
* satisfies this selection criterion iff the provider implements the
* specified algorithm or type for the specified cryptographic service.
- * <li> <i><crypto_service>.<algorithm_or_type> <attribute_name></i>
+ * <li> <i>{@literal <crypto_service>}.
+ * {@literal <algorithm_or_type> <attribute_name>}</i>
* <p> The cryptographic service name must not contain any dots. There
- * must be one or more space charaters between the <i><algorithm_or_type></i>
- * and the <i><attribute_name></i>.
+ * must be one or more space charaters between the
+ * <i>{@literal <algorithm_or_type>}</i>
+ * and the <i>{@literal <attribute_name>}</i>.
* <p> The value associated with the key must be a non-empty string.
* A provider satisfies this selection criterion iff the
* provider implements the specified algorithm or type for the specified
@@ -689,7 +693,7 @@
* an instance of an implementation of the requested algorithm
* and type, and the second object in the array identifies the provider
* of that implementation.
- * The <code>provider</code> argument can be null, in which case all
+ * The {@code provider} argument can be null, in which case all
* configured providers will be searched in order of preference.
*/
static Object[] getImpl(String algorithm, String type, String provider)
@@ -720,7 +724,7 @@
* an instance of an implementation of the requested algorithm
* and type, and the second object in the array identifies the provider
* of that implementation.
- * The <code>provider</code> argument cannot be null.
+ * The {@code provider} argument cannot be null.
*/
static Object[] getImpl(String algorithm, String type, Provider provider)
throws NoSuchAlgorithmException {
@@ -739,8 +743,8 @@
* Gets a security property value.
*
* <p>First, if there is a security manager, its
- * <code>checkPermission</code> method is called with a
- * <code>java.security.SecurityPermission("getProperty."+key)</code>
+ * {@code checkPermission} method is called with a
+ * {@code java.security.SecurityPermission("getProperty."+key)}
* permission to see if it's ok to retrieve the specified
* security property value..
*
@@ -749,8 +753,8 @@
* @return the value of the security property corresponding to key.
*
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkPermission}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkPermission} method
* denies
* access to retrieve the specified security property value
* @throws NullPointerException is key is null
@@ -774,8 +778,8 @@
* Sets a security property value.
*
* <p>First, if there is a security manager, its
- * <code>checkPermission</code> method is called with a
- * <code>java.security.SecurityPermission("setProperty."+key)</code>
+ * {@code checkPermission} method is called with a
+ * {@code java.security.SecurityPermission("setProperty."+key)}
* permission to see if it's ok to set the specified
* security property value.
*
@@ -784,8 +788,8 @@
* @param datum the value of the property to be set.
*
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkPermission}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkPermission} method
* denies access to set the specified security property value
* @throws NullPointerException if key or datum is null
*
--- a/jdk/src/share/classes/java/security/SecurityPermission.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/SecurityPermission.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -57,7 +57,7 @@
* <td>createAccessControlContext</td>
* <td>Creation of an AccessControlContext</td>
* <td>This allows someone to instantiate an AccessControlContext
- * with a <code>DomainCombiner</code>. Extreme care must be taken when
+ * with a {@code DomainCombiner}. Extreme care must be taken when
* granting this permission. Malicious code could create a DomainCombiner
* that augments the set of permissions granted to code, and even grant the
* code {@link java.security.AllPermission}.</td>
@@ -67,7 +67,7 @@
* <td>getDomainCombiner</td>
* <td>Retrieval of an AccessControlContext's DomainCombiner</td>
* <td>This allows someone to retrieve an AccessControlContext's
- * <code>DomainCombiner</code>. Since DomainCombiners may contain
+ * {@code DomainCombiner}. Since DomainCombiners may contain
* sensitive information, this could potentially lead to a privacy leak.</td>
* </tr>
*
@@ -76,7 +76,7 @@
* <td>Retrieval of the system-wide security policy (specifically, of the
* currently-installed Policy object)</td>
* <td>This allows someone to query the policy via the
- * <code>getPermissions</code> call,
+ * {@code getPermissions} call,
* which discloses which permissions would be granted to a given CodeSource.
* While revealing the policy does not compromise the security of
* the system, it does provide malicious code with additional information
@@ -303,8 +303,8 @@
*
* @param name the name of the SecurityPermission
*
- * @throws NullPointerException if <code>name</code> is <code>null</code>.
- * @throws IllegalArgumentException if <code>name</code> is empty.
+ * @throws NullPointerException if {@code name} is {@code null}.
+ * @throws IllegalArgumentException if {@code name} is empty.
*/
public SecurityPermission(String name)
@@ -320,8 +320,8 @@
* @param name the name of the SecurityPermission
* @param actions should be null.
*
- * @throws NullPointerException if <code>name</code> is <code>null</code>.
- * @throws IllegalArgumentException if <code>name</code> is empty.
+ * @throws NullPointerException if {@code name} is {@code null}.
+ * @throws IllegalArgumentException if {@code name} is empty.
*/
public SecurityPermission(String name, String actions)
--- a/jdk/src/share/classes/java/security/Signature.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/Signature.java Tue Jul 02 15:23:23 2013 -0700
@@ -53,10 +53,10 @@
*
* <p> The signature algorithm can be, among others, the NIST standard
* DSA, using DSA and SHA-1. The DSA algorithm using the
- * SHA-1 message digest algorithm can be specified as <tt>SHA1withDSA</tt>.
+ * SHA-1 message digest algorithm can be specified as {@code SHA1withDSA}.
* In the case of RSA, there are multiple choices for the message digest
* algorithm, so the signing algorithm could be specified as, for example,
- * <tt>MD2withRSA</tt>, <tt>MD5withRSA</tt>, or <tt>SHA1withRSA</tt>.
+ * {@code MD2withRSA}, {@code MD5withRSA}, or {@code SHA1withRSA}.
* The algorithm name must be specified, as there is no default.
*
* <p> A Signature object can be used to generate and verify digital
@@ -92,18 +92,18 @@
* </ol>
*
* <p>Note that this class is abstract and extends from
- * <code>SignatureSpi</code> for historical reasons.
+ * {@code SignatureSpi} for historical reasons.
* Application developers should only take notice of the methods defined in
- * this <code>Signature</code> class; all the methods in
+ * this {@code Signature} class; all the methods in
* the superclass are intended for cryptographic service providers who wish to
* supply their own implementations of digital signature algorithms.
*
* <p> Every implementation of the Java platform is required to support the
- * following standard <code>Signature</code> algorithms:
+ * following standard {@code Signature} algorithms:
* <ul>
- * <li><tt>SHA1withDSA</tt></li>
- * <li><tt>SHA1withRSA</tt></li>
- * <li><tt>SHA256withRSA</tt></li>
+ * <li>{@code SHA1withDSA}</li>
+ * <li>{@code SHA1withRSA}</li>
+ * <li>{@code SHA256withRSA}</li>
* </ul>
* These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#Signature">
@@ -461,7 +461,7 @@
* extension field implies that the public key in
* the certificate and its corresponding private key are not
* supposed to be used for digital signatures, an
- * <code>InvalidKeyException</code> is thrown.
+ * {@code InvalidKeyException} is thrown.
*
* @param certificate the certificate of the identity whose signature is
* going to be verified.
@@ -538,10 +538,10 @@
*
* <p>A call to this method resets this signature object to the state
* it was in when previously initialized for signing via a
- * call to <code>initSign(PrivateKey)</code>. That is, the object is
+ * call to {@code initSign(PrivateKey)}. That is, the object is
* reset and available to generate another signature from the same
- * signer, if desired, via new calls to <code>update</code> and
- * <code>sign</code>.
+ * signer, if desired, via new calls to {@code update} and
+ * {@code sign}.
*
* @return the signature bytes of the signing operation's result.
*
@@ -559,28 +559,28 @@
/**
* Finishes the signature operation and stores the resulting signature
- * bytes in the provided buffer <code>outbuf</code>, starting at
- * <code>offset</code>.
+ * bytes in the provided buffer {@code outbuf}, starting at
+ * {@code offset}.
* The format of the signature depends on the underlying
* signature scheme.
*
* <p>This signature object is reset to its initial state (the state it
- * was in after a call to one of the <code>initSign</code> methods) and
+ * was in after a call to one of the {@code initSign} methods) and
* can be reused to generate further signatures with the same private key.
*
* @param outbuf buffer for the signature result.
*
- * @param offset offset into <code>outbuf</code> where the signature is
+ * @param offset offset into {@code outbuf} where the signature is
* stored.
*
- * @param len number of bytes within <code>outbuf</code> allotted for the
+ * @param len number of bytes within {@code outbuf} allotted for the
* signature.
*
- * @return the number of bytes placed into <code>outbuf</code>.
+ * @return the number of bytes placed into {@code outbuf}.
*
* @exception SignatureException if this signature object is not
* initialized properly, if this signature algorithm is unable to
- * process the input data provided, or if <code>len</code> is less
+ * process the input data provided, or if {@code len} is less
* than the actual signature length.
*
* @since 1.2
@@ -606,9 +606,9 @@
*
* <p>A call to this method resets this signature object to the state
* it was in when previously initialized for verification via a
- * call to <code>initVerify(PublicKey)</code>. That is, the object is
+ * call to {@code initVerify(PublicKey)}. That is, the object is
* reset and available to verify another signature from the identity
- * whose public key was specified in the call to <code>initVerify</code>.
+ * whose public key was specified in the call to {@code initVerify}.
*
* @param signature the signature bytes to be verified.
*
@@ -633,9 +633,9 @@
*
* <p>A call to this method resets this signature object to the state
* it was in when previously initialized for verification via a
- * call to <code>initVerify(PublicKey)</code>. That is, the object is
+ * call to {@code initVerify(PublicKey)}. That is, the object is
* reset and available to verify another signature from the identity
- * whose public key was specified in the call to <code>initVerify</code>.
+ * whose public key was specified in the call to {@code initVerify}.
*
*
* @param signature the signature bytes to be verified.
@@ -648,11 +648,11 @@
* initialized properly, the passed-in signature is improperly
* encoded or of the wrong type, if this signature algorithm is unable to
* process the input data provided, etc.
- * @exception IllegalArgumentException if the <code>signature</code>
- * byte array is null, or the <code>offset</code> or <code>length</code>
- * is less than 0, or the sum of the <code>offset</code> and
- * <code>length</code> is greater than the length of the
- * <code>signature</code> byte array.
+ * @exception IllegalArgumentException if the {@code signature}
+ * byte array is null, or the {@code offset} or {@code length}
+ * is less than 0, or the sum of the {@code offset} and
+ * {@code length} is greater than the length of the
+ * {@code signature} byte array.
* @since 1.4
*/
public final boolean verify(byte[] signature, int offset, int length)
@@ -722,8 +722,8 @@
/**
* Updates the data to be signed or verified using the specified
- * ByteBuffer. Processes the <code>data.remaining()</code> bytes
- * starting at at <code>data.position()</code>.
+ * ByteBuffer. Processes the {@code data.remaining()} bytes
+ * starting at at {@code data.position()}.
* Upon return, the buffer's position will be equal to its limit;
* its limit will not have changed.
*
@@ -790,7 +790,7 @@
* @param param the string identifier of the parameter.
* @param value the parameter value.
*
- * @exception InvalidParameterException if <code>param</code> is an
+ * @exception InvalidParameterException if {@code param} is an
* invalid parameter for this signature algorithm engine,
* the parameter is already set
* and cannot be set again, a security exception occurs, and so on.
@@ -856,7 +856,7 @@
* @return the object that represents the parameter value, or null if
* there is none.
*
- * @exception InvalidParameterException if <code>param</code> is an invalid
+ * @exception InvalidParameterException if {@code param} is an invalid
* parameter for this engine, or another exception occurs while
* trying to get this parameter.
*
@@ -876,7 +876,7 @@
* @return a clone if the implementation is cloneable.
*
* @exception CloneNotSupportedException if this is called
- * on an implementation that does not support <code>Cloneable</code>.
+ * on an implementation that does not support {@code Cloneable}.
*/
public Object clone() throws CloneNotSupportedException {
if (this instanceof Cloneable) {
@@ -940,7 +940,7 @@
* @return a clone if the delegate is cloneable.
*
* @exception CloneNotSupportedException if this is called on a
- * delegate that does not support <code>Cloneable</code>.
+ * delegate that does not support {@code Cloneable}.
*/
public Object clone() throws CloneNotSupportedException {
chooseFirstProvider();
--- a/jdk/src/share/classes/java/security/SignatureException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/SignatureException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -56,13 +56,13 @@
}
/**
- * Creates a <code>SignatureException</code> with the specified
+ * Creates a {@code SignatureException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -71,13 +71,13 @@
}
/**
- * Creates a <code>SignatureException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code SignatureException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/SignatureSpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/SignatureSpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -35,7 +35,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>Signature</code> class, which is used to provide the
+ * for the {@code Signature} class, which is used to provide the
* functionality of a digital signature algorithm. Digital signatures are used
* for authentication and integrity assurance of digital data.
*.
@@ -130,8 +130,8 @@
/**
* Updates the data to be signed or verified using the specified
- * ByteBuffer. Processes the <code>data.remaining()</code> bytes
- * starting at at <code>data.position()</code>.
+ * ByteBuffer. Processes the {@code data.remaining()} bytes
+ * starting at at {@code data.position()}.
* Upon return, the buffer's position will be equal to its limit;
* its limit will not have changed.
*
@@ -183,14 +183,14 @@
/**
* Finishes this signature operation and stores the resulting signature
- * bytes in the provided buffer <code>outbuf</code>, starting at
- * <code>offset</code>.
+ * bytes in the provided buffer {@code outbuf}, starting at
+ * {@code offset}.
* The format of the signature depends on the underlying
* signature scheme.
*
* <p>The signature implementation is reset to its initial state
* (the state it was in after a call to one of the
- * <code>engineInitSign</code> methods)
+ * {@code engineInitSign} methods)
* and can be reused to generate further signatures with the same private
* key.
*
@@ -200,10 +200,10 @@
*
* @param outbuf buffer for the signature result.
*
- * @param offset offset into <code>outbuf</code> where the signature is
+ * @param offset offset into {@code outbuf} where the signature is
* stored.
*
- * @param len number of bytes within <code>outbuf</code> allotted for the
+ * @param len number of bytes within {@code outbuf} allotted for the
* signature.
* Both this default implementation and the SUN provider do not
* return partial digests. If the value of this parameter is less
@@ -212,11 +212,11 @@
* This parameter is ignored if its value is greater than or equal to
* the actual signature length.
*
- * @return the number of bytes placed into <code>outbuf</code>
+ * @return the number of bytes placed into {@code outbuf}
*
* @exception SignatureException if the engine is not
* initialized properly, if this signature algorithm is unable to
- * process the input data provided, or if <code>len</code> is less
+ * process the input data provided, or if {@code len} is less
* than the actual signature length.
*
* @since 1.2
@@ -293,7 +293,7 @@
*
* @param value the parameter value.
*
- * @exception InvalidParameterException if <code>param</code> is an
+ * @exception InvalidParameterException if {@code param} is an
* invalid parameter for this signature algorithm engine,
* the parameter is already set
* and cannot be set again, a security exception occurs, and so on.
@@ -362,7 +362,7 @@
* @return the object that represents the parameter value, or null if
* there is none.
*
- * @exception InvalidParameterException if <code>param</code> is an
+ * @exception InvalidParameterException if {@code param} is an
* invalid parameter for this engine, or another exception occurs while
* trying to get this parameter.
*
@@ -378,7 +378,7 @@
* @return a clone if the implementation is cloneable.
*
* @exception CloneNotSupportedException if this is called
- * on an implementation that does not support <code>Cloneable</code>.
+ * on an implementation that does not support {@code Cloneable}.
*/
public Object clone() throws CloneNotSupportedException {
if (this instanceof Cloneable) {
--- a/jdk/src/share/classes/java/security/SignedObject.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/SignedObject.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -40,44 +40,44 @@
* the original object has no side effect on the copy.
*
* <p> The underlying signing algorithm is designated by the Signature
- * object passed to the constructor and the <code>verify</code> method.
+ * object passed to the constructor and the {@code verify} method.
* A typical usage for signing is the following:
*
- * <p> <code> <pre>
+ * <p> <pre>{@code
* Signature signingEngine = Signature.getInstance(algorithm,
* provider);
* SignedObject so = new SignedObject(myobject, signingKey,
* signingEngine);
- * </pre> </code>
+ * }</pre>
*
* <p> A typical usage for verification is the following (having
- * received SignedObject <code>so</code>):
+ * received SignedObject {@code so}):
*
- * <p> <code> <pre>
+ * <p> <pre>{@code
* Signature verificationEngine =
* Signature.getInstance(algorithm, provider);
* if (so.verify(publickey, verificationEngine))
* try {
* Object myobj = so.getObject();
* } catch (java.lang.ClassNotFoundException e) {};
- * </pre> </code>
+ * }</pre>
*
* <p> Several points are worth noting. First, there is no need to
* initialize the signing or verification engine, as it will be
- * re-initialized inside the constructor and the <code>verify</code>
+ * re-initialized inside the constructor and the {@code verify}
* method. Secondly, for verification to succeed, the specified
* public key must be the public key corresponding to the private key
* used to generate the SignedObject.
*
* <p> More importantly, for flexibility reasons, the
- * constructor and <code>verify</code> method allow for
+ * constructor and {@code verify} method allow for
* customized signature engines, which can implement signature
* algorithms that are not installed formally as part of a crypto
* provider. However, it is crucial that the programmer writing the
- * verifier code be aware what <code>Signature</code> engine is being
- * used, as its own implementation of the <code>verify</code> method
+ * verifier code be aware what {@code Signature} engine is being
+ * used, as its own implementation of the {@code verify} method
* is invoked to verify a signature. In other words, a malicious
- * <code>Signature</code> may choose to always return true on
+ * {@code Signature} may choose to always return true on
* verification in an attempt to bypass a security check.
*
* <p> The signature algorithm can be, among others, the NIST standard
@@ -92,7 +92,7 @@
*
* <p> The name of the Cryptography Package Provider is designated
* also by the Signature parameter to the constructor and the
- * <code>verify</code> method. If the provider is not
+ * {@code verify} method. If the provider is not
* specified, the default provider is used. Each installation can
* be configured to use a particular provider as default.
*
@@ -214,8 +214,8 @@
* @exception SignatureException if signature verification failed.
* @exception InvalidKeyException if the verification key is invalid.
*
- * @return <tt>true</tt> if the signature
- * is valid, <tt>false</tt> otherwise
+ * @return {@code true} if the signature
+ * is valid, {@code false} otherwise
*/
public boolean verify(PublicKey verificationKey,
Signature verificationEngine)
--- a/jdk/src/share/classes/java/security/Signer.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/Signer.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -40,9 +40,9 @@
* @author Benjamin Renaud
*
* @deprecated This class is no longer used. Its functionality has been
- * replaced by <code>java.security.KeyStore</code>, the
- * <code>java.security.cert</code> package, and
- * <code>java.security.Principal</code>.
+ * replaced by {@code java.security.KeyStore}, the
+ * {@code java.security.cert} package, and
+ * {@code java.security.Principal}.
*/
@Deprecated
public abstract class Signer extends Identity {
@@ -92,15 +92,15 @@
/**
* Returns this signer's private key.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"getSignerPrivateKey"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "getSignerPrivateKey"}
* as its argument to see if it's ok to return the private key.
*
* @return this signer's private key, or null if the private key has
* not yet been set.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* returning the private key.
*
* @see SecurityManager#checkSecurityAccess
@@ -113,8 +113,8 @@
/**
* Sets the key pair (public key and private key) for this signer.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"setSignerKeyPair"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "setSignerKeyPair"}
* as its argument to see if it's ok to set the key pair.
*
* @param pair an initialized key pair.
@@ -124,7 +124,7 @@
* @exception KeyException if the key pair cannot be set for any
* other reason.
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* setting the key pair.
*
* @see SecurityManager#checkSecurityAccess
--- a/jdk/src/share/classes/java/security/UnresolvedPermission.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/UnresolvedPermission.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -72,11 +72,11 @@
* the class provides a zero, one, and/or two-argument constructor.
* The zero-argument constructor would be used to instantiate
* a permission without a name and without actions.
- * A one-arg constructor is assumed to take a <code>String</code>
+ * A one-arg constructor is assumed to take a {@code String}
* name as input, and a two-arg constructor is assumed to take a
- * <code>String</code> name and <code>String</code> actions
+ * {@code String} name and {@code String} actions
* as input. UnresolvedPermission may invoke a
- * constructor with a <code>null</code> name and/or actions.
+ * constructor with a {@code null} name and/or actions.
* If an appropriate permission constructor is not available,
* the UnresolvedPermission is ignored and the relevant permission
* will not be granted to executing code.
@@ -84,9 +84,9 @@
* <p> The newly created permission object replaces the
* UnresolvedPermission, which is removed.
*
- * <p> Note that the <code>getName</code> method for an
- * <code>UnresolvedPermission</code> returns the
- * <code>type</code> (class name) for the underlying permission
+ * <p> Note that the {@code getName} method for an
+ * {@code UnresolvedPermission} returns the
+ * {@code type} (class name) for the underlying permission
* that has not been resolved.
*
* @see java.security.Permission
@@ -440,7 +440,7 @@
* has not been resolved.
*
* @return the target name of the underlying permission that
- * has not been resolved, or <code>null</code>,
+ * has not been resolved, or {@code null},
* if there is no targe name
*
* @since 1.5
@@ -454,7 +454,7 @@
* has not been resolved.
*
* @return the actions for the underlying permission that
- * has not been resolved, or <code>null</code>
+ * has not been resolved, or {@code null}
* if there are no actions
*
* @since 1.5
@@ -503,16 +503,16 @@
/**
* Writes this object out to a stream (i.e., serializes it).
*
- * @serialData An initial <code>String</code> denoting the
- * <code>type</code> is followed by a <code>String</code> denoting the
- * <code>name</code> is followed by a <code>String</code> denoting the
- * <code>actions</code> is followed by an <code>int</code> indicating the
+ * @serialData An initial {@code String} denoting the
+ * {@code type} is followed by a {@code String} denoting the
+ * {@code name} is followed by a {@code String} denoting the
+ * {@code actions} is followed by an {@code int} indicating the
* number of certificates to follow
* (a value of "zero" denotes that there are no certificates associated
* with this object).
- * Each certificate is written out starting with a <code>String</code>
+ * Each certificate is written out starting with a {@code String}
* denoting the certificate type, followed by an
- * <code>int</code> specifying the length of the certificate encoding,
+ * {@code int} specifying the length of the certificate encoding,
* followed by the certificate encoding itself which is written out as an
* array of bytes.
*/
--- a/jdk/src/share/classes/java/security/acl/Acl.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/acl/Acl.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -66,19 +66,19 @@
*
* </ul>
*
- * The <code> java.security.acl </code> package provides the
+ * The {@code java.security.acl } package provides the
* interfaces to the ACL and related data structures (ACL entries,
- * groups, permissions, etc.), and the <code> sun.security.acl </code>
+ * groups, permissions, etc.), and the {@code sun.security.acl }
* classes provide a default implementation of the interfaces. For
- * example, <code> java.security.acl.Acl </code> provides the
- * interface to an ACL and the <code> sun.security.acl.AclImpl </code>
+ * example, {@code java.security.acl.Acl } provides the
+ * interface to an ACL and the {@code sun.security.acl.AclImpl }
* class provides the default implementation of the interface.<p>
*
- * The <code> java.security.acl.Acl </code> interface extends the
- * <code> java.security.acl.Owner </code> interface. The Owner
+ * The {@code java.security.acl.Acl } interface extends the
+ * {@code java.security.acl.Owner } interface. The Owner
* interface is used to maintain a list of owners for each ACL. Only
* owners are allowed to modify an ACL. For example, only an owner can
- * call the ACL's <code>addEntry</code> method to add a new ACL entry
+ * call the ACL's {@code addEntry} method to add a new ACL entry
* to the ACL.
*
* @see java.security.acl.AclEntry
@@ -217,7 +217,7 @@
* More specifically, this method checks whether the passed permission
* is a member of the allowed permission set of the specified principal.
* The allowed permission set is determined by the same algorithm as is
- * used by the <code>getPermissions</code> method.
+ * used by the {@code getPermissions} method.
*
* @param principal the principal, assumed to be a valid authenticated
* Principal.
--- a/jdk/src/share/classes/java/security/acl/AclEntry.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/acl/AclEntry.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -84,7 +84,7 @@
* specified in the entry.
*
* Note: ACL entries are by default positive. An entry becomes a
- * negative entry only if this <code>setNegativePermissions</code>
+ * negative entry only if this {@code setNegativePermissions}
* method is called on it.
*/
public void setNegativePermissions();
--- a/jdk/src/share/classes/java/security/acl/Group.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/acl/Group.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -35,7 +35,7 @@
* Note that Group extends Principal. Thus, either a Principal or a Group can
* be passed as an argument to methods containing a Principal parameter. For
* example, you can add either a Principal or a Group to a Group object by
- * calling the object's <code>addMember</code> method, passing it the
+ * calling the object's {@code addMember} method, passing it the
* Principal or Group.
*
* @author Satish Dharmaraj
--- a/jdk/src/share/classes/java/security/acl/Owner.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/acl/Owner.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -30,7 +30,7 @@
/**
* Interface for managing owners of Access Control Lists (ACLs) or ACL
* configurations. (Note that the Acl interface in the
- * <code> java.security.acl </code> package extends this Owner
+ * {@code java.security.acl} package extends this Owner
* interface.) The initial owner Principal should be specified as an
* argument to the constructor of the class implementing this interface.
*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/security/acl/package-info.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 1998, 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. 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.
+ */
+
+/**
+ * The classes and interfaces in this package have been
+ * superseded by classes in the java.security package.
+ * See that package and, for example, java.security.Permission for details.
+ *
+ * @since JDK1.1
+ */
+package java.security.acl;
--- a/jdk/src/share/classes/java/security/acl/package.html Tue Jul 02 15:20:55 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-<DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 1998, 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.
--->
-
-</head>
-<body bgcolor="white">
-
-The classes and interfaces in this package have been
-superseded by classes in the java.security package.
-See that package and, for example, java.security.Permission for details.
-
-<!--
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
- <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
--->
-
-@since JDK1.1
-</body>
-</html>
--- a/jdk/src/share/classes/java/security/cert/CRLException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CRLException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -57,13 +57,13 @@
}
/**
- * Creates a <code>CRLException</code> with the specified
+ * Creates a {@code CRLException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -72,13 +72,13 @@
}
/**
- * Creates a <code>CRLException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code CRLException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/cert/CRLSelector.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CRLSelector.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -26,9 +26,9 @@
package java.security.cert;
/**
- * A selector that defines a set of criteria for selecting <code>CRL</code>s.
+ * A selector that defines a set of criteria for selecting {@code CRL}s.
* Classes that implement this interface are often used to specify
- * which <code>CRL</code>s should be retrieved from a <code>CertStore</code>.
+ * which {@code CRL}s should be retrieved from a {@code CertStore}.
* <p>
* <b>Concurrent Access</b>
* <p>
@@ -48,19 +48,19 @@
public interface CRLSelector extends Cloneable {
/**
- * Decides whether a <code>CRL</code> should be selected.
+ * Decides whether a {@code CRL} should be selected.
*
- * @param crl the <code>CRL</code> to be checked
- * @return <code>true</code> if the <code>CRL</code> should be selected,
- * <code>false</code> otherwise
+ * @param crl the {@code CRL} to be checked
+ * @return {@code true} if the {@code CRL} should be selected,
+ * {@code false} otherwise
*/
boolean match(CRL crl);
/**
- * Makes a copy of this <code>CRLSelector</code>. Changes to the
+ * Makes a copy of this {@code CRLSelector}. Changes to the
* copy will not affect the original and vice versa.
*
- * @return a copy of this <code>CRLSelector</code>
+ * @return a copy of this {@code CRLSelector}
*/
Object clone();
}
--- a/jdk/src/share/classes/java/security/cert/CertPath.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertPath.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -36,59 +36,59 @@
* An immutable sequence of certificates (a certification path).
* <p>
* This is an abstract class that defines the methods common to all
- * <code>CertPath</code>s. Subclasses can handle different kinds of
+ * {@code CertPath}s. Subclasses can handle different kinds of
* certificates (X.509, PGP, etc.).
* <p>
- * All <code>CertPath</code> objects have a type, a list of
- * <code>Certificate</code>s, and one or more supported encodings. Because the
- * <code>CertPath</code> class is immutable, a <code>CertPath</code> cannot
+ * All {@code CertPath} objects have a type, a list of
+ * {@code Certificate}s, and one or more supported encodings. Because the
+ * {@code CertPath} class is immutable, a {@code CertPath} cannot
* change in any externally visible way after being constructed. This
* stipulation applies to all public fields and methods of this class and any
* added or overridden by subclasses.
* <p>
- * The type is a <code>String</code> that identifies the type of
- * <code>Certificate</code>s in the certification path. For each
- * certificate <code>cert</code> in a certification path <code>certPath</code>,
- * <code>cert.getType().equals(certPath.getType())</code> must be
- * <code>true</code>.
+ * The type is a {@code String} that identifies the type of
+ * {@code Certificate}s in the certification path. For each
+ * certificate {@code cert} in a certification path {@code certPath},
+ * {@code cert.getType().equals(certPath.getType())} must be
+ * {@code true}.
* <p>
- * The list of <code>Certificate</code>s is an ordered <code>List</code> of
- * zero or more <code>Certificate</code>s. This <code>List</code> and all
- * of the <code>Certificate</code>s contained in it must be immutable.
+ * The list of {@code Certificate}s is an ordered {@code List} of
+ * zero or more {@code Certificate}s. This {@code List} and all
+ * of the {@code Certificate}s contained in it must be immutable.
* <p>
- * Each <code>CertPath</code> object must support one or more encodings
+ * Each {@code CertPath} object must support one or more encodings
* so that the object can be translated into a byte array for storage or
* transmission to other parties. Preferably, these encodings should be
* well-documented standards (such as PKCS#7). One of the encodings supported
- * by a <code>CertPath</code> is considered the default encoding. This
+ * by a {@code CertPath} is considered the default encoding. This
* encoding is used if no encoding is explicitly requested (for the
* {@link #getEncoded() getEncoded()} method, for instance).
* <p>
- * All <code>CertPath</code> objects are also <code>Serializable</code>.
- * <code>CertPath</code> objects are resolved into an alternate
+ * All {@code CertPath} objects are also {@code Serializable}.
+ * {@code CertPath} objects are resolved into an alternate
* {@link CertPathRep CertPathRep} object during serialization. This allows
- * a <code>CertPath</code> object to be serialized into an equivalent
+ * a {@code CertPath} object to be serialized into an equivalent
* representation regardless of its underlying implementation.
* <p>
- * <code>CertPath</code> objects can be created with a
- * <code>CertificateFactory</code> or they can be returned by other classes,
- * such as a <code>CertPathBuilder</code>.
+ * {@code CertPath} objects can be created with a
+ * {@code CertificateFactory} or they can be returned by other classes,
+ * such as a {@code CertPathBuilder}.
* <p>
- * By convention, X.509 <code>CertPath</code>s (consisting of
- * <code>X509Certificate</code>s), are ordered starting with the target
+ * By convention, X.509 {@code CertPath}s (consisting of
+ * {@code X509Certificate}s), are ordered starting with the target
* certificate and ending with a certificate issued by the trust anchor. That
* is, the issuer of one certificate is the subject of the following one. The
* certificate representing the {@link TrustAnchor TrustAnchor} should not be
- * included in the certification path. Unvalidated X.509 <code>CertPath</code>s
- * may not follow these conventions. PKIX <code>CertPathValidator</code>s will
+ * included in the certification path. Unvalidated X.509 {@code CertPath}s
+ * may not follow these conventions. PKIX {@code CertPathValidator}s will
* detect any departure from these conventions that cause the certification
- * path to be invalid and throw a <code>CertPathValidatorException</code>.
+ * path to be invalid and throw a {@code CertPathValidatorException}.
*
* <p> Every implementation of the Java platform is required to support the
- * following standard <code>CertPath</code> encodings:
+ * following standard {@code CertPath} encodings:
* <ul>
- * <li><tt>PKCS7</tt></li>
- * <li><tt>PkiPath</tt></li>
+ * <li>{@code PKCS7}</li>
+ * <li>{@code PkiPath}</li>
* </ul>
* These encodings are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathEncodings">
@@ -99,17 +99,17 @@
* <p>
* <b>Concurrent Access</b>
* <p>
- * All <code>CertPath</code> objects must be thread-safe. That is, multiple
+ * All {@code CertPath} objects must be thread-safe. That is, multiple
* threads may concurrently invoke the methods defined in this class on a
- * single <code>CertPath</code> object (or more than one) with no
- * ill effects. This is also true for the <code>List</code> returned by
- * <code>CertPath.getCertificates</code>.
+ * single {@code CertPath} object (or more than one) with no
+ * ill effects. This is also true for the {@code List} returned by
+ * {@code CertPath.getCertificates}.
* <p>
- * Requiring <code>CertPath</code> objects to be immutable and thread-safe
+ * Requiring {@code CertPath} objects to be immutable and thread-safe
* allows them to be passed around to various pieces of code without worrying
* about coordinating access. Providing this thread-safety is
- * generally not difficult, since the <code>CertPath</code> and
- * <code>List</code> objects in question are immutable.
+ * generally not difficult, since the {@code CertPath} and
+ * {@code List} objects in question are immutable.
*
* @see CertificateFactory
* @see CertPathBuilder
@@ -124,25 +124,25 @@
private String type; // the type of certificates in this chain
/**
- * Creates a <code>CertPath</code> of the specified type.
+ * Creates a {@code CertPath} of the specified type.
* <p>
* This constructor is protected because most users should use a
- * <code>CertificateFactory</code> to create <code>CertPath</code>s.
+ * {@code CertificateFactory} to create {@code CertPath}s.
*
* @param type the standard name of the type of
- * <code>Certificate</code>s in this path
+ * {@code Certificate}s in this path
*/
protected CertPath(String type) {
this.type = type;
}
/**
- * Returns the type of <code>Certificate</code>s in this certification
+ * Returns the type of {@code Certificate}s in this certification
* path. This is the same string that would be returned by
* {@link java.security.cert.Certificate#getType() cert.getType()}
- * for all <code>Certificate</code>s in the certification path.
+ * for all {@code Certificate}s in the certification path.
*
- * @return the type of <code>Certificate</code>s in this certification
+ * @return the type of {@code Certificate}s in this certification
* path (never null)
*/
public String getType() {
@@ -152,21 +152,21 @@
/**
* Returns an iteration of the encodings supported by this certification
* path, with the default encoding first. Attempts to modify the returned
- * <code>Iterator</code> via its <code>remove</code> method result in an
- * <code>UnsupportedOperationException</code>.
+ * {@code Iterator} via its {@code remove} method result in an
+ * {@code UnsupportedOperationException}.
*
- * @return an <code>Iterator</code> over the names of the supported
+ * @return an {@code Iterator} over the names of the supported
* encodings (as Strings)
*/
public abstract Iterator<String> getEncodings();
/**
* Compares this certification path for equality with the specified
- * object. Two <code>CertPath</code>s are equal if and only if their
- * types are equal and their certificate <code>List</code>s (and by
- * implication the <code>Certificate</code>s in those <code>List</code>s)
- * are equal. A <code>CertPath</code> is never equal to an object that is
- * not a <code>CertPath</code>.
+ * object. Two {@code CertPath}s are equal if and only if their
+ * types are equal and their certificate {@code List}s (and by
+ * implication the {@code Certificate}s in those {@code List}s)
+ * are equal. A {@code CertPath} is never equal to an object that is
+ * not a {@code CertPath}.
* <p>
* This algorithm is implemented by this method. If it is overridden,
* the behavior specified here must be maintained.
@@ -195,14 +195,14 @@
* Returns the hashcode for this certification path. The hash code of
* a certification path is defined to be the result of the following
* calculation:
- * <pre><code>
+ * <pre>{@code
* hashCode = path.getType().hashCode();
* hashCode = 31*hashCode + path.getCertificates().hashCode();
- * </code></pre>
- * This ensures that <code>path1.equals(path2)</code> implies that
- * <code>path1.hashCode()==path2.hashCode()</code> for any two certification
- * paths, <code>path1</code> and <code>path2</code>, as required by the
- * general contract of <code>Object.hashCode</code>.
+ * }</pre>
+ * This ensures that {@code path1.equals(path2)} implies that
+ * {@code path1.hashCode()==path2.hashCode()} for any two certification
+ * paths, {@code path1} and {@code path2}, as required by the
+ * general contract of {@code Object.hashCode}.
*
* @return the hashcode value for this certification path
*/
@@ -214,8 +214,8 @@
/**
* Returns a string representation of this certification path.
- * This calls the <code>toString</code> method on each of the
- * <code>Certificate</code>s in the path.
+ * This calls the {@code toString} method on each of the
+ * {@code Certificate}s in the path.
*
* @return a string representation of this certification path
*/
@@ -266,20 +266,20 @@
/**
* Returns the list of certificates in this certification path.
- * The <code>List</code> returned must be immutable and thread-safe.
+ * The {@code List} returned must be immutable and thread-safe.
*
- * @return an immutable <code>List</code> of <code>Certificate</code>s
+ * @return an immutable {@code List} of {@code Certificate}s
* (may be empty, but not null)
*/
public abstract List<? extends Certificate> getCertificates();
/**
- * Replaces the <code>CertPath</code> to be serialized with a
- * <code>CertPathRep</code> object.
+ * Replaces the {@code CertPath} to be serialized with a
+ * {@code CertPathRep} object.
*
- * @return the <code>CertPathRep</code> to be serialized
+ * @return the {@code CertPathRep} to be serialized
*
- * @throws ObjectStreamException if a <code>CertPathRep</code> object
+ * @throws ObjectStreamException if a {@code CertPathRep} object
* representing this certification path could not be created
*/
protected Object writeReplace() throws ObjectStreamException {
@@ -295,7 +295,7 @@
}
/**
- * Alternate <code>CertPath</code> class for serialization.
+ * Alternate {@code CertPath} class for serialization.
* @since 1.4
*/
protected static class CertPathRep implements Serializable {
@@ -308,10 +308,10 @@
private byte[] data;
/**
- * Creates a <code>CertPathRep</code> with the specified
+ * Creates a {@code CertPathRep} with the specified
* type and encoded form of a certification path.
*
- * @param type the standard name of a <code>CertPath</code> type
+ * @param type the standard name of a {@code CertPath} type
* @param data the encoded form of the certification path
*/
protected CertPathRep(String type, byte[] data) {
@@ -320,11 +320,11 @@
}
/**
- * Returns a <code>CertPath</code> constructed from the type and data.
+ * Returns a {@code CertPath} constructed from the type and data.
*
- * @return the resolved <code>CertPath</code> object
+ * @return the resolved {@code CertPath} object
*
- * @throws ObjectStreamException if a <code>CertPath</code> could not
+ * @throws ObjectStreamException if a {@code CertPath} could not
* be constructed
*/
protected Object readResolve() throws ObjectStreamException {
--- a/jdk/src/share/classes/java/security/cert/CertPathBuilder.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertPathBuilder.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -41,16 +41,16 @@
* A class for building certification paths (also known as certificate chains).
* <p>
* This class uses a provider-based architecture.
- * To create a <code>CertPathBuilder</code>, call
- * one of the static <code>getInstance</code> methods, passing in the
- * algorithm name of the <code>CertPathBuilder</code> desired and optionally
+ * To create a {@code CertPathBuilder}, call
+ * one of the static {@code getInstance} methods, passing in the
+ * algorithm name of the {@code CertPathBuilder} desired and optionally
* the name of the provider desired.
*
- * <p>Once a <code>CertPathBuilder</code> object has been created, certification
+ * <p>Once a {@code CertPathBuilder} object has been created, certification
* paths can be constructed by calling the {@link #build build} method and
* passing it an algorithm-specific set of parameters. If successful, the
- * result (including the <code>CertPath</code> that was built) is returned
- * in an object that implements the <code>CertPathBuilderResult</code>
+ * result (including the {@code CertPath} that was built) is returned
+ * in an object that implements the {@code CertPathBuilderResult}
* interface.
*
* <p>The {@link #getRevocationChecker} method allows an application to specify
@@ -67,9 +67,9 @@
* </pre>
*
* <p>Every implementation of the Java platform is required to support the
- * following standard <code>CertPathBuilder</code> algorithm:
+ * following standard {@code CertPathBuilder} algorithm:
* <ul>
- * <li><tt>PKIX</tt></li>
+ * <li>{@code PKIX}</li>
* </ul>
* This algorithm is described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathBuilder">
@@ -87,9 +87,9 @@
* <p>
* However, this is not true for the non-static methods defined by this class.
* Unless otherwise documented by a specific provider, threads that need to
- * access a single <code>CertPathBuilder</code> instance concurrently should
+ * access a single {@code CertPathBuilder} instance concurrently should
* synchronize amongst themselves and provide the necessary locking. Multiple
- * threads each manipulating a different <code>CertPathBuilder</code> instance
+ * threads each manipulating a different {@code CertPathBuilder} instance
* need not synchronize.
*
* @see CertPath
@@ -114,7 +114,7 @@
private final String algorithm;
/**
- * Creates a <code>CertPathBuilder</code> object of the given algorithm,
+ * Creates a {@code CertPathBuilder} object of the given algorithm,
* and encapsulates the given provider implementation (SPI object) in it.
*
* @param builderSpi the provider implementation
@@ -130,7 +130,7 @@
}
/**
- * Returns a <code>CertPathBuilder</code> object that implements the
+ * Returns a {@code CertPathBuilder} object that implements the
* specified algorithm.
*
* <p> This method traverses the list of registered security Providers,
@@ -142,13 +142,13 @@
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
- * @param algorithm the name of the requested <code>CertPathBuilder</code>
+ * @param algorithm the name of the requested {@code CertPathBuilder}
* algorithm. See the CertPathBuilder section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathBuilder">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
- * @return a <code>CertPathBuilder</code> object that implements the
+ * @return a {@code CertPathBuilder} object that implements the
* specified algorithm.
*
* @throws NoSuchAlgorithmException if no Provider supports a
@@ -166,7 +166,7 @@
}
/**
- * Returns a <code>CertPathBuilder</code> object that implements the
+ * Returns a {@code CertPathBuilder} object that implements the
* specified algorithm.
*
* <p> A new CertPathBuilder object encapsulating the
@@ -177,7 +177,7 @@
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
- * @param algorithm the name of the requested <code>CertPathBuilder</code>
+ * @param algorithm the name of the requested {@code CertPathBuilder}
* algorithm. See the CertPathBuilder section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathBuilder">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
@@ -185,7 +185,7 @@
*
* @param provider the name of the provider.
*
- * @return a <code>CertPathBuilder</code> object that implements the
+ * @return a {@code CertPathBuilder} object that implements the
* specified algorithm.
*
* @throws NoSuchAlgorithmException if a CertPathBuilderSpi
@@ -195,7 +195,7 @@
* @throws NoSuchProviderException if the specified provider is not
* registered in the security provider list.
*
- * @exception IllegalArgumentException if the <code>provider</code> is
+ * @exception IllegalArgumentException if the {@code provider} is
* null or empty.
*
* @see java.security.Provider
@@ -209,7 +209,7 @@
}
/**
- * Returns a <code>CertPathBuilder</code> object that implements the
+ * Returns a {@code CertPathBuilder} object that implements the
* specified algorithm.
*
* <p> A new CertPathBuilder object encapsulating the
@@ -217,7 +217,7 @@
* object is returned. Note that the specified Provider object
* does not have to be registered in the provider list.
*
- * @param algorithm the name of the requested <code>CertPathBuilder</code>
+ * @param algorithm the name of the requested {@code CertPathBuilder}
* algorithm. See the CertPathBuilder section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathBuilder">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
@@ -225,14 +225,14 @@
*
* @param provider the provider.
*
- * @return a <code>CertPathBuilder</code> object that implements the
+ * @return a {@code CertPathBuilder} object that implements the
* specified algorithm.
*
* @exception NoSuchAlgorithmException if a CertPathBuilderSpi
* implementation for the specified algorithm is not available
* from the specified Provider object.
*
- * @exception IllegalArgumentException if the <code>provider</code> is
+ * @exception IllegalArgumentException if the {@code provider} is
* null.
*
* @see java.security.Provider
@@ -246,18 +246,18 @@
}
/**
- * Returns the provider of this <code>CertPathBuilder</code>.
+ * Returns the provider of this {@code CertPathBuilder}.
*
- * @return the provider of this <code>CertPathBuilder</code>
+ * @return the provider of this {@code CertPathBuilder}
*/
public final Provider getProvider() {
return this.provider;
}
/**
- * Returns the name of the algorithm of this <code>CertPathBuilder</code>.
+ * Returns the name of the algorithm of this {@code CertPathBuilder}.
*
- * @return the name of the algorithm of this <code>CertPathBuilder</code>
+ * @return the name of the algorithm of this {@code CertPathBuilder}
*/
public final String getAlgorithm() {
return this.algorithm;
@@ -272,7 +272,7 @@
* @throws CertPathBuilderException if the builder is unable to construct
* a certification path that satisfies the specified parameters
* @throws InvalidAlgorithmParameterException if the specified parameters
- * are inappropriate for this <code>CertPathBuilder</code>
+ * are inappropriate for this {@code CertPathBuilder}
*/
public final CertPathBuilderResult build(CertPathParameters params)
throws CertPathBuilderException, InvalidAlgorithmParameterException
--- a/jdk/src/share/classes/java/security/cert/CertPathBuilderException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertPathBuilderException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -29,9 +29,9 @@
/**
* An exception indicating one of a variety of problems encountered when
- * building a certification path with a <code>CertPathBuilder</code>.
+ * building a certification path with a {@code CertPathBuilder}.
* <p>
- * A <code>CertPathBuilderException</code> provides support for wrapping
+ * A {@code CertPathBuilderException} provides support for wrapping
* exceptions. The {@link #getCause getCause} method returns the throwable,
* if any, that caused this exception to be thrown.
* <p>
@@ -53,7 +53,7 @@
private static final long serialVersionUID = 5316471420178794402L;
/**
- * Creates a <code>CertPathBuilderException</code> with <code>null</code>
+ * Creates a {@code CertPathBuilderException} with {@code null}
* as its detail message.
*/
public CertPathBuilderException() {
@@ -61,8 +61,8 @@
}
/**
- * Creates a <code>CertPathBuilderException</code> with the given
- * detail message. The detail message is a <code>String</code> that
+ * Creates a {@code CertPathBuilderException} with the given
+ * detail message. The detail message is a {@code String} that
* describes this particular exception in more detail.
*
* @param msg the detail message
@@ -72,16 +72,16 @@
}
/**
- * Creates a <code>CertPathBuilderException</code> that wraps the specified
+ * Creates a {@code CertPathBuilderException} that wraps the specified
* throwable. This allows any exception to be converted into a
- * <code>CertPathBuilderException</code>, while retaining information
+ * {@code CertPathBuilderException}, while retaining information
* about the wrapped exception, which may be useful for debugging. The
- * detail message is set to (<code>cause==null ? null : cause.toString()
- * </code>) (which typically contains the class and detail message of
+ * detail message is set to ({@code cause==null ? null : cause.toString()})
+ * (which typically contains the class and detail message of
* cause).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause getCause()} method). (A <code>null</code> value is
+ * {@link #getCause getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or unknown.)
*/
public CertPathBuilderException(Throwable cause) {
@@ -89,12 +89,12 @@
}
/**
- * Creates a <code>CertPathBuilderException</code> with the specified
+ * Creates a {@code CertPathBuilderException} with the specified
* detail message and cause.
*
* @param msg the detail message
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause getCause()} method). (A <code>null</code> value is
+ * {@link #getCause getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or unknown.)
*/
public CertPathBuilderException(String msg, Throwable cause) {
--- a/jdk/src/share/classes/java/security/cert/CertPathBuilderResult.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertPathBuilderResult.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -30,8 +30,8 @@
* All results returned by the {@link CertPathBuilder#build
* CertPathBuilder.build} method must implement this interface.
* <p>
- * At a minimum, a <code>CertPathBuilderResult</code> contains the
- * <code>CertPath</code> built by the <code>CertPathBuilder</code> instance.
+ * At a minimum, a {@code CertPathBuilderResult} contains the
+ * {@code CertPath} built by the {@code CertPathBuilder} instance.
* Implementations of this interface may add methods to return implementation
* or algorithm specific information, such as debugging information or
* certification path validation results.
@@ -54,15 +54,15 @@
/**
* Returns the built certification path.
*
- * @return the certification path (never <code>null</code>)
+ * @return the certification path (never {@code null})
*/
CertPath getCertPath();
/**
- * Makes a copy of this <code>CertPathBuilderResult</code>. Changes to the
+ * Makes a copy of this {@code CertPathBuilderResult}. Changes to the
* copy will not affect the original and vice versa.
*
- * @return a copy of this <code>CertPathBuilderResult</code>
+ * @return a copy of this {@code CertPathBuilderResult}
*/
Object clone();
}
--- a/jdk/src/share/classes/java/security/cert/CertPathBuilderSpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertPathBuilderSpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -30,23 +30,23 @@
/**
* The <i>Service Provider Interface</i> (<b>SPI</b>)
* for the {@link CertPathBuilder CertPathBuilder} class. All
- * <code>CertPathBuilder</code> implementations must include a class (the
- * SPI class) that extends this class (<code>CertPathBuilderSpi</code>) and
+ * {@code CertPathBuilder} implementations must include a class (the
+ * SPI class) that extends this class ({@code CertPathBuilderSpi}) and
* implements all of its methods. In general, instances of this class should
- * only be accessed through the <code>CertPathBuilder</code> class. For
+ * only be accessed through the {@code CertPathBuilder} class. For
* details, see the Java Cryptography Architecture.
* <p>
* <b>Concurrent Access</b>
* <p>
* Instances of this class need not be protected against concurrent
* access from multiple threads. Threads that need to access a single
- * <code>CertPathBuilderSpi</code> instance concurrently should synchronize
+ * {@code CertPathBuilderSpi} instance concurrently should synchronize
* amongst themselves and provide the necessary locking before calling the
- * wrapping <code>CertPathBuilder</code> object.
+ * wrapping {@code CertPathBuilder} object.
* <p>
- * However, implementations of <code>CertPathBuilderSpi</code> may still
+ * However, implementations of {@code CertPathBuilderSpi} may still
* encounter concurrency issues, since multiple threads each
- * manipulating a different <code>CertPathBuilderSpi</code> instance need not
+ * manipulating a different {@code CertPathBuilderSpi} instance need not
* synchronize.
*
* @since 1.4
@@ -68,7 +68,7 @@
* @throws CertPathBuilderException if the builder is unable to construct
* a certification path that satisfies the specified parameters
* @throws InvalidAlgorithmParameterException if the specified parameters
- * are inappropriate for this <code>CertPathBuilder</code>
+ * are inappropriate for this {@code CertPathBuilder}
*/
public abstract CertPathBuilderResult engineBuild(CertPathParameters params)
throws CertPathBuilderException, InvalidAlgorithmParameterException;
--- a/jdk/src/share/classes/java/security/cert/CertPathParameters.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertPathParameters.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -28,8 +28,8 @@
/**
* A specification of certification path algorithm parameters.
* The purpose of this interface is to group (and provide type safety for)
- * all <code>CertPath</code> parameter specifications. All
- * <code>CertPath</code> parameter specifications must implement this
+ * all {@code CertPath} parameter specifications. All
+ * {@code CertPath} parameter specifications must implement this
* interface.
*
* @author Yassir Elley
@@ -40,10 +40,10 @@
public interface CertPathParameters extends Cloneable {
/**
- * Makes a copy of this <code>CertPathParameters</code>. Changes to the
+ * Makes a copy of this {@code CertPathParameters}. Changes to the
* copy will not affect the original and vice versa.
*
- * @return a copy of this <code>CertPathParameters</code>
+ * @return a copy of this {@code CertPathParameters}
*/
Object clone();
}
--- a/jdk/src/share/classes/java/security/cert/CertPathValidator.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertPathValidator.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -42,17 +42,17 @@
* chains).
* <p>
* This class uses a provider-based architecture.
- * To create a <code>CertPathValidator</code>,
- * call one of the static <code>getInstance</code> methods, passing in the
- * algorithm name of the <code>CertPathValidator</code> desired and
+ * To create a {@code CertPathValidator},
+ * call one of the static {@code getInstance} methods, passing in the
+ * algorithm name of the {@code CertPathValidator} desired and
* optionally the name of the provider desired.
*
- * <p>Once a <code>CertPathValidator</code> object has been created, it can
+ * <p>Once a {@code CertPathValidator} object has been created, it can
* be used to validate certification paths by calling the {@link #validate
- * validate} method and passing it the <code>CertPath</code> to be validated
+ * validate} method and passing it the {@code CertPath} to be validated
* and an algorithm-specific set of parameters. If successful, the result is
* returned in an object that implements the
- * <code>CertPathValidatorResult</code> interface.
+ * {@code CertPathValidatorResult} interface.
*
* <p>The {@link #getRevocationChecker} method allows an application to specify
* additional algorithm-specific parameters and options used by the
@@ -69,9 +69,9 @@
* </pre>
*
* <p>Every implementation of the Java platform is required to support the
- * following standard <code>CertPathValidator</code> algorithm:
+ * following standard {@code CertPathValidator} algorithm:
* <ul>
- * <li><tt>PKIX</tt></li>
+ * <li>{@code PKIX}</li>
* </ul>
* This algorithm is described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathValidator">
@@ -89,9 +89,9 @@
* <p>
* However, this is not true for the non-static methods defined by this class.
* Unless otherwise documented by a specific provider, threads that need to
- * access a single <code>CertPathValidator</code> instance concurrently should
+ * access a single {@code CertPathValidator} instance concurrently should
* synchronize amongst themselves and provide the necessary locking. Multiple
- * threads each manipulating a different <code>CertPathValidator</code>
+ * threads each manipulating a different {@code CertPathValidator}
* instance need not synchronize.
*
* @see CertPath
@@ -115,7 +115,7 @@
private final String algorithm;
/**
- * Creates a <code>CertPathValidator</code> object of the given algorithm,
+ * Creates a {@code CertPathValidator} object of the given algorithm,
* and encapsulates the given provider implementation (SPI object) in it.
*
* @param validatorSpi the provider implementation
@@ -131,7 +131,7 @@
}
/**
- * Returns a <code>CertPathValidator</code> object that implements the
+ * Returns a {@code CertPathValidator} object that implements the
* specified algorithm.
*
* <p> This method traverses the list of registered security Providers,
@@ -143,13 +143,13 @@
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
- * @param algorithm the name of the requested <code>CertPathValidator</code>
+ * @param algorithm the name of the requested {@code CertPathValidator}
* algorithm. See the CertPathValidator section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathValidator">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
- * @return a <code>CertPathValidator</code> object that implements the
+ * @return a {@code CertPathValidator} object that implements the
* specified algorithm.
*
* @exception NoSuchAlgorithmException if no Provider supports a
@@ -167,7 +167,7 @@
}
/**
- * Returns a <code>CertPathValidator</code> object that implements the
+ * Returns a {@code CertPathValidator} object that implements the
* specified algorithm.
*
* <p> A new CertPathValidator object encapsulating the
@@ -178,7 +178,7 @@
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
- * @param algorithm the name of the requested <code>CertPathValidator</code>
+ * @param algorithm the name of the requested {@code CertPathValidator}
* algorithm. See the CertPathValidator section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathValidator">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
@@ -186,7 +186,7 @@
*
* @param provider the name of the provider.
*
- * @return a <code>CertPathValidator</code> object that implements the
+ * @return a {@code CertPathValidator} object that implements the
* specified algorithm.
*
* @exception NoSuchAlgorithmException if a CertPathValidatorSpi
@@ -196,7 +196,7 @@
* @exception NoSuchProviderException if the specified provider is not
* registered in the security provider list.
*
- * @exception IllegalArgumentException if the <code>provider</code> is
+ * @exception IllegalArgumentException if the {@code provider} is
* null or empty.
*
* @see java.security.Provider
@@ -211,7 +211,7 @@
}
/**
- * Returns a <code>CertPathValidator</code> object that implements the
+ * Returns a {@code CertPathValidator} object that implements the
* specified algorithm.
*
* <p> A new CertPathValidator object encapsulating the
@@ -219,7 +219,7 @@
* object is returned. Note that the specified Provider object
* does not have to be registered in the provider list.
*
- * @param algorithm the name of the requested <code>CertPathValidator</code>
+ * @param algorithm the name of the requested {@code CertPathValidator}
* algorithm. See the CertPathValidator section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathValidator">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
@@ -227,14 +227,14 @@
*
* @param provider the provider.
*
- * @return a <code>CertPathValidator</code> object that implements the
+ * @return a {@code CertPathValidator} object that implements the
* specified algorithm.
*
* @exception NoSuchAlgorithmException if a CertPathValidatorSpi
* implementation for the specified algorithm is not available
* from the specified Provider object.
*
- * @exception IllegalArgumentException if the <code>provider</code> is
+ * @exception IllegalArgumentException if the {@code provider} is
* null.
*
* @see java.security.Provider
@@ -248,19 +248,19 @@
}
/**
- * Returns the <code>Provider</code> of this
- * <code>CertPathValidator</code>.
+ * Returns the {@code Provider} of this
+ * {@code CertPathValidator}.
*
- * @return the <code>Provider</code> of this <code>CertPathValidator</code>
+ * @return the {@code Provider} of this {@code CertPathValidator}
*/
public final Provider getProvider() {
return this.provider;
}
/**
- * Returns the algorithm name of this <code>CertPathValidator</code>.
+ * Returns the algorithm name of this {@code CertPathValidator}.
*
- * @return the algorithm name of this <code>CertPathValidator</code>
+ * @return the algorithm name of this {@code CertPathValidator}
*/
public final String getAlgorithm() {
return this.algorithm;
@@ -270,20 +270,20 @@
* Validates the specified certification path using the specified
* algorithm parameter set.
* <p>
- * The <code>CertPath</code> specified must be of a type that is
+ * The {@code CertPath} specified must be of a type that is
* supported by the validation algorithm, otherwise an
- * <code>InvalidAlgorithmParameterException</code> will be thrown. For
- * example, a <code>CertPathValidator</code> that implements the PKIX
- * algorithm validates <code>CertPath</code> objects of type X.509.
+ * {@code InvalidAlgorithmParameterException} will be thrown. For
+ * example, a {@code CertPathValidator} that implements the PKIX
+ * algorithm validates {@code CertPath} objects of type X.509.
*
- * @param certPath the <code>CertPath</code> to be validated
+ * @param certPath the {@code CertPath} to be validated
* @param params the algorithm parameters
* @return the result of the validation algorithm
- * @exception CertPathValidatorException if the <code>CertPath</code>
+ * @exception CertPathValidatorException if the {@code CertPath}
* does not validate
* @exception InvalidAlgorithmParameterException if the specified
- * parameters or the type of the specified <code>CertPath</code> are
- * inappropriate for this <code>CertPathValidator</code>
+ * parameters or the type of the specified {@code CertPath} are
+ * inappropriate for this {@code CertPathValidator}
*/
public final CertPathValidatorResult validate(CertPath certPath,
CertPathParameters params)
--- a/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -34,11 +34,11 @@
* An exception indicating one of a variety of problems encountered when
* validating a certification path.
* <p>
- * A <code>CertPathValidatorException</code> provides support for wrapping
+ * A {@code CertPathValidatorException} provides support for wrapping
* exceptions. The {@link #getCause getCause} method returns the throwable,
* if any, that caused this exception to be thrown.
* <p>
- * A <code>CertPathValidatorException</code> may also include the
+ * A {@code CertPathValidatorException} may also include the
* certification path that was being validated when the exception was thrown,
* the index of the certificate in the certification path that caused the
* exception to be thrown, and the reason that caused the failure. Use the
@@ -70,7 +70,7 @@
private int index = -1;
/**
- * @serial the <code>CertPath</code> that was being validated when
+ * @serial the {@code CertPath} that was being validated when
* the exception was thrown
*/
private CertPath certPath;
@@ -81,7 +81,7 @@
private Reason reason = BasicReason.UNSPECIFIED;
/**
- * Creates a <code>CertPathValidatorException</code> with
+ * Creates a {@code CertPathValidatorException} with
* no detail message.
*/
public CertPathValidatorException() {
@@ -89,8 +89,8 @@
}
/**
- * Creates a <code>CertPathValidatorException</code> with the given
- * detail message. A detail message is a <code>String</code> that
+ * Creates a {@code CertPathValidatorException} with the given
+ * detail message. A detail message is a {@code String} that
* describes this particular exception.
*
* @param msg the detail message
@@ -100,16 +100,16 @@
}
/**
- * Creates a <code>CertPathValidatorException</code> that wraps the
+ * Creates a {@code CertPathValidatorException} that wraps the
* specified throwable. This allows any exception to be converted into a
- * <code>CertPathValidatorException</code>, while retaining information
+ * {@code CertPathValidatorException}, while retaining information
* about the wrapped exception, which may be useful for debugging. The
- * detail message is set to (<code>cause==null ? null : cause.toString()
- * </code>) (which typically contains the class and detail message of
+ * detail message is set to ({@code cause==null ? null : cause.toString()})
+ * (which typically contains the class and detail message of
* cause).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause getCause()} method). (A <code>null</code> value is
+ * {@link #getCause getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or unknown.)
*/
public CertPathValidatorException(Throwable cause) {
@@ -117,12 +117,12 @@
}
/**
- * Creates a <code>CertPathValidatorException</code> with the specified
+ * Creates a {@code CertPathValidatorException} with the specified
* detail message and cause.
*
* @param msg the detail message
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause getCause()} method). (A <code>null</code> value is
+ * {@link #getCause getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or unknown.)
*/
public CertPathValidatorException(String msg, Throwable cause) {
@@ -130,21 +130,21 @@
}
/**
- * Creates a <code>CertPathValidatorException</code> with the specified
+ * Creates a {@code CertPathValidatorException} with the specified
* detail message, cause, certification path, and index.
*
- * @param msg the detail message (or <code>null</code> if none)
- * @param cause the cause (or <code>null</code> if none)
+ * @param msg the detail message (or {@code null} if none)
+ * @param cause the cause (or {@code null} if none)
* @param certPath the certification path that was in the process of
* being validated when the error was encountered
* @param index the index of the certificate in the certification path
* that caused the error (or -1 if not applicable). Note that
- * the list of certificates in a <code>CertPath</code> is zero based.
+ * the list of certificates in a {@code CertPath} is zero based.
* @throws IndexOutOfBoundsException if the index is out of range
* {@code (index < -1 || (certPath != null && index >=
* certPath.getCertificates().size()) }
- * @throws IllegalArgumentException if <code>certPath</code> is
- * <code>null</code> and <code>index</code> is not -1
+ * @throws IllegalArgumentException if {@code certPath} is
+ * {@code null} and {@code index} is not -1
*/
public CertPathValidatorException(String msg, Throwable cause,
CertPath certPath, int index) {
@@ -152,23 +152,23 @@
}
/**
- * Creates a <code>CertPathValidatorException</code> with the specified
+ * Creates a {@code CertPathValidatorException} with the specified
* detail message, cause, certification path, index, and reason.
*
- * @param msg the detail message (or <code>null</code> if none)
- * @param cause the cause (or <code>null</code> if none)
+ * @param msg the detail message (or {@code null} if none)
+ * @param cause the cause (or {@code null} if none)
* @param certPath the certification path that was in the process of
* being validated when the error was encountered
* @param index the index of the certificate in the certification path
* that caused the error (or -1 if not applicable). Note that
- * the list of certificates in a <code>CertPath</code> is zero based.
+ * the list of certificates in a {@code CertPath} is zero based.
* @param reason the reason the validation failed
* @throws IndexOutOfBoundsException if the index is out of range
* {@code (index < -1 || (certPath != null && index >=
* certPath.getCertificates().size()) }
- * @throws IllegalArgumentException if <code>certPath</code> is
- * <code>null</code> and <code>index</code> is not -1
- * @throws NullPointerException if <code>reason</code> is <code>null</code>
+ * @throws IllegalArgumentException if {@code certPath} is
+ * {@code null} and {@code index} is not -1
+ * @throws NullPointerException if {@code reason} is {@code null}
*
* @since 1.7
*/
@@ -194,8 +194,8 @@
* Returns the certification path that was being validated when
* the exception was thrown.
*
- * @return the <code>CertPath</code> that was being validated when
- * the exception was thrown (or <code>null</code> if not specified)
+ * @return the {@code CertPath} that was being validated when
+ * the exception was thrown (or {@code null} if not specified)
*/
public CertPath getCertPath() {
return this.certPath;
@@ -204,7 +204,7 @@
/**
* Returns the index of the certificate in the certification path
* that caused the exception to be thrown. Note that the list of
- * certificates in a <code>CertPath</code> is zero based. If no
+ * certificates in a {@code CertPath} is zero based. If no
* index has been set, -1 is returned.
*
* @return the index that has been set, or -1 if none has been set
@@ -219,7 +219,7 @@
* {@link #getIndex}.
*
* @return the reason that the validation failed, or
- * <code>BasicReason.UNSPECIFIED</code> if a reason has not been
+ * {@code BasicReason.UNSPECIFIED} if a reason has not been
* specified
*
* @since 1.7
--- a/jdk/src/share/classes/java/security/cert/CertPathValidatorResult.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertPathValidatorResult.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -41,10 +41,10 @@
public interface CertPathValidatorResult extends Cloneable {
/**
- * Makes a copy of this <code>CertPathValidatorResult</code>. Changes to the
+ * Makes a copy of this {@code CertPathValidatorResult}. Changes to the
* copy will not affect the original and vice versa.
*
- * @return a copy of this <code>CertPathValidatorResult</code>
+ * @return a copy of this {@code CertPathValidatorResult}
*/
Object clone();
}
--- a/jdk/src/share/classes/java/security/cert/CertPathValidatorSpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertPathValidatorSpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -31,23 +31,23 @@
*
* The <i>Service Provider Interface</i> (<b>SPI</b>)
* for the {@link CertPathValidator CertPathValidator} class. All
- * <code>CertPathValidator</code> implementations must include a class (the
- * SPI class) that extends this class (<code>CertPathValidatorSpi</code>)
+ * {@code CertPathValidator} implementations must include a class (the
+ * SPI class) that extends this class ({@code CertPathValidatorSpi})
* and implements all of its methods. In general, instances of this class
- * should only be accessed through the <code>CertPathValidator</code> class.
+ * should only be accessed through the {@code CertPathValidator} class.
* For details, see the Java Cryptography Architecture.
* <p>
* <b>Concurrent Access</b>
* <p>
* Instances of this class need not be protected against concurrent
* access from multiple threads. Threads that need to access a single
- * <code>CertPathValidatorSpi</code> instance concurrently should synchronize
+ * {@code CertPathValidatorSpi} instance concurrently should synchronize
* amongst themselves and provide the necessary locking before calling the
- * wrapping <code>CertPathValidator</code> object.
+ * wrapping {@code CertPathValidator} object.
* <p>
- * However, implementations of <code>CertPathValidatorSpi</code> may still
+ * However, implementations of {@code CertPathValidatorSpi} may still
* encounter concurrency issues, since multiple threads each
- * manipulating a different <code>CertPathValidatorSpi</code> instance need not
+ * manipulating a different {@code CertPathValidatorSpi} instance need not
* synchronize.
*
* @since 1.4
@@ -64,20 +64,20 @@
* Validates the specified certification path using the specified
* algorithm parameter set.
* <p>
- * The <code>CertPath</code> specified must be of a type that is
+ * The {@code CertPath} specified must be of a type that is
* supported by the validation algorithm, otherwise an
- * <code>InvalidAlgorithmParameterException</code> will be thrown. For
- * example, a <code>CertPathValidator</code> that implements the PKIX
- * algorithm validates <code>CertPath</code> objects of type X.509.
+ * {@code InvalidAlgorithmParameterException} will be thrown. For
+ * example, a {@code CertPathValidator} that implements the PKIX
+ * algorithm validates {@code CertPath} objects of type X.509.
*
- * @param certPath the <code>CertPath</code> to be validated
+ * @param certPath the {@code CertPath} to be validated
* @param params the algorithm parameters
* @return the result of the validation algorithm
- * @exception CertPathValidatorException if the <code>CertPath</code>
+ * @exception CertPathValidatorException if the {@code CertPath}
* does not validate
* @exception InvalidAlgorithmParameterException if the specified
- * parameters or the type of the specified <code>CertPath</code> are
- * inappropriate for this <code>CertPathValidator</code>
+ * parameters or the type of the specified {@code CertPath} are
+ * inappropriate for this {@code CertPathValidator}
*/
public abstract CertPathValidatorResult
engineValidate(CertPath certPath, CertPathParameters params)
--- a/jdk/src/share/classes/java/security/cert/CertSelector.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertSelector.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -27,9 +27,9 @@
/**
* A selector that defines a set of criteria for selecting
- * <code>Certificate</code>s. Classes that implement this interface
- * are often used to specify which <code>Certificate</code>s should
- * be retrieved from a <code>CertStore</code>.
+ * {@code Certificate}s. Classes that implement this interface
+ * are often used to specify which {@code Certificate}s should
+ * be retrieved from a {@code CertStore}.
* <p>
* <b>Concurrent Access</b>
* <p>
@@ -49,19 +49,19 @@
public interface CertSelector extends Cloneable {
/**
- * Decides whether a <code>Certificate</code> should be selected.
+ * Decides whether a {@code Certificate} should be selected.
*
- * @param cert the <code>Certificate</code> to be checked
- * @return <code>true</code> if the <code>Certificate</code>
- * should be selected, <code>false</code> otherwise
+ * @param cert the {@code Certificate} to be checked
+ * @return {@code true} if the {@code Certificate}
+ * should be selected, {@code false} otherwise
*/
boolean match(Certificate cert);
/**
- * Makes a copy of this <code>CertSelector</code>. Changes to the
+ * Makes a copy of this {@code CertSelector}. Changes to the
* copy will not affect the original and vice versa.
*
- * @return a copy of this <code>CertSelector</code>
+ * @return a copy of this {@code CertSelector}
*/
Object clone();
}
--- a/jdk/src/share/classes/java/security/cert/CertStore.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertStore.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -38,32 +38,32 @@
import sun.security.jca.GetInstance.Instance;
/**
- * A class for retrieving <code>Certificate</code>s and <code>CRL</code>s
+ * A class for retrieving {@code Certificate}s and {@code CRL}s
* from a repository.
* <p>
* This class uses a provider-based architecture.
- * To create a <code>CertStore</code>, call one of the static
- * <code>getInstance</code> methods, passing in the type of
- * <code>CertStore</code> desired, any applicable initialization parameters
+ * To create a {@code CertStore}, call one of the static
+ * {@code getInstance} methods, passing in the type of
+ * {@code CertStore} desired, any applicable initialization parameters
* and optionally the name of the provider desired.
* <p>
- * Once the <code>CertStore</code> has been created, it can be used to
- * retrieve <code>Certificate</code>s and <code>CRL</code>s by calling its
+ * Once the {@code CertStore} has been created, it can be used to
+ * retrieve {@code Certificate}s and {@code CRL}s by calling its
* {@link #getCertificates(CertSelector selector) getCertificates} and
* {@link #getCRLs(CRLSelector selector) getCRLs} methods.
* <p>
* Unlike a {@link java.security.KeyStore KeyStore}, which provides access
* to a cache of private keys and trusted certificates, a
- * <code>CertStore</code> is designed to provide access to a potentially
+ * {@code CertStore} is designed to provide access to a potentially
* vast repository of untrusted certificates and CRLs. For example, an LDAP
- * implementation of <code>CertStore</code> provides access to certificates
+ * implementation of {@code CertStore} provides access to certificates
* and CRLs stored in one or more directories using the LDAP protocol and the
* schema as defined in the RFC service attribute.
*
* <p> Every implementation of the Java platform is required to support the
- * following standard <code>CertStore</code> type:
+ * following standard {@code CertStore} type:
* <ul>
- * <li><tt>Collection</tt></li>
+ * <li>{@code Collection}</li>
* </ul>
* This type is described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertStore">
@@ -75,10 +75,10 @@
* <p>
* <b>Concurrent Access</b>
* <p>
- * All public methods of <code>CertStore</code> objects must be thread-safe.
+ * All public methods of {@code CertStore} objects must be thread-safe.
* That is, multiple threads may concurrently invoke these methods on a
- * single <code>CertStore</code> object (or more than one) with no
- * ill effects. This allows a <code>CertPathBuilder</code> to search for a
+ * single {@code CertStore} object (or more than one) with no
+ * ill effects. This allows a {@code CertPathBuilder} to search for a
* CRL while simultaneously searching for further certificates, for instance.
* <p>
* The static methods of this class are also guaranteed to be thread-safe.
@@ -104,13 +104,13 @@
private CertStoreParameters params;
/**
- * Creates a <code>CertStore</code> object of the given type, and
+ * Creates a {@code CertStore} object of the given type, and
* encapsulates the given provider implementation (SPI object) in it.
*
* @param storeSpi the provider implementation
* @param provider the provider
* @param type the type
- * @param params the initialization parameters (may be <code>null</code>)
+ * @param params the initialization parameters (may be {@code null})
*/
protected CertStore(CertStoreSpi storeSpi, Provider provider,
String type, CertStoreParameters params) {
@@ -122,28 +122,28 @@
}
/**
- * Returns a <code>Collection</code> of <code>Certificate</code>s that
- * match the specified selector. If no <code>Certificate</code>s
- * match the selector, an empty <code>Collection</code> will be returned.
+ * Returns a {@code Collection} of {@code Certificate}s that
+ * match the specified selector. If no {@code Certificate}s
+ * match the selector, an empty {@code Collection} will be returned.
* <p>
- * For some <code>CertStore</code> types, the resulting
- * <code>Collection</code> may not contain <b>all</b> of the
- * <code>Certificate</code>s that match the selector. For instance,
- * an LDAP <code>CertStore</code> may not search all entries in the
+ * For some {@code CertStore} types, the resulting
+ * {@code Collection} may not contain <b>all</b> of the
+ * {@code Certificate}s that match the selector. For instance,
+ * an LDAP {@code CertStore} may not search all entries in the
* directory. Instead, it may just search entries that are likely to
- * contain the <code>Certificate</code>s it is looking for.
+ * contain the {@code Certificate}s it is looking for.
* <p>
- * Some <code>CertStore</code> implementations (especially LDAP
- * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
- * unless a non-null <code>CertSelector</code> is provided that
+ * Some {@code CertStore} implementations (especially LDAP
+ * {@code CertStore}s) may throw a {@code CertStoreException}
+ * unless a non-null {@code CertSelector} is provided that
* includes specific criteria that can be used to find the certificates.
* Issuer and/or subject names are especially useful criteria.
*
- * @param selector A <code>CertSelector</code> used to select which
- * <code>Certificate</code>s should be returned. Specify <code>null</code>
- * to return all <code>Certificate</code>s (if supported).
- * @return A <code>Collection</code> of <code>Certificate</code>s that
- * match the specified selector (never <code>null</code>)
+ * @param selector A {@code CertSelector} used to select which
+ * {@code Certificate}s should be returned. Specify {@code null}
+ * to return all {@code Certificate}s (if supported).
+ * @return A {@code Collection} of {@code Certificate}s that
+ * match the specified selector (never {@code null})
* @throws CertStoreException if an exception occurs
*/
public final Collection<? extends Certificate> getCertificates
@@ -152,28 +152,28 @@
}
/**
- * Returns a <code>Collection</code> of <code>CRL</code>s that
- * match the specified selector. If no <code>CRL</code>s
- * match the selector, an empty <code>Collection</code> will be returned.
+ * Returns a {@code Collection} of {@code CRL}s that
+ * match the specified selector. If no {@code CRL}s
+ * match the selector, an empty {@code Collection} will be returned.
* <p>
- * For some <code>CertStore</code> types, the resulting
- * <code>Collection</code> may not contain <b>all</b> of the
- * <code>CRL</code>s that match the selector. For instance,
- * an LDAP <code>CertStore</code> may not search all entries in the
+ * For some {@code CertStore} types, the resulting
+ * {@code Collection} may not contain <b>all</b> of the
+ * {@code CRL}s that match the selector. For instance,
+ * an LDAP {@code CertStore} may not search all entries in the
* directory. Instead, it may just search entries that are likely to
- * contain the <code>CRL</code>s it is looking for.
+ * contain the {@code CRL}s it is looking for.
* <p>
- * Some <code>CertStore</code> implementations (especially LDAP
- * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
- * unless a non-null <code>CRLSelector</code> is provided that
+ * Some {@code CertStore} implementations (especially LDAP
+ * {@code CertStore}s) may throw a {@code CertStoreException}
+ * unless a non-null {@code CRLSelector} is provided that
* includes specific criteria that can be used to find the CRLs.
* Issuer names and/or the certificate to be checked are especially useful.
*
- * @param selector A <code>CRLSelector</code> used to select which
- * <code>CRL</code>s should be returned. Specify <code>null</code>
- * to return all <code>CRL</code>s (if supported).
- * @return A <code>Collection</code> of <code>CRL</code>s that
- * match the specified selector (never <code>null</code>)
+ * @param selector A {@code CRLSelector} used to select which
+ * {@code CRL}s should be returned. Specify {@code null}
+ * to return all {@code CRL}s (if supported).
+ * @return A {@code Collection} of {@code CRL}s that
+ * match the specified selector (never {@code null})
* @throws CertStoreException if an exception occurs
*/
public final Collection<? extends CRL> getCRLs(CRLSelector selector)
@@ -182,8 +182,8 @@
}
/**
- * Returns a <code>CertStore</code> object that implements the specified
- * <code>CertStore</code> type and is initialized with the specified
+ * Returns a {@code CertStore} object that implements the specified
+ * {@code CertStore} type and is initialized with the specified
* parameters.
*
* <p> This method traverses the list of registered security Providers,
@@ -195,29 +195,29 @@
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
- * <p>The <code>CertStore</code> that is returned is initialized with the
- * specified <code>CertStoreParameters</code>. The type of parameters
- * needed may vary between different types of <code>CertStore</code>s.
- * Note that the specified <code>CertStoreParameters</code> object is
+ * <p>The {@code CertStore} that is returned is initialized with the
+ * specified {@code CertStoreParameters}. The type of parameters
+ * needed may vary between different types of {@code CertStore}s.
+ * Note that the specified {@code CertStoreParameters} object is
* cloned.
*
- * @param type the name of the requested <code>CertStore</code> type.
+ * @param type the name of the requested {@code CertStore} type.
* See the CertStore section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertStore">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard types.
*
- * @param params the initialization parameters (may be <code>null</code>).
+ * @param params the initialization parameters (may be {@code null}).
*
- * @return a <code>CertStore</code> object that implements the specified
- * <code>CertStore</code> type.
+ * @return a {@code CertStore} object that implements the specified
+ * {@code CertStore} type.
*
* @throws NoSuchAlgorithmException if no Provider supports a
* CertStoreSpi implementation for the specified type.
*
* @throws InvalidAlgorithmParameterException if the specified
* initialization parameters are inappropriate for this
- * <code>CertStore</code>.
+ * {@code CertStore}.
*
* @see java.security.Provider
*/
@@ -244,8 +244,8 @@
}
/**
- * Returns a <code>CertStore</code> object that implements the specified
- * <code>CertStore</code> type.
+ * Returns a {@code CertStore} object that implements the specified
+ * {@code CertStore} type.
*
* <p> A new CertStore object encapsulating the
* CertStoreSpi implementation from the specified provider
@@ -255,23 +255,23 @@
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
- * <p>The <code>CertStore</code> that is returned is initialized with the
- * specified <code>CertStoreParameters</code>. The type of parameters
- * needed may vary between different types of <code>CertStore</code>s.
- * Note that the specified <code>CertStoreParameters</code> object is
+ * <p>The {@code CertStore} that is returned is initialized with the
+ * specified {@code CertStoreParameters}. The type of parameters
+ * needed may vary between different types of {@code CertStore}s.
+ * Note that the specified {@code CertStoreParameters} object is
* cloned.
*
- * @param type the requested <code>CertStore</code> type.
+ * @param type the requested {@code CertStore} type.
* See the CertStore section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertStore">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard types.
*
- * @param params the initialization parameters (may be <code>null</code>).
+ * @param params the initialization parameters (may be {@code null}).
*
* @param provider the name of the provider.
*
- * @return a <code>CertStore</code> object that implements the
+ * @return a {@code CertStore} object that implements the
* specified type.
*
* @throws NoSuchAlgorithmException if a CertStoreSpi
@@ -280,12 +280,12 @@
*
* @throws InvalidAlgorithmParameterException if the specified
* initialization parameters are inappropriate for this
- * <code>CertStore</code>.
+ * {@code CertStore}.
*
* @throws NoSuchProviderException if the specified provider is not
* registered in the security provider list.
*
- * @exception IllegalArgumentException if the <code>provider</code> is
+ * @exception IllegalArgumentException if the {@code provider} is
* null or empty.
*
* @see java.security.Provider
@@ -305,31 +305,31 @@
}
/**
- * Returns a <code>CertStore</code> object that implements the specified
- * <code>CertStore</code> type.
+ * Returns a {@code CertStore} object that implements the specified
+ * {@code CertStore} type.
*
* <p> A new CertStore object encapsulating the
* CertStoreSpi implementation from the specified Provider
* object is returned. Note that the specified Provider object
* does not have to be registered in the provider list.
*
- * <p>The <code>CertStore</code> that is returned is initialized with the
- * specified <code>CertStoreParameters</code>. The type of parameters
- * needed may vary between different types of <code>CertStore</code>s.
- * Note that the specified <code>CertStoreParameters</code> object is
+ * <p>The {@code CertStore} that is returned is initialized with the
+ * specified {@code CertStoreParameters}. The type of parameters
+ * needed may vary between different types of {@code CertStore}s.
+ * Note that the specified {@code CertStoreParameters} object is
* cloned.
*
- * @param type the requested <code>CertStore</code> type.
+ * @param type the requested {@code CertStore} type.
* See the CertStore section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertStore">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard types.
*
- * @param params the initialization parameters (may be <code>null</code>).
+ * @param params the initialization parameters (may be {@code null}).
*
* @param provider the provider.
*
- * @return a <code>CertStore</code> object that implements the
+ * @return a {@code CertStore} object that implements the
* specified type.
*
* @exception NoSuchAlgorithmException if a CertStoreSpi
@@ -338,9 +338,9 @@
*
* @throws InvalidAlgorithmParameterException if the specified
* initialization parameters are inappropriate for this
- * <code>CertStore</code>
+ * {@code CertStore}
*
- * @exception IllegalArgumentException if the <code>provider</code> is
+ * @exception IllegalArgumentException if the {@code provider} is
* null.
*
* @see java.security.Provider
@@ -359,30 +359,30 @@
}
/**
- * Returns the parameters used to initialize this <code>CertStore</code>.
- * Note that the <code>CertStoreParameters</code> object is cloned before
+ * Returns the parameters used to initialize this {@code CertStore}.
+ * Note that the {@code CertStoreParameters} object is cloned before
* it is returned.
*
- * @return the parameters used to initialize this <code>CertStore</code>
- * (may be <code>null</code>)
+ * @return the parameters used to initialize this {@code CertStore}
+ * (may be {@code null})
*/
public final CertStoreParameters getCertStoreParameters() {
return (params == null ? null : (CertStoreParameters) params.clone());
}
/**
- * Returns the type of this <code>CertStore</code>.
+ * Returns the type of this {@code CertStore}.
*
- * @return the type of this <code>CertStore</code>
+ * @return the type of this {@code CertStore}
*/
public final String getType() {
return this.type;
}
/**
- * Returns the provider of this <code>CertStore</code>.
+ * Returns the provider of this {@code CertStore}.
*
- * @return the provider of this <code>CertStore</code>
+ * @return the provider of this {@code CertStore}
*/
public final Provider getProvider() {
return this.provider;
--- a/jdk/src/share/classes/java/security/cert/CertStoreException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertStoreException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -29,9 +29,9 @@
/**
* An exception indicating one of a variety of problems retrieving
- * certificates and CRLs from a <code>CertStore</code>.
+ * certificates and CRLs from a {@code CertStore}.
* <p>
- * A <code>CertStoreException</code> provides support for wrapping
+ * A {@code CertStoreException} provides support for wrapping
* exceptions. The {@link #getCause getCause} method returns the throwable,
* if any, that caused this exception to be thrown.
* <p>
@@ -53,7 +53,7 @@
private static final long serialVersionUID = 2395296107471573245L;
/**
- * Creates a <code>CertStoreException</code> with <code>null</code> as
+ * Creates a {@code CertStoreException} with {@code null} as
* its detail message.
*/
public CertStoreException() {
@@ -61,8 +61,8 @@
}
/**
- * Creates a <code>CertStoreException</code> with the given detail
- * message. A detail message is a <code>String</code> that describes this
+ * Creates a {@code CertStoreException} with the given detail
+ * message. A detail message is a {@code String} that describes this
* particular exception.
*
* @param msg the detail message
@@ -72,15 +72,15 @@
}
/**
- * Creates a <code>CertStoreException</code> that wraps the specified
+ * Creates a {@code CertStoreException} that wraps the specified
* throwable. This allows any exception to be converted into a
- * <code>CertStoreException</code>, while retaining information about the
+ * {@code CertStoreException}, while retaining information about the
* cause, which may be useful for debugging. The detail message is
- * set to (<code>cause==null ? null : cause.toString()</code>) (which
+ * set to ({@code cause==null ? null : cause.toString()}) (which
* typically contains the class and detail message of cause).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause getCause()} method). (A <code>null</code> value is
+ * {@link #getCause getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or unknown.)
*/
public CertStoreException(Throwable cause) {
@@ -88,12 +88,12 @@
}
/**
- * Creates a <code>CertStoreException</code> with the specified detail
+ * Creates a {@code CertStoreException} with the specified detail
* message and cause.
*
* @param msg the detail message
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause getCause()} method). (A <code>null</code> value is
+ * {@link #getCause getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or unknown.)
*/
public CertStoreException(String msg, Throwable cause) {
--- a/jdk/src/share/classes/java/security/cert/CertStoreParameters.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertStoreParameters.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -26,20 +26,20 @@
package java.security.cert;
/**
- * A specification of <code>CertStore</code> parameters.
+ * A specification of {@code CertStore} parameters.
* <p>
* The purpose of this interface is to group (and provide type safety for)
- * all <code>CertStore</code> parameter specifications. All
- * <code>CertStore</code> parameter specifications must implement this
+ * all {@code CertStore} parameter specifications. All
+ * {@code CertStore} parameter specifications must implement this
* interface.
* <p>
- * Typically, a <code>CertStoreParameters</code> object is passed as a parameter
+ * Typically, a {@code CertStoreParameters} object is passed as a parameter
* to one of the {@link CertStore#getInstance CertStore.getInstance} methods.
- * The <code>getInstance</code> method returns a <code>CertStore</code> that
- * is used for retrieving <code>Certificate</code>s and <code>CRL</code>s. The
- * <code>CertStore</code> that is returned is initialized with the specified
+ * The {@code getInstance} method returns a {@code CertStore} that
+ * is used for retrieving {@code Certificate}s and {@code CRL}s. The
+ * {@code CertStore} that is returned is initialized with the specified
* parameters. The type of parameters needed may vary between different types
- * of <code>CertStore</code>s.
+ * of {@code CertStore}s.
*
* @see CertStore#getInstance
*
@@ -49,32 +49,32 @@
public interface CertStoreParameters extends Cloneable {
/**
- * Makes a copy of this <code>CertStoreParameters</code>.
+ * Makes a copy of this {@code CertStoreParameters}.
* <p>
* The precise meaning of "copy" may depend on the class of
- * the <code>CertStoreParameters</code> object. A typical implementation
+ * the {@code CertStoreParameters} object. A typical implementation
* performs a "deep copy" of this object, but this is not an absolute
* requirement. Some implementations may perform a "shallow copy" of some
* or all of the fields of this object.
* <p>
- * Note that the <code>CertStore.getInstance</code> methods make a copy
- * of the specified <code>CertStoreParameters</code>. A deep copy
- * implementation of <code>clone</code> is safer and more robust, as it
- * prevents the caller from corrupting a shared <code>CertStore</code> by
+ * Note that the {@code CertStore.getInstance} methods make a copy
+ * of the specified {@code CertStoreParameters}. A deep copy
+ * implementation of {@code clone} is safer and more robust, as it
+ * prevents the caller from corrupting a shared {@code CertStore} by
* subsequently modifying the contents of its initialization parameters.
- * However, a shallow copy implementation of <code>clone</code> is more
+ * However, a shallow copy implementation of {@code clone} is more
* appropriate for applications that need to hold a reference to a
- * parameter contained in the <code>CertStoreParameters</code>. For example,
+ * parameter contained in the {@code CertStoreParameters}. For example,
* a shallow copy clone allows an application to release the resources of
- * a particular <code>CertStore</code> initialization parameter immediately,
+ * a particular {@code CertStore} initialization parameter immediately,
* rather than waiting for the garbage collection mechanism. This should
- * be done with the utmost care, since the <code>CertStore</code> may still
+ * be done with the utmost care, since the {@code CertStore} may still
* be in use by other threads.
* <p>
* Each subclass should state the precise behavior of this method so
* that users and developers know what to expect.
*
- * @return a copy of this <code>CertStoreParameters</code>
+ * @return a copy of this {@code CertStoreParameters}
*/
Object clone();
}
--- a/jdk/src/share/classes/java/security/cert/CertStoreSpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertStoreSpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -30,26 +30,26 @@
/**
* The <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the {@link CertStore CertStore} class. All <code>CertStore</code>
+ * for the {@link CertStore CertStore} class. All {@code CertStore}
* implementations must include a class (the SPI class) that extends
- * this class (<code>CertStoreSpi</code>), provides a constructor with
- * a single argument of type <code>CertStoreParameters</code>, and implements
+ * this class ({@code CertStoreSpi}), provides a constructor with
+ * a single argument of type {@code CertStoreParameters}, and implements
* all of its methods. In general, instances of this class should only be
- * accessed through the <code>CertStore</code> class.
+ * accessed through the {@code CertStore} class.
* For details, see the Java Cryptography Architecture.
* <p>
* <b>Concurrent Access</b>
* <p>
- * The public methods of all <code>CertStoreSpi</code> objects must be
+ * The public methods of all {@code CertStoreSpi} objects must be
* thread-safe. That is, multiple threads may concurrently invoke these
- * methods on a single <code>CertStoreSpi</code> object (or more than one)
- * with no ill effects. This allows a <code>CertPathBuilder</code> to search
+ * methods on a single {@code CertStoreSpi} object (or more than one)
+ * with no ill effects. This allows a {@code CertPathBuilder} to search
* for a CRL while simultaneously searching for further certificates, for
* instance.
* <p>
- * Simple <code>CertStoreSpi</code> implementations will probably ensure
- * thread safety by adding a <code>synchronized</code> keyword to their
- * <code>engineGetCertificates</code> and <code>engineGetCRLs</code> methods.
+ * Simple {@code CertStoreSpi} implementations will probably ensure
+ * thread safety by adding a {@code synchronized} keyword to their
+ * {@code engineGetCertificates} and {@code engineGetCRLs} methods.
* More sophisticated ones may allow truly concurrent access.
*
* @since 1.4
@@ -60,64 +60,64 @@
/**
* The sole constructor.
*
- * @param params the initialization parameters (may be <code>null</code>)
+ * @param params the initialization parameters (may be {@code null})
* @throws InvalidAlgorithmParameterException if the initialization
- * parameters are inappropriate for this <code>CertStoreSpi</code>
+ * parameters are inappropriate for this {@code CertStoreSpi}
*/
public CertStoreSpi(CertStoreParameters params)
throws InvalidAlgorithmParameterException { }
/**
- * Returns a <code>Collection</code> of <code>Certificate</code>s that
- * match the specified selector. If no <code>Certificate</code>s
- * match the selector, an empty <code>Collection</code> will be returned.
+ * Returns a {@code Collection} of {@code Certificate}s that
+ * match the specified selector. If no {@code Certificate}s
+ * match the selector, an empty {@code Collection} will be returned.
* <p>
- * For some <code>CertStore</code> types, the resulting
- * <code>Collection</code> may not contain <b>all</b> of the
- * <code>Certificate</code>s that match the selector. For instance,
- * an LDAP <code>CertStore</code> may not search all entries in the
+ * For some {@code CertStore} types, the resulting
+ * {@code Collection} may not contain <b>all</b> of the
+ * {@code Certificate}s that match the selector. For instance,
+ * an LDAP {@code CertStore} may not search all entries in the
* directory. Instead, it may just search entries that are likely to
- * contain the <code>Certificate</code>s it is looking for.
+ * contain the {@code Certificate}s it is looking for.
* <p>
- * Some <code>CertStore</code> implementations (especially LDAP
- * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
- * unless a non-null <code>CertSelector</code> is provided that includes
+ * Some {@code CertStore} implementations (especially LDAP
+ * {@code CertStore}s) may throw a {@code CertStoreException}
+ * unless a non-null {@code CertSelector} is provided that includes
* specific criteria that can be used to find the certificates. Issuer
* and/or subject names are especially useful criteria.
*
- * @param selector A <code>CertSelector</code> used to select which
- * <code>Certificate</code>s should be returned. Specify <code>null</code>
- * to return all <code>Certificate</code>s (if supported).
- * @return A <code>Collection</code> of <code>Certificate</code>s that
- * match the specified selector (never <code>null</code>)
+ * @param selector A {@code CertSelector} used to select which
+ * {@code Certificate}s should be returned. Specify {@code null}
+ * to return all {@code Certificate}s (if supported).
+ * @return A {@code Collection} of {@code Certificate}s that
+ * match the specified selector (never {@code null})
* @throws CertStoreException if an exception occurs
*/
public abstract Collection<? extends Certificate> engineGetCertificates
(CertSelector selector) throws CertStoreException;
/**
- * Returns a <code>Collection</code> of <code>CRL</code>s that
- * match the specified selector. If no <code>CRL</code>s
- * match the selector, an empty <code>Collection</code> will be returned.
+ * Returns a {@code Collection} of {@code CRL}s that
+ * match the specified selector. If no {@code CRL}s
+ * match the selector, an empty {@code Collection} will be returned.
* <p>
- * For some <code>CertStore</code> types, the resulting
- * <code>Collection</code> may not contain <b>all</b> of the
- * <code>CRL</code>s that match the selector. For instance,
- * an LDAP <code>CertStore</code> may not search all entries in the
+ * For some {@code CertStore} types, the resulting
+ * {@code Collection} may not contain <b>all</b> of the
+ * {@code CRL}s that match the selector. For instance,
+ * an LDAP {@code CertStore} may not search all entries in the
* directory. Instead, it may just search entries that are likely to
- * contain the <code>CRL</code>s it is looking for.
+ * contain the {@code CRL}s it is looking for.
* <p>
- * Some <code>CertStore</code> implementations (especially LDAP
- * <code>CertStore</code>s) may throw a <code>CertStoreException</code>
- * unless a non-null <code>CRLSelector</code> is provided that includes
+ * Some {@code CertStore} implementations (especially LDAP
+ * {@code CertStore}s) may throw a {@code CertStoreException}
+ * unless a non-null {@code CRLSelector} is provided that includes
* specific criteria that can be used to find the CRLs. Issuer names
* and/or the certificate to be checked are especially useful.
*
- * @param selector A <code>CRLSelector</code> used to select which
- * <code>CRL</code>s should be returned. Specify <code>null</code>
- * to return all <code>CRL</code>s (if supported).
- * @return A <code>Collection</code> of <code>CRL</code>s that
- * match the specified selector (never <code>null</code>)
+ * @param selector A {@code CRLSelector} used to select which
+ * {@code CRL}s should be returned. Specify {@code null}
+ * to return all {@code CRL}s (if supported).
+ * @return A {@code Collection} of {@code CRL}s that
+ * match the specified selector (never {@code null})
* @throws CertStoreException if an exception occurs
*/
public abstract Collection<? extends CRL> engineGetCRLs
--- a/jdk/src/share/classes/java/security/cert/Certificate.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/Certificate.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -90,8 +90,8 @@
/**
* Compares this certificate for equality with the specified
- * object. If the <code>other</code> object is an
- * <code>instanceof</code> <code>Certificate</code>, then
+ * object. If the {@code other} object is an
+ * {@code instanceof} {@code Certificate}, then
* its encoded form is retrieved and compared with the
* encoded form of this certificate.
*
@@ -196,8 +196,8 @@
*
* <p> This method was added to version 1.8 of the Java Platform
* Standard Edition. In order to maintain backwards compatibility with
- * existing service providers, this method cannot be <code>abstract</code>
- * and by default throws an <code>UnsupportedOperationException</code>.
+ * existing service providers, this method cannot be {@code abstract}
+ * and by default throws an {@code UnsupportedOperationException}.
*
* @param key the PublicKey used to carry out the verification.
* @param sigProvider the signature provider.
--- a/jdk/src/share/classes/java/security/cert/CertificateEncodingException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertificateEncodingException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -56,13 +56,13 @@
}
/**
- * Creates a <code>CertificateEncodingException</code> with the specified
+ * Creates a {@code CertificateEncodingException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -71,14 +71,14 @@
}
/**
- * Creates a <code>CertificateEncodingException</code>
+ * Creates a {@code CertificateEncodingException}
* with the specified cause and a detail message of
- * <tt>(cause==null ? null : cause.toString())</tt>
+ * {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/cert/CertificateException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertificateException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -57,13 +57,13 @@
}
/**
- * Creates a <code>CertificateException</code> with the specified
+ * Creates a {@code CertificateException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -72,13 +72,13 @@
}
/**
- * Creates a <code>CertificateException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code CertificateException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/cert/CertificateExpiredException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertificateExpiredException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,8 +27,8 @@
/**
* Certificate Expired Exception. This is thrown whenever the current
- * <code>Date</code> or the specified <code>Date</code> is after the
- * <code>notAfter</code> date/time specified in the validity period
+ * {@code Date} or the specified {@code Date} is after the
+ * {@code notAfter} date/time specified in the validity period
* of the certificate.
*
* @author Hemma Prafullchandra
--- a/jdk/src/share/classes/java/security/cert/CertificateFactory.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertificateFactory.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -41,27 +41,27 @@
/**
* This class defines the functionality of a certificate factory, which is
- * used to generate certificate, certification path (<code>CertPath</code>)
+ * used to generate certificate, certification path ({@code CertPath})
* and certificate revocation list (CRL) objects from their encodings.
*
* <p>For encodings consisting of multiple certificates, use
- * <code>generateCertificates</code> when you want to
+ * {@code generateCertificates} when you want to
* parse a collection of possibly unrelated certificates. Otherwise,
- * use <code>generateCertPath</code> when you want to generate
- * a <code>CertPath</code> (a certificate chain) and subsequently
- * validate it with a <code>CertPathValidator</code>.
+ * use {@code generateCertPath} when you want to generate
+ * a {@code CertPath} (a certificate chain) and subsequently
+ * validate it with a {@code CertPathValidator}.
*
* <p>A certificate factory for X.509 must return certificates that are an
- * instance of <code>java.security.cert.X509Certificate</code>, and CRLs
- * that are an instance of <code>java.security.cert.X509CRL</code>.
+ * instance of {@code java.security.cert.X509Certificate}, and CRLs
+ * that are an instance of {@code java.security.cert.X509CRL}.
*
* <p>The following example reads a file with Base64 encoded certificates,
* which are each bounded at the beginning by -----BEGIN CERTIFICATE-----, and
* bounded at the end by -----END CERTIFICATE-----. We convert the
- * <code>FileInputStream</code> (which does not support <code>mark</code>
- * and <code>reset</code>) to a <code>BufferedInputStream</code> (which
+ * {@code FileInputStream} (which does not support {@code mark}
+ * and {@code reset}) to a {@code BufferedInputStream} (which
* supports those methods), so that each call to
- * <code>generateCertificate</code> consumes only one certificate, and the
+ * {@code generateCertificate} consumes only one certificate, and the
* read position of the input stream is positioned to the next certificate in
* the file:<p>
*
@@ -92,14 +92,14 @@
* </pre>
*
* <p> Every implementation of the Java platform is required to support the
- * following standard <code>CertificateFactory</code> type:
+ * following standard {@code CertificateFactory} type:
* <ul>
- * <li><tt>X.509</tt></li>
+ * <li>{@code X.509}</li>
* </ul>
- * and the following standard <code>CertPath</code> encodings:
+ * and the following standard {@code CertPath} encodings:
* <ul>
- * <li><tt>PKCS7</tt></li>
- * <li><tt>PkiPath</tt></li>
+ * <li>{@code PKCS7}</li>
+ * <li>{@code PkiPath}</li>
* </ul>
* The type and encodings are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertificateFactory">
@@ -258,7 +258,7 @@
* implementation for the specified algorithm is not available
* from the specified Provider object.
*
- * @exception IllegalArgumentException if the <code>provider</code> is
+ * @exception IllegalArgumentException if the {@code provider} is
* null.
*
* @see java.security.Provider
@@ -299,17 +299,17 @@
/**
* Generates a certificate object and initializes it with
- * the data read from the input stream <code>inStream</code>.
+ * the data read from the input stream {@code inStream}.
*
* <p>In order to take advantage of the specialized certificate format
* supported by this certificate factory,
* the returned certificate object can be typecast to the corresponding
* certificate class. For example, if this certificate
* factory implements X.509 certificates, the returned certificate object
- * can be typecast to the <code>X509Certificate</code> class.
+ * can be typecast to the {@code X509Certificate} class.
*
* <p>In the case of a certificate factory for X.509 certificates, the
- * certificate provided in <code>inStream</code> must be DER-encoded and
+ * certificate provided in {@code inStream} must be DER-encoded and
* may be supplied in binary or printable (Base64) encoding. If the
* certificate is provided in Base64 encoding, it must be bounded at
* the beginning by -----BEGIN CERTIFICATE-----, and must be bounded at
@@ -324,7 +324,7 @@
* the inherent end-of-certificate marker. If the data in the input stream
* does not contain an inherent end-of-certificate marker (other
* than EOF) and there is trailing data after the certificate is parsed, a
- * <code>CertificateException</code> is thrown.
+ * {@code CertificateException} is thrown.
*
* @param inStream an input stream with the certificate data.
*
@@ -340,19 +340,19 @@
}
/**
- * Returns an iteration of the <code>CertPath</code> encodings supported
+ * Returns an iteration of the {@code CertPath} encodings supported
* by this certificate factory, with the default encoding first. See
* the CertPath Encodings section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathEncodings">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard encoding names and their formats.
* <p>
- * Attempts to modify the returned <code>Iterator</code> via its
- * <code>remove</code> method result in an
- * <code>UnsupportedOperationException</code>.
+ * Attempts to modify the returned {@code Iterator} via its
+ * {@code remove} method result in an
+ * {@code UnsupportedOperationException}.
*
- * @return an <code>Iterator</code> over the names of the supported
- * <code>CertPath</code> encodings (as <code>String</code>s)
+ * @return an {@code Iterator} over the names of the supported
+ * {@code CertPath} encodings (as {@code String}s)
* @since 1.4
*/
public final Iterator<String> getCertPathEncodings() {
@@ -360,15 +360,15 @@
}
/**
- * Generates a <code>CertPath</code> object and initializes it with
- * the data read from the <code>InputStream</code> inStream. The data
+ * Generates a {@code CertPath} object and initializes it with
+ * the data read from the {@code InputStream} inStream. The data
* is assumed to be in the default encoding. The name of the default
- * encoding is the first element of the <code>Iterator</code> returned by
+ * encoding is the first element of the {@code Iterator} returned by
* the {@link #getCertPathEncodings getCertPathEncodings} method.
*
- * @param inStream an <code>InputStream</code> containing the data
- * @return a <code>CertPath</code> initialized with the data from the
- * <code>InputStream</code>
+ * @param inStream an {@code InputStream} containing the data
+ * @return a {@code CertPath} initialized with the data from the
+ * {@code InputStream}
* @exception CertificateException if an exception occurs while decoding
* @since 1.4
*/
@@ -379,18 +379,18 @@
}
/**
- * Generates a <code>CertPath</code> object and initializes it with
- * the data read from the <code>InputStream</code> inStream. The data
+ * Generates a {@code CertPath} object and initializes it with
+ * the data read from the {@code InputStream} inStream. The data
* is assumed to be in the specified encoding. See
* the CertPath Encodings section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathEncodings">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard encoding names and their formats.
*
- * @param inStream an <code>InputStream</code> containing the data
+ * @param inStream an {@code InputStream} containing the data
* @param encoding the encoding used for the data
- * @return a <code>CertPath</code> initialized with the data from the
- * <code>InputStream</code>
+ * @return a {@code CertPath} initialized with the data from the
+ * {@code InputStream}
* @exception CertificateException if an exception occurs while decoding or
* the encoding requested is not supported
* @since 1.4
@@ -402,15 +402,15 @@
}
/**
- * Generates a <code>CertPath</code> object and initializes it with
- * a <code>List</code> of <code>Certificate</code>s.
+ * Generates a {@code CertPath} object and initializes it with
+ * a {@code List} of {@code Certificate}s.
* <p>
* The certificates supplied must be of a type supported by the
- * <code>CertificateFactory</code>. They will be copied out of the supplied
- * <code>List</code> object.
+ * {@code CertificateFactory}. They will be copied out of the supplied
+ * {@code List} object.
*
- * @param certificates a <code>List</code> of <code>Certificate</code>s
- * @return a <code>CertPath</code> initialized with the supplied list of
+ * @param certificates a {@code List} of {@code Certificate}s
+ * @return a {@code CertPath} initialized with the supplied list of
* certificates
* @exception CertificateException if an exception occurs
* @since 1.4
@@ -424,20 +424,20 @@
/**
* Returns a (possibly empty) collection view of the certificates read
- * from the given input stream <code>inStream</code>.
+ * from the given input stream {@code inStream}.
*
* <p>In order to take advantage of the specialized certificate format
* supported by this certificate factory, each element in
* the returned collection view can be typecast to the corresponding
* certificate class. For example, if this certificate
* factory implements X.509 certificates, the elements in the returned
- * collection can be typecast to the <code>X509Certificate</code> class.
+ * collection can be typecast to the {@code X509Certificate} class.
*
* <p>In the case of a certificate factory for X.509 certificates,
- * <code>inStream</code> may contain a sequence of DER-encoded certificates
+ * {@code inStream} may contain a sequence of DER-encoded certificates
* in the formats described for
* {@link #generateCertificate(java.io.InputStream) generateCertificate}.
- * In addition, <code>inStream</code> may contain a PKCS#7 certificate
+ * In addition, {@code inStream} may contain a PKCS#7 certificate
* chain. This is a PKCS#7 <i>SignedData</i> object, with the only
* significant field being <i>certificates</i>. In particular, the
* signature and the contents are ignored. This format allows multiple
@@ -464,14 +464,14 @@
/**
* Generates a certificate revocation list (CRL) object and initializes it
- * with the data read from the input stream <code>inStream</code>.
+ * with the data read from the input stream {@code inStream}.
*
* <p>In order to take advantage of the specialized CRL format
* supported by this certificate factory,
* the returned CRL object can be typecast to the corresponding
* CRL class. For example, if this certificate
* factory implements X.509 CRLs, the returned CRL object
- * can be typecast to the <code>X509CRL</code> class.
+ * can be typecast to the {@code X509CRL} class.
*
* <p>Note that if the given input stream does not support
* {@link java.io.InputStream#mark(int) mark} and
@@ -482,7 +482,7 @@
* end-of-CRL marker. If the data in the
* input stream does not contain an inherent end-of-CRL marker (other
* than EOF) and there is trailing data after the CRL is parsed, a
- * <code>CRLException</code> is thrown.
+ * {@code CRLException} is thrown.
*
* @param inStream an input stream with the CRL data.
*
@@ -499,18 +499,18 @@
/**
* Returns a (possibly empty) collection view of the CRLs read
- * from the given input stream <code>inStream</code>.
+ * from the given input stream {@code inStream}.
*
* <p>In order to take advantage of the specialized CRL format
* supported by this certificate factory, each element in
* the returned collection view can be typecast to the corresponding
* CRL class. For example, if this certificate
* factory implements X.509 CRLs, the elements in the returned
- * collection can be typecast to the <code>X509CRL</code> class.
+ * collection can be typecast to the {@code X509CRL} class.
*
* <p>In the case of a certificate factory for X.509 CRLs,
- * <code>inStream</code> may contain a sequence of DER-encoded CRLs.
- * In addition, <code>inStream</code> may contain a PKCS#7 CRL
+ * {@code inStream} may contain a sequence of DER-encoded CRLs.
+ * In addition, {@code inStream} may contain a PKCS#7 CRL
* set. This is a PKCS#7 <i>SignedData</i> object, with the only
* significant field being <i>crls</i>. In particular, the
* signature and the contents are ignored. This format allows multiple
--- a/jdk/src/share/classes/java/security/cert/CertificateFactorySpi.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertificateFactorySpi.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -35,18 +35,18 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>CertificateFactory</code> class.
+ * for the {@code CertificateFactory} class.
* All the abstract methods in this class must be implemented by each
* cryptographic service provider who wishes to supply the implementation
* of a certificate factory for a particular certificate type, e.g., X.509.
*
* <p>Certificate factories are used to generate certificate, certification path
- * (<code>CertPath</code>) and certificate revocation list (CRL) objects from
+ * ({@code CertPath}) and certificate revocation list (CRL) objects from
* their encodings.
*
* <p>A certificate factory for X.509 must return certificates that are an
- * instance of <code>java.security.cert.X509Certificate</code>, and CRLs
- * that are an instance of <code>java.security.cert.X509CRL</code>.
+ * instance of {@code java.security.cert.X509Certificate}, and CRLs
+ * that are an instance of {@code java.security.cert.X509CRL}.
*
* @author Hemma Prafullchandra
* @author Jan Luehe
@@ -67,17 +67,17 @@
/**
* Generates a certificate object and initializes it with
- * the data read from the input stream <code>inStream</code>.
+ * the data read from the input stream {@code inStream}.
*
* <p>In order to take advantage of the specialized certificate format
* supported by this certificate factory,
* the returned certificate object can be typecast to the corresponding
* certificate class. For example, if this certificate
* factory implements X.509 certificates, the returned certificate object
- * can be typecast to the <code>X509Certificate</code> class.
+ * can be typecast to the {@code X509Certificate} class.
*
* <p>In the case of a certificate factory for X.509 certificates, the
- * certificate provided in <code>inStream</code> must be DER-encoded and
+ * certificate provided in {@code inStream} must be DER-encoded and
* may be supplied in binary or printable (Base64) encoding. If the
* certificate is provided in Base64 encoding, it must be bounded at
* the beginning by -----BEGIN CERTIFICATE-----, and must be bounded at
@@ -92,7 +92,7 @@
* end-of-certificate marker. If the data in the
* input stream does not contain an inherent end-of-certificate marker (other
* than EOF) and there is trailing data after the certificate is parsed, a
- * <code>CertificateException</code> is thrown.
+ * {@code CertificateException} is thrown.
*
* @param inStream an input stream with the certificate data.
*
@@ -105,18 +105,18 @@
throws CertificateException;
/**
- * Generates a <code>CertPath</code> object and initializes it with
- * the data read from the <code>InputStream</code> inStream. The data
+ * Generates a {@code CertPath} object and initializes it with
+ * the data read from the {@code InputStream} inStream. The data
* is assumed to be in the default encoding.
*
* <p> This method was added to version 1.4 of the Java 2 Platform
* Standard Edition. In order to maintain backwards compatibility with
- * existing service providers, this method cannot be <code>abstract</code>
- * and by default throws an <code>UnsupportedOperationException</code>.
+ * existing service providers, this method cannot be {@code abstract}
+ * and by default throws an {@code UnsupportedOperationException}.
*
- * @param inStream an <code>InputStream</code> containing the data
- * @return a <code>CertPath</code> initialized with the data from the
- * <code>InputStream</code>
+ * @param inStream an {@code InputStream} containing the data
+ * @return a {@code CertPath} initialized with the data from the
+ * {@code InputStream}
* @exception CertificateException if an exception occurs while decoding
* @exception UnsupportedOperationException if the method is not supported
* @since 1.4
@@ -128,19 +128,19 @@
}
/**
- * Generates a <code>CertPath</code> object and initializes it with
- * the data read from the <code>InputStream</code> inStream. The data
+ * Generates a {@code CertPath} object and initializes it with
+ * the data read from the {@code InputStream} inStream. The data
* is assumed to be in the specified encoding.
*
* <p> This method was added to version 1.4 of the Java 2 Platform
* Standard Edition. In order to maintain backwards compatibility with
- * existing service providers, this method cannot be <code>abstract</code>
- * and by default throws an <code>UnsupportedOperationException</code>.
+ * existing service providers, this method cannot be {@code abstract}
+ * and by default throws an {@code UnsupportedOperationException}.
*
- * @param inStream an <code>InputStream</code> containing the data
+ * @param inStream an {@code InputStream} containing the data
* @param encoding the encoding used for the data
- * @return a <code>CertPath</code> initialized with the data from the
- * <code>InputStream</code>
+ * @return a {@code CertPath} initialized with the data from the
+ * {@code InputStream}
* @exception CertificateException if an exception occurs while decoding or
* the encoding requested is not supported
* @exception UnsupportedOperationException if the method is not supported
@@ -153,20 +153,20 @@
}
/**
- * Generates a <code>CertPath</code> object and initializes it with
- * a <code>List</code> of <code>Certificate</code>s.
+ * Generates a {@code CertPath} object and initializes it with
+ * a {@code List} of {@code Certificate}s.
* <p>
* The certificates supplied must be of a type supported by the
- * <code>CertificateFactory</code>. They will be copied out of the supplied
- * <code>List</code> object.
+ * {@code CertificateFactory}. They will be copied out of the supplied
+ * {@code List} object.
*
* <p> This method was added to version 1.4 of the Java 2 Platform
* Standard Edition. In order to maintain backwards compatibility with
- * existing service providers, this method cannot be <code>abstract</code>
- * and by default throws an <code>UnsupportedOperationException</code>.
+ * existing service providers, this method cannot be {@code abstract}
+ * and by default throws an {@code UnsupportedOperationException}.
*
- * @param certificates a <code>List</code> of <code>Certificate</code>s
- * @return a <code>CertPath</code> initialized with the supplied list of
+ * @param certificates a {@code List} of {@code Certificate}s
+ * @return a {@code CertPath} initialized with the supplied list of
* certificates
* @exception CertificateException if an exception occurs
* @exception UnsupportedOperationException if the method is not supported
@@ -180,24 +180,24 @@
}
/**
- * Returns an iteration of the <code>CertPath</code> encodings supported
+ * Returns an iteration of the {@code CertPath} encodings supported
* by this certificate factory, with the default encoding first. See
* the CertPath Encodings section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathEncodings">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard encoding names.
* <p>
- * Attempts to modify the returned <code>Iterator</code> via its
- * <code>remove</code> method result in an
- * <code>UnsupportedOperationException</code>.
+ * Attempts to modify the returned {@code Iterator} via its
+ * {@code remove} method result in an
+ * {@code UnsupportedOperationException}.
*
* <p> This method was added to version 1.4 of the Java 2 Platform
* Standard Edition. In order to maintain backwards compatibility with
- * existing service providers, this method cannot be <code>abstract</code>
- * and by default throws an <code>UnsupportedOperationException</code>.
+ * existing service providers, this method cannot be {@code abstract}
+ * and by default throws an {@code UnsupportedOperationException}.
*
- * @return an <code>Iterator</code> over the names of the supported
- * <code>CertPath</code> encodings (as <code>String</code>s)
+ * @return an {@code Iterator} over the names of the supported
+ * {@code CertPath} encodings (as {@code String}s)
* @exception UnsupportedOperationException if the method is not supported
* @since 1.4
*/
@@ -207,21 +207,21 @@
/**
* Returns a (possibly empty) collection view of the certificates read
- * from the given input stream <code>inStream</code>.
+ * from the given input stream {@code inStream}.
*
* <p>In order to take advantage of the specialized certificate format
* supported by this certificate factory, each element in
* the returned collection view can be typecast to the corresponding
* certificate class. For example, if this certificate
* factory implements X.509 certificates, the elements in the returned
- * collection can be typecast to the <code>X509Certificate</code> class.
+ * collection can be typecast to the {@code X509Certificate} class.
*
* <p>In the case of a certificate factory for X.509 certificates,
- * <code>inStream</code> may contain a single DER-encoded certificate
+ * {@code inStream} may contain a single DER-encoded certificate
* in the formats described for
* {@link CertificateFactory#generateCertificate(java.io.InputStream)
* generateCertificate}.
- * In addition, <code>inStream</code> may contain a PKCS#7 certificate
+ * In addition, {@code inStream} may contain a PKCS#7 certificate
* chain. This is a PKCS#7 <i>SignedData</i> object, with the only
* significant field being <i>certificates</i>. In particular, the
* signature and the contents are ignored. This format allows multiple
@@ -247,14 +247,14 @@
/**
* Generates a certificate revocation list (CRL) object and initializes it
- * with the data read from the input stream <code>inStream</code>.
+ * with the data read from the input stream {@code inStream}.
*
* <p>In order to take advantage of the specialized CRL format
* supported by this certificate factory,
* the returned CRL object can be typecast to the corresponding
* CRL class. For example, if this certificate
* factory implements X.509 CRLs, the returned CRL object
- * can be typecast to the <code>X509CRL</code> class.
+ * can be typecast to the {@code X509CRL} class.
*
* <p>Note that if the given input stream does not support
* {@link java.io.InputStream#mark(int) mark} and
@@ -265,7 +265,7 @@
* end-of-CRL marker. If the data in the
* input stream does not contain an inherent end-of-CRL marker (other
* than EOF) and there is trailing data after the CRL is parsed, a
- * <code>CRLException</code> is thrown.
+ * {@code CRLException} is thrown.
*
* @param inStream an input stream with the CRL data.
*
@@ -279,18 +279,18 @@
/**
* Returns a (possibly empty) collection view of the CRLs read
- * from the given input stream <code>inStream</code>.
+ * from the given input stream {@code inStream}.
*
* <p>In order to take advantage of the specialized CRL format
* supported by this certificate factory, each element in
* the returned collection view can be typecast to the corresponding
* CRL class. For example, if this certificate
* factory implements X.509 CRLs, the elements in the returned
- * collection can be typecast to the <code>X509CRL</code> class.
+ * collection can be typecast to the {@code X509CRL} class.
*
* <p>In the case of a certificate factory for X.509 CRLs,
- * <code>inStream</code> may contain a single DER-encoded CRL.
- * In addition, <code>inStream</code> may contain a PKCS#7 CRL
+ * {@code inStream} may contain a single DER-encoded CRL.
+ * In addition, {@code inStream} may contain a PKCS#7 CRL
* set. This is a PKCS#7 <i>SignedData</i> object, with the only
* significant field being <i>crls</i>. In particular, the
* signature and the contents are ignored. This format allows multiple
--- a/jdk/src/share/classes/java/security/cert/CertificateNotYetValidException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertificateNotYetValidException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,8 +27,8 @@
/**
* Certificate is not yet valid exception. This is thrown whenever
- * the current <code>Date</code> or the specified <code>Date</code>
- * is before the <code>notBefore</code> date/time in the Certificate
+ * the current {@code Date} or the specified {@code Date}
+ * is before the {@code notBefore} date/time in the Certificate
* validity period.
*
* @author Hemma Prafullchandra
--- a/jdk/src/share/classes/java/security/cert/CertificateParsingException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertificateParsingException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -57,13 +57,13 @@
}
/**
- * Creates a <code>CertificateParsingException</code> with the specified
+ * Creates a {@code CertificateParsingException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -72,14 +72,14 @@
}
/**
- * Creates a <code>CertificateParsingException</code> with the
+ * Creates a {@code CertificateParsingException} with the
* specified cause and a detail message of
- * <tt>(cause==null ? null : cause.toString())</tt>
+ * {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/cert/CertificateRevokedException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertificateRevokedException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -39,7 +39,7 @@
/**
* An exception that indicates an X.509 certificate is revoked. A
- * <code>CertificateRevokedException</code> contains additional information
+ * {@code CertificateRevokedException} contains additional information
* about the revoked certificate, such as the date on which the
* certificate was revoked and the reason it was revoked.
*
@@ -60,7 +60,7 @@
*/
private final CRLReason reason;
/**
- * @serial the <code>X500Principal</code> that represents the name of the
+ * @serial the {@code X500Principal} that represents the name of the
* authority that signed the certificate's revocation status information
*/
private final X500Principal authority;
@@ -68,7 +68,7 @@
private transient Map<String, Extension> extensions;
/**
- * Constructs a <code>CertificateRevokedException</code> with
+ * Constructs a {@code CertificateRevokedException} with
* the specified revocation date, reason code, authority name, and map
* of extensions.
*
@@ -78,12 +78,12 @@
* @param extensions a map of X.509 Extensions. Each key is an OID String
* that maps to the corresponding Extension. The map is copied to
* prevent subsequent modification.
- * @param authority the <code>X500Principal</code> that represents the name
+ * @param authority the {@code X500Principal} that represents the name
* of the authority that signed the certificate's revocation status
* information
- * @throws NullPointerException if <code>revocationDate</code>,
- * <code>reason</code>, <code>authority</code>, or
- * <code>extensions</code> is <code>null</code>
+ * @throws NullPointerException if {@code revocationDate},
+ * {@code reason}, {@code authority}, or
+ * {@code extensions} is {@code null}
*/
public CertificateRevokedException(Date revocationDate, CRLReason reason,
X500Principal authority, Map<String, Extension> extensions) {
@@ -121,7 +121,7 @@
* Returns the name of the authority that signed the certificate's
* revocation status information.
*
- * @return the <code>X500Principal</code> that represents the name of the
+ * @return the {@code X500Principal} that represents the name of the
* authority that signed the certificate's revocation status information
*/
public X500Principal getAuthorityName() {
@@ -130,16 +130,16 @@
/**
* Returns the invalidity date, as specifed in the Invalidity Date
- * extension of this <code>CertificateRevokedException</code>. The
+ * extension of this {@code CertificateRevokedException}. The
* invalidity date is the date on which it is known or suspected that the
* private key was compromised or that the certificate otherwise became
- * invalid. This implementation calls <code>getExtensions()</code> and
+ * invalid. This implementation calls {@code getExtensions()} and
* checks the returned map for an entry for the Invalidity Date extension
* OID ("2.5.29.24"). If found, it returns the invalidity date in the
* extension; otherwise null. A new Date object is returned each time the
* method is invoked to protect against subsequent modification.
*
- * @return the invalidity date, or <code>null</code> if not specified
+ * @return the invalidity date, or {@code null} if not specified
*/
public Date getInvalidityDate() {
Extension ext = getExtensions().get("2.5.29.24");
@@ -176,7 +176,7 @@
}
/**
- * Serialize this <code>CertificateRevokedException</code> instance.
+ * Serialize this {@code CertificateRevokedException} instance.
*
* @serialData the size of the extensions map (int), followed by all of
* the extensions in the map, in no particular order. For each extension,
@@ -208,7 +208,7 @@
}
/**
- * Deserialize the <code>CertificateRevokedException</code> instance.
+ * Deserialize the {@code CertificateRevokedException} instance.
*/
private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException {
--- a/jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -30,13 +30,13 @@
import java.util.Collections;
/**
- * Parameters used as input for the Collection <code>CertStore</code>
+ * Parameters used as input for the Collection {@code CertStore}
* algorithm.
* <p>
* This class is used to provide necessary configuration parameters
- * to implementations of the Collection <code>CertStore</code>
+ * to implementations of the Collection {@code CertStore}
* algorithm. The only parameter included in this class is the
- * <code>Collection</code> from which the <code>CertStore</code> will
+ * {@code Collection} from which the {@code CertStore} will
* retrieve certificates and CRLs.
* <p>
* <b>Concurrent Access</b>
@@ -58,30 +58,30 @@
private Collection<?> coll;
/**
- * Creates an instance of <code>CollectionCertStoreParameters</code>
+ * Creates an instance of {@code CollectionCertStoreParameters}
* which will allow certificates and CRLs to be retrieved from the
- * specified <code>Collection</code>. If the specified
- * <code>Collection</code> contains an object that is not a
- * <code>Certificate</code> or <code>CRL</code>, that object will be
- * ignored by the Collection <code>CertStore</code>.
+ * specified {@code Collection}. If the specified
+ * {@code Collection} contains an object that is not a
+ * {@code Certificate} or {@code CRL}, that object will be
+ * ignored by the Collection {@code CertStore}.
* <p>
- * The <code>Collection</code> is <b>not</b> copied. Instead, a
+ * The {@code Collection} is <b>not</b> copied. Instead, a
* reference is used. This allows the caller to subsequently add or
- * remove <code>Certificates</code> or <code>CRL</code>s from the
- * <code>Collection</code>, thus changing the set of
- * <code>Certificates</code> or <code>CRL</code>s available to the
- * Collection <code>CertStore</code>. The Collection <code>CertStore</code>
- * will not modify the contents of the <code>Collection</code>.
+ * remove {@code Certificates} or {@code CRL}s from the
+ * {@code Collection}, thus changing the set of
+ * {@code Certificates} or {@code CRL}s available to the
+ * Collection {@code CertStore}. The Collection {@code CertStore}
+ * will not modify the contents of the {@code Collection}.
* <p>
- * If the <code>Collection</code> will be modified by one thread while
- * another thread is calling a method of a Collection <code>CertStore</code>
- * that has been initialized with this <code>Collection</code>, the
- * <code>Collection</code> must have fail-fast iterators.
+ * If the {@code Collection} will be modified by one thread while
+ * another thread is calling a method of a Collection {@code CertStore}
+ * that has been initialized with this {@code Collection}, the
+ * {@code Collection} must have fail-fast iterators.
*
- * @param collection a <code>Collection</code> of
- * <code>Certificate</code>s and <code>CRL</code>s
- * @exception NullPointerException if <code>collection</code> is
- * <code>null</code>
+ * @param collection a {@code Collection} of
+ * {@code Certificate}s and {@code CRL}s
+ * @exception NullPointerException if {@code collection} is
+ * {@code null}
*/
public CollectionCertStoreParameters(Collection<?> collection) {
if (collection == null)
@@ -90,22 +90,22 @@
}
/**
- * Creates an instance of <code>CollectionCertStoreParameters</code> with
+ * Creates an instance of {@code CollectionCertStoreParameters} with
* the default parameter values (an empty and immutable
- * <code>Collection</code>).
+ * {@code Collection}).
*/
public CollectionCertStoreParameters() {
coll = Collections.EMPTY_SET;
}
/**
- * Returns the <code>Collection</code> from which <code>Certificate</code>s
- * and <code>CRL</code>s are retrieved. This is <b>not</b> a copy of the
- * <code>Collection</code>, it is a reference. This allows the caller to
- * subsequently add or remove <code>Certificates</code> or
- * <code>CRL</code>s from the <code>Collection</code>.
+ * Returns the {@code Collection} from which {@code Certificate}s
+ * and {@code CRL}s are retrieved. This is <b>not</b> a copy of the
+ * {@code Collection}, it is a reference. This allows the caller to
+ * subsequently add or remove {@code Certificates} or
+ * {@code CRL}s from the {@code Collection}.
*
- * @return the <code>Collection</code> (never null)
+ * @return the {@code Collection} (never null)
*/
public Collection<?> getCollection() {
return coll;
@@ -113,7 +113,7 @@
/**
* Returns a copy of this object. Note that only a reference to the
- * <code>Collection</code> is copied, and not the contents.
+ * {@code Collection} is copied, and not the contents.
*
* @return the copy
*/
--- a/jdk/src/share/classes/java/security/cert/Extension.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/Extension.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -84,7 +84,7 @@
* that are encoded as an OCTET STRING. It does not include the OCTET
* STRING tag and length.
*
- * @return a copy of the extension's value, or <code>null</code> if no
+ * @return a copy of the extension's value, or {@code null} if no
* extension value is present.
*/
byte[] getValue();
@@ -95,7 +95,7 @@
*
* @param out the output stream
* @exception IOException on encoding or output error.
- * @exception NullPointerException if <code>out</code> is <code>null</code>.
+ * @exception NullPointerException if {@code out} is {@code null}.
*/
void encode(OutputStream out) throws IOException;
}
--- a/jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -26,10 +26,10 @@
package java.security.cert;
/**
- * Parameters used as input for the LDAP <code>CertStore</code> algorithm.
+ * Parameters used as input for the LDAP {@code CertStore} algorithm.
* <p>
* This class is used to provide necessary configuration parameters (server
- * name and port number) to implementations of the LDAP <code>CertStore</code>
+ * name and port number) to implementations of the LDAP {@code CertStore}
* algorithm.
* <p>
* <b>Concurrent Access</b>
@@ -59,13 +59,13 @@
private String serverName;
/**
- * Creates an instance of <code>LDAPCertStoreParameters</code> with the
+ * Creates an instance of {@code LDAPCertStoreParameters} with the
* specified parameter values.
*
* @param serverName the DNS name of the LDAP server
* @param port the port number of the LDAP server
- * @exception NullPointerException if <code>serverName</code> is
- * <code>null</code>
+ * @exception NullPointerException if {@code serverName} is
+ * {@code null}
*/
public LDAPCertStoreParameters(String serverName, int port) {
if (serverName == null)
@@ -75,19 +75,19 @@
}
/**
- * Creates an instance of <code>LDAPCertStoreParameters</code> with the
+ * Creates an instance of {@code LDAPCertStoreParameters} with the
* specified server name and a default port of 389.
*
* @param serverName the DNS name of the LDAP server
- * @exception NullPointerException if <code>serverName</code> is
- * <code>null</code>
+ * @exception NullPointerException if {@code serverName} is
+ * {@code null}
*/
public LDAPCertStoreParameters(String serverName) {
this(serverName, LDAP_DEFAULT_PORT);
}
/**
- * Creates an instance of <code>LDAPCertStoreParameters</code> with the
+ * Creates an instance of {@code LDAPCertStoreParameters} with the
* default parameter values (server name "localhost", port 389).
*/
public LDAPCertStoreParameters() {
@@ -97,7 +97,7 @@
/**
* Returns the DNS name of the LDAP server.
*
- * @return the name (not <code>null</code>)
+ * @return the name (not {@code null})
*/
public String getServerName() {
return serverName;
@@ -117,7 +117,7 @@
* the original and vice versa.
* <p>
* Note: this method currently performs a shallow copy of the object
- * (simply calls <code>Object.clone()</code>). This may be changed in a
+ * (simply calls {@code Object.clone()}). This may be changed in a
* future revision to perform a deep copy if new parameters are added
* that should not be shared.
*
--- a/jdk/src/share/classes/java/security/cert/PKIXBuilderParameters.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/PKIXBuilderParameters.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -32,35 +32,35 @@
import java.util.Set;
/**
- * Parameters used as input for the PKIX <code>CertPathBuilder</code>
+ * Parameters used as input for the PKIX {@code CertPathBuilder}
* algorithm.
* <p>
- * A PKIX <code>CertPathBuilder</code> uses these parameters to {@link
- * CertPathBuilder#build build} a <code>CertPath</code> which has been
+ * A PKIX {@code CertPathBuilder} uses these parameters to {@link
+ * CertPathBuilder#build build} a {@code CertPath} which has been
* validated according to the PKIX certification path validation algorithm.
*
- * <p>To instantiate a <code>PKIXBuilderParameters</code> object, an
+ * <p>To instantiate a {@code PKIXBuilderParameters} object, an
* application must specify one or more <i>most-trusted CAs</i> as defined by
* the PKIX certification path validation algorithm. The most-trusted CA
* can be specified using one of two constructors. An application
* can call {@link #PKIXBuilderParameters(Set, CertSelector)
* PKIXBuilderParameters(Set, CertSelector)}, specifying a
- * <code>Set</code> of <code>TrustAnchor</code> objects, each of which
+ * {@code Set} of {@code TrustAnchor} objects, each of which
* identifies a most-trusted CA. Alternatively, an application can call
* {@link #PKIXBuilderParameters(KeyStore, CertSelector)
* PKIXBuilderParameters(KeyStore, CertSelector)}, specifying a
- * <code>KeyStore</code> instance containing trusted certificate entries, each
+ * {@code KeyStore} instance containing trusted certificate entries, each
* of which will be considered as a most-trusted CA.
*
* <p>In addition, an application must specify constraints on the target
- * certificate that the <code>CertPathBuilder</code> will attempt
+ * certificate that the {@code CertPathBuilder} will attempt
* to build a path to. The constraints are specified as a
- * <code>CertSelector</code> object. These constraints should provide the
- * <code>CertPathBuilder</code> with enough search criteria to find the target
- * certificate. Minimal criteria for an <code>X509Certificate</code> usually
+ * {@code CertSelector} object. These constraints should provide the
+ * {@code CertPathBuilder} with enough search criteria to find the target
+ * certificate. Minimal criteria for an {@code X509Certificate} usually
* include the subject name and/or one or more subject alternative names.
- * If enough criteria is not specified, the <code>CertPathBuilder</code>
- * may throw a <code>CertPathBuilderException</code>.
+ * If enough criteria is not specified, the {@code CertPathBuilder}
+ * may throw a {@code CertPathBuilderException}.
* <p>
* <b>Concurrent Access</b>
* <p>
@@ -80,23 +80,23 @@
private int maxPathLength = 5;
/**
- * Creates an instance of <code>PKIXBuilderParameters</code> with
- * the specified <code>Set</code> of most-trusted CAs.
+ * Creates an instance of {@code PKIXBuilderParameters} with
+ * the specified {@code Set} of most-trusted CAs.
* Each element of the set is a {@link TrustAnchor TrustAnchor}.
*
- * <p>Note that the <code>Set</code> is copied to protect against
+ * <p>Note that the {@code Set} is copied to protect against
* subsequent modifications.
*
- * @param trustAnchors a <code>Set</code> of <code>TrustAnchor</code>s
- * @param targetConstraints a <code>CertSelector</code> specifying the
+ * @param trustAnchors a {@code Set} of {@code TrustAnchor}s
+ * @param targetConstraints a {@code CertSelector} specifying the
* constraints on the target certificate
- * @throws InvalidAlgorithmParameterException if <code>trustAnchors</code>
- * is empty <code>(trustAnchors.isEmpty() == true)</code>
- * @throws NullPointerException if <code>trustAnchors</code> is
- * <code>null</code>
+ * @throws InvalidAlgorithmParameterException if {@code trustAnchors}
+ * is empty {@code (trustAnchors.isEmpty() == true)}
+ * @throws NullPointerException if {@code trustAnchors} is
+ * {@code null}
* @throws ClassCastException if any of the elements of
- * <code>trustAnchors</code> are not of type
- * <code>java.security.cert.TrustAnchor</code>
+ * {@code trustAnchors} are not of type
+ * {@code java.security.cert.TrustAnchor}
*/
public PKIXBuilderParameters(Set<TrustAnchor> trustAnchors, CertSelector
targetConstraints) throws InvalidAlgorithmParameterException
@@ -106,22 +106,22 @@
}
/**
- * Creates an instance of <code>PKIXBuilderParameters</code> that
+ * Creates an instance of {@code PKIXBuilderParameters} that
* populates the set of most-trusted CAs from the trusted
- * certificate entries contained in the specified <code>KeyStore</code>.
- * Only keystore entries that contain trusted <code>X509Certificate</code>s
+ * certificate entries contained in the specified {@code KeyStore}.
+ * Only keystore entries that contain trusted {@code X509Certificate}s
* are considered; all other certificate types are ignored.
*
- * @param keystore a <code>KeyStore</code> from which the set of
+ * @param keystore a {@code KeyStore} from which the set of
* most-trusted CAs will be populated
- * @param targetConstraints a <code>CertSelector</code> specifying the
+ * @param targetConstraints a {@code CertSelector} specifying the
* constraints on the target certificate
- * @throws KeyStoreException if <code>keystore</code> has not been
+ * @throws KeyStoreException if {@code keystore} has not been
* initialized
- * @throws InvalidAlgorithmParameterException if <code>keystore</code> does
+ * @throws InvalidAlgorithmParameterException if {@code keystore} does
* not contain at least one trusted certificate entry
- * @throws NullPointerException if <code>keystore</code> is
- * <code>null</code>
+ * @throws NullPointerException if {@code keystore} is
+ * {@code null}
*/
public PKIXBuilderParameters(KeyStore keystore,
CertSelector targetConstraints)
@@ -139,7 +139,7 @@
* in a certification path is not an intermediate certificate, and is not
* included in this limit. Usually the last certificate is an end entity
* certificate, but it can be a CA certificate. A PKIX
- * <code>CertPathBuilder</code> instance must not build
+ * {@code CertPathBuilder} instance must not build
* paths longer than the length specified.
*
* <p> A value of 0 implies that the path can only contain
@@ -149,14 +149,14 @@
* Setting a value less than -1 will cause an exception to be thrown.
*
* <p> If any of the CA certificates contain the
- * <code>BasicConstraintsExtension</code>, the value of the
- * <code>pathLenConstraint</code> field of the extension overrides
+ * {@code BasicConstraintsExtension}, the value of the
+ * {@code pathLenConstraint} field of the extension overrides
* the maximum path length parameter whenever the result is a
* certification path of smaller length.
*
* @param maxPathLength the maximum number of non-self-issued intermediate
* certificates that may exist in a certification path
- * @throws InvalidParameterException if <code>maxPathLength</code> is set
+ * @throws InvalidParameterException if {@code maxPathLength} is set
* to a value less than -1
*
* @see #getMaxPathLength
--- a/jdk/src/share/classes/java/security/cert/PKIXCertPathBuilderResult.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/PKIXCertPathBuilderResult.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -33,14 +33,14 @@
* returned using this algorithm are also validated according to the PKIX
* certification path validation algorithm.
*
- * <p>Instances of <code>PKIXCertPathBuilderResult</code> are returned by
- * the <code>build</code> method of <code>CertPathBuilder</code>
+ * <p>Instances of {@code PKIXCertPathBuilderResult} are returned by
+ * the {@code build} method of {@code CertPathBuilder}
* objects implementing the PKIX algorithm.
*
- * <p>All <code>PKIXCertPathBuilderResult</code> objects contain the
+ * <p>All {@code PKIXCertPathBuilderResult} objects contain the
* certification path constructed by the build algorithm, the
* valid policy tree and subject public key resulting from the build
- * algorithm, and a <code>TrustAnchor</code> describing the certification
+ * algorithm, and a {@code TrustAnchor} describing the certification
* authority (CA) that served as a trust anchor for the certification path.
* <p>
* <b>Concurrent Access</b>
@@ -62,18 +62,18 @@
private CertPath certPath;
/**
- * Creates an instance of <code>PKIXCertPathBuilderResult</code>
+ * Creates an instance of {@code PKIXCertPathBuilderResult}
* containing the specified parameters.
*
- * @param certPath the validated <code>CertPath</code>
- * @param trustAnchor a <code>TrustAnchor</code> describing the CA that
+ * @param certPath the validated {@code CertPath}
+ * @param trustAnchor a {@code TrustAnchor} describing the CA that
* served as a trust anchor for the certification path
- * @param policyTree the immutable valid policy tree, or <code>null</code>
+ * @param policyTree the immutable valid policy tree, or {@code null}
* if there are no valid policies
* @param subjectPublicKey the public key of the subject
- * @throws NullPointerException if the <code>certPath</code>,
- * <code>trustAnchor</code> or <code>subjectPublicKey</code> parameters
- * are <code>null</code>
+ * @throws NullPointerException if the {@code certPath},
+ * {@code trustAnchor} or {@code subjectPublicKey} parameters
+ * are {@code null}
*/
public PKIXCertPathBuilderResult(CertPath certPath,
TrustAnchor trustAnchor, PolicyNode policyTree,
@@ -87,13 +87,13 @@
/**
* Returns the built and validated certification path. The
- * <code>CertPath</code> object does not include the trust anchor.
+ * {@code CertPath} object does not include the trust anchor.
* Instead, use the {@link #getTrustAnchor() getTrustAnchor()} method to
- * obtain the <code>TrustAnchor</code> that served as the trust anchor
+ * obtain the {@code TrustAnchor} that served as the trust anchor
* for the certification path.
*
- * @return the built and validated <code>CertPath</code> (never
- * <code>null</code>)
+ * @return the built and validated {@code CertPath} (never
+ * {@code null})
*/
public CertPath getCertPath() {
return certPath;
@@ -101,10 +101,10 @@
/**
* Return a printable representation of this
- * <code>PKIXCertPathBuilderResult</code>.
+ * {@code PKIXCertPathBuilderResult}.
*
- * @return a <code>String</code> describing the contents of this
- * <code>PKIXCertPathBuilderResult</code>
+ * @return a {@code String} describing the contents of this
+ * {@code PKIXCertPathBuilderResult}
*/
public String toString() {
StringBuffer sb = new StringBuffer();
--- a/jdk/src/share/classes/java/security/cert/PKIXCertPathChecker.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/PKIXCertPathChecker.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -30,38 +30,38 @@
/**
* An abstract class that performs one or more checks on an
- * <code>X509Certificate</code>.
+ * {@code X509Certificate}.
*
- * <p>A concrete implementation of the <code>PKIXCertPathChecker</code> class
+ * <p>A concrete implementation of the {@code PKIXCertPathChecker} class
* can be created to extend the PKIX certification path validation algorithm.
* For example, an implementation may check for and process a critical private
* extension of each certificate in a certification path.
*
- * <p>Instances of <code>PKIXCertPathChecker</code> are passed as parameters
+ * <p>Instances of {@code PKIXCertPathChecker} are passed as parameters
* using the {@link PKIXParameters#setCertPathCheckers setCertPathCheckers}
* or {@link PKIXParameters#addCertPathChecker addCertPathChecker} methods
- * of the <code>PKIXParameters</code> and <code>PKIXBuilderParameters</code>
- * class. Each of the <code>PKIXCertPathChecker</code>s {@link #check check}
+ * of the {@code PKIXParameters} and {@code PKIXBuilderParameters}
+ * class. Each of the {@code PKIXCertPathChecker}s {@link #check check}
* methods will be called, in turn, for each certificate processed by a PKIX
- * <code>CertPathValidator</code> or <code>CertPathBuilder</code>
+ * {@code CertPathValidator} or {@code CertPathBuilder}
* implementation.
*
- * <p>A <code>PKIXCertPathChecker</code> may be called multiple times on
+ * <p>A {@code PKIXCertPathChecker} may be called multiple times on
* successive certificates in a certification path. Concrete subclasses
* are expected to maintain any internal state that may be necessary to
* check successive certificates. The {@link #init init} method is used
* to initialize the internal state of the checker so that the certificates
* of a new certification path may be checked. A stateful implementation
* <b>must</b> override the {@link #clone clone} method if necessary in
- * order to allow a PKIX <code>CertPathBuilder</code> to efficiently
+ * order to allow a PKIX {@code CertPathBuilder} to efficiently
* backtrack and try other paths. In these situations, the
- * <code>CertPathBuilder</code> is able to restore prior path validation
- * states by restoring the cloned <code>PKIXCertPathChecker</code>s.
+ * {@code CertPathBuilder} is able to restore prior path validation
+ * states by restoring the cloned {@code PKIXCertPathChecker}s.
*
* <p>The order in which the certificates are presented to the
- * <code>PKIXCertPathChecker</code> may be either in the forward direction
+ * {@code PKIXCertPathChecker} may be either in the forward direction
* (from target to most-trusted CA) or in the reverse direction (from
- * most-trusted CA to target). A <code>PKIXCertPathChecker</code> implementation
+ * most-trusted CA to target). A {@code PKIXCertPathChecker} implementation
* <b>must</b> support reverse checking (the ability to perform its checks when
* it is presented with certificates in the reverse direction) and <b>may</b>
* support forward checking (the ability to perform its checks when it is
@@ -96,19 +96,19 @@
protected PKIXCertPathChecker() {}
/**
- * Initializes the internal state of this <code>PKIXCertPathChecker</code>.
+ * Initializes the internal state of this {@code PKIXCertPathChecker}.
* <p>
- * The <code>forward</code> flag specifies the order that
+ * The {@code forward} flag specifies the order that
* certificates will be passed to the {@link #check check} method
- * (forward or reverse). A <code>PKIXCertPathChecker</code> <b>must</b>
+ * (forward or reverse). A {@code PKIXCertPathChecker} <b>must</b>
* support reverse checking and <b>may</b> support forward checking.
*
* @param forward the order that certificates are presented to
- * the <code>check</code> method. If <code>true</code>, certificates
+ * the {@code check} method. If {@code true}, certificates
* are presented from target to most-trusted CA (forward); if
- * <code>false</code>, from most-trusted CA to target (reverse).
+ * {@code false}, from most-trusted CA to target (reverse).
* @throws CertPathValidatorException if this
- * <code>PKIXCertPathChecker</code> is unable to check certificates in
+ * {@code PKIXCertPathChecker} is unable to check certificates in
* the specified order; it should never be thrown if the forward flag
* is false since reverse checking must be supported
*/
@@ -118,32 +118,32 @@
/**
* Indicates if forward checking is supported. Forward checking refers
- * to the ability of the <code>PKIXCertPathChecker</code> to perform
- * its checks when certificates are presented to the <code>check</code>
+ * to the ability of the {@code PKIXCertPathChecker} to perform
+ * its checks when certificates are presented to the {@code check}
* method in the forward direction (from target to most-trusted CA).
*
- * @return <code>true</code> if forward checking is supported,
- * <code>false</code> otherwise
+ * @return {@code true} if forward checking is supported,
+ * {@code false} otherwise
*/
@Override
public abstract boolean isForwardCheckingSupported();
/**
- * Returns an immutable <code>Set</code> of X.509 certificate extensions
- * that this <code>PKIXCertPathChecker</code> supports (i.e. recognizes, is
- * able to process), or <code>null</code> if no extensions are supported.
+ * Returns an immutable {@code Set} of X.509 certificate extensions
+ * that this {@code PKIXCertPathChecker} supports (i.e. recognizes, is
+ * able to process), or {@code null} if no extensions are supported.
* <p>
- * Each element of the set is a <code>String</code> representing the
+ * Each element of the set is a {@code String} representing the
* Object Identifier (OID) of the X.509 extension that is supported.
* The OID is represented by a set of nonnegative integers separated by
* periods.
* <p>
- * All X.509 certificate extensions that a <code>PKIXCertPathChecker</code>
+ * All X.509 certificate extensions that a {@code PKIXCertPathChecker}
* might possibly be able to process should be included in the set.
*
- * @return an immutable <code>Set</code> of X.509 extension OIDs (in
- * <code>String</code> format) supported by this
- * <code>PKIXCertPathChecker</code>, or <code>null</code> if no
+ * @return an immutable {@code Set} of X.509 extension OIDs (in
+ * {@code String} format) supported by this
+ * {@code PKIXCertPathChecker}, or {@code null} if no
* extensions are supported
*/
public abstract Set<String> getSupportedExtensions();
@@ -153,10 +153,10 @@
* state and removes any critical extensions that it processes from the
* specified collection of OID strings that represent the unresolved
* critical extensions. The certificates are presented in the order
- * specified by the <code>init</code> method.
+ * specified by the {@code init} method.
*
- * @param cert the <code>Certificate</code> to be checked
- * @param unresolvedCritExts a <code>Collection</code> of OID strings
+ * @param cert the {@code Certificate} to be checked
+ * @param unresolvedCritExts a {@code Collection} of OID strings
* representing the current set of unresolved critical extensions
* @exception CertPathValidatorException if the specified certificate does
* not pass the check
@@ -177,12 +177,12 @@
}
/**
- * Returns a clone of this object. Calls the <code>Object.clone()</code>
+ * Returns a clone of this object. Calls the {@code Object.clone()}
* method.
* All subclasses which maintain state must support and
* override this method, if necessary.
*
- * @return a copy of this <code>PKIXCertPathChecker</code>
+ * @return a copy of this {@code PKIXCertPathChecker}
*/
@Override
public Object clone() {
--- a/jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -31,13 +31,13 @@
* This class represents the successful result of the PKIX certification
* path validation algorithm.
*
- * <p>Instances of <code>PKIXCertPathValidatorResult</code> are returned by the
+ * <p>Instances of {@code PKIXCertPathValidatorResult} are returned by the
* {@link CertPathValidator#validate validate} method of
- * <code>CertPathValidator</code> objects implementing the PKIX algorithm.
+ * {@code CertPathValidator} objects implementing the PKIX algorithm.
*
- * <p> All <code>PKIXCertPathValidatorResult</code> objects contain the
+ * <p> All {@code PKIXCertPathValidatorResult} objects contain the
* valid policy tree and subject public key resulting from the
- * validation algorithm, as well as a <code>TrustAnchor</code> describing
+ * validation algorithm, as well as a {@code TrustAnchor} describing
* the certification authority (CA) that served as a trust anchor for the
* certification path.
* <p>
@@ -62,16 +62,16 @@
private PublicKey subjectPublicKey;
/**
- * Creates an instance of <code>PKIXCertPathValidatorResult</code>
+ * Creates an instance of {@code PKIXCertPathValidatorResult}
* containing the specified parameters.
*
- * @param trustAnchor a <code>TrustAnchor</code> describing the CA that
+ * @param trustAnchor a {@code TrustAnchor} describing the CA that
* served as a trust anchor for the certification path
- * @param policyTree the immutable valid policy tree, or <code>null</code>
+ * @param policyTree the immutable valid policy tree, or {@code null}
* if there are no valid policies
* @param subjectPublicKey the public key of the subject
- * @throws NullPointerException if the <code>subjectPublicKey</code> or
- * <code>trustAnchor</code> parameters are <code>null</code>
+ * @throws NullPointerException if the {@code subjectPublicKey} or
+ * {@code trustAnchor} parameters are {@code null}
*/
public PKIXCertPathValidatorResult(TrustAnchor trustAnchor,
PolicyNode policyTree, PublicKey subjectPublicKey)
@@ -86,10 +86,10 @@
}
/**
- * Returns the <code>TrustAnchor</code> describing the CA that served
+ * Returns the {@code TrustAnchor} describing the CA that served
* as a trust anchor for the certification path.
*
- * @return the <code>TrustAnchor</code> (never <code>null</code>)
+ * @return the {@code TrustAnchor} (never {@code null})
*/
public TrustAnchor getTrustAnchor() {
return trustAnchor;
@@ -98,18 +98,18 @@
/**
* Returns the root node of the valid policy tree resulting from the
* PKIX certification path validation algorithm. The
- * <code>PolicyNode</code> object that is returned and any objects that
+ * {@code PolicyNode} object that is returned and any objects that
* it returns through public methods are immutable.
*
* <p>Most applications will not need to examine the valid policy tree.
* They can achieve their policy processing goals by setting the
- * policy-related parameters in <code>PKIXParameters</code>. However, more
+ * policy-related parameters in {@code PKIXParameters}. However, more
* sophisticated applications, especially those that process policy
* qualifiers, may need to traverse the valid policy tree using the
* {@link PolicyNode#getParent PolicyNode.getParent} and
* {@link PolicyNode#getChildren PolicyNode.getChildren} methods.
*
- * @return the root node of the valid policy tree, or <code>null</code>
+ * @return the root node of the valid policy tree, or {@code null}
* if there are no valid policies
*/
public PolicyNode getPolicyTree() {
@@ -120,7 +120,7 @@
* Returns the public key of the subject (target) of the certification
* path, including any inherited public key parameters if applicable.
*
- * @return the public key of the subject (never <code>null</code>)
+ * @return the public key of the subject (never {@code null})
*/
public PublicKey getPublicKey() {
return subjectPublicKey;
@@ -142,10 +142,10 @@
/**
* Return a printable representation of this
- * <code>PKIXCertPathValidatorResult</code>.
+ * {@code PKIXCertPathValidatorResult}.
*
- * @return a <code>String</code> describing the contents of this
- * <code>PKIXCertPathValidatorResult</code>
+ * @return a {@code String} describing the contents of this
+ * {@code PKIXCertPathValidatorResult}
*/
public String toString() {
StringBuffer sb = new StringBuffer();
--- a/jdk/src/share/classes/java/security/cert/PKIXParameters.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/PKIXParameters.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -38,34 +38,34 @@
import java.util.Set;
/**
- * Parameters used as input for the PKIX <code>CertPathValidator</code>
+ * Parameters used as input for the PKIX {@code CertPathValidator}
* algorithm.
* <p>
- * A PKIX <code>CertPathValidator</code> uses these parameters to
- * validate a <code>CertPath</code> according to the PKIX certification path
+ * A PKIX {@code CertPathValidator} uses these parameters to
+ * validate a {@code CertPath} according to the PKIX certification path
* validation algorithm.
*
- * <p>To instantiate a <code>PKIXParameters</code> object, an
+ * <p>To instantiate a {@code PKIXParameters} object, an
* application must specify one or more <i>most-trusted CAs</i> as defined by
* the PKIX certification path validation algorithm. The most-trusted CAs
* can be specified using one of two constructors. An application
* can call {@link #PKIXParameters(Set) PKIXParameters(Set)},
- * specifying a <code>Set</code> of <code>TrustAnchor</code> objects, each
+ * specifying a {@code Set} of {@code TrustAnchor} objects, each
* of which identify a most-trusted CA. Alternatively, an application can call
* {@link #PKIXParameters(KeyStore) PKIXParameters(KeyStore)}, specifying a
- * <code>KeyStore</code> instance containing trusted certificate entries, each
+ * {@code KeyStore} instance containing trusted certificate entries, each
* of which will be considered as a most-trusted CA.
* <p>
- * Once a <code>PKIXParameters</code> object has been created, other parameters
+ * Once a {@code PKIXParameters} object has been created, other parameters
* can be specified (by calling {@link #setInitialPolicies setInitialPolicies}
* or {@link #setDate setDate}, for instance) and then the
- * <code>PKIXParameters</code> is passed along with the <code>CertPath</code>
+ * {@code PKIXParameters} is passed along with the {@code CertPath}
* to be validated to {@link CertPathValidator#validate
* CertPathValidator.validate}.
* <p>
- * Any parameter that is not set (or is set to <code>null</code>) will
+ * Any parameter that is not set (or is set to {@code null}) will
* be set to the default value for that parameter. The default value for the
- * <code>date</code> parameter is <code>null</code>, which indicates
+ * {@code date} parameter is {@code null}, which indicates
* the current time when the path is validated. The default for the
* remaining parameters is the least constrained.
* <p>
@@ -99,20 +99,20 @@
private CertSelector certSelector;
/**
- * Creates an instance of <code>PKIXParameters</code> with the specified
- * <code>Set</code> of most-trusted CAs. Each element of the
+ * Creates an instance of {@code PKIXParameters} with the specified
+ * {@code Set} of most-trusted CAs. Each element of the
* set is a {@link TrustAnchor TrustAnchor}.
* <p>
- * Note that the <code>Set</code> is copied to protect against
+ * Note that the {@code Set} is copied to protect against
* subsequent modifications.
*
- * @param trustAnchors a <code>Set</code> of <code>TrustAnchor</code>s
+ * @param trustAnchors a {@code Set} of {@code TrustAnchor}s
* @throws InvalidAlgorithmParameterException if the specified
- * <code>Set</code> is empty <code>(trustAnchors.isEmpty() == true)</code>
- * @throws NullPointerException if the specified <code>Set</code> is
- * <code>null</code>
- * @throws ClassCastException if any of the elements in the <code>Set</code>
- * are not of type <code>java.security.cert.TrustAnchor</code>
+ * {@code Set} is empty {@code (trustAnchors.isEmpty() == true)}
+ * @throws NullPointerException if the specified {@code Set} is
+ * {@code null}
+ * @throws ClassCastException if any of the elements in the {@code Set}
+ * are not of type {@code java.security.cert.TrustAnchor}
*/
public PKIXParameters(Set<TrustAnchor> trustAnchors)
throws InvalidAlgorithmParameterException
@@ -125,18 +125,18 @@
}
/**
- * Creates an instance of <code>PKIXParameters</code> that
+ * Creates an instance of {@code PKIXParameters} that
* populates the set of most-trusted CAs from the trusted
- * certificate entries contained in the specified <code>KeyStore</code>.
- * Only keystore entries that contain trusted <code>X509Certificates</code>
+ * certificate entries contained in the specified {@code KeyStore}.
+ * Only keystore entries that contain trusted {@code X509Certificates}
* are considered; all other certificate types are ignored.
*
- * @param keystore a <code>KeyStore</code> from which the set of
+ * @param keystore a {@code KeyStore} from which the set of
* most-trusted CAs will be populated
* @throws KeyStoreException if the keystore has not been initialized
* @throws InvalidAlgorithmParameterException if the keystore does
* not contain at least one trusted certificate entry
- * @throws NullPointerException if the keystore is <code>null</code>
+ * @throws NullPointerException if the keystore is {@code null}
*/
public PKIXParameters(KeyStore keystore)
throws KeyStoreException, InvalidAlgorithmParameterException
@@ -161,11 +161,11 @@
}
/**
- * Returns an immutable <code>Set</code> of the most-trusted
+ * Returns an immutable {@code Set} of the most-trusted
* CAs.
*
- * @return an immutable <code>Set</code> of <code>TrustAnchor</code>s
- * (never <code>null</code>)
+ * @return an immutable {@code Set} of {@code TrustAnchor}s
+ * (never {@code null})
*
* @see #setTrustAnchors
*/
@@ -174,18 +174,18 @@
}
/**
- * Sets the <code>Set</code> of most-trusted CAs.
+ * Sets the {@code Set} of most-trusted CAs.
* <p>
- * Note that the <code>Set</code> is copied to protect against
+ * Note that the {@code Set} is copied to protect against
* subsequent modifications.
*
- * @param trustAnchors a <code>Set</code> of <code>TrustAnchor</code>s
+ * @param trustAnchors a {@code Set} of {@code TrustAnchor}s
* @throws InvalidAlgorithmParameterException if the specified
- * <code>Set</code> is empty <code>(trustAnchors.isEmpty() == true)</code>
- * @throws NullPointerException if the specified <code>Set</code> is
- * <code>null</code>
+ * {@code Set} is empty {@code (trustAnchors.isEmpty() == true)}
+ * @throws NullPointerException if the specified {@code Set} is
+ * {@code null}
* @throws ClassCastException if any of the elements in the set
- * are not of type <code>java.security.cert.TrustAnchor</code>
+ * are not of type {@code java.security.cert.TrustAnchor}
*
* @see #getTrustAnchors
*/
@@ -211,16 +211,16 @@
}
/**
- * Returns an immutable <code>Set</code> of initial
+ * Returns an immutable {@code Set} of initial
* policy identifiers (OID strings), indicating that any one of these
* policies would be acceptable to the certificate user for the purposes of
* certification path processing. The default return value is an empty
- * <code>Set</code>, which is interpreted as meaning that any policy would
+ * {@code Set}, which is interpreted as meaning that any policy would
* be acceptable.
*
- * @return an immutable <code>Set</code> of initial policy OIDs in
- * <code>String</code> format, or an empty <code>Set</code> (implying any
- * policy is acceptable). Never returns <code>null</code>.
+ * @return an immutable {@code Set} of initial policy OIDs in
+ * {@code String} format, or an empty {@code Set} (implying any
+ * policy is acceptable). Never returns {@code null}.
*
* @see #setInitialPolicies
*/
@@ -229,21 +229,21 @@
}
/**
- * Sets the <code>Set</code> of initial policy identifiers
+ * Sets the {@code Set} of initial policy identifiers
* (OID strings), indicating that any one of these
* policies would be acceptable to the certificate user for the purposes of
* certification path processing. By default, any policy is acceptable
* (i.e. all policies), so a user that wants to allow any policy as
* acceptable does not need to call this method, or can call it
- * with an empty <code>Set</code> (or <code>null</code>).
+ * with an empty {@code Set} (or {@code null}).
* <p>
- * Note that the <code>Set</code> is copied to protect against
+ * Note that the {@code Set} is copied to protect against
* subsequent modifications.
*
- * @param initialPolicies a <code>Set</code> of initial policy
- * OIDs in <code>String</code> format (or <code>null</code>)
+ * @param initialPolicies a {@code Set} of initial policy
+ * OIDs in {@code String} format (or {@code null})
* @throws ClassCastException if any of the elements in the set are
- * not of type <code>String</code>
+ * not of type {@code String}
*
* @see #getInitialPolicies
*/
@@ -262,19 +262,19 @@
}
/**
- * Sets the list of <code>CertStore</code>s to be used in finding
- * certificates and CRLs. May be <code>null</code>, in which case
- * no <code>CertStore</code>s will be used. The first
- * <code>CertStore</code>s in the list may be preferred to those that
+ * Sets the list of {@code CertStore}s to be used in finding
+ * certificates and CRLs. May be {@code null}, in which case
+ * no {@code CertStore}s will be used. The first
+ * {@code CertStore}s in the list may be preferred to those that
* appear later.
* <p>
- * Note that the <code>List</code> is copied to protect against
+ * Note that the {@code List} is copied to protect against
* subsequent modifications.
*
- * @param stores a <code>List</code> of <code>CertStore</code>s (or
- * <code>null</code>)
+ * @param stores a {@code List} of {@code CertStore}s (or
+ * {@code null})
* @throws ClassCastException if any of the elements in the list are
- * not of type <code>java.security.cert.CertStore</code>
+ * not of type {@code java.security.cert.CertStore}
*
* @see #getCertStores
*/
@@ -293,10 +293,10 @@
}
/**
- * Adds a <code>CertStore</code> to the end of the list of
- * <code>CertStore</code>s used in finding certificates and CRLs.
+ * Adds a {@code CertStore} to the end of the list of
+ * {@code CertStore}s used in finding certificates and CRLs.
*
- * @param store the <code>CertStore</code> to add. If <code>null</code>,
+ * @param store the {@code CertStore} to add. If {@code null},
* the store is ignored (not added to list).
*/
public void addCertStore(CertStore store) {
@@ -306,11 +306,11 @@
}
/**
- * Returns an immutable <code>List</code> of <code>CertStore</code>s that
+ * Returns an immutable {@code List} of {@code CertStore}s that
* are used to find certificates and CRLs.
*
- * @return an immutable <code>List</code> of <code>CertStore</code>s
- * (may be empty, but never <code>null</code>)
+ * @return an immutable {@code List} of {@code CertStore}s
+ * (may be empty, but never {@code null})
*
* @see #setCertStores
*/
@@ -325,7 +325,7 @@
* will be used. If this flag is false, the default revocation checking
* mechanism will be disabled (not used).
* <p>
- * When a <code>PKIXParameters</code> object is created, this flag is set
+ * When a {@code PKIXParameters} object is created, this flag is set
* to true. This setting reflects the most common strategy for checking
* revocation, since each service provider must support revocation
* checking to be PKIX compliant. Sophisticated applications should set
@@ -360,8 +360,8 @@
* acceptable policy needs to be explicitly identified in every certificate.
* By default, the ExplicitPolicyRequired flag is false.
*
- * @param val <code>true</code> if explicit policy is to be required,
- * <code>false</code> otherwise
+ * @param val {@code true} if explicit policy is to be required,
+ * {@code false} otherwise
*/
public void setExplicitPolicyRequired(boolean val) {
explicitPolicyRequired = val;
@@ -372,8 +372,8 @@
* acceptable policy needs to be explicitly identified in every certificate.
* By default, the ExplicitPolicyRequired flag is false.
*
- * @return <code>true</code> if explicit policy is required,
- * <code>false</code> otherwise
+ * @return {@code true} if explicit policy is required,
+ * {@code false} otherwise
*/
public boolean isExplicitPolicyRequired() {
return explicitPolicyRequired;
@@ -384,8 +384,8 @@
* mapping is inhibited. By default, policy mapping is not inhibited (the
* flag is false).
*
- * @param val <code>true</code> if policy mapping is to be inhibited,
- * <code>false</code> otherwise
+ * @param val {@code true} if policy mapping is to be inhibited,
+ * {@code false} otherwise
*/
public void setPolicyMappingInhibited(boolean val) {
policyMappingInhibited = val;
@@ -406,10 +406,10 @@
* Sets state to determine if the any policy OID should be processed
* if it is included in a certificate. By default, the any policy OID
* is not inhibited ({@link #isAnyPolicyInhibited isAnyPolicyInhibited()}
- * returns <code>false</code>).
+ * returns {@code false}).
*
- * @param val <code>true</code> if the any policy OID is to be
- * inhibited, <code>false</code> otherwise
+ * @param val {@code true} if the any policy OID is to be
+ * inhibited, {@code false} otherwise
*/
public void setAnyPolicyInhibited(boolean val) {
anyPolicyInhibited = val;
@@ -419,8 +419,8 @@
* Checks whether the any policy OID should be processed if it
* is included in a certificate.
*
- * @return <code>true</code> if the any policy OID is inhibited,
- * <code>false</code> otherwise
+ * @return {@code true} if the any policy OID is inhibited,
+ * {@code false} otherwise
*/
public boolean isAnyPolicyInhibited() {
return anyPolicyInhibited;
@@ -432,7 +432,7 @@
* policies extension that is marked critical are rejected.
* If the flag is false, certificates are not rejected on this basis.
*
- * <p> When a <code>PKIXParameters</code> object is created, this flag is
+ * <p> When a {@code PKIXParameters} object is created, this flag is
* set to true. This setting reflects the most common (and simplest)
* strategy for processing policy qualifiers. Applications that want to use
* a more sophisticated policy must set this flag to false.
@@ -459,7 +459,7 @@
* extension that is marked critical are rejected.
* If the flag is false, certificates are not rejected on this basis.
*
- * <p> When a <code>PKIXParameters</code> object is created, this flag is
+ * <p> When a {@code PKIXParameters} object is created, this flag is
* set to true. This setting reflects the most common (and simplest)
* strategy for processing policy qualifiers. Applications that want to use
* a more sophisticated policy must set this flag to false.
@@ -473,12 +473,12 @@
/**
* Returns the time for which the validity of the certification path
- * should be determined. If <code>null</code>, the current time is used.
+ * should be determined. If {@code null}, the current time is used.
* <p>
- * Note that the <code>Date</code> returned is copied to protect against
+ * Note that the {@code Date} returned is copied to protect against
* subsequent modifications.
*
- * @return the <code>Date</code>, or <code>null</code> if not set
+ * @return the {@code Date}, or {@code null} if not set
* @see #setDate
*/
public Date getDate() {
@@ -490,12 +490,12 @@
/**
* Sets the time for which the validity of the certification path
- * should be determined. If <code>null</code>, the current time is used.
+ * should be determined. If {@code null}, the current time is used.
* <p>
- * Note that the <code>Date</code> supplied here is copied to protect
+ * Note that the {@code Date} supplied here is copied to protect
* against subsequent modifications.
*
- * @param date the <code>Date</code>, or <code>null</code> for the
+ * @param date the {@code Date}, or {@code null} for the
* current time
* @see #getDate
*/
@@ -507,39 +507,39 @@
}
/**
- * Sets a <code>List</code> of additional certification path checkers. If
- * the specified <code>List</code> contains an object that is not a
- * <code>PKIXCertPathChecker</code>, it is ignored.
+ * Sets a {@code List} of additional certification path checkers. If
+ * the specified {@code List} contains an object that is not a
+ * {@code PKIXCertPathChecker}, it is ignored.
* <p>
- * Each <code>PKIXCertPathChecker</code> specified implements
+ * Each {@code PKIXCertPathChecker} specified implements
* additional checks on a certificate. Typically, these are checks to
* process and verify private extensions contained in certificates.
- * Each <code>PKIXCertPathChecker</code> should be instantiated with any
+ * Each {@code PKIXCertPathChecker} should be instantiated with any
* initialization parameters needed to execute the check.
* <p>
* This method allows sophisticated applications to extend a PKIX
- * <code>CertPathValidator</code> or <code>CertPathBuilder</code>.
- * Each of the specified <code>PKIXCertPathChecker</code>s will be called,
- * in turn, by a PKIX <code>CertPathValidator</code> or
- * <code>CertPathBuilder</code> for each certificate processed or
+ * {@code CertPathValidator} or {@code CertPathBuilder}.
+ * Each of the specified {@code PKIXCertPathChecker}s will be called,
+ * in turn, by a PKIX {@code CertPathValidator} or
+ * {@code CertPathBuilder} for each certificate processed or
* validated.
* <p>
- * Regardless of whether these additional <code>PKIXCertPathChecker</code>s
- * are set, a PKIX <code>CertPathValidator</code> or
- * <code>CertPathBuilder</code> must perform all of the required PKIX
+ * Regardless of whether these additional {@code PKIXCertPathChecker}s
+ * are set, a PKIX {@code CertPathValidator} or
+ * {@code CertPathBuilder} must perform all of the required PKIX
* checks on each certificate. The one exception to this rule is if the
* RevocationEnabled flag is set to false (see the {@link
* #setRevocationEnabled setRevocationEnabled} method).
* <p>
- * Note that the <code>List</code> supplied here is copied and each
- * <code>PKIXCertPathChecker</code> in the list is cloned to protect
+ * Note that the {@code List} supplied here is copied and each
+ * {@code PKIXCertPathChecker} in the list is cloned to protect
* against subsequent modifications.
*
- * @param checkers a <code>List</code> of <code>PKIXCertPathChecker</code>s.
- * May be <code>null</code>, in which case no additional checkers will be
+ * @param checkers a {@code List} of {@code PKIXCertPathChecker}s.
+ * May be {@code null}, in which case no additional checkers will be
* used.
* @throws ClassCastException if any of the elements in the list
- * are not of type <code>java.security.cert.PKIXCertPathChecker</code>
+ * are not of type {@code java.security.cert.PKIXCertPathChecker}
* @see #getCertPathCheckers
*/
public void setCertPathCheckers(List<PKIXCertPathChecker> checkers) {
@@ -556,14 +556,14 @@
}
/**
- * Returns the <code>List</code> of certification path checkers.
- * The returned <code>List</code> is immutable, and each
- * <code>PKIXCertPathChecker</code> in the <code>List</code> is cloned
+ * Returns the {@code List} of certification path checkers.
+ * The returned {@code List} is immutable, and each
+ * {@code PKIXCertPathChecker} in the {@code List} is cloned
* to protect against subsequent modifications.
*
- * @return an immutable <code>List</code> of
- * <code>PKIXCertPathChecker</code>s (may be empty, but not
- * <code>null</code>)
+ * @return an immutable {@code List} of
+ * {@code PKIXCertPathChecker}s (may be empty, but not
+ * {@code null})
* @see #setCertPathCheckers
*/
public List<PKIXCertPathChecker> getCertPathCheckers() {
@@ -575,15 +575,15 @@
}
/**
- * Adds a <code>PKIXCertPathChecker</code> to the list of certification
+ * Adds a {@code PKIXCertPathChecker} to the list of certification
* path checkers. See the {@link #setCertPathCheckers setCertPathCheckers}
* method for more details.
* <p>
- * Note that the <code>PKIXCertPathChecker</code> is cloned to protect
+ * Note that the {@code PKIXCertPathChecker} is cloned to protect
* against subsequent modifications.
*
- * @param checker a <code>PKIXCertPathChecker</code> to add to the list of
- * checks. If <code>null</code>, the checker is ignored (not added to list).
+ * @param checker a {@code PKIXCertPathChecker} to add to the list of
+ * checks. If {@code null}, the checker is ignored (not added to list).
*/
public void addCertPathChecker(PKIXCertPathChecker checker) {
if (checker != null) {
@@ -592,10 +592,10 @@
}
/**
- * Returns the signature provider's name, or <code>null</code>
+ * Returns the signature provider's name, or {@code null}
* if not set.
*
- * @return the signature provider's name (or <code>null</code>)
+ * @return the signature provider's name (or {@code null})
* @see #setSigProvider
*/
public String getSigProvider() {
@@ -605,10 +605,10 @@
/**
* Sets the signature provider's name. The specified provider will be
* preferred when creating {@link java.security.Signature Signature}
- * objects. If <code>null</code> or not set, the first provider found
+ * objects. If {@code null} or not set, the first provider found
* supporting the algorithm will be used.
*
- * @param sigProvider the signature provider's name (or <code>null</code>)
+ * @param sigProvider the signature provider's name (or {@code null})
* @see #getSigProvider
*/
public void setSigProvider(String sigProvider) {
@@ -617,14 +617,14 @@
/**
* Returns the required constraints on the target certificate.
- * The constraints are returned as an instance of <code>CertSelector</code>.
- * If <code>null</code>, no constraints are defined.
+ * The constraints are returned as an instance of {@code CertSelector}.
+ * If {@code null}, no constraints are defined.
*
- * <p>Note that the <code>CertSelector</code> returned is cloned
+ * <p>Note that the {@code CertSelector} returned is cloned
* to protect against subsequent modifications.
*
- * @return a <code>CertSelector</code> specifying the constraints
- * on the target certificate (or <code>null</code>)
+ * @return a {@code CertSelector} specifying the constraints
+ * on the target certificate (or {@code null})
* @see #setTargetCertConstraints
*/
public CertSelector getTargetCertConstraints() {
@@ -638,14 +638,14 @@
/**
* Sets the required constraints on the target certificate.
* The constraints are specified as an instance of
- * <code>CertSelector</code>. If <code>null</code>, no constraints are
+ * {@code CertSelector}. If {@code null}, no constraints are
* defined.
*
- * <p>Note that the <code>CertSelector</code> specified is cloned
+ * <p>Note that the {@code CertSelector} specified is cloned
* to protect against subsequent modifications.
*
- * @param selector a <code>CertSelector</code> specifying the constraints
- * on the target certificate (or <code>null</code>)
+ * @param selector a {@code CertSelector} specifying the constraints
+ * on the target certificate (or {@code null})
* @see #getTargetCertConstraints
*/
public void setTargetCertConstraints(CertSelector selector) {
@@ -656,10 +656,10 @@
}
/**
- * Makes a copy of this <code>PKIXParameters</code> object. Changes
+ * Makes a copy of this {@code PKIXParameters} object. Changes
* to the copy will not affect the original and vice versa.
*
- * @return a copy of this <code>PKIXParameters</code> object
+ * @return a copy of this {@code PKIXParameters} object
*/
public Object clone() {
try {
--- a/jdk/src/share/classes/java/security/cert/PKIXReason.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/PKIXReason.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -26,10 +26,10 @@
package java.security.cert;
/**
- * The <code>PKIXReason</code> enumerates the potential PKIX-specific reasons
+ * The {@code PKIXReason} enumerates the potential PKIX-specific reasons
* that an X.509 certification path may be invalid according to the PKIX
* (RFC 3280) standard. These reasons are in addition to those of the
- * <code>CertPathValidatorException.BasicReason</code> enumeration.
+ * {@code CertPathValidatorException.BasicReason} enumeration.
*
* @since 1.7
*/
--- a/jdk/src/share/classes/java/security/cert/PolicyNode.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/PolicyNode.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -41,7 +41,7 @@
*
* <p>Most applications will not need to examine the valid policy tree.
* They can achieve their policy processing goals by setting the
- * policy-related parameters in <code>PKIXParameters</code>. However,
+ * policy-related parameters in {@code PKIXParameters}. However,
* the valid policy tree is available for more sophisticated applications,
* especially those that process policy qualifiers.
*
@@ -50,12 +50,12 @@
* valid policy tree. The tree can be traversed using the
* {@link #getChildren getChildren} and {@link #getParent getParent} methods.
* Data about a particular node can be retrieved using other methods of
- * <code>PolicyNode</code>.
+ * {@code PolicyNode}.
*
* <p><b>Concurrent Access</b>
- * <p>All <code>PolicyNode</code> objects must be immutable and
+ * <p>All {@code PolicyNode} objects must be immutable and
* thread-safe. Multiple threads may concurrently invoke the methods defined
- * in this class on a single <code>PolicyNode</code> object (or more than one)
+ * in this class on a single {@code PolicyNode} object (or more than one)
* with no ill effects. This stipulation applies to all public fields and
* methods of this class and any added or overridden by subclasses.
*
@@ -65,10 +65,10 @@
public interface PolicyNode {
/**
- * Returns the parent of this node, or <code>null</code> if this is the
+ * Returns the parent of this node, or {@code null} if this is the
* root node.
*
- * @return the parent of this node, or <code>null</code> if this is the
+ * @return the parent of this node, or {@code null} if this is the
* root node
*/
PolicyNode getParent();
@@ -76,8 +76,8 @@
/**
* Returns an iterator over the children of this node. Any attempts to
* modify the children of this node through the
- * <code>Iterator</code>'s remove method must throw an
- * <code>UnsupportedOperationException</code>.
+ * {@code Iterator}'s remove method must throw an
+ * {@code UnsupportedOperationException}.
*
* @return an iterator over the children of this node
*/
@@ -94,7 +94,7 @@
/**
* Returns the valid policy represented by this node.
*
- * @return the <code>String</code> OID of the valid policy
+ * @return the {@code String} OID of the valid policy
* represented by this node. For the root node, this method always returns
* the special anyPolicy OID: "2.5.29.32.0".
*/
@@ -104,9 +104,9 @@
* Returns the set of policy qualifiers associated with the
* valid policy represented by this node.
*
- * @return an immutable <code>Set</code> of
- * <code>PolicyQualifierInfo</code>s. For the root node, this
- * is always an empty <code>Set</code>.
+ * @return an immutable {@code Set} of
+ * {@code PolicyQualifierInfo}s. For the root node, this
+ * is always an empty {@code Set}.
*/
Set<? extends PolicyQualifierInfo> getPolicyQualifiers();
@@ -114,9 +114,9 @@
* Returns the set of expected policies that would satisfy this
* node's valid policy in the next certificate to be processed.
*
- * @return an immutable <code>Set</code> of expected policy
- * <code>String</code> OIDs. For the root node, this method
- * always returns a <code>Set</code> with one element, the
+ * @return an immutable {@code Set} of expected policy
+ * {@code String} OIDs. For the root node, this method
+ * always returns a {@code Set} with one element, the
* special anyPolicy OID: "2.5.29.32.0".
*/
Set<String> getExpectedPolicies();
@@ -125,8 +125,8 @@
* Returns the criticality indicator of the certificate policy extension
* in the most recently processed certificate.
*
- * @return <code>true</code> if extension marked critical,
- * <code>false</code> otherwise. For the root node, <code>false</code>
+ * @return {@code true} if extension marked critical,
+ * {@code false} otherwise. For the root node, {@code false}
* is always returned.
*/
boolean isCritical();
--- a/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -50,12 +50,12 @@
* policy information terms limit the set of policies for certification paths
* which include this certificate.
* <p>
- * A <code>Set</code> of <code>PolicyQualifierInfo</code> objects are returned
+ * A {@code Set} of {@code PolicyQualifierInfo} objects are returned
* by the {@link PolicyNode#getPolicyQualifiers PolicyNode.getPolicyQualifiers}
* method. This allows applications with specific policy requirements to
* process and validate each policy qualifier. Applications that need to
* process policy qualifiers should explicitly set the
- * <code>policyQualifiersRejected</code> flag to false (by calling the
+ * {@code policyQualifiersRejected} flag to false (by calling the
* {@link PKIXParameters#setPolicyQualifiersRejected
* PKIXParameters.setPolicyQualifiersRejected} method) before validating
* a certification path.
@@ -64,17 +64,17 @@
* that any policy qualifier in a certificate policies extension that is
* marked critical must be processed and validated. Otherwise the
* certification path must be rejected. If the
- * <code>policyQualifiersRejected</code> flag is set to false, it is up to
+ * {@code policyQualifiersRejected} flag is set to false, it is up to
* the application to validate all policy qualifiers in this manner in order
* to be PKIX compliant.
*
* <p><b>Concurrent Access</b>
*
- * <p>All <code>PolicyQualifierInfo</code> objects must be immutable and
+ * <p>All {@code PolicyQualifierInfo} objects must be immutable and
* thread-safe. That is, multiple threads may concurrently invoke the
- * methods defined in this class on a single <code>PolicyQualifierInfo</code>
+ * methods defined in this class on a single {@code PolicyQualifierInfo}
* object (or more than one) with no ill effects. Requiring
- * <code>PolicyQualifierInfo</code> objects to be immutable and thread-safe
+ * {@code PolicyQualifierInfo} objects to be immutable and thread-safe
* allows them to be passed around to various pieces of code without
* worrying about coordinating access.
*
@@ -90,7 +90,7 @@
private String pqiString;
/**
- * Creates an instance of <code>PolicyQualifierInfo</code> from the
+ * Creates an instance of {@code PolicyQualifierInfo} from the
* encoded bytes. The encoded byte array is copied on construction.
*
* @param encoded a byte array containing the qualifier in DER encoding
@@ -115,12 +115,12 @@
}
/**
- * Returns the <code>policyQualifierId</code> field of this
- * <code>PolicyQualifierInfo</code>. The <code>policyQualifierId</code>
+ * Returns the {@code policyQualifierId} field of this
+ * {@code PolicyQualifierInfo}. The {@code policyQualifierId}
* is an Object Identifier (OID) represented by a set of nonnegative
* integers separated by periods.
*
- * @return the OID (never <code>null</code>)
+ * @return the OID (never {@code null})
*/
public final String getPolicyQualifierId() {
return mId;
@@ -128,9 +128,9 @@
/**
* Returns the ASN.1 DER encoded form of this
- * <code>PolicyQualifierInfo</code>.
+ * {@code PolicyQualifierInfo}.
*
- * @return the ASN.1 DER encoded bytes (never <code>null</code>).
+ * @return the ASN.1 DER encoded bytes (never {@code null}).
* Note that a copy is returned, so the data is cloned each time
* this method is called.
*/
@@ -139,10 +139,10 @@
}
/**
- * Returns the ASN.1 DER encoded form of the <code>qualifier</code>
- * field of this <code>PolicyQualifierInfo</code>.
+ * Returns the ASN.1 DER encoded form of the {@code qualifier}
+ * field of this {@code PolicyQualifierInfo}.
*
- * @return the ASN.1 DER encoded bytes of the <code>qualifier</code>
+ * @return the ASN.1 DER encoded bytes of the {@code qualifier}
* field. Note that a copy is returned, so the data is cloned each
* time this method is called.
*/
@@ -152,10 +152,10 @@
/**
* Return a printable representation of this
- * <code>PolicyQualifierInfo</code>.
+ * {@code PolicyQualifierInfo}.
*
- * @return a <code>String</code> describing the contents of this
- * <code>PolicyQualifierInfo</code>
+ * @return a {@code String} describing the contents of this
+ * {@code PolicyQualifierInfo}
*/
public String toString() {
if (pqiString != null)
--- a/jdk/src/share/classes/java/security/cert/TrustAnchor.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/TrustAnchor.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -40,16 +40,16 @@
* for validating X.509 certification paths. A most-trusted CA includes the
* public key of the CA, the CA's name, and any constraints upon the set of
* paths which may be validated using this key. These parameters can be
- * specified in the form of a trusted <code>X509Certificate</code> or as
+ * specified in the form of a trusted {@code X509Certificate} or as
* individual parameters.
* <p>
* <b>Concurrent Access</b>
* <p>
- * <p>All <code>TrustAnchor</code> objects must be immutable and
+ * <p>All {@code TrustAnchor} objects must be immutable and
* thread-safe. That is, multiple threads may concurrently invoke the
- * methods defined in this class on a single <code>TrustAnchor</code>
+ * methods defined in this class on a single {@code TrustAnchor}
* object (or more than one) with no ill effects. Requiring
- * <code>TrustAnchor</code> objects to be immutable and thread-safe
+ * {@code TrustAnchor} objects to be immutable and thread-safe
* allows them to be passed around to various pieces of code without
* worrying about coordinating access. This stipulation applies to all
* public fields and methods of this class and any added or overridden
@@ -71,8 +71,8 @@
private NameConstraintsExtension nc;
/**
- * Creates an instance of <code>TrustAnchor</code> with the specified
- * <code>X509Certificate</code> and optional name constraints, which
+ * Creates an instance of {@code TrustAnchor} with the specified
+ * {@code X509Certificate} and optional name constraints, which
* are intended to be used as additional constraints when validating
* an X.509 certification path.
* <p>
@@ -82,7 +82,7 @@
* <a href="http://www.ietf.org/rfc/rfc3280">RFC 3280</a>
* and X.509. The ASN.1 definition of this structure appears below.
*
- * <pre><code>
+ * <pre>{@code
* NameConstraints ::= SEQUENCE {
* permittedSubtrees [0] GeneralSubtrees OPTIONAL,
* excludedSubtrees [1] GeneralSubtrees OPTIONAL }
@@ -106,20 +106,20 @@
* uniformResourceIdentifier [6] IA5String,
* iPAddress [7] OCTET STRING,
* registeredID [8] OBJECT IDENTIFIER}
- * </code></pre>
+ * }</pre>
* <p>
* Note that the name constraints byte array supplied is cloned to protect
* against subsequent modifications.
*
- * @param trustedCert a trusted <code>X509Certificate</code>
+ * @param trustedCert a trusted {@code X509Certificate}
* @param nameConstraints a byte array containing the ASN.1 DER encoding of
* a NameConstraints extension to be used for checking name constraints.
* Only the value of the extension is included, not the OID or criticality
- * flag. Specify <code>null</code> to omit the parameter.
+ * flag. Specify {@code null} to omit the parameter.
* @throws IllegalArgumentException if the name constraints cannot be
* decoded
* @throws NullPointerException if the specified
- * <code>X509Certificate</code> is <code>null</code>
+ * {@code X509Certificate} is {@code null}
*/
public TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints)
{
@@ -134,7 +134,7 @@
}
/**
- * Creates an instance of <code>TrustAnchor</code> where the
+ * Creates an instance of {@code TrustAnchor} where the
* most-trusted CA is specified as an X500Principal and public key.
* Name constraints are an optional parameter, and are intended to be used
* as additional constraints when validating an X.509 certification path.
@@ -155,9 +155,9 @@
* @param nameConstraints a byte array containing the ASN.1 DER encoding of
* a NameConstraints extension to be used for checking name constraints.
* Only the value of the extension is included, not the OID or criticality
- * flag. Specify <code>null</code> to omit the parameter.
- * @throws NullPointerException if the specified <code>caPrincipal</code> or
- * <code>pubKey</code> parameter is <code>null</code>
+ * flag. Specify {@code null} to omit the parameter.
+ * @throws NullPointerException if the specified {@code caPrincipal} or
+ * {@code pubKey} parameter is {@code null}
* @since 1.5
*/
public TrustAnchor(X500Principal caPrincipal, PublicKey pubKey,
@@ -173,7 +173,7 @@
}
/**
- * Creates an instance of <code>TrustAnchor</code> where the
+ * Creates an instance of {@code TrustAnchor} where the
* most-trusted CA is specified as a distinguished name and public key.
* Name constraints are an optional parameter, and are intended to be used
* as additional constraints when validating an X.509 certification path.
@@ -191,17 +191,17 @@
*
* @param caName the X.500 distinguished name of the most-trusted CA in
* <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
- * <code>String</code> format
+ * {@code String} format
* @param pubKey the public key of the most-trusted CA
* @param nameConstraints a byte array containing the ASN.1 DER encoding of
* a NameConstraints extension to be used for checking name constraints.
* Only the value of the extension is included, not the OID or criticality
- * flag. Specify <code>null</code> to omit the parameter.
- * @throws IllegalArgumentException if the specified <code>
- * caName</code> parameter is empty <code>(caName.length() == 0)</code>
+ * flag. Specify {@code null} to omit the parameter.
+ * @throws IllegalArgumentException if the specified
+ * {@code caName} parameter is empty {@code (caName.length() == 0)}
* or incorrectly formatted or the name constraints cannot be decoded
- * @throws NullPointerException if the specified <code>caName</code> or
- * <code>pubKey</code> parameter is <code>null</code>
+ * @throws NullPointerException if the specified {@code caName} or
+ * {@code pubKey} parameter is {@code null}
*/
public TrustAnchor(String caName, PublicKey pubKey, byte[] nameConstraints)
{
@@ -225,7 +225,7 @@
/**
* Returns the most-trusted CA certificate.
*
- * @return a trusted <code>X509Certificate</code> or <code>null</code>
+ * @return a trusted {@code X509Certificate} or {@code null}
* if the trust anchor was not specified as a trusted certificate
*/
public final X509Certificate getTrustedCert() {
@@ -236,7 +236,7 @@
* Returns the name of the most-trusted CA as an X500Principal.
*
* @return the X.500 distinguished name of the most-trusted CA, or
- * <code>null</code> if the trust anchor was not specified as a trusted
+ * {@code null} if the trust anchor was not specified as a trusted
* public key and name or X500Principal pair
* @since 1.5
*/
@@ -245,11 +245,11 @@
}
/**
- * Returns the name of the most-trusted CA in RFC 2253 <code>String</code>
+ * Returns the name of the most-trusted CA in RFC 2253 {@code String}
* format.
*
* @return the X.500 distinguished name of the most-trusted CA, or
- * <code>null</code> if the trust anchor was not specified as a trusted
+ * {@code null} if the trust anchor was not specified as a trusted
* public key and name or X500Principal pair
*/
public final String getCAName() {
@@ -259,7 +259,7 @@
/**
* Returns the public key of the most-trusted CA.
*
- * @return the public key of the most-trusted CA, or <code>null</code>
+ * @return the public key of the most-trusted CA, or {@code null}
* if the trust anchor was not specified as a trusted public key and name
* or X500Principal pair
*/
@@ -306,16 +306,16 @@
*
* @return a byte array containing the ASN.1 DER encoding of
* a NameConstraints extension used for checking name constraints,
- * or <code>null</code> if not set.
+ * or {@code null} if not set.
*/
public final byte [] getNameConstraints() {
return ncBytes == null ? null : ncBytes.clone();
}
/**
- * Returns a formatted string describing the <code>TrustAnchor</code>.
+ * Returns a formatted string describing the {@code TrustAnchor}.
*
- * @return a formatted string describing the <code>TrustAnchor</code>
+ * @return a formatted string describing the {@code TrustAnchor}
*/
public String toString() {
StringBuffer sb = new StringBuffer();
--- a/jdk/src/share/classes/java/security/cert/X509CRL.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/X509CRL.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -72,7 +72,7 @@
* <a href="http://www.ietf.org/rfc/rfc3280.txt">RFC 3280: Internet X.509
* Public Key Infrastructure Certificate and CRL Profile</a>.
* <p>
- * The ASN.1 definition of <code>tbsCertList</code> is:
+ * The ASN.1 definition of {@code tbsCertList} is:
* <pre>
* TBSCertList ::= SEQUENCE {
* version Version OPTIONAL,
@@ -94,12 +94,12 @@
* <p>
* CRLs are instantiated using a certificate factory. The following is an
* example of how to instantiate an X.509 CRL:
- * <pre><code>
+ * <pre>{@code
* try (InputStream inStream = new FileInputStream("fileName-of-crl")) {
* CertificateFactory cf = CertificateFactory.getInstance("X.509");
* X509CRL crl = (X509CRL)cf.generateCRL(inStream);
* }
- * </code></pre>
+ * }</pre>
*
* @author Hemma Prafullchandra
*
@@ -122,8 +122,8 @@
/**
* Compares this CRL for equality with the given
- * object. If the <code>other</code> object is an
- * <code>instanceof</code> <code>X509CRL</code>, then
+ * object. If the {@code other} object is an
+ * {@code instanceof} {@code X509CRL}, then
* its encoded form is retrieved and compared with the
* encoded form of this CRL.
*
@@ -225,7 +225,7 @@
*
* This method was added to version 1.8 of the Java Platform Standard
* Edition. In order to maintain backwards compatibility with existing
- * service providers, this method is not <code>abstract</code>
+ * service providers, this method is not {@code abstract}
* and it provides a default implementation.
*
* @param key the PublicKey used to carry out the verification.
@@ -245,11 +245,12 @@
}
/**
- * Gets the <code>version</code> (version number) value from the CRL.
+ * Gets the {@code version} (version number) value from the CRL.
* The ASN.1 definition for this is:
* <pre>
* version Version OPTIONAL,
- * -- if present, must be v2<p>
+ * -- if present, must be v2
+ *
* Version ::= INTEGER { v1(0), v2(1), v3(2) }
* -- v3 does not apply to CRLs but appears for consistency
* -- with definition of Version for certs
@@ -261,12 +262,12 @@
/**
* <strong>Denigrated</strong>, replaced by {@linkplain
- * #getIssuerX500Principal()}. This method returns the <code>issuer</code>
+ * #getIssuerX500Principal()}. This method returns the {@code issuer}
* as an implementation specific Principal object, which should not be
* relied upon by portable code.
*
* <p>
- * Gets the <code>issuer</code> (issuer distinguished name) value from
+ * Gets the {@code issuer} (issuer distinguished name) value from
* the CRL. The issuer name identifies the entity that signed (and
* issued) the CRL.
*
@@ -287,14 +288,14 @@
* AttributeType ::= OBJECT IDENTIFIER
* AttributeValue ::= ANY
* </pre>
- * The <code>Name</code> describes a hierarchical name composed of
+ * The {@code Name} describes a hierarchical name composed of
* attributes,
* such as country name, and corresponding values, such as US.
- * The type of the <code>AttributeValue</code> component is determined by
- * the <code>AttributeType</code>; in general it will be a
- * <code>directoryString</code>. A <code>directoryString</code> is usually
- * one of <code>PrintableString</code>,
- * <code>TeletexString</code> or <code>UniversalString</code>.
+ * The type of the {@code AttributeValue} component is determined by
+ * the {@code AttributeType}; in general it will be a
+ * {@code directoryString}. A {@code directoryString} is usually
+ * one of {@code PrintableString},
+ * {@code TeletexString} or {@code UniversalString}.
*
* @return a Principal whose name is the issuer distinguished name.
*/
@@ -302,11 +303,11 @@
/**
* Returns the issuer (issuer distinguished name) value from the
- * CRL as an <code>X500Principal</code>.
+ * CRL as an {@code X500Principal}.
* <p>
* It is recommended that subclasses override this method.
*
- * @return an <code>X500Principal</code> representing the issuer
+ * @return an {@code X500Principal} representing the issuer
* distinguished name
* @since 1.4
*/
@@ -318,7 +319,7 @@
}
/**
- * Gets the <code>thisUpdate</code> date from the CRL.
+ * Gets the {@code thisUpdate} date from the CRL.
* The ASN.1 definition for this is:
* <pre>
* thisUpdate ChoiceOfTime
@@ -327,14 +328,14 @@
* generalTime GeneralizedTime }
* </pre>
*
- * @return the <code>thisUpdate</code> date from the CRL.
+ * @return the {@code thisUpdate} date from the CRL.
*/
public abstract Date getThisUpdate();
/**
- * Gets the <code>nextUpdate</code> date from the CRL.
+ * Gets the {@code nextUpdate} date from the CRL.
*
- * @return the <code>nextUpdate</code> date from the CRL, or null if
+ * @return the {@code nextUpdate} date from the CRL, or null if
* not present.
*/
public abstract Date getNextUpdate();
@@ -388,7 +389,7 @@
/**
* Gets the DER-encoded CRL information, the
- * <code>tbsCertList</code> from this CRL.
+ * {@code tbsCertList} from this CRL.
* This can be used to verify the signature independently.
*
* @return the DER-encoded CRL information.
@@ -397,7 +398,7 @@
public abstract byte[] getTBSCertList() throws CRLException;
/**
- * Gets the <code>signature</code> value (the raw signature bits) from
+ * Gets the {@code signature} value (the raw signature bits) from
* the CRL.
* The ASN.1 definition for this is:
* <pre>
@@ -413,7 +414,8 @@
* signature algorithm. An example is the string "SHA256withRSA".
* The ASN.1 definition for this is:
* <pre>
- * signatureAlgorithm AlgorithmIdentifier<p>
+ * signatureAlgorithm AlgorithmIdentifier
+ *
* AlgorithmIdentifier ::= SEQUENCE {
* algorithm OBJECT IDENTIFIER,
* parameters ANY DEFINED BY algorithm OPTIONAL }
@@ -422,7 +424,7 @@
* -- algorithm object identifier value
* </pre>
*
- * <p>The algorithm name is determined from the <code>algorithm</code>
+ * <p>The algorithm name is determined from the {@code algorithm}
* OID string.
*
* @return the signature algorithm name.
--- a/jdk/src/share/classes/java/security/cert/X509CRLEntry.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/X509CRLEntry.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -43,11 +43,11 @@
* crlEntryExtensions Extensions OPTIONAL
* -- if present, must be v2
* } OPTIONAL
- *<p>
+ *
* CertificateSerialNumber ::= INTEGER
- *<p>
+ *
* Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
- *<p>
+ *
* Extension ::= SEQUENCE {
* extnId OBJECT IDENTIFIER,
* critical BOOLEAN DEFAULT FALSE,
@@ -68,8 +68,8 @@
/**
* Compares this CRL entry for equality with the given
- * object. If the <code>other</code> object is an
- * <code>instanceof</code> <code>X509CRLEntry</code>, then
+ * object. If the {@code other} object is an
+ * {@code instanceof} {@code X509CRLEntry}, then
* its encoded form (the inner SEQUENCE) is retrieved and compared
* with the encoded form of this CRL entry.
*
@@ -178,7 +178,7 @@
* in the Reason Code extension of this CRL entry.
*
* @return the reason the certificate has been revoked, or
- * <code>null</code> if this CRL entry does not have
+ * {@code null} if this CRL entry does not have
* a Reason Code extension
* @since 1.7
*/
--- a/jdk/src/share/classes/java/security/cert/X509CRLSelector.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/X509CRLSelector.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -37,18 +37,18 @@
import sun.security.x509.X500Name;
/**
- * A <code>CRLSelector</code> that selects <code>X509CRLs</code> that
+ * A {@code CRLSelector} that selects {@code X509CRLs} that
* match all specified criteria. This class is particularly useful when
- * selecting CRLs from a <code>CertStore</code> to check revocation status
+ * selecting CRLs from a {@code CertStore} to check revocation status
* of a particular certificate.
* <p>
- * When first constructed, an <code>X509CRLSelector</code> has no criteria
- * enabled and each of the <code>get</code> methods return a default
- * value (<code>null</code>). Therefore, the {@link #match match} method
- * would return <code>true</code> for any <code>X509CRL</code>. Typically,
+ * When first constructed, an {@code X509CRLSelector} has no criteria
+ * enabled and each of the {@code get} methods return a default
+ * value ({@code null}). Therefore, the {@link #match match} method
+ * would return {@code true} for any {@code X509CRL}. Typically,
* several criteria are enabled (by calling {@link #setIssuers setIssuers}
* or {@link #setDateAndTime setDateAndTime}, for instance) and then the
- * <code>X509CRLSelector</code> is passed to
+ * {@code X509CRLSelector} is passed to
* {@link CertStore#getCRLs CertStore.getCRLs} or some similar
* method.
* <p>
@@ -86,35 +86,35 @@
private long skew = 0;
/**
- * Creates an <code>X509CRLSelector</code>. Initially, no criteria are set
- * so any <code>X509CRL</code> will match.
+ * Creates an {@code X509CRLSelector}. Initially, no criteria are set
+ * so any {@code X509CRL} will match.
*/
public X509CRLSelector() {}
/**
* Sets the issuerNames criterion. The issuer distinguished name in the
- * <code>X509CRL</code> must match at least one of the specified
- * distinguished names. If <code>null</code>, any issuer distinguished name
+ * {@code X509CRL} must match at least one of the specified
+ * distinguished names. If {@code null}, any issuer distinguished name
* will do.
* <p>
* This method allows the caller to specify, with a single method call,
- * the complete set of issuer names which <code>X509CRLs</code> may contain.
+ * the complete set of issuer names which {@code X509CRLs} may contain.
* The specified value replaces the previous value for the issuerNames
* criterion.
* <p>
- * The <code>names</code> parameter (if not <code>null</code>) is a
- * <code>Collection</code> of <code>X500Principal</code>s.
+ * The {@code names} parameter (if not {@code null}) is a
+ * {@code Collection} of {@code X500Principal}s.
* <p>
- * Note that the <code>names</code> parameter can contain duplicate
+ * Note that the {@code names} parameter can contain duplicate
* distinguished names, but they may be removed from the
- * <code>Collection</code> of names returned by the
+ * {@code Collection} of names returned by the
* {@link #getIssuers getIssuers} method.
* <p>
- * Note that a copy is performed on the <code>Collection</code> to
+ * Note that a copy is performed on the {@code Collection} to
* protect against subsequent modifications.
*
- * @param issuers a <code>Collection</code> of X500Principals
- * (or <code>null</code>)
+ * @param issuers a {@code Collection} of X500Principals
+ * (or {@code null})
* @see #getIssuers
* @since 1.5
*/
@@ -138,31 +138,31 @@
* this method. See {@link #addIssuerName(String)} for more information.
* <p>
* Sets the issuerNames criterion. The issuer distinguished name in the
- * <code>X509CRL</code> must match at least one of the specified
- * distinguished names. If <code>null</code>, any issuer distinguished name
+ * {@code X509CRL} must match at least one of the specified
+ * distinguished names. If {@code null}, any issuer distinguished name
* will do.
* <p>
* This method allows the caller to specify, with a single method call,
- * the complete set of issuer names which <code>X509CRLs</code> may contain.
+ * the complete set of issuer names which {@code X509CRLs} may contain.
* The specified value replaces the previous value for the issuerNames
* criterion.
* <p>
- * The <code>names</code> parameter (if not <code>null</code>) is a
- * <code>Collection</code> of names. Each name is a <code>String</code>
+ * The {@code names} parameter (if not {@code null}) is a
+ * {@code Collection} of names. Each name is a {@code String}
* or a byte array representing a distinguished name (in
* <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> or
- * ASN.1 DER encoded form, respectively). If <code>null</code> is supplied
+ * ASN.1 DER encoded form, respectively). If {@code null} is supplied
* as the value for this argument, no issuerNames check will be performed.
* <p>
- * Note that the <code>names</code> parameter can contain duplicate
+ * Note that the {@code names} parameter can contain duplicate
* distinguished names, but they may be removed from the
- * <code>Collection</code> of names returned by the
+ * {@code Collection} of names returned by the
* {@link #getIssuerNames getIssuerNames} method.
* <p>
* If a name is specified as a byte array, it should contain a single DER
* encoded distinguished name, as defined in X.501. The ASN.1 notation for
* this structure is as follows.
- * <pre><code>
+ * <pre>{@code
* Name ::= CHOICE {
* RDNSequence }
*
@@ -185,12 +185,12 @@
* universalString UniversalString (SIZE (1..MAX)),
* utf8String UTF8String (SIZE (1.. MAX)),
* bmpString BMPString (SIZE (1..MAX)) }
- * </code></pre>
+ * }</pre>
* <p>
- * Note that a deep copy is performed on the <code>Collection</code> to
+ * Note that a deep copy is performed on the {@code Collection} to
* protect against subsequent modifications.
*
- * @param names a <code>Collection</code> of names (or <code>null</code>)
+ * @param names a {@code Collection} of names (or {@code null})
* @throws IOException if a parsing error occurs
* @see #getIssuerNames
*/
@@ -208,11 +208,11 @@
/**
* Adds a name to the issuerNames criterion. The issuer distinguished
- * name in the <code>X509CRL</code> must match at least one of the specified
+ * name in the {@code X509CRL} must match at least one of the specified
* distinguished names.
* <p>
* This method allows the caller to add a name to the set of issuer names
- * which <code>X509CRLs</code> may contain. The specified name is added to
+ * which {@code X509CRLs} may contain. The specified name is added to
* any previous value for the issuerNames criterion.
* If the specified name is a duplicate, it may be ignored.
*
@@ -232,11 +232,11 @@
* names.
* <p>
* Adds a name to the issuerNames criterion. The issuer distinguished
- * name in the <code>X509CRL</code> must match at least one of the specified
+ * name in the {@code X509CRL} must match at least one of the specified
* distinguished names.
* <p>
* This method allows the caller to add a name to the set of issuer names
- * which <code>X509CRLs</code> may contain. The specified name is added to
+ * which {@code X509CRLs} may contain. The specified name is added to
* any previous value for the issuerNames criterion.
* If the specified name is a duplicate, it may be ignored.
*
@@ -249,11 +249,11 @@
/**
* Adds a name to the issuerNames criterion. The issuer distinguished
- * name in the <code>X509CRL</code> must match at least one of the specified
+ * name in the {@code X509CRL} must match at least one of the specified
* distinguished names.
* <p>
* This method allows the caller to add a name to the set of issuer names
- * which <code>X509CRLs</code> may contain. The specified name is added to
+ * which {@code X509CRLs} may contain. The specified name is added to
* any previous value for the issuerNames criterion. If the specified name
* is a duplicate, it may be ignored.
* If a name is specified as a byte array, it should contain a single DER
@@ -279,7 +279,7 @@
/**
* A private method that adds a name (String or byte array) to the
* issuerNames criterion. The issuer distinguished
- * name in the <code>X509CRL</code> must match at least one of the specified
+ * name in the {@code X509CRL} must match at least one of the specified
* distinguished names.
*
* @param name the name in string or byte array form
@@ -301,11 +301,11 @@
* Clone and check an argument of the form passed to
* setIssuerNames. Throw an IOException if the argument is malformed.
*
- * @param names a <code>Collection</code> of names. Each entry is a
+ * @param names a {@code Collection} of names. Each entry is a
* String or a byte array (the name, in string or ASN.1
- * DER encoded form, respectively). <code>null</code> is
+ * DER encoded form, respectively). {@code null} is
* not an acceptable value.
- * @return a deep copy of the specified <code>Collection</code>
+ * @return a deep copy of the specified {@code Collection}
* @throws IOException if a parsing error occurs
*/
private static HashSet<Object> cloneAndCheckIssuerNames(Collection<?> names)
@@ -334,11 +334,11 @@
* into a RuntimeException. This method should be used when the object being
* cloned has already been checked, so there should never be any exceptions.
*
- * @param names a <code>Collection</code> of names. Each entry is a
+ * @param names a {@code Collection} of names. Each entry is a
* String or a byte array (the name, in string or ASN.1
- * DER encoded form, respectively). <code>null</code> is
+ * DER encoded form, respectively). {@code null} is
* not an acceptable value.
- * @return a deep copy of the specified <code>Collection</code>
+ * @return a deep copy of the specified {@code Collection}
* @throws RuntimeException if a parsing error occurs
*/
private static HashSet<Object> cloneIssuerNames(Collection<Object> names) {
@@ -354,7 +354,7 @@
* returning a Collection of issuerX500Principals.
* Throw an IOException if the argument is malformed.
*
- * @param names a <code>Collection</code> of names. Each entry is a
+ * @param names a {@code Collection} of names. Each entry is a
* String or a byte array (the name, in string or ASN.1
* DER encoded form, respectively). <Code>Null</Code> is
* not an acceptable value.
@@ -380,24 +380,24 @@
}
/**
- * Sets the minCRLNumber criterion. The <code>X509CRL</code> must have a
+ * Sets the minCRLNumber criterion. The {@code X509CRL} must have a
* CRL number extension whose value is greater than or equal to the
- * specified value. If <code>null</code>, no minCRLNumber check will be
+ * specified value. If {@code null}, no minCRLNumber check will be
* done.
*
- * @param minCRL the minimum CRL number accepted (or <code>null</code>)
+ * @param minCRL the minimum CRL number accepted (or {@code null})
*/
public void setMinCRLNumber(BigInteger minCRL) {
this.minCRL = minCRL;
}
/**
- * Sets the maxCRLNumber criterion. The <code>X509CRL</code> must have a
+ * Sets the maxCRLNumber criterion. The {@code X509CRL} must have a
* CRL number extension whose value is less than or equal to the
- * specified value. If <code>null</code>, no maxCRLNumber check will be
+ * specified value. If {@code null}, no maxCRLNumber check will be
* done.
*
- * @param maxCRL the maximum CRL number accepted (or <code>null</code>)
+ * @param maxCRL the maximum CRL number accepted (or {@code null})
*/
public void setMaxCRLNumber(BigInteger maxCRL) {
this.maxCRL = maxCRL;
@@ -406,16 +406,16 @@
/**
* Sets the dateAndTime criterion. The specified date must be
* equal to or later than the value of the thisUpdate component
- * of the <code>X509CRL</code> and earlier than the value of the
- * nextUpdate component. There is no match if the <code>X509CRL</code>
+ * of the {@code X509CRL} and earlier than the value of the
+ * nextUpdate component. There is no match if the {@code X509CRL}
* does not contain a nextUpdate component.
- * If <code>null</code>, no dateAndTime check will be done.
+ * If {@code null}, no dateAndTime check will be done.
* <p>
- * Note that the <code>Date</code> supplied here is cloned to protect
+ * Note that the {@code Date} supplied here is cloned to protect
* against subsequent modifications.
*
- * @param dateAndTime the <code>Date</code> to match against
- * (or <code>null</code>)
+ * @param dateAndTime the {@code Date} to match against
+ * (or {@code null})
* @see #getDateAndTime
*/
public void setDateAndTime(Date dateAndTime) {
@@ -438,13 +438,13 @@
/**
* Sets the certificate being checked. This is not a criterion. Rather,
- * it is optional information that may help a <code>CertStore</code>
+ * it is optional information that may help a {@code CertStore}
* find CRLs that would be relevant when checking revocation for the
- * specified certificate. If <code>null</code> is specified, then no
+ * specified certificate. If {@code null} is specified, then no
* such optional information is provided.
*
- * @param cert the <code>X509Certificate</code> being checked
- * (or <code>null</code>)
+ * @param cert the {@code X509Certificate} being checked
+ * (or {@code null})
* @see #getCertificateChecking
*/
public void setCertificateChecking(X509Certificate cert) {
@@ -453,15 +453,15 @@
/**
* Returns the issuerNames criterion. The issuer distinguished
- * name in the <code>X509CRL</code> must match at least one of the specified
- * distinguished names. If the value returned is <code>null</code>, any
+ * name in the {@code X509CRL} must match at least one of the specified
+ * distinguished names. If the value returned is {@code null}, any
* issuer distinguished name will do.
* <p>
- * If the value returned is not <code>null</code>, it is a
- * unmodifiable <code>Collection</code> of <code>X500Principal</code>s.
+ * If the value returned is not {@code null}, it is a
+ * unmodifiable {@code Collection} of {@code X500Principal}s.
*
- * @return an unmodifiable <code>Collection</code> of names
- * (or <code>null</code>)
+ * @return an unmodifiable {@code Collection} of names
+ * (or {@code null})
* @see #setIssuers
* @since 1.5
*/
@@ -474,25 +474,25 @@
/**
* Returns a copy of the issuerNames criterion. The issuer distinguished
- * name in the <code>X509CRL</code> must match at least one of the specified
- * distinguished names. If the value returned is <code>null</code>, any
+ * name in the {@code X509CRL} must match at least one of the specified
+ * distinguished names. If the value returned is {@code null}, any
* issuer distinguished name will do.
* <p>
- * If the value returned is not <code>null</code>, it is a
- * <code>Collection</code> of names. Each name is a <code>String</code>
+ * If the value returned is not {@code null}, it is a
+ * {@code Collection} of names. Each name is a {@code String}
* or a byte array representing a distinguished name (in RFC 2253 or
* ASN.1 DER encoded form, respectively). Note that the
- * <code>Collection</code> returned may contain duplicate names.
+ * {@code Collection} returned may contain duplicate names.
* <p>
* If a name is specified as a byte array, it should contain a single DER
* encoded distinguished name, as defined in X.501. The ASN.1 notation for
* this structure is given in the documentation for
* {@link #setIssuerNames setIssuerNames(Collection names)}.
* <p>
- * Note that a deep copy is performed on the <code>Collection</code> to
+ * Note that a deep copy is performed on the {@code Collection} to
* protect against subsequent modifications.
*
- * @return a <code>Collection</code> of names (or <code>null</code>)
+ * @return a {@code Collection} of names (or {@code null})
* @see #setIssuerNames
*/
public Collection<Object> getIssuerNames() {
@@ -503,23 +503,23 @@
}
/**
- * Returns the minCRLNumber criterion. The <code>X509CRL</code> must have a
+ * Returns the minCRLNumber criterion. The {@code X509CRL} must have a
* CRL number extension whose value is greater than or equal to the
- * specified value. If <code>null</code>, no minCRLNumber check will be done.
+ * specified value. If {@code null}, no minCRLNumber check will be done.
*
- * @return the minimum CRL number accepted (or <code>null</code>)
+ * @return the minimum CRL number accepted (or {@code null})
*/
public BigInteger getMinCRL() {
return minCRL;
}
/**
- * Returns the maxCRLNumber criterion. The <code>X509CRL</code> must have a
+ * Returns the maxCRLNumber criterion. The {@code X509CRL} must have a
* CRL number extension whose value is less than or equal to the
- * specified value. If <code>null</code>, no maxCRLNumber check will be
+ * specified value. If {@code null}, no maxCRLNumber check will be
* done.
*
- * @return the maximum CRL number accepted (or <code>null</code>)
+ * @return the maximum CRL number accepted (or {@code null})
*/
public BigInteger getMaxCRL() {
return maxCRL;
@@ -528,15 +528,15 @@
/**
* Returns the dateAndTime criterion. The specified date must be
* equal to or later than the value of the thisUpdate component
- * of the <code>X509CRL</code> and earlier than the value of the
+ * of the {@code X509CRL} and earlier than the value of the
* nextUpdate component. There is no match if the
- * <code>X509CRL</code> does not contain a nextUpdate component.
- * If <code>null</code>, no dateAndTime check will be done.
+ * {@code X509CRL} does not contain a nextUpdate component.
+ * If {@code null}, no dateAndTime check will be done.
* <p>
- * Note that the <code>Date</code> returned is cloned to protect against
+ * Note that the {@code Date} returned is cloned to protect against
* subsequent modifications.
*
- * @return the <code>Date</code> to match against (or <code>null</code>)
+ * @return the {@code Date} to match against (or {@code null})
* @see #setDateAndTime
*/
public Date getDateAndTime() {
@@ -547,12 +547,12 @@
/**
* Returns the certificate being checked. This is not a criterion. Rather,
- * it is optional information that may help a <code>CertStore</code>
+ * it is optional information that may help a {@code CertStore}
* find CRLs that would be relevant when checking revocation for the
- * specified certificate. If the value returned is <code>null</code>, then
+ * specified certificate. If the value returned is {@code null}, then
* no such optional information is provided.
*
- * @return the certificate being checked (or <code>null</code>)
+ * @return the certificate being checked (or {@code null})
* @see #setCertificateChecking
*/
public X509Certificate getCertificateChecking() {
@@ -560,10 +560,10 @@
}
/**
- * Returns a printable representation of the <code>X509CRLSelector</code>.
+ * Returns a printable representation of the {@code X509CRLSelector}.
*
- * @return a <code>String</code> describing the contents of the
- * <code>X509CRLSelector</code>.
+ * @return a {@code String} describing the contents of the
+ * {@code X509CRLSelector}.
*/
public String toString() {
StringBuffer sb = new StringBuffer();
@@ -587,11 +587,11 @@
}
/**
- * Decides whether a <code>CRL</code> should be selected.
+ * Decides whether a {@code CRL} should be selected.
*
- * @param crl the <code>CRL</code> to be checked
- * @return <code>true</code> if the <code>CRL</code> should be selected,
- * <code>false</code> otherwise
+ * @param crl the {@code CRL} to be checked
+ * @return {@code true} if the {@code CRL} should be selected,
+ * {@code false} otherwise
*/
public boolean match(CRL crl) {
if (!(crl instanceof X509CRL)) {
--- a/jdk/src/share/classes/java/security/cert/X509CertSelector.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/X509CertSelector.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -39,27 +39,27 @@
import sun.security.x509.*;
/**
- * A <code>CertSelector</code> that selects <code>X509Certificates</code> that
+ * A {@code CertSelector} that selects {@code X509Certificates} that
* match all specified criteria. This class is particularly useful when
- * selecting certificates from a <code>CertStore</code> to build a
+ * selecting certificates from a {@code CertStore} to build a
* PKIX-compliant certification path.
* <p>
- * When first constructed, an <code>X509CertSelector</code> has no criteria
- * enabled and each of the <code>get</code> methods return a default value
- * (<code>null</code>, or <code>-1</code> for the {@link #getBasicConstraints
+ * When first constructed, an {@code X509CertSelector} has no criteria
+ * enabled and each of the {@code get} methods return a default value
+ * ({@code null}, or {@code -1} for the {@link #getBasicConstraints
* getBasicConstraints} method). Therefore, the {@link #match match}
- * method would return <code>true</code> for any <code>X509Certificate</code>.
+ * method would return {@code true} for any {@code X509Certificate}.
* Typically, several criteria are enabled (by calling
* {@link #setIssuer setIssuer} or
* {@link #setKeyUsage setKeyUsage}, for instance) and then the
- * <code>X509CertSelector</code> is passed to
+ * {@code X509CertSelector} is passed to
* {@link CertStore#getCertificates CertStore.getCertificates} or some similar
* method.
* <p>
* Several criteria can be enabled (by calling {@link #setIssuer setIssuer}
* and {@link #setSerialNumber setSerialNumber},
- * for example) such that the <code>match</code> method
- * usually uniquely matches a single <code>X509Certificate</code>. We say
+ * for example) such that the {@code match} method
+ * usually uniquely matches a single {@code X509Certificate}. We say
* usually, since it is possible for two issuing CAs to have the same
* distinguished name and each issue a certificate with the same serial
* number. Other unique combinations include the issuer, subject,
@@ -149,8 +149,8 @@
static final int NAME_OID = 8;
/**
- * Creates an <code>X509CertSelector</code>. Initially, no criteria are set
- * so any <code>X509Certificate</code> will match.
+ * Creates an {@code X509CertSelector}. Initially, no criteria are set
+ * so any {@code X509Certificate} will match.
*/
public X509CertSelector() {
// empty
@@ -158,17 +158,17 @@
/**
* Sets the certificateEquals criterion. The specified
- * <code>X509Certificate</code> must be equal to the
- * <code>X509Certificate</code> passed to the <code>match</code> method.
- * If <code>null</code>, then this check is not applied.
+ * {@code X509Certificate} must be equal to the
+ * {@code X509Certificate} passed to the {@code match} method.
+ * If {@code null}, then this check is not applied.
*
* <p>This method is particularly useful when it is necessary to
* match a single certificate. Although other criteria can be specified
* in conjunction with the certificateEquals criterion, it is usually not
* practical or necessary.
*
- * @param cert the <code>X509Certificate</code> to match (or
- * <code>null</code>)
+ * @param cert the {@code X509Certificate} to match (or
+ * {@code null})
* @see #getCertificate
*/
public void setCertificate(X509Certificate cert) {
@@ -178,11 +178,11 @@
/**
* Sets the serialNumber criterion. The specified serial number
* must match the certificate serial number in the
- * <code>X509Certificate</code>. If <code>null</code>, any certificate
+ * {@code X509Certificate}. If {@code null}, any certificate
* serial number will do.
*
* @param serial the certificate serial number to match
- * (or <code>null</code>)
+ * (or {@code null})
* @see #getSerialNumber
*/
public void setSerialNumber(BigInteger serial) {
@@ -192,11 +192,11 @@
/**
* Sets the issuer criterion. The specified distinguished name
* must match the issuer distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code>, any issuer
+ * {@code X509Certificate}. If {@code null}, any issuer
* distinguished name will do.
*
* @param issuer a distinguished name as X500Principal
- * (or <code>null</code>)
+ * (or {@code null})
* @since 1.5
*/
public void setIssuer(X500Principal issuer) {
@@ -213,14 +213,14 @@
* <p>
* Sets the issuer criterion. The specified distinguished name
* must match the issuer distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code>, any issuer
+ * {@code X509Certificate}. If {@code null}, any issuer
* distinguished name will do.
* <p>
- * If <code>issuerDN</code> is not <code>null</code>, it should contain a
+ * If {@code issuerDN} is not {@code null}, it should contain a
* distinguished name, in RFC 2253 format.
*
* @param issuerDN a distinguished name in RFC 2253 format
- * (or <code>null</code>)
+ * (or {@code null})
* @throws IOException if a parsing error occurs (incorrect form for DN)
*/
public void setIssuer(String issuerDN) throws IOException {
@@ -234,14 +234,14 @@
/**
* Sets the issuer criterion. The specified distinguished name
* must match the issuer distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code> is specified,
+ * {@code X509Certificate}. If {@code null} is specified,
* the issuer criterion is disabled and any issuer distinguished name will
* do.
* <p>
- * If <code>issuerDN</code> is not <code>null</code>, it should contain a
+ * If {@code issuerDN} is not {@code null}, it should contain a
* single DER encoded distinguished name, as defined in X.501. The ASN.1
* notation for this structure is as follows.
- * <pre><code>
+ * <pre>{@code
* Name ::= CHOICE {
* RDNSequence }
*
@@ -264,13 +264,13 @@
* universalString UniversalString (SIZE (1..MAX)),
* utf8String UTF8String (SIZE (1.. MAX)),
* bmpString BMPString (SIZE (1..MAX)) }
- * </code></pre>
+ * }</pre>
* <p>
* Note that the byte array specified here is cloned to protect against
* subsequent modifications.
*
* @param issuerDN a byte array containing the distinguished name
- * in ASN.1 DER encoded form (or <code>null</code>)
+ * in ASN.1 DER encoded form (or {@code null})
* @throws IOException if an encoding error occurs (incorrect form for DN)
*/
public void setIssuer(byte[] issuerDN) throws IOException {
@@ -284,11 +284,11 @@
/**
* Sets the subject criterion. The specified distinguished name
* must match the subject distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code>, any subject
+ * {@code X509Certificate}. If {@code null}, any subject
* distinguished name will do.
*
* @param subject a distinguished name as X500Principal
- * (or <code>null</code>)
+ * (or {@code null})
* @since 1.5
*/
public void setSubject(X500Principal subject) {
@@ -304,14 +304,14 @@
* <p>
* Sets the subject criterion. The specified distinguished name
* must match the subject distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code>, any subject
+ * {@code X509Certificate}. If {@code null}, any subject
* distinguished name will do.
* <p>
- * If <code>subjectDN</code> is not <code>null</code>, it should contain a
+ * If {@code subjectDN} is not {@code null}, it should contain a
* distinguished name, in RFC 2253 format.
*
* @param subjectDN a distinguished name in RFC 2253 format
- * (or <code>null</code>)
+ * (or {@code null})
* @throws IOException if a parsing error occurs (incorrect form for DN)
*/
public void setSubject(String subjectDN) throws IOException {
@@ -325,16 +325,16 @@
/**
* Sets the subject criterion. The specified distinguished name
* must match the subject distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code>, any subject
+ * {@code X509Certificate}. If {@code null}, any subject
* distinguished name will do.
* <p>
- * If <code>subjectDN</code> is not <code>null</code>, it should contain a
+ * If {@code subjectDN} is not {@code null}, it should contain a
* single DER encoded distinguished name, as defined in X.501. For the ASN.1
* notation for this structure, see
* {@link #setIssuer(byte [] issuerDN) setIssuer(byte [] issuerDN)}.
*
* @param subjectDN a byte array containing the distinguished name in
- * ASN.1 DER format (or <code>null</code>)
+ * ASN.1 DER format (or {@code null})
* @throws IOException if an encoding error occurs (incorrect form for DN)
*/
public void setSubject(byte[] subjectDN) throws IOException {
@@ -347,34 +347,34 @@
/**
* Sets the subjectKeyIdentifier criterion. The
- * <code>X509Certificate</code> must contain a SubjectKeyIdentifier
+ * {@code X509Certificate} must contain a SubjectKeyIdentifier
* extension for which the contents of the extension
* matches the specified criterion value.
- * If the criterion value is <code>null</code>, no
+ * If the criterion value is {@code null}, no
* subjectKeyIdentifier check will be done.
* <p>
- * If <code>subjectKeyID</code> is not <code>null</code>, it
+ * If {@code subjectKeyID} is not {@code null}, it
* should contain a single DER encoded value corresponding to the contents
* of the extension value (not including the object identifier,
* criticality setting, and encapsulating OCTET STRING)
* for a SubjectKeyIdentifier extension.
* The ASN.1 notation for this structure follows.
* <p>
- * <pre><code>
+ * <pre>{@code
* SubjectKeyIdentifier ::= KeyIdentifier
*
* KeyIdentifier ::= OCTET STRING
- * </code></pre>
+ * }</pre>
* <p>
* Since the format of subject key identifiers is not mandated by
* any standard, subject key identifiers are not parsed by the
- * <code>X509CertSelector</code>. Instead, the values are compared using
+ * {@code X509CertSelector}. Instead, the values are compared using
* a byte-by-byte comparison.
* <p>
* Note that the byte array supplied here is cloned to protect against
* subsequent modifications.
*
- * @param subjectKeyID the subject key identifier (or <code>null</code>)
+ * @param subjectKeyID the subject key identifier (or {@code null})
* @see #getSubjectKeyIdentifier
*/
public void setSubjectKeyIdentifier(byte[] subjectKeyID) {
@@ -387,46 +387,46 @@
/**
* Sets the authorityKeyIdentifier criterion. The
- * <code>X509Certificate</code> must contain an
+ * {@code X509Certificate} must contain an
* AuthorityKeyIdentifier extension for which the contents of the
* extension value matches the specified criterion value.
- * If the criterion value is <code>null</code>, no
+ * If the criterion value is {@code null}, no
* authorityKeyIdentifier check will be done.
* <p>
- * If <code>authorityKeyID</code> is not <code>null</code>, it
+ * If {@code authorityKeyID} is not {@code null}, it
* should contain a single DER encoded value corresponding to the contents
* of the extension value (not including the object identifier,
* criticality setting, and encapsulating OCTET STRING)
* for an AuthorityKeyIdentifier extension.
* The ASN.1 notation for this structure follows.
* <p>
- * <pre><code>
+ * <pre>{@code
* AuthorityKeyIdentifier ::= SEQUENCE {
* keyIdentifier [0] KeyIdentifier OPTIONAL,
* authorityCertIssuer [1] GeneralNames OPTIONAL,
* authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL }
*
* KeyIdentifier ::= OCTET STRING
- * </code></pre>
+ * }</pre>
* <p>
* Authority key identifiers are not parsed by the
- * <code>X509CertSelector</code>. Instead, the values are
+ * {@code X509CertSelector}. Instead, the values are
* compared using a byte-by-byte comparison.
* <p>
- * When the <code>keyIdentifier</code> field of
- * <code>AuthorityKeyIdentifier</code> is populated, the value is
- * usually taken from the <code>SubjectKeyIdentifier</code> extension
+ * When the {@code keyIdentifier} field of
+ * {@code AuthorityKeyIdentifier} is populated, the value is
+ * usually taken from the {@code SubjectKeyIdentifier} extension
* in the issuer's certificate. Note, however, that the result of
- * <code>X509Certificate.getExtensionValue(<SubjectKeyIdentifier Object
- * Identifier>)</code> on the issuer's certificate may NOT be used
- * directly as the input to <code>setAuthorityKeyIdentifier</code>.
+ * {@code X509Certificate.getExtensionValue(<SubjectKeyIdentifier Object
+ * Identifier>)} on the issuer's certificate may NOT be used
+ * directly as the input to {@code setAuthorityKeyIdentifier}.
* This is because the SubjectKeyIdentifier contains
* only a KeyIdentifier OCTET STRING, and not a SEQUENCE of
* KeyIdentifier, GeneralNames, and CertificateSerialNumber.
* In order to use the extension value of the issuer certificate's
- * <code>SubjectKeyIdentifier</code>
+ * {@code SubjectKeyIdentifier}
* extension, it will be necessary to extract the value of the embedded
- * <code>KeyIdentifier</code> OCTET STRING, then DER encode this OCTET
+ * {@code KeyIdentifier} OCTET STRING, then DER encode this OCTET
* STRING inside a SEQUENCE.
* For more details on SubjectKeyIdentifier, see
* {@link #setSubjectKeyIdentifier(byte[] subjectKeyID)}.
@@ -435,7 +435,7 @@
* subsequent modifications.
*
* @param authorityKeyID the authority key identifier
- * (or <code>null</code>)
+ * (or {@code null})
* @see #getAuthorityKeyIdentifier
*/
public void setAuthorityKeyIdentifier(byte[] authorityKeyID) {
@@ -449,13 +449,13 @@
/**
* Sets the certificateValid criterion. The specified date must fall
* within the certificate validity period for the
- * <code>X509Certificate</code>. If <code>null</code>, no certificateValid
+ * {@code X509Certificate}. If {@code null}, no certificateValid
* check will be done.
* <p>
- * Note that the <code>Date</code> supplied here is cloned to protect
+ * Note that the {@code Date} supplied here is cloned to protect
* against subsequent modifications.
*
- * @param certValid the <code>Date</code> to check (or <code>null</code>)
+ * @param certValid the {@code Date} to check (or {@code null})
* @see #getCertificateValid
*/
public void setCertificateValid(Date certValid) {
@@ -469,14 +469,14 @@
/**
* Sets the privateKeyValid criterion. The specified date must fall
* within the private key validity period for the
- * <code>X509Certificate</code>. If <code>null</code>, no privateKeyValid
+ * {@code X509Certificate}. If {@code null}, no privateKeyValid
* check will be done.
* <p>
- * Note that the <code>Date</code> supplied here is cloned to protect
+ * Note that the {@code Date} supplied here is cloned to protect
* against subsequent modifications.
*
- * @param privateKeyValid the <code>Date</code> to check (or
- * <code>null</code>)
+ * @param privateKeyValid the {@code Date} to check (or
+ * {@code null})
* @see #getPrivateKeyValid
*/
public void setPrivateKeyValid(Date privateKeyValid) {
@@ -489,12 +489,12 @@
/**
* Sets the subjectPublicKeyAlgID criterion. The
- * <code>X509Certificate</code> must contain a subject public key
- * with the specified algorithm. If <code>null</code>, no
+ * {@code X509Certificate} must contain a subject public key
+ * with the specified algorithm. If {@code null}, no
* subjectPublicKeyAlgID check will be done.
*
* @param oid The object identifier (OID) of the algorithm to check
- * for (or <code>null</code>). An OID is represented by a
+ * for (or {@code null}). An OID is represented by a
* set of nonnegative integers separated by periods.
* @throws IOException if the OID is invalid, such as
* the first component being not 0, 1 or 2 or the second component
@@ -512,10 +512,10 @@
/**
* Sets the subjectPublicKey criterion. The
- * <code>X509Certificate</code> must contain the specified subject public
- * key. If <code>null</code>, no subjectPublicKey check will be done.
+ * {@code X509Certificate} must contain the specified subject public
+ * key. If {@code null}, no subjectPublicKey check will be done.
*
- * @param key the subject public key to check for (or <code>null</code>)
+ * @param key the subject public key to check for (or {@code null})
* @see #getSubjectPublicKey
*/
public void setSubjectPublicKey(PublicKey key) {
@@ -529,17 +529,17 @@
}
/**
- * Sets the subjectPublicKey criterion. The <code>X509Certificate</code>
- * must contain the specified subject public key. If <code>null</code>,
+ * Sets the subjectPublicKey criterion. The {@code X509Certificate}
+ * must contain the specified subject public key. If {@code null},
* no subjectPublicKey check will be done.
* <p>
* Because this method allows the public key to be specified as a byte
* array, it may be used for unknown key types.
* <p>
- * If <code>key</code> is not <code>null</code>, it should contain a
+ * If {@code key} is not {@code null}, it should contain a
* single DER encoded SubjectPublicKeyInfo structure, as defined in X.509.
* The ASN.1 notation for this structure is as follows.
- * <pre><code>
+ * <pre>{@code
* SubjectPublicKeyInfo ::= SEQUENCE {
* algorithm AlgorithmIdentifier,
* subjectPublicKey BIT STRING }
@@ -550,13 +550,13 @@
* -- contains a value of the type
* -- registered for use with the
* -- algorithm object identifier value
- * </code></pre>
+ * }</pre>
* <p>
* Note that the byte array supplied here is cloned to protect against
* subsequent modifications.
*
* @param key a byte array containing the subject public key in ASN.1 DER
- * form (or <code>null</code>)
+ * form (or {@code null})
* @throws IOException if an encoding error occurs (incorrect form for
* subject public key)
* @see #getSubjectPublicKey
@@ -572,9 +572,9 @@
}
/**
- * Sets the keyUsage criterion. The <code>X509Certificate</code>
- * must allow the specified keyUsage values. If <code>null</code>, no
- * keyUsage check will be done. Note that an <code>X509Certificate</code>
+ * Sets the keyUsage criterion. The {@code X509Certificate}
+ * must allow the specified keyUsage values. If {@code null}, no
+ * keyUsage check will be done. Note that an {@code X509Certificate}
* that has no keyUsage extension implicitly allows all keyUsage values.
* <p>
* Note that the boolean array supplied here is cloned to protect against
@@ -583,7 +583,7 @@
* @param keyUsage a boolean array in the same format as the boolean
* array returned by
* {@link X509Certificate#getKeyUsage() X509Certificate.getKeyUsage()}.
- * Or <code>null</code>.
+ * Or {@code null}.
* @see #getKeyUsage
*/
public void setKeyUsage(boolean[] keyUsage) {
@@ -595,18 +595,18 @@
}
/**
- * Sets the extendedKeyUsage criterion. The <code>X509Certificate</code>
+ * Sets the extendedKeyUsage criterion. The {@code X509Certificate}
* must allow the specified key purposes in its extended key usage
- * extension. If <code>keyPurposeSet</code> is empty or <code>null</code>,
+ * extension. If {@code keyPurposeSet} is empty or {@code null},
* no extendedKeyUsage check will be done. Note that an
- * <code>X509Certificate</code> that has no extendedKeyUsage extension
+ * {@code X509Certificate} that has no extendedKeyUsage extension
* implicitly allows all key purposes.
* <p>
- * Note that the <code>Set</code> is cloned to protect against
+ * Note that the {@code Set} is cloned to protect against
* subsequent modifications.
*
- * @param keyPurposeSet a <code>Set</code> of key purpose OIDs in string
- * format (or <code>null</code>). Each OID is represented by a set of
+ * @param keyPurposeSet a {@code Set} of key purpose OIDs in string
+ * format (or {@code null}). Each OID is represented by a set of
* nonnegative integers separated by periods.
* @throws IOException if the OID is invalid, such as
* the first component being not 0, 1 or 2 or the second component
@@ -632,15 +632,15 @@
* specified in the {@link #setSubjectAlternativeNames
* setSubjectAlternativeNames} or {@link #addSubjectAlternativeName
* addSubjectAlternativeName} methods. If enabled,
- * the <code>X509Certificate</code> must contain all of the
+ * the {@code X509Certificate} must contain all of the
* specified subject alternative names. If disabled, the
- * <code>X509Certificate</code> must contain at least one of the
+ * {@code X509Certificate} must contain at least one of the
* specified subject alternative names.
*
- * <p>The matchAllNames flag is <code>true</code> by default.
+ * <p>The matchAllNames flag is {@code true} by default.
*
- * @param matchAllNames if <code>true</code>, the flag is enabled;
- * if <code>false</code>, the flag is disabled.
+ * @param matchAllNames if {@code true}, the flag is enabled;
+ * if {@code false}, the flag is disabled.
* @see #getMatchAllSubjectAltNames
*/
public void setMatchAllSubjectAltNames(boolean matchAllNames) {
@@ -649,7 +649,7 @@
/**
* Sets the subjectAlternativeNames criterion. The
- * <code>X509Certificate</code> must contain all or at least one of the
+ * {@code X509Certificate} must contain all or at least one of the
* specified subjectAlternativeNames, depending on the value of
* the matchAllNames flag (see {@link #setMatchAllSubjectAltNames
* setMatchAllSubjectAltNames}).
@@ -659,19 +659,19 @@
* subjectAlternativeNames criterion. The specified value replaces
* the previous value for the subjectAlternativeNames criterion.
* <p>
- * The <code>names</code> parameter (if not <code>null</code>) is a
- * <code>Collection</code> with one
+ * The {@code names} parameter (if not {@code null}) is a
+ * {@code Collection} with one
* entry for each name to be included in the subject alternative name
- * criterion. Each entry is a <code>List</code> whose first entry is an
- * <code>Integer</code> (the name type, 0-8) and whose second
- * entry is a <code>String</code> or a byte array (the name, in
+ * criterion. Each entry is a {@code List} whose first entry is an
+ * {@code Integer} (the name type, 0-8) and whose second
+ * entry is a {@code String} or a byte array (the name, in
* string or ASN.1 DER encoded form, respectively).
- * There can be multiple names of the same type. If <code>null</code>
+ * There can be multiple names of the same type. If {@code null}
* is supplied as the value for this argument, no
* subjectAlternativeNames check will be performed.
* <p>
- * Each subject alternative name in the <code>Collection</code>
- * may be specified either as a <code>String</code> or as an ASN.1 encoded
+ * Each subject alternative name in the {@code Collection}
+ * may be specified either as a {@code String} or as an ASN.1 encoded
* byte array. For more details about the formats used, see
* {@link #addSubjectAlternativeName(int type, String name)
* addSubjectAlternativeName(int type, String name)} and
@@ -682,15 +682,15 @@
* array form instead of the String form. See the note in
* {@link #addSubjectAlternativeName(int, String)} for more information.
* <p>
- * Note that the <code>names</code> parameter can contain duplicate
+ * Note that the {@code names} parameter can contain duplicate
* names (same name and name type), but they may be removed from the
- * <code>Collection</code> of names returned by the
+ * {@code Collection} of names returned by the
* {@link #getSubjectAlternativeNames getSubjectAlternativeNames} method.
* <p>
- * Note that a deep copy is performed on the <code>Collection</code> to
+ * Note that a deep copy is performed on the {@code Collection} to
* protect against subsequent modifications.
*
- * @param names a <code>Collection</code> of names (or <code>null</code>)
+ * @param names a {@code Collection} of names (or {@code null})
* @throws IOException if a parsing error occurs
* @see #getSubjectAlternativeNames
*/
@@ -714,7 +714,7 @@
/**
* Adds a name to the subjectAlternativeNames criterion. The
- * <code>X509Certificate</code> must contain all or at least one
+ * {@code X509Certificate} must contain all or at least one
* of the specified subjectAlternativeNames, depending on the value of
* the matchAllNames flag (see {@link #setMatchAllSubjectAltNames
* setMatchAllSubjectAltNames}).
@@ -747,7 +747,7 @@
*
* @param type the name type (0-8, as specified in
* RFC 3280, section 4.2.1.7)
- * @param name the name in string form (not <code>null</code>)
+ * @param name the name in string form (not {@code null})
* @throws IOException if a parsing error occurs
*/
public void addSubjectAlternativeName(int type, String name)
@@ -757,7 +757,7 @@
/**
* Adds a name to the subjectAlternativeNames criterion. The
- * <code>X509Certificate</code> must contain all or at least one
+ * {@code X509Certificate} must contain all or at least one
* of the specified subjectAlternativeNames, depending on the value of
* the matchAllNames flag (see {@link #setMatchAllSubjectAltNames
* setMatchAllSubjectAltNames}).
@@ -774,7 +774,7 @@
* the encoded value of the name, and should not include the tag associated
* with the name in the GeneralName structure. The ASN.1 definition of this
* structure appears below.
- * <pre><code>
+ * <pre>{@code
* GeneralName ::= CHOICE {
* otherName [0] OtherName,
* rfc822Name [1] IA5String,
@@ -785,7 +785,7 @@
* uniformResourceIdentifier [6] IA5String,
* iPAddress [7] OCTET STRING,
* registeredID [8] OBJECT IDENTIFIER}
- * </code></pre>
+ * }</pre>
* <p>
* Note that the byte array supplied here is cloned to protect against
* subsequent modifications.
@@ -802,7 +802,7 @@
/**
* A private method that adds a name (String or byte array) to the
- * subjectAlternativeNames criterion. The <code>X509Certificate</code>
+ * subjectAlternativeNames criterion. The {@code X509Certificate}
* must contain the specified subjectAlternativeName.
*
* @param type the name type (0-8, as specified in
@@ -829,19 +829,19 @@
/**
* Parse an argument of the form passed to setSubjectAlternativeNames,
- * returning a <code>Collection</code> of
- * <code>GeneralNameInterface</code>s.
+ * returning a {@code Collection} of
+ * {@code GeneralNameInterface}s.
* Throw an IllegalArgumentException or a ClassCastException
* if the argument is malformed.
*
* @param names a Collection with one entry per name.
- * Each entry is a <code>List</code> whose first entry
+ * Each entry is a {@code List} whose first entry
* is an Integer (the name type, 0-8) and whose second
* entry is a String or a byte array (the name, in
* string or ASN.1 DER encoded form, respectively).
* There can be multiple names of the same type. Null is
* not an acceptable value.
- * @return a Set of <code>GeneralNameInterface</code>s
+ * @return a Set of {@code GeneralNameInterface}s
* @throws IOException if a parsing error occurs
*/
private static Set<GeneralNameInterface> parseNames(Collection<List<?>> names) throws IOException {
@@ -865,8 +865,8 @@
/**
* Compare for equality two objects of the form passed to
* setSubjectAlternativeNames (or X509CRLSelector.setIssuerNames).
- * Throw an <code>IllegalArgumentException</code> or a
- * <code>ClassCastException</code> if one of the objects is malformed.
+ * Throw an {@code IllegalArgumentException} or a
+ * {@code ClassCastException} if one of the objects is malformed.
*
* @param object1 a Collection containing the first object to compare
* @param object2 a Collection containing the second object to compare
@@ -880,7 +880,7 @@
}
/**
- * Make a <code>GeneralNameInterface</code> out of a name type (0-8) and an
+ * Make a {@code GeneralNameInterface} out of a name type (0-8) and an
* Object that may be a byte array holding the ASN.1 DER encoded
* name or a String form of the name. Except for X.509
* Distinguished Names, the String form of the name must not be the
@@ -989,7 +989,7 @@
/**
- * Sets the name constraints criterion. The <code>X509Certificate</code>
+ * Sets the name constraints criterion. The {@code X509Certificate}
* must have subject and subject alternative names that
* meet the specified name constraints.
* <p>
@@ -998,7 +998,7 @@
* would appear in the NameConstraints structure defined in RFC 3280
* and X.509. The ASN.1 definition of this structure appears below.
*
- * <pre><code>
+ * <pre>{@code
* NameConstraints ::= SEQUENCE {
* permittedSubtrees [0] GeneralSubtrees OPTIONAL,
* excludedSubtrees [1] GeneralSubtrees OPTIONAL }
@@ -1022,7 +1022,7 @@
* uniformResourceIdentifier [6] IA5String,
* iPAddress [7] OCTET STRING,
* registeredID [8] OBJECT IDENTIFIER}
- * </code></pre>
+ * }</pre>
* <p>
* Note that the byte array supplied here is cloned to protect against
* subsequent modifications.
@@ -1031,7 +1031,7 @@
* a NameConstraints extension to be used for checking
* name constraints. Only the value of the extension is
* included, not the OID or criticality flag. Can be
- * <code>null</code>,
+ * {@code null},
* in which case no name constraints check will be performed.
* @throws IOException if a parsing error occurs
* @see #getNameConstraints
@@ -1048,7 +1048,7 @@
/**
* Sets the basic constraints constraint. If the value is greater than or
- * equal to zero, <code>X509Certificates</code> must include a
+ * equal to zero, {@code X509Certificates} must include a
* basicConstraints extension with
* a pathLen of at least this value. If the value is -2, only end-entity
* certificates are accepted. If the value is -1, no check is done.
@@ -1070,18 +1070,18 @@
}
/**
- * Sets the policy constraint. The <code>X509Certificate</code> must
+ * Sets the policy constraint. The {@code X509Certificate} must
* include at least one of the specified policies in its certificate
- * policies extension. If <code>certPolicySet</code> is empty, then the
- * <code>X509Certificate</code> must include at least some specified policy
- * in its certificate policies extension. If <code>certPolicySet</code> is
- * <code>null</code>, no policy check will be performed.
+ * policies extension. If {@code certPolicySet} is empty, then the
+ * {@code X509Certificate} must include at least some specified policy
+ * in its certificate policies extension. If {@code certPolicySet} is
+ * {@code null}, no policy check will be performed.
* <p>
- * Note that the <code>Set</code> is cloned to protect against
+ * Note that the {@code Set} is cloned to protect against
* subsequent modifications.
*
- * @param certPolicySet a <code>Set</code> of certificate policy OIDs in
- * string format (or <code>null</code>). Each OID is
+ * @param certPolicySet a {@code Set} of certificate policy OIDs in
+ * string format (or {@code null}). Each OID is
* represented by a set of nonnegative integers
* separated by periods.
* @throws IOException if a parsing error occurs on the OID such as
@@ -1115,12 +1115,12 @@
}
/**
- * Sets the pathToNames criterion. The <code>X509Certificate</code> must
+ * Sets the pathToNames criterion. The {@code X509Certificate} must
* not include name constraints that would prohibit building a
* path to the specified names.
* <p>
* This method allows the caller to specify, with a single method call,
- * the complete set of names which the <code>X509Certificates</code>'s
+ * the complete set of names which the {@code X509Certificates}'s
* name constraints must permit. The specified value replaces
* the previous value for the pathToNames criterion.
* <p>
@@ -1129,19 +1129,19 @@
* built, any candidate certificate must not include name constraints that
* would prohibit building a path to any of the names in the partial path.
* <p>
- * The <code>names</code> parameter (if not <code>null</code>) is a
- * <code>Collection</code> with one
+ * The {@code names} parameter (if not {@code null}) is a
+ * {@code Collection} with one
* entry for each name to be included in the pathToNames
- * criterion. Each entry is a <code>List</code> whose first entry is an
- * <code>Integer</code> (the name type, 0-8) and whose second
- * entry is a <code>String</code> or a byte array (the name, in
+ * criterion. Each entry is a {@code List} whose first entry is an
+ * {@code Integer} (the name type, 0-8) and whose second
+ * entry is a {@code String} or a byte array (the name, in
* string or ASN.1 DER encoded form, respectively).
- * There can be multiple names of the same type. If <code>null</code>
+ * There can be multiple names of the same type. If {@code null}
* is supplied as the value for this argument, no
* pathToNames check will be performed.
* <p>
- * Each name in the <code>Collection</code>
- * may be specified either as a <code>String</code> or as an ASN.1 encoded
+ * Each name in the {@code Collection}
+ * may be specified either as a {@code String} or as an ASN.1 encoded
* byte array. For more details about the formats used, see
* {@link #addPathToName(int type, String name)
* addPathToName(int type, String name)} and
@@ -1152,16 +1152,16 @@
* array form instead of the String form. See the note in
* {@link #addPathToName(int, String)} for more information.
* <p>
- * Note that the <code>names</code> parameter can contain duplicate
+ * Note that the {@code names} parameter can contain duplicate
* names (same name and name type), but they may be removed from the
- * <code>Collection</code> of names returned by the
+ * {@code Collection} of names returned by the
* {@link #getPathToNames getPathToNames} method.
* <p>
- * Note that a deep copy is performed on the <code>Collection</code> to
+ * Note that a deep copy is performed on the {@code Collection} to
* protect against subsequent modifications.
*
- * @param names a <code>Collection</code> with one entry per name
- * (or <code>null</code>)
+ * @param names a {@code Collection} with one entry per name
+ * (or {@code null})
* @throws IOException if a parsing error occurs
* @see #getPathToNames
*/
@@ -1186,12 +1186,12 @@
}
/**
- * Adds a name to the pathToNames criterion. The <code>X509Certificate</code>
+ * Adds a name to the pathToNames criterion. The {@code X509Certificate}
* must not include name constraints that would prohibit building a
* path to the specified name.
* <p>
* This method allows the caller to add a name to the set of names which
- * the <code>X509Certificates</code>'s name constraints must permit.
+ * the {@code X509Certificates}'s name constraints must permit.
* The specified name is added to any previous value for the
* pathToNames criterion. If the name is a duplicate, it may be ignored.
* <p>
@@ -1223,12 +1223,12 @@
}
/**
- * Adds a name to the pathToNames criterion. The <code>X509Certificate</code>
+ * Adds a name to the pathToNames criterion. The {@code X509Certificate}
* must not include name constraints that would prohibit building a
* path to the specified name.
* <p>
* This method allows the caller to add a name to the set of names which
- * the <code>X509Certificates</code>'s name constraints must permit.
+ * the {@code X509Certificates}'s name constraints must permit.
* The specified name is added to any previous value for the
* pathToNames criterion. If the name is a duplicate, it may be ignored.
* <p>
@@ -1254,7 +1254,7 @@
/**
* A private method that adds a name (String or byte array) to the
- * pathToNames criterion. The <code>X509Certificate</code> must contain
+ * pathToNames criterion. The {@code X509Certificate} must contain
* the specified pathToName.
*
* @param type the name type (0-8, as specified in
@@ -1279,11 +1279,11 @@
/**
* Returns the certificateEquals criterion. The specified
- * <code>X509Certificate</code> must be equal to the
- * <code>X509Certificate</code> passed to the <code>match</code> method.
- * If <code>null</code>, this check is not applied.
+ * {@code X509Certificate} must be equal to the
+ * {@code X509Certificate} passed to the {@code match} method.
+ * If {@code null}, this check is not applied.
*
- * @return the <code>X509Certificate</code> to match (or <code>null</code>)
+ * @return the {@code X509Certificate} to match (or {@code null})
* @see #setCertificate
*/
public X509Certificate getCertificate() {
@@ -1293,11 +1293,11 @@
/**
* Returns the serialNumber criterion. The specified serial number
* must match the certificate serial number in the
- * <code>X509Certificate</code>. If <code>null</code>, any certificate
+ * {@code X509Certificate}. If {@code null}, any certificate
* serial number will do.
*
* @return the certificate serial number to match
- * (or <code>null</code>)
+ * (or {@code null})
* @see #setSerialNumber
*/
public BigInteger getSerialNumber() {
@@ -1305,13 +1305,13 @@
}
/**
- * Returns the issuer criterion as an <code>X500Principal</code>. This
+ * Returns the issuer criterion as an {@code X500Principal}. This
* distinguished name must match the issuer distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code>, the issuer criterion
+ * {@code X509Certificate}. If {@code null}, the issuer criterion
* is disabled and any issuer distinguished name will do.
*
* @return the required issuer distinguished name as X500Principal
- * (or <code>null</code>)
+ * (or {@code null})
* @since 1.5
*/
public X500Principal getIssuer() {
@@ -1325,16 +1325,16 @@
* encoding information in the RFC 2253 String form of some distinguished
* names.
* <p>
- * Returns the issuer criterion as a <code>String</code>. This
+ * Returns the issuer criterion as a {@code String}. This
* distinguished name must match the issuer distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code>, the issuer criterion
+ * {@code X509Certificate}. If {@code null}, the issuer criterion
* is disabled and any issuer distinguished name will do.
* <p>
- * If the value returned is not <code>null</code>, it is a
+ * If the value returned is not {@code null}, it is a
* distinguished name, in RFC 2253 format.
*
* @return the required issuer distinguished name in RFC 2253 format
- * (or <code>null</code>)
+ * (or {@code null})
*/
public String getIssuerAsString() {
return (issuer == null ? null : issuer.getName());
@@ -1343,10 +1343,10 @@
/**
* Returns the issuer criterion as a byte array. This distinguished name
* must match the issuer distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code>, the issuer criterion
+ * {@code X509Certificate}. If {@code null}, the issuer criterion
* is disabled and any issuer distinguished name will do.
* <p>
- * If the value returned is not <code>null</code>, it is a byte
+ * If the value returned is not {@code null}, it is a byte
* array containing a single DER encoded distinguished name, as defined in
* X.501. The ASN.1 notation for this structure is supplied in the
* documentation for
@@ -1356,7 +1356,7 @@
* subsequent modifications.
*
* @return a byte array containing the required issuer distinguished name
- * in ASN.1 DER format (or <code>null</code>)
+ * in ASN.1 DER format (or {@code null})
* @throws IOException if an encoding error occurs
*/
public byte[] getIssuerAsBytes() throws IOException {
@@ -1364,13 +1364,13 @@
}
/**
- * Returns the subject criterion as an <code>X500Principal</code>. This
+ * Returns the subject criterion as an {@code X500Principal}. This
* distinguished name must match the subject distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code>, the subject criterion
+ * {@code X509Certificate}. If {@code null}, the subject criterion
* is disabled and any subject distinguished name will do.
*
* @return the required subject distinguished name as X500Principal
- * (or <code>null</code>)
+ * (or {@code null})
* @since 1.5
*/
public X500Principal getSubject() {
@@ -1384,16 +1384,16 @@
* encoding information in the RFC 2253 String form of some distinguished
* names.
* <p>
- * Returns the subject criterion as a <code>String</code>. This
+ * Returns the subject criterion as a {@code String}. This
* distinguished name must match the subject distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code>, the subject criterion
+ * {@code X509Certificate}. If {@code null}, the subject criterion
* is disabled and any subject distinguished name will do.
* <p>
- * If the value returned is not <code>null</code>, it is a
+ * If the value returned is not {@code null}, it is a
* distinguished name, in RFC 2253 format.
*
* @return the required subject distinguished name in RFC 2253 format
- * (or <code>null</code>)
+ * (or {@code null})
*/
public String getSubjectAsString() {
return (subject == null ? null : subject.getName());
@@ -1402,10 +1402,10 @@
/**
* Returns the subject criterion as a byte array. This distinguished name
* must match the subject distinguished name in the
- * <code>X509Certificate</code>. If <code>null</code>, the subject criterion
+ * {@code X509Certificate}. If {@code null}, the subject criterion
* is disabled and any subject distinguished name will do.
* <p>
- * If the value returned is not <code>null</code>, it is a byte
+ * If the value returned is not {@code null}, it is a byte
* array containing a single DER encoded distinguished name, as defined in
* X.501. The ASN.1 notation for this structure is supplied in the
* documentation for
@@ -1415,7 +1415,7 @@
* subsequent modifications.
*
* @return a byte array containing the required subject distinguished name
- * in ASN.1 DER format (or <code>null</code>)
+ * in ASN.1 DER format (or {@code null})
* @throws IOException if an encoding error occurs
*/
public byte[] getSubjectAsBytes() throws IOException {
@@ -1424,14 +1424,14 @@
/**
* Returns the subjectKeyIdentifier criterion. The
- * <code>X509Certificate</code> must contain a SubjectKeyIdentifier
- * extension with the specified value. If <code>null</code>, no
+ * {@code X509Certificate} must contain a SubjectKeyIdentifier
+ * extension with the specified value. If {@code null}, no
* subjectKeyIdentifier check will be done.
* <p>
* Note that the byte array returned is cloned to protect against
* subsequent modifications.
*
- * @return the key identifier (or <code>null</code>)
+ * @return the key identifier (or {@code null})
* @see #setSubjectKeyIdentifier
*/
public byte[] getSubjectKeyIdentifier() {
@@ -1443,14 +1443,14 @@
/**
* Returns the authorityKeyIdentifier criterion. The
- * <code>X509Certificate</code> must contain a AuthorityKeyIdentifier
- * extension with the specified value. If <code>null</code>, no
+ * {@code X509Certificate} must contain a AuthorityKeyIdentifier
+ * extension with the specified value. If {@code null}, no
* authorityKeyIdentifier check will be done.
* <p>
* Note that the byte array returned is cloned to protect against
* subsequent modifications.
*
- * @return the key identifier (or <code>null</code>)
+ * @return the key identifier (or {@code null})
* @see #setAuthorityKeyIdentifier
*/
public byte[] getAuthorityKeyIdentifier() {
@@ -1463,13 +1463,13 @@
/**
* Returns the certificateValid criterion. The specified date must fall
* within the certificate validity period for the
- * <code>X509Certificate</code>. If <code>null</code>, no certificateValid
+ * {@code X509Certificate}. If {@code null}, no certificateValid
* check will be done.
* <p>
- * Note that the <code>Date</code> returned is cloned to protect against
+ * Note that the {@code Date} returned is cloned to protect against
* subsequent modifications.
*
- * @return the <code>Date</code> to check (or <code>null</code>)
+ * @return the {@code Date} to check (or {@code null})
* @see #setCertificateValid
*/
public Date getCertificateValid() {
@@ -1482,13 +1482,13 @@
/**
* Returns the privateKeyValid criterion. The specified date must fall
* within the private key validity period for the
- * <code>X509Certificate</code>. If <code>null</code>, no privateKeyValid
+ * {@code X509Certificate}. If {@code null}, no privateKeyValid
* check will be done.
* <p>
- * Note that the <code>Date</code> returned is cloned to protect against
+ * Note that the {@code Date} returned is cloned to protect against
* subsequent modifications.
*
- * @return the <code>Date</code> to check (or <code>null</code>)
+ * @return the {@code Date} to check (or {@code null})
* @see #setPrivateKeyValid
*/
public Date getPrivateKeyValid() {
@@ -1500,12 +1500,12 @@
/**
* Returns the subjectPublicKeyAlgID criterion. The
- * <code>X509Certificate</code> must contain a subject public key
- * with the specified algorithm. If <code>null</code>, no
+ * {@code X509Certificate} must contain a subject public key
+ * with the specified algorithm. If {@code null}, no
* subjectPublicKeyAlgID check will be done.
*
* @return the object identifier (OID) of the signature algorithm to check
- * for (or <code>null</code>). An OID is represented by a set of
+ * for (or {@code null}). An OID is represented by a set of
* nonnegative integers separated by periods.
* @see #setSubjectPublicKeyAlgID
*/
@@ -1518,10 +1518,10 @@
/**
* Returns the subjectPublicKey criterion. The
- * <code>X509Certificate</code> must contain the specified subject
- * public key. If <code>null</code>, no subjectPublicKey check will be done.
+ * {@code X509Certificate} must contain the specified subject
+ * public key. If {@code null}, no subjectPublicKey check will be done.
*
- * @return the subject public key to check for (or <code>null</code>)
+ * @return the subject public key to check for (or {@code null})
* @see #setSubjectPublicKey
*/
public PublicKey getSubjectPublicKey() {
@@ -1529,7 +1529,7 @@
}
/**
- * Returns the keyUsage criterion. The <code>X509Certificate</code>
+ * Returns the keyUsage criterion. The {@code X509Certificate}
* must allow the specified keyUsage values. If null, no keyUsage
* check will be done.
* <p>
@@ -1539,7 +1539,7 @@
* @return a boolean array in the same format as the boolean
* array returned by
* {@link X509Certificate#getKeyUsage() X509Certificate.getKeyUsage()}.
- * Or <code>null</code>.
+ * Or {@code null}.
* @see #setKeyUsage
*/
public boolean[] getKeyUsage() {
@@ -1550,15 +1550,15 @@
}
/**
- * Returns the extendedKeyUsage criterion. The <code>X509Certificate</code>
+ * Returns the extendedKeyUsage criterion. The {@code X509Certificate}
* must allow the specified key purposes in its extended key usage
- * extension. If the <code>keyPurposeSet</code> returned is empty or
- * <code>null</code>, no extendedKeyUsage check will be done. Note that an
- * <code>X509Certificate</code> that has no extendedKeyUsage extension
+ * extension. If the {@code keyPurposeSet} returned is empty or
+ * {@code null}, no extendedKeyUsage check will be done. Note that an
+ * {@code X509Certificate} that has no extendedKeyUsage extension
* implicitly allows all key purposes.
*
- * @return an immutable <code>Set</code> of key purpose OIDs in string
- * format (or <code>null</code>)
+ * @return an immutable {@code Set} of key purpose OIDs in string
+ * format (or {@code null})
* @see #setExtendedKeyUsage
*/
public Set<String> getExtendedKeyUsage() {
@@ -1566,19 +1566,19 @@
}
/**
- * Indicates if the <code>X509Certificate</code> must contain all
+ * Indicates if the {@code X509Certificate} must contain all
* or at least one of the subjectAlternativeNames
* specified in the {@link #setSubjectAlternativeNames
* setSubjectAlternativeNames} or {@link #addSubjectAlternativeName
- * addSubjectAlternativeName} methods. If <code>true</code>,
- * the <code>X509Certificate</code> must contain all of the
- * specified subject alternative names. If <code>false</code>, the
- * <code>X509Certificate</code> must contain at least one of the
+ * addSubjectAlternativeName} methods. If {@code true},
+ * the {@code X509Certificate} must contain all of the
+ * specified subject alternative names. If {@code false}, the
+ * {@code X509Certificate} must contain at least one of the
* specified subject alternative names.
*
- * @return <code>true</code> if the flag is enabled;
- * <code>false</code> if the flag is disabled. The flag is
- * <code>true</code> by default.
+ * @return {@code true} if the flag is enabled;
+ * {@code false} if the flag is disabled. The flag is
+ * {@code true} by default.
* @see #setMatchAllSubjectAltNames
*/
public boolean getMatchAllSubjectAltNames() {
@@ -1587,35 +1587,35 @@
/**
* Returns a copy of the subjectAlternativeNames criterion.
- * The <code>X509Certificate</code> must contain all or at least one
+ * The {@code X509Certificate} must contain all or at least one
* of the specified subjectAlternativeNames, depending on the value
* of the matchAllNames flag (see {@link #getMatchAllSubjectAltNames
* getMatchAllSubjectAltNames}). If the value returned is
- * <code>null</code>, no subjectAlternativeNames check will be performed.
+ * {@code null}, no subjectAlternativeNames check will be performed.
* <p>
- * If the value returned is not <code>null</code>, it is a
- * <code>Collection</code> with
+ * If the value returned is not {@code null}, it is a
+ * {@code Collection} with
* one entry for each name to be included in the subject alternative name
- * criterion. Each entry is a <code>List</code> whose first entry is an
- * <code>Integer</code> (the name type, 0-8) and whose second
- * entry is a <code>String</code> or a byte array (the name, in
+ * criterion. Each entry is a {@code List} whose first entry is an
+ * {@code Integer} (the name type, 0-8) and whose second
+ * entry is a {@code String} or a byte array (the name, in
* string or ASN.1 DER encoded form, respectively).
* There can be multiple names of the same type. Note that the
- * <code>Collection</code> returned may contain duplicate names (same name
+ * {@code Collection} returned may contain duplicate names (same name
* and name type).
* <p>
- * Each subject alternative name in the <code>Collection</code>
- * may be specified either as a <code>String</code> or as an ASN.1 encoded
+ * Each subject alternative name in the {@code Collection}
+ * may be specified either as a {@code String} or as an ASN.1 encoded
* byte array. For more details about the formats used, see
* {@link #addSubjectAlternativeName(int type, String name)
* addSubjectAlternativeName(int type, String name)} and
* {@link #addSubjectAlternativeName(int type, byte [] name)
* addSubjectAlternativeName(int type, byte [] name)}.
* <p>
- * Note that a deep copy is performed on the <code>Collection</code> to
+ * Note that a deep copy is performed on the {@code Collection} to
* protect against subsequent modifications.
*
- * @return a <code>Collection</code> of names (or <code>null</code>)
+ * @return a {@code Collection} of names (or {@code null})
* @see #setSubjectAlternativeNames
*/
public Collection<List<?>> getSubjectAlternativeNames() {
@@ -1628,21 +1628,21 @@
/**
* Clone an object of the form passed to
* setSubjectAlternativeNames and setPathToNames.
- * Throw a <code>RuntimeException</code> if the argument is malformed.
+ * Throw a {@code RuntimeException} if the argument is malformed.
* <p>
* This method wraps cloneAndCheckNames, changing any
- * <code>IOException</code> into a <code>RuntimeException</code>. This
+ * {@code IOException} into a {@code RuntimeException}. This
* method should be used when the object being
* cloned has already been checked, so there should never be any exceptions.
*
- * @param names a <code>Collection</code> with one entry per name.
- * Each entry is a <code>List</code> whose first entry
+ * @param names a {@code Collection} with one entry per name.
+ * Each entry is a {@code List} whose first entry
* is an Integer (the name type, 0-8) and whose second
* entry is a String or a byte array (the name, in
* string or ASN.1 DER encoded form, respectively).
* There can be multiple names of the same type. Null
* is not an acceptable value.
- * @return a deep copy of the specified <code>Collection</code>
+ * @return a deep copy of the specified {@code Collection}
* @throws RuntimeException if a parsing error occurs
*/
private static Set<List<?>> cloneNames(Collection<List<?>> names) {
@@ -1657,16 +1657,16 @@
/**
* Clone and check an argument of the form passed to
* setSubjectAlternativeNames and setPathToNames.
- * Throw an <code>IOException</code> if the argument is malformed.
+ * Throw an {@code IOException} if the argument is malformed.
*
- * @param names a <code>Collection</code> with one entry per name.
- * Each entry is a <code>List</code> whose first entry
+ * @param names a {@code Collection} with one entry per name.
+ * Each entry is a {@code List} whose first entry
* is an Integer (the name type, 0-8) and whose second
* entry is a String or a byte array (the name, in
* string or ASN.1 DER encoded form, respectively).
* There can be multiple names of the same type.
- * <code>null</code> is not an acceptable value.
- * @return a deep copy of the specified <code>Collection</code>
+ * {@code null} is not an acceptable value.
+ * @return a deep copy of the specified {@code Collection}
* @throws IOException if a parsing error occurs
*/
private static Set<List<?>> cloneAndCheckNames(Collection<List<?>> names) throws IOException {
@@ -1709,7 +1709,7 @@
}
/**
- * Returns the name constraints criterion. The <code>X509Certificate</code>
+ * Returns the name constraints criterion. The {@code X509Certificate}
* must have subject and subject alternative names that
* meet the specified name constraints.
* <p>
@@ -1725,7 +1725,7 @@
*
* @return a byte array containing the ASN.1 DER encoding of
* a NameConstraints extension used for checking name constraints.
- * <code>null</code> if no name constraints check will be performed.
+ * {@code null} if no name constraints check will be performed.
* @see #setNameConstraints
*/
public byte[] getNameConstraints() {
@@ -1738,7 +1738,7 @@
/**
* Returns the basic constraints constraint. If the value is greater than
- * or equal to zero, the <code>X509Certificates</code> must include a
+ * or equal to zero, the {@code X509Certificates} must include a
* basicConstraints extension with a pathLen of at least this value.
* If the value is -2, only end-entity certificates are accepted. If
* the value is -1, no basicConstraints check is done.
@@ -1751,15 +1751,15 @@
}
/**
- * Returns the policy criterion. The <code>X509Certificate</code> must
+ * Returns the policy criterion. The {@code X509Certificate} must
* include at least one of the specified policies in its certificate policies
- * extension. If the <code>Set</code> returned is empty, then the
- * <code>X509Certificate</code> must include at least some specified policy
- * in its certificate policies extension. If the <code>Set</code> returned is
- * <code>null</code>, no policy check will be performed.
+ * extension. If the {@code Set} returned is empty, then the
+ * {@code X509Certificate} must include at least some specified policy
+ * in its certificate policies extension. If the {@code Set} returned is
+ * {@code null}, no policy check will be performed.
*
- * @return an immutable <code>Set</code> of certificate policy OIDs in
- * string format (or <code>null</code>)
+ * @return an immutable {@code Set} of certificate policy OIDs in
+ * string format (or {@code null})
* @see #setPolicy
*/
public Set<String> getPolicy() {
@@ -1768,33 +1768,33 @@
/**
* Returns a copy of the pathToNames criterion. The
- * <code>X509Certificate</code> must not include name constraints that would
+ * {@code X509Certificate} must not include name constraints that would
* prohibit building a path to the specified names. If the value
- * returned is <code>null</code>, no pathToNames check will be performed.
+ * returned is {@code null}, no pathToNames check will be performed.
* <p>
- * If the value returned is not <code>null</code>, it is a
- * <code>Collection</code> with one
+ * If the value returned is not {@code null}, it is a
+ * {@code Collection} with one
* entry for each name to be included in the pathToNames
- * criterion. Each entry is a <code>List</code> whose first entry is an
- * <code>Integer</code> (the name type, 0-8) and whose second
- * entry is a <code>String</code> or a byte array (the name, in
+ * criterion. Each entry is a {@code List} whose first entry is an
+ * {@code Integer} (the name type, 0-8) and whose second
+ * entry is a {@code String} or a byte array (the name, in
* string or ASN.1 DER encoded form, respectively).
* There can be multiple names of the same type. Note that the
- * <code>Collection</code> returned may contain duplicate names (same
+ * {@code Collection} returned may contain duplicate names (same
* name and name type).
* <p>
- * Each name in the <code>Collection</code>
- * may be specified either as a <code>String</code> or as an ASN.1 encoded
+ * Each name in the {@code Collection}
+ * may be specified either as a {@code String} or as an ASN.1 encoded
* byte array. For more details about the formats used, see
* {@link #addPathToName(int type, String name)
* addPathToName(int type, String name)} and
* {@link #addPathToName(int type, byte [] name)
* addPathToName(int type, byte [] name)}.
* <p>
- * Note that a deep copy is performed on the <code>Collection</code> to
+ * Note that a deep copy is performed on the {@code Collection} to
* protect against subsequent modifications.
*
- * @return a <code>Collection</code> of names (or <code>null</code>)
+ * @return a {@code Collection} of names (or {@code null})
* @see #setPathToNames
*/
public Collection<List<?>> getPathToNames() {
@@ -1805,10 +1805,10 @@
}
/**
- * Return a printable representation of the <code>CertSelector</code>.
+ * Return a printable representation of the {@code CertSelector}.
*
- * @return a <code>String</code> describing the contents of the
- * <code>CertSelector</code>
+ * @return a {@code String} describing the contents of the
+ * {@code CertSelector}
*/
public String toString() {
StringBuffer sb = new StringBuffer();
@@ -1927,22 +1927,22 @@
/**
* Returns an Extension object given any X509Certificate and extension oid.
- * Throw an <code>IOException</code> if the extension byte value is
+ * Throw an {@code IOException} if the extension byte value is
* malformed.
*
- * @param cert a <code>X509Certificate</code>
- * @param extId an <code>integer</code> which specifies the extension index.
+ * @param cert a {@code X509Certificate}
+ * @param extId an {@code integer} which specifies the extension index.
* Currently, the supported extensions are as follows:
* index 0 - PrivateKeyUsageExtension
* index 1 - SubjectAlternativeNameExtension
* index 2 - NameConstraintsExtension
* index 3 - CertificatePoliciesExtension
* index 4 - ExtendedKeyUsageExtension
- * @return an <code>Extension</code> object whose real type is as specified
+ * @return an {@code Extension} object whose real type is as specified
* by the extension oid.
- * @throws IOException if cannot construct the <code>Extension</code>
+ * @throws IOException if cannot construct the {@code Extension}
* object with the extension encoding retrieved from the passed in
- * <code>X509Certificate</code>.
+ * {@code X509Certificate}.
*/
private static Extension getExtensionObject(X509Certificate cert, int extId)
throws IOException {
@@ -1990,11 +1990,11 @@
}
/**
- * Decides whether a <code>Certificate</code> should be selected.
+ * Decides whether a {@code Certificate} should be selected.
*
- * @param cert the <code>Certificate</code> to be checked
- * @return <code>true</code> if the <code>Certificate</code> should be
- * selected, <code>false</code> otherwise
+ * @param cert the {@code Certificate} to be checked
+ * @return {@code true} if the {@code Certificate} should be
+ * selected, {@code false} otherwise
*/
public boolean match(Certificate cert) {
if (!(cert instanceof X509Certificate)) {
--- a/jdk/src/share/classes/java/security/cert/X509Certificate.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/X509Certificate.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -66,7 +66,7 @@
* <a href="http://www.ietf.org/rfc/rfc3280.txt">RFC 3280: Internet X.509
* Public Key Infrastructure Certificate and CRL Profile</a>.
* <p>
- * The ASN.1 definition of <code>tbsCertificate</code> is:
+ * The ASN.1 definition of {@code tbsCertificate} is:
* <pre>
* TBSCertificate ::= SEQUENCE {
* version [0] EXPLICIT Version DEFAULT v1,
@@ -126,10 +126,12 @@
* is valid. It is defined in
* ASN.1 as:
* <pre>
- * validity Validity<p>
+ * validity Validity
+ *
* Validity ::= SEQUENCE {
* notBefore CertificateValidityDate,
- * notAfter CertificateValidityDate }<p>
+ * notAfter CertificateValidityDate }
+ *
* CertificateValidityDate ::= CHOICE {
* utcTime UTCTime,
* generalTime GeneralizedTime }
@@ -151,9 +153,9 @@
* is valid at that date/time.
*
* @exception CertificateExpiredException if the certificate has expired
- * with respect to the <code>date</code> supplied.
+ * with respect to the {@code date} supplied.
* @exception CertificateNotYetValidException if the certificate is not
- * yet valid with respect to the <code>date</code> supplied.
+ * yet valid with respect to the {@code date} supplied.
*
* @see #checkValidity()
*/
@@ -161,11 +163,12 @@
throws CertificateExpiredException, CertificateNotYetValidException;
/**
- * Gets the <code>version</code> (version number) value from the
+ * Gets the {@code version} (version number) value from the
* certificate.
* The ASN.1 definition for this is:
* <pre>
- * version [0] EXPLICIT Version DEFAULT v1<p>
+ * version [0] EXPLICIT Version DEFAULT v1
+ *
* Version ::= INTEGER { v1(0), v2(1), v3(2) }
* </pre>
* @return the version number, i.e. 1, 2 or 3.
@@ -173,14 +176,14 @@
public abstract int getVersion();
/**
- * Gets the <code>serialNumber</code> value from the certificate.
+ * Gets the {@code serialNumber} value from the certificate.
* The serial number is an integer assigned by the certification
* authority to each certificate. It must be unique for each
* certificate issued by a given CA (i.e., the issuer name and
* serial number identify a unique certificate).
* The ASN.1 definition for this is:
* <pre>
- * serialNumber CertificateSerialNumber<p>
+ * serialNumber CertificateSerialNumber
*
* CertificateSerialNumber ::= INTEGER
* </pre>
@@ -191,12 +194,12 @@
/**
* <strong>Denigrated</strong>, replaced by {@linkplain
- * #getIssuerX500Principal()}. This method returns the <code>issuer</code>
+ * #getIssuerX500Principal()}. This method returns the {@code issuer}
* as an implementation specific Principal object, which should not be
* relied upon by portable code.
*
* <p>
- * Gets the <code>issuer</code> (issuer distinguished name) value from
+ * Gets the {@code issuer} (issuer distinguished name) value from
* the certificate. The issuer name identifies the entity that signed (and
* issued) the certificate.
*
@@ -204,7 +207,7 @@
* X.500 distinguished name (DN).
* The ASN.1 definition for this is:
* <pre>
- * issuer Name<p>
+ * issuer Name
*
* Name ::= CHOICE { RDNSequence }
* RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
@@ -217,14 +220,14 @@
* AttributeType ::= OBJECT IDENTIFIER
* AttributeValue ::= ANY
* </pre>
- * The <code>Name</code> describes a hierarchical name composed of
+ * The {@code Name} describes a hierarchical name composed of
* attributes,
* such as country name, and corresponding values, such as US.
- * The type of the <code>AttributeValue</code> component is determined by
- * the <code>AttributeType</code>; in general it will be a
- * <code>directoryString</code>. A <code>directoryString</code> is usually
- * one of <code>PrintableString</code>,
- * <code>TeletexString</code> or <code>UniversalString</code>.
+ * The type of the {@code AttributeValue} component is determined by
+ * the {@code AttributeType}; in general it will be a
+ * {@code directoryString}. A {@code directoryString} is usually
+ * one of {@code PrintableString},
+ * {@code TeletexString} or {@code UniversalString}.
*
* @return a Principal whose name is the issuer distinguished name.
*/
@@ -232,11 +235,11 @@
/**
* Returns the issuer (issuer distinguished name) value from the
- * certificate as an <code>X500Principal</code>.
+ * certificate as an {@code X500Principal}.
* <p>
* It is recommended that subclasses override this method.
*
- * @return an <code>X500Principal</code> representing the issuer
+ * @return an {@code X500Principal} representing the issuer
* distinguished name
* @since 1.4
*/
@@ -249,22 +252,22 @@
/**
* <strong>Denigrated</strong>, replaced by {@linkplain
- * #getSubjectX500Principal()}. This method returns the <code>subject</code>
+ * #getSubjectX500Principal()}. This method returns the {@code subject}
* as an implementation specific Principal object, which should not be
* relied upon by portable code.
*
* <p>
- * Gets the <code>subject</code> (subject distinguished name) value
- * from the certificate. If the <code>subject</code> value is empty,
- * then the <code>getName()</code> method of the returned
- * <code>Principal</code> object returns an empty string ("").
+ * Gets the {@code subject} (subject distinguished name) value
+ * from the certificate. If the {@code subject} value is empty,
+ * then the {@code getName()} method of the returned
+ * {@code Principal} object returns an empty string ("").
*
* <p> The ASN.1 definition for this is:
* <pre>
* subject Name
* </pre>
*
- * <p>See {@link #getIssuerDN() getIssuerDN} for <code>Name</code>
+ * <p>See {@link #getIssuerDN() getIssuerDN} for {@code Name}
* and other relevant definitions.
*
* @return a Principal whose name is the subject name.
@@ -273,13 +276,13 @@
/**
* Returns the subject (subject distinguished name) value from the
- * certificate as an <code>X500Principal</code>. If the subject value
- * is empty, then the <code>getName()</code> method of the returned
- * <code>X500Principal</code> object returns an empty string ("").
+ * certificate as an {@code X500Principal}. If the subject value
+ * is empty, then the {@code getName()} method of the returned
+ * {@code X500Principal} object returns an empty string ("").
* <p>
* It is recommended that subclasses override this method.
*
- * @return an <code>X500Principal</code> representing the subject
+ * @return an {@code X500Principal} representing the subject
* distinguished name
* @since 1.4
*/
@@ -291,15 +294,16 @@
}
/**
- * Gets the <code>notBefore</code> date from the validity period of
+ * Gets the {@code notBefore} date from the validity period of
* the certificate.
* The relevant ASN.1 definitions are:
* <pre>
- * validity Validity<p>
+ * validity Validity
*
* Validity ::= SEQUENCE {
* notBefore CertificateValidityDate,
- * notAfter CertificateValidityDate }<p>
+ * notAfter CertificateValidityDate }
+ *
* CertificateValidityDate ::= CHOICE {
* utcTime UTCTime,
* generalTime GeneralizedTime }
@@ -311,7 +315,7 @@
public abstract Date getNotBefore();
/**
- * Gets the <code>notAfter</code> date from the validity period of
+ * Gets the {@code notAfter} date from the validity period of
* the certificate. See {@link #getNotBefore() getNotBefore}
* for relevant ASN.1 definitions.
*
@@ -322,7 +326,7 @@
/**
* Gets the DER-encoded certificate information, the
- * <code>tbsCertificate</code> from this certificate.
+ * {@code tbsCertificate} from this certificate.
* This can be used to verify the signature independently.
*
* @return the DER-encoded certificate information.
@@ -332,7 +336,7 @@
throws CertificateEncodingException;
/**
- * Gets the <code>signature</code> value (the raw signature bits) from
+ * Gets the {@code signature} value (the raw signature bits) from
* the certificate.
* The ASN.1 definition for this is:
* <pre>
@@ -348,7 +352,8 @@
* signature algorithm. An example is the string "SHA256withRSA".
* The ASN.1 definition for this is:
* <pre>
- * signatureAlgorithm AlgorithmIdentifier<p>
+ * signatureAlgorithm AlgorithmIdentifier
+ *
* AlgorithmIdentifier ::= SEQUENCE {
* algorithm OBJECT IDENTIFIER,
* parameters ANY DEFINED BY algorithm OPTIONAL }
@@ -357,7 +362,7 @@
* -- algorithm object identifier value
* </pre>
*
- * <p>The algorithm name is determined from the <code>algorithm</code>
+ * <p>The algorithm name is determined from the {@code algorithm}
* OID string.
*
* @return the signature algorithm name.
@@ -400,7 +405,7 @@
public abstract byte[] getSigAlgParams();
/**
- * Gets the <code>issuerUniqueID</code> value from the certificate.
+ * Gets the {@code issuerUniqueID} value from the certificate.
* The issuer unique identifier is present in the certificate
* to handle the possibility of reuse of issuer names over time.
* RFC 3280 recommends that names not be reused and that
@@ -410,7 +415,8 @@
*
* <p>The ASN.1 definition for this is:
* <pre>
- * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL<p>
+ * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL
+ *
* UniqueIdentifier ::= BIT STRING
* </pre>
*
@@ -420,11 +426,12 @@
public abstract boolean[] getIssuerUniqueID();
/**
- * Gets the <code>subjectUniqueID</code> value from the certificate.
+ * Gets the {@code subjectUniqueID} value from the certificate.
*
* <p>The ASN.1 definition for this is:
* <pre>
- * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL<p>
+ * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL
+ *
* UniqueIdentifier ::= BIT STRING
* </pre>
*
@@ -435,7 +442,7 @@
/**
* Gets a boolean array representing bits of
- * the <code>KeyUsage</code> extension, (OID = 2.5.29.15).
+ * the {@code KeyUsage} extension, (OID = 2.5.29.15).
* The key usage extension defines the purpose (e.g., encipherment,
* signature, certificate signing) of the key contained in the
* certificate.
@@ -467,16 +474,16 @@
/**
* Gets an unmodifiable list of Strings representing the OBJECT
- * IDENTIFIERs of the <code>ExtKeyUsageSyntax</code> field of the
+ * IDENTIFIERs of the {@code ExtKeyUsageSyntax} field of the
* extended key usage extension, (OID = 2.5.29.37). It indicates
* one or more purposes for which the certified public key may be
* used, in addition to or in place of the basic purposes
* indicated in the key usage extension field. The ASN.1
* definition for this is:
* <pre>
- * ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId<p>
+ * ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
*
- * KeyPurposeId ::= OBJECT IDENTIFIER<p>
+ * KeyPurposeId ::= OBJECT IDENTIFIER
* </pre>
*
* Key purposes may be defined by any organization with a
@@ -486,7 +493,7 @@
* <p>
* This method was added to version 1.4 of the Java 2 Platform Standard
* Edition. In order to maintain backwards compatibility with existing
- * service providers, this method is not <code>abstract</code>
+ * service providers, this method is not {@code abstract}
* and it provides a default implementation. Subclasses
* should override this method with a correct implementation.
*
@@ -503,13 +510,13 @@
/**
* Gets the certificate constraints path length from the
- * critical <code>BasicConstraints</code> extension, (OID = 2.5.29.19).
+ * critical {@code BasicConstraints} extension, (OID = 2.5.29.19).
* <p>
* The basic constraints extension identifies whether the subject
* of the certificate is a Certificate Authority (CA) and
* how deep a certification path may exist through that CA. The
- * <code>pathLenConstraint</code> field (see below) is meaningful
- * only if <code>cA</code> is set to TRUE. In this case, it gives the
+ * {@code pathLenConstraint} field (see below) is meaningful
+ * only if {@code cA} is set to TRUE. In this case, it gives the
* maximum number of CA certificates that may follow this certificate in a
* certification path. A value of zero indicates that only an end-entity
* certificate may follow in the path.
@@ -521,21 +528,21 @@
* pathLenConstraint INTEGER (0..MAX) OPTIONAL }
* </pre>
*
- * @return the value of <code>pathLenConstraint</code> if the
+ * @return the value of {@code pathLenConstraint} if the
* BasicConstraints extension is present in the certificate and the
* subject of the certificate is a CA, otherwise -1.
* If the subject of the certificate is a CA and
- * <code>pathLenConstraint</code> does not appear,
- * <code>Integer.MAX_VALUE</code> is returned to indicate that there is no
+ * {@code pathLenConstraint} does not appear,
+ * {@code Integer.MAX_VALUE} is returned to indicate that there is no
* limit to the allowed length of the certification path.
*/
public abstract int getBasicConstraints();
/**
* Gets an immutable collection of subject alternative names from the
- * <code>SubjectAltName</code> extension, (OID = 2.5.29.17).
+ * {@code SubjectAltName} extension, (OID = 2.5.29.17).
* <p>
- * The ASN.1 definition of the <code>SubjectAltName</code> extension is:
+ * The ASN.1 definition of the {@code SubjectAltName} extension is:
* <pre>
* SubjectAltName ::= GeneralNames
*
@@ -553,23 +560,23 @@
* registeredID [8] OBJECT IDENTIFIER}
* </pre>
* <p>
- * If this certificate does not contain a <code>SubjectAltName</code>
- * extension, <code>null</code> is returned. Otherwise, a
- * <code>Collection</code> is returned with an entry representing each
- * <code>GeneralName</code> included in the extension. Each entry is a
- * <code>List</code> whose first entry is an <code>Integer</code>
- * (the name type, 0-8) and whose second entry is a <code>String</code>
+ * If this certificate does not contain a {@code SubjectAltName}
+ * extension, {@code null} is returned. Otherwise, a
+ * {@code Collection} is returned with an entry representing each
+ * {@code GeneralName} included in the extension. Each entry is a
+ * {@code List} whose first entry is an {@code Integer}
+ * (the name type, 0-8) and whose second entry is a {@code String}
* or a byte array (the name, in string or ASN.1 DER encoded form,
* respectively).
* <p>
* <a href="http://www.ietf.org/rfc/rfc822.txt">RFC 822</a>, DNS, and URI
- * names are returned as <code>String</code>s,
+ * names are returned as {@code String}s,
* using the well-established string formats for those types (subject to
* the restrictions included in RFC 3280). IPv4 address names are
* returned using dotted quad notation. IPv6 address names are returned
* in the form "a1:a2:...:a8", where a1-a8 are hexadecimal values
* representing the eight 16-bit pieces of the address. OID names are
- * returned as <code>String</code>s represented as a series of nonnegative
+ * returned as {@code String}s represented as a series of nonnegative
* integers separated by periods. And directory names (distinguished names)
* are returned in <a href="http://www.ietf.org/rfc/rfc2253.txt">
* RFC 2253</a> string format. No standard string format is
@@ -577,19 +584,19 @@
* other type of names. They are returned as byte arrays
* containing the ASN.1 DER encoded form of the name.
* <p>
- * Note that the <code>Collection</code> returned may contain more
+ * Note that the {@code Collection} returned may contain more
* than one name of the same type. Also, note that the returned
- * <code>Collection</code> is immutable and any entries containing byte
+ * {@code Collection} is immutable and any entries containing byte
* arrays are cloned to protect against subsequent modifications.
* <p>
* This method was added to version 1.4 of the Java 2 Platform Standard
* Edition. In order to maintain backwards compatibility with existing
- * service providers, this method is not <code>abstract</code>
+ * service providers, this method is not {@code abstract}
* and it provides a default implementation. Subclasses
* should override this method with a correct implementation.
*
- * @return an immutable <code>Collection</code> of subject alternative
- * names (or <code>null</code>)
+ * @return an immutable {@code Collection} of subject alternative
+ * names (or {@code null})
* @throws CertificateParsingException if the extension cannot be decoded
* @since 1.4
*/
@@ -600,38 +607,38 @@
/**
* Gets an immutable collection of issuer alternative names from the
- * <code>IssuerAltName</code> extension, (OID = 2.5.29.18).
+ * {@code IssuerAltName} extension, (OID = 2.5.29.18).
* <p>
- * The ASN.1 definition of the <code>IssuerAltName</code> extension is:
+ * The ASN.1 definition of the {@code IssuerAltName} extension is:
* <pre>
* IssuerAltName ::= GeneralNames
* </pre>
- * The ASN.1 definition of <code>GeneralNames</code> is defined
+ * The ASN.1 definition of {@code GeneralNames} is defined
* in {@link #getSubjectAlternativeNames getSubjectAlternativeNames}.
* <p>
- * If this certificate does not contain an <code>IssuerAltName</code>
- * extension, <code>null</code> is returned. Otherwise, a
- * <code>Collection</code> is returned with an entry representing each
- * <code>GeneralName</code> included in the extension. Each entry is a
- * <code>List</code> whose first entry is an <code>Integer</code>
- * (the name type, 0-8) and whose second entry is a <code>String</code>
+ * If this certificate does not contain an {@code IssuerAltName}
+ * extension, {@code null} is returned. Otherwise, a
+ * {@code Collection} is returned with an entry representing each
+ * {@code GeneralName} included in the extension. Each entry is a
+ * {@code List} whose first entry is an {@code Integer}
+ * (the name type, 0-8) and whose second entry is a {@code String}
* or a byte array (the name, in string or ASN.1 DER encoded form,
* respectively). For more details about the formats used for each
- * name type, see the <code>getSubjectAlternativeNames</code> method.
+ * name type, see the {@code getSubjectAlternativeNames} method.
* <p>
- * Note that the <code>Collection</code> returned may contain more
+ * Note that the {@code Collection} returned may contain more
* than one name of the same type. Also, note that the returned
- * <code>Collection</code> is immutable and any entries containing byte
+ * {@code Collection} is immutable and any entries containing byte
* arrays are cloned to protect against subsequent modifications.
* <p>
* This method was added to version 1.4 of the Java 2 Platform Standard
* Edition. In order to maintain backwards compatibility with existing
- * service providers, this method is not <code>abstract</code>
+ * service providers, this method is not {@code abstract}
* and it provides a default implementation. Subclasses
* should override this method with a correct implementation.
*
- * @return an immutable <code>Collection</code> of issuer alternative
- * names (or <code>null</code>)
+ * @return an immutable {@code Collection} of issuer alternative
+ * names (or {@code null})
* @throws CertificateParsingException if the extension cannot be decoded
* @since 1.4
*/
@@ -649,7 +656,7 @@
*
* This method was added to version 1.8 of the Java Platform Standard
* Edition. In order to maintain backwards compatibility with existing
- * service providers, this method is not <code>abstract</code>
+ * service providers, this method is not {@code abstract}
* and it provides a default implementation.
*
* @param key the PublicKey used to carry out the verification.
--- a/jdk/src/share/classes/java/security/cert/X509Extension.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/X509Extension.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -59,9 +59,9 @@
* -- the extnId object identifier value
* }
* </pre>
- * Since not all extensions are known, the <code>getExtensionValue</code>
+ * Since not all extensions are known, the {@code getExtensionValue}
* method returns the DER-encoded OCTET STRING of the
- * extension value (i.e., the <code>extnValue</code>). This can then
+ * extension value (i.e., the {@code extnValue}). This can then
* be handled by a <em>Class</em> that understands the extension.
*
* @author Hemma Prafullchandra
@@ -72,8 +72,8 @@
/**
* Check if there is a critical extension that is not supported.
*
- * @return <tt>true</tt> if a critical extension is found that is
- * not supported, otherwise <tt>false</tt>.
+ * @return {@code true} if a critical extension is found that is
+ * not supported, otherwise {@code false}.
*/
public boolean hasUnsupportedCriticalExtension();
@@ -113,28 +113,28 @@
*
* Here is sample code to get a Set of non-critical extensions from an
* X509CRL revoked certificate entry and print the OIDs:
- * <pre><code>
+ * <pre>{@code
* CertificateFactory cf = null;
* X509CRL crl = null;
* try (InputStream inStrm = new FileInputStream("DER-encoded-CRL")) {
* cf = CertificateFactory.getInstance("X.509");
* crl = (X509CRL)cf.generateCRL(inStrm);
- * }<p>
+ * }
*
- * byte[] certData = <DER-encoded certificate data>
+ * byte[] certData = <DER-encoded certificate data>
* ByteArrayInputStream bais = new ByteArrayInputStream(certData);
* X509Certificate cert = (X509Certificate)cf.generateCertificate(bais);
* X509CRLEntry badCert =
- * crl.getRevokedCertificate(cert.getSerialNumber());<p>
+ * crl.getRevokedCertificate(cert.getSerialNumber());
*
* if (badCert != null) {
- * Set<String> nonCritSet = badCert.getNonCriticalExtensionOIDs();<p>
+ * Set<String> nonCritSet = badCert.getNonCriticalExtensionOIDs();
* if (nonCritSet != null)
* for (String oid : nonCritSet) {
* System.out.println(oid);
* }
* }
- * </code></pre>
+ * }</pre>
*
* @return a Set (or an empty Set if none are marked non-critical) of
* the extension OID strings for extensions that are marked non-critical.
@@ -145,9 +145,9 @@
/**
* Gets the DER-encoded OCTET string for the extension value
- * (<em>extnValue</em>) identified by the passed-in <code>oid</code>
+ * (<em>extnValue</em>) identified by the passed-in {@code oid}
* String.
- * The <code>oid</code> string is
+ * The {@code oid} string is
* represented by a set of nonnegative whole numbers separated
* by periods.
*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/security/cert/package-info.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1998, 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. 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.
+ */
+
+/**
+ * Provides classes and interfaces for parsing and managing
+ * certificates, certificate revocation lists (CRLs), and
+ * certification paths. It contains support for X.509 v3
+ * certificates and X.509 v2 CRLs.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li><a href="{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
+ * <b>Java™
+ * Cryptography Architecture (JCA) Reference Guide</b></a>
+ * <li>RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
+ * Certificate Revocation List (CRL) Profile
+ * <li>RFC 2560: X.509 Internet Public Key Infrastructure Online Certificate
+ * Status Protocol - OCSP
+ * <li><a href="{@docRoot}/../technotes/guides/security/StandardNames.html">
+ * <b>Java™
+ * Cryptography Architecture Standard Algorithm Name
+ * Documentation</b></a></li>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * For information about X.509 certificates and CRLs, please see:
+ * <ul>
+ * <li><a href="http://www.ietf.org/rfc/rfc5280.txt">
+ * http://www.ietf.org/rfc/rfc5280.txt</a>
+ * <li><a href=
+ * "{@docRoot}/../technotes/guides/security/certpath/CertPathProgGuide.html">
+ * <b>Java™
+ * PKI Programmer's Guide</b></a>
+ * <li><a href="{@docRoot}/../technotes/guides/security/cert3.html">
+ * <b>X.509 Certificates and Certificate Revocation Lists (CRLs)</b></a>
+ * </ul>
+ *
+ * @since 1.2
+ */
+package java.security.cert;
--- a/jdk/src/share/classes/java/security/cert/package.html Tue Jul 02 15:20:55 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-<!--
- Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- 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.
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<body bgcolor="white">
-
-Provides classes and interfaces for parsing and managing
-certificates, certificate revocation lists (CRLs), and
-certification paths. It contains support for X.509 v3
-certificates and X.509 v2 CRLs.
-
-<h2>Package Specification</h2>
-
-<ul>
- <li><a href="{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- <b>Java<FONT SIZE=-2><SUP>TM</SUP></FONT>
- Cryptography Architecture (JCA) Reference Guide</b></a>
- <li>RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
- Certificate Revocation List (CRL) Profile
- <li>RFC 2560: X.509 Internet Public Key Infrastructure Online Certificate
- Status Protocol - OCSP
- <li><a href="{@docRoot}/../technotes/guides/security/StandardNames.html">
- <b>Java<FONT SIZE=-2><SUP>TM</SUP></FONT>
- Cryptography Architecture Standard Algorithm Name
- Documentation</b></a></li>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For information about X.509 certificates and CRLs, please see:
-<ul>
- <li><a href="http://www.ietf.org/rfc/rfc5280.txt">
- http://www.ietf.org/rfc/rfc5280.txt</a>
- <li><a href=
- "{@docRoot}/../technotes/guides/security/certpath/CertPathProgGuide.html">
- <b>Java<FONT SIZE=-2><SUP>TM</SUP></FONT>
- PKI Programmer's Guide</a>
- <li><a href="{@docRoot}/../technotes/guides/security/cert3.html">
- X.509 Certificates and Certificate Revocation Lists (CRLs)</a>
-</ul>
-
-@since 1.2
-</body>
-</html>
--- a/jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -30,8 +30,8 @@
/**
* An interface to an object capable of generating DSA key pairs.
*
- * <p>The <code>initialize</code> methods may each be called any number
- * of times. If no <code>initialize</code> method is called on a
+ * <p>The {@code initialize} methods may each be called any number
+ * of times. If no {@code initialize} method is called on a
* DSAKeyPairGenerator, the default is to generate 1024-bit keys, using
* precomputed p, q and g parameters and an instance of SecureRandom as
* the random bit source.
@@ -42,22 +42,22 @@
* <ol>
*
* <li>Get a key pair generator for the DSA algorithm by calling the
- * KeyPairGenerator <code>getInstance</code> method with "DSA"
+ * KeyPairGenerator {@code getInstance} method with "DSA"
* as its argument.<p>
*
* <li>Initialize the generator by casting the result to a DSAKeyPairGenerator
* and calling one of the
- * <code>initialize</code> methods from this DSAKeyPairGenerator interface.<p>
+ * {@code initialize} methods from this DSAKeyPairGenerator interface.<p>
*
- * <li>Generate a key pair by calling the <code>generateKeyPair</code>
+ * <li>Generate a key pair by calling the {@code generateKeyPair}
* method from the KeyPairGenerator class.
*
* </ol>
*
* <p>Note: it is not always necessary to do do algorithm-specific
* initialization for a DSA key pair generator. That is, it is not always
- * necessary to call an <code>initialize</code> method in this interface.
- * Algorithm-independent initialization using the <code>initialize</code> method
+ * necessary to call an {@code initialize} method in this interface.
+ * Algorithm-independent initialization using the {@code initialize} method
* in the KeyPairGenerator
* interface is all that is needed when you accept defaults for algorithm-specific
* parameters.
@@ -80,7 +80,7 @@
* @param random the random bit source to use to generate key bits;
* can be null.
*
- * @exception InvalidParameterException if the <code>params</code>
+ * @exception InvalidParameterException if the {@code params}
* value is invalid, null, or unsupported.
*/
public void initialize(DSAParams params, SecureRandom random)
@@ -92,7 +92,7 @@
* If a SecureRandom bit source is needed but not supplied, i.e.
* null, a default SecureRandom instance will be used.
*
- * <p>If <code>genParams</code> is true, this method generates new
+ * <p>If {@code genParams} is true, this method generates new
* p, q and g parameters. If it is false, the method uses precomputed
* parameters for the modulus length requested. If there are no
* precomputed parameters for that modulus length, an exception will be
@@ -108,8 +108,8 @@
* @param genParams whether or not to generate new parameters for
* the modulus length requested.
*
- * @exception InvalidParameterException if <code>modlen</code> is
- * invalid, or unsupported, or if <code>genParams</code> is false and there
+ * @exception InvalidParameterException if {@code modlen} is
+ * invalid, or unsupported, or if {@code genParams} is false and there
* are no precomputed parameters for the requested modulus length.
*/
public void initialize(int modlen, boolean genParams, SecureRandom random)
--- a/jdk/src/share/classes/java/security/interfaces/DSAParams.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/interfaces/DSAParams.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -42,23 +42,23 @@
public interface DSAParams {
/**
- * Returns the prime, <code>p</code>.
+ * Returns the prime, {@code p}.
*
- * @return the prime, <code>p</code>.
+ * @return the prime, {@code p}.
*/
public BigInteger getP();
/**
- * Returns the subprime, <code>q</code>.
+ * Returns the subprime, {@code q}.
*
- * @return the subprime, <code>q</code>.
+ * @return the subprime, {@code q}.
*/
public BigInteger getQ();
/**
- * Returns the base, <code>g</code>.
+ * Returns the base, {@code g}.
*
- * @return the base, <code>g</code>.
+ * @return the base, {@code g}.
*/
public BigInteger getG();
}
--- a/jdk/src/share/classes/java/security/interfaces/DSAPrivateKey.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/interfaces/DSAPrivateKey.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -50,9 +50,9 @@
static final long serialVersionUID = 7776497482533790279L;
/**
- * Returns the value of the private key, <code>x</code>.
+ * Returns the value of the private key, {@code x}.
*
- * @return the value of the private key, <code>x</code>.
+ * @return the value of the private key, {@code x}.
*/
public BigInteger getX();
}
--- a/jdk/src/share/classes/java/security/interfaces/DSAPublicKey.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/interfaces/DSAPublicKey.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -50,9 +50,9 @@
static final long serialVersionUID = 1234526332779022332L;
/**
- * Returns the value of the public key, <code>y</code>.
+ * Returns the value of the public key, {@code y}.
*
- * @return the value of the public key, <code>y</code>.
+ * @return the value of the public key, {@code y}.
*/
public BigInteger getY();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/security/interfaces/package-info.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1998, 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. 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.
+ */
+
+/**
+ * Provides interfaces for generating RSA (Rivest, Shamir and
+ * Adleman AsymmetricCipher algorithm)
+ * keys as defined in the RSA Laboratory Technical Note
+ * PKCS#1, and DSA (Digital Signature
+ * Algorithm) keys as defined in NIST's FIPS-186.
+ * <P>
+ * Note that these interfaces are intended only for key
+ * implementations whose key material is accessible and
+ * available. These interfaces are not intended for key
+ * implementations whose key material resides in
+ * inaccessible, protected storage (such as in a
+ * hardware device).
+ * <P>
+ * For more developer information on how to use these
+ * interfaces, including information on how to design
+ * {@code Key} classes for hardware devices, please refer
+ * to these cryptographic provider developer guides:
+ * <ul>
+ * <li><a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
+ * <b>How to Implement a Provider for the
+ * Java™ Cryptography Architecture
+ * </b></a></li>
+ * </ul>
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>PKCS #1: RSA Encryption Standard, Version 1.5, November 1993 </li>
+ * <li>Federal Information Processing Standards Publication (FIPS PUB) 186:
+ * Digital Signature Standard (DSS) </li>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * For further documentation, please see:
+ * <ul>
+ * <li>
+ * <a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
+ * <b>Java™
+ * Cryptography Architecture API Specification and Reference
+ * </b></a></li>
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+package java.security.interfaces;
--- a/jdk/src/share/classes/java/security/interfaces/package.html Tue Jul 02 15:20:55 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-<!--
- Copyright (c) 1998, 2006, 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.
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<body bgcolor="white">
-
-Provides interfaces for generating RSA (Rivest, Shamir and
-Adleman AsymmetricCipher algorithm)
-keys as defined in the RSA Laboratory Technical Note
-PKCS#1, and DSA (Digital Signature
-Algorithm) keys as defined in NIST's FIPS-186.
-<P>
-Note that these interfaces are intended only for key
-implementations whose key material is accessible and
-available. These interfaces are not intended for key
-implementations whose key material resides in
-inaccessible, protected storage (such as in a
-hardware device).
-<P>
-For more developer information on how to use these
-interfaces, including information on how to design
-<code>Key</code> classes for hardware devices, please refer
-to these cryptographic provider developer guides:
-<ul>
- <li><a href=
- "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- <b>How to Implement a Provider for the
- Java<FONT SIZE=-2><SUP>TM</SUP></FONT> Cryptography Architecture
- </b></a></li>
-</ul>
-
-<h2>Package Specification</h2>
-
-<ul>
- <li>PKCS #1: RSA Encryption Standard, Version 1.5, November 1993 </li>
- <li>Federal Information Processing Standards Publication (FIPS PUB) 186:
- Digital Signature Standard (DSS) </li>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For further documentation, please see:
-<ul>
- <li>
- <a href=
- "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- <b>Java<FONT SIZE=-2><SUP>TM</SUP></FONT>
- Cryptography Architecture API Specification and Reference
- </b></a></li>
-</ul>
-
-@since JDK1.1
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/security/package-info.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 1998, 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. 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.
+ */
+
+/**
+ * Provides the classes and interfaces for the security framework.
+ * This includes classes that implement an easily configurable,
+ * fine-grained access control security architecture.
+ * This package also supports
+ * the generation and storage of cryptographic public key pairs,
+ * as well as a number of exportable cryptographic operations
+ * including those for message digest and signature generation. Finally,
+ * this package provides classes that support signed/guarded objects
+ * and secure random number generation.
+ *
+ * Many of the classes provided in this package (the cryptographic
+ * and secure random number generator classes in particular) are
+ * provider-based. The class itself defines a programming interface
+ * to which applications may write. The implementations themselves may
+ * then be written by independent third-party vendors and plugged
+ * in seamlessly as needed. Therefore application developers may
+ * take advantage of any number of provider-based implementations
+ * without having to add or rewrite code.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li><a href="{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
+ * <b>Java™
+ * Cryptography Architecture (JCA) Reference Guide</b></a></li>
+ *
+ * <li>PKCS #8: Private-Key Information Syntax Standard, Version 1.2,
+ * November 1993</li>
+ *
+ * <li><a href="{@docRoot}/../technotes/guides/security/StandardNames.html">
+ * <b>Java™
+ * Cryptography Architecture Standard Algorithm Name
+ * Documentation</b></a></li>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * For further documentation, please see:
+ * <ul>
+ * <li><a href=
+ * "{@docRoot}/../technotes/guides/security/spec/security-spec.doc.html">
+ * <b>Java™
+ * SE Platform Security Architecture</b></a></li>
+ *
+ * <li><a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
+ * <b>How to Implement a Provider in the
+ * Java™ Cryptography Architecture
+ * </b></a></li>
+ *
+ * <li><a href=
+ * "{@docRoot}/../technotes/guides/security/PolicyFiles.html"><b>
+ * Default Policy Implementation and Policy File Syntax
+ * </b></a></li>
+ *
+ * <li><a href=
+ * "{@docRoot}/../technotes/guides/security/permissions.html"><b>
+ * Permissions in the
+ * Java™ SE Development Kit (JDK)
+ * </b></a></li>
+ *
+ * <li><a href=
+ * "{@docRoot}/../technotes/guides/security/SecurityToolsSummary.html"><b>
+ * Summary of Tools for
+ * Java™ Platform Security
+ * </b></a></li>
+ *
+ * <li><b>keytool</b>
+ * (<a href="{@docRoot}/../technotes/tools/solaris/keytool.html">
+ * for Solaris/Linux</a>)
+ * (<a href="{@docRoot}/../technotes/tools/windows/keytool.html">
+ * for Windows</a>)
+ * </li>
+ *
+ * <li><b>jarsigner</b>
+ * (<a href="{@docRoot}/../technotes/tools/solaris/jarsigner.html">
+ * for Solaris/Linux</a>)
+ * (<a href="{@docRoot}/../technotes/tools/windows/jarsigner.html">
+ * for Windows</a>)
+ * </li>
+ *
+ * </ul>
+ *
+ * @since 1.1
+ */
+package java.security;
--- a/jdk/src/share/classes/java/security/package.html Tue Jul 02 15:20:55 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation. 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.
--->
-
-</head>
-<body bgcolor="white">
-
-Provides the classes and interfaces for the security framework.
-This includes classes that implement an easily configurable,
-fine-grained access control security architecture.
-This package also supports
-the generation and storage of cryptographic public key pairs,
-as well as a number of exportable cryptographic operations
-including those for message digest and signature generation. Finally,
-this package provides classes that support signed/guarded objects
-and secure random number generation.
-
-Many of the classes provided in this package (the cryptographic
-and secure random number generator classes in particular) are
-provider-based. The class itself defines a programming interface
-to which applications may write. The implementations themselves may
-then be written by independent third-party vendors and plugged
-in seamlessly as needed. Therefore application developers may
-take advantage of any number of provider-based implementations
-without having to add or rewrite code.
-
-<h2>Package Specification</h2>
-
-<ul>
- <li><a href="{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- <b>Java<FONT SIZE=-2><SUP>TM</SUP></FONT>
- Cryptography Architecture (JCA) Reference Guide</b></a></li>
-
- <li>PKCS #8: Private-Key Information Syntax Standard, Version 1.2,
- November 1993</li>
-
- <li><a href="{@docRoot}/../technotes/guides/security/StandardNames.html">
- <b>Java<FONT SIZE=-2><SUP>TM</SUP></FONT>
- Cryptography Architecture Standard Algorithm Name
- Documentation</b></a></li>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For further documentation, please see:
-<ul>
- <li><a href=
- "{@docRoot}/../technotes/guides/security/spec/security-spec.doc.html">
- <b>Java<FONT SIZE=-2><SUP>TM</SUP></FONT>
- SE Platform Security Architecture</b></a></li>
-
- <li><a href=
- "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- <b>How to Implement a Provider in the
- Java<FONT SIZE=-2><SUP>TM</SUP></FONT> Cryptography Architecture
- </b></a></li>
-
- <li><a href=
- "{@docRoot}/../technotes/guides/security/PolicyFiles.html"><b>
- Default Policy Implementation and Policy File Syntax
- </b></a></li>
-
- <li><a href=
- "{@docRoot}/../technotes/guides/security/permissions.html"><b>
- Permissions in the
- Java<FONT SIZE=-2><SUP>TM</SUP></FONT> SE Development Kit (JDK)
- </b></a></li>
-
- <li><a href=
- "{@docRoot}/../technotes/guides/security/SecurityToolsSummary.html"><b>
- Summary of Tools for
- Java<FONT SIZE=-2><SUP>TM</SUP></FONT> Platform Security
- </b></a></li>
-
- <li><b>keytool</b>
- (<a href="{@docRoot}/../technotes/tools/solaris/keytool.html">
- for Solaris/Linux</a>)
- (<a href="{@docRoot}/../technotes/tools/windows/keytool.html">
- for Windows</a>)
- </li>
-
- <li><b>jarsigner</b>
- (<a href="{@docRoot}/../technotes/tools/solaris/jarsigner.html">
- for Solaris/Linux</a>)
- (<a href="{@docRoot}/../technotes/tools/windows/jarsigner.html">
- for Windows</a>)
- </li>
-
-</ul>
-
-@since 1.1
-</body>
-</html>
--- a/jdk/src/share/classes/java/security/spec/DSAGenParameterSpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/DSAGenParameterSpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -41,13 +41,13 @@
/**
* Creates a domain parameter specification for DSA parameter
- * generation using <code>primePLen</code> and <code>subprimeQLen</code>.
- * The value of <code>subprimeQLen</code> is also used as the default
+ * generation using {@code primePLen} and {@code subprimeQLen}.
+ * The value of {@code subprimeQLen} is also used as the default
* length of the domain parameter seed in bits.
* @param primePLen the desired length of the prime P in bits.
* @param subprimeQLen the desired length of the sub-prime Q in bits.
- * @exception IllegalArgumentException if <code>primePLen</code>
- * or <code>subprimeQLen</code> is illegal per the specification of
+ * @exception IllegalArgumentException if {@code primePLen}
+ * or {@code subprimeQLen} is illegal per the specification of
* FIPS 186-3.
*/
public DSAGenParameterSpec(int primePLen, int subprimeQLen) {
@@ -56,14 +56,14 @@
/**
* Creates a domain parameter specification for DSA parameter
- * generation using <code>primePLen</code>, <code>subprimeQLen</code>,
- * and <code>seedLen</code>.
+ * generation using {@code primePLen}, {@code subprimeQLen},
+ * and {@code seedLen}.
* @param primePLen the desired length of the prime P in bits.
* @param subprimeQLen the desired length of the sub-prime Q in bits.
* @param seedLen the desired length of the domain parameter seed in bits,
- * shall be equal to or greater than <code>subprimeQLen</code>.
- * @exception IllegalArgumentException if <code>primePLenLen</code>,
- * <code>subprimeQLen</code>, or <code>seedLen</code> is illegal per the
+ * shall be equal to or greater than {@code subprimeQLen}.
+ * @exception IllegalArgumentException if {@code primePLenLen},
+ * {@code subprimeQLen}, or {@code seedLen} is illegal per the
* specification of FIPS 186-3.
*/
public DSAGenParameterSpec(int primePLen, int subprimeQLen, int seedLen) {
--- a/jdk/src/share/classes/java/security/spec/DSAParameterSpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/DSAParameterSpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -61,27 +61,27 @@
}
/**
- * Returns the prime <code>p</code>.
+ * Returns the prime {@code p}.
*
- * @return the prime <code>p</code>.
+ * @return the prime {@code p}.
*/
public BigInteger getP() {
return this.p;
}
/**
- * Returns the sub-prime <code>q</code>.
+ * Returns the sub-prime {@code q}.
*
- * @return the sub-prime <code>q</code>.
+ * @return the sub-prime {@code q}.
*/
public BigInteger getQ() {
return this.q;
}
/**
- * Returns the base <code>g</code>.
+ * Returns the base {@code g}.
*
- * @return the base <code>g</code>.
+ * @return the base {@code g}.
*/
public BigInteger getG() {
return this.g;
--- a/jdk/src/share/classes/java/security/spec/DSAPrivateKeySpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/DSAPrivateKeySpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -69,36 +69,36 @@
}
/**
- * Returns the private key <code>x</code>.
+ * Returns the private key {@code x}.
*
- * @return the private key <code>x</code>.
+ * @return the private key {@code x}.
*/
public BigInteger getX() {
return this.x;
}
/**
- * Returns the prime <code>p</code>.
+ * Returns the prime {@code p}.
*
- * @return the prime <code>p</code>.
+ * @return the prime {@code p}.
*/
public BigInteger getP() {
return this.p;
}
/**
- * Returns the sub-prime <code>q</code>.
+ * Returns the sub-prime {@code q}.
*
- * @return the sub-prime <code>q</code>.
+ * @return the sub-prime {@code q}.
*/
public BigInteger getQ() {
return this.q;
}
/**
- * Returns the base <code>g</code>.
+ * Returns the base {@code g}.
*
- * @return the base <code>g</code>.
+ * @return the base {@code g}.
*/
public BigInteger getG() {
return this.g;
--- a/jdk/src/share/classes/java/security/spec/DSAPublicKeySpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/DSAPublicKeySpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -69,36 +69,36 @@
}
/**
- * Returns the public key <code>y</code>.
+ * Returns the public key {@code y}.
*
- * @return the public key <code>y</code>.
+ * @return the public key {@code y}.
*/
public BigInteger getY() {
return this.y;
}
/**
- * Returns the prime <code>p</code>.
+ * Returns the prime {@code p}.
*
- * @return the prime <code>p</code>.
+ * @return the prime {@code p}.
*/
public BigInteger getP() {
return this.p;
}
/**
- * Returns the sub-prime <code>q</code>.
+ * Returns the sub-prime {@code q}.
*
- * @return the sub-prime <code>q</code>.
+ * @return the sub-prime {@code q}.
*/
public BigInteger getQ() {
return this.q;
}
/**
- * Returns the base <code>g</code>.
+ * Returns the base {@code g}.
*
- * @return the base <code>g</code>.
+ * @return the base {@code g}.
*/
public BigInteger getG() {
return this.g;
--- a/jdk/src/share/classes/java/security/spec/ECFieldF2m.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/ECFieldF2m.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -45,9 +45,9 @@
/**
* Creates an elliptic curve characteristic 2 finite
- * field which has 2^<code>m</code> elements with normal basis.
- * @param m with 2^<code>m</code> being the number of elements.
- * @exception IllegalArgumentException if <code>m</code>
+ * field which has 2^{@code m} elements with normal basis.
+ * @param m with 2^{@code m} being the number of elements.
+ * @exception IllegalArgumentException if {@code m}
* is not positive.
*/
public ECFieldF2m(int m) {
@@ -61,24 +61,24 @@
/**
* Creates an elliptic curve characteristic 2 finite
- * field which has 2^<code>m</code> elements with
+ * field which has 2^{@code m} elements with
* polynomial basis.
* The reduction polynomial for this field is based
- * on <code>rp</code> whose i-th bit correspondes to
+ * on {@code rp} whose i-th bit correspondes to
* the i-th coefficient of the reduction polynomial.<p>
* Note: A valid reduction polynomial is either a
- * trinomial (X^<code>m</code> + X^<code>k</code> + 1
- * with <code>m</code> > <code>k</code> >= 1) or a
- * pentanomial (X^<code>m</code> + X^<code>k3</code>
- * + X^<code>k2</code> + X^<code>k1</code> + 1 with
- * <code>m</code> > <code>k3</code> > <code>k2</code>
- * > <code>k1</code> >= 1).
- * @param m with 2^<code>m</code> being the number of elements.
+ * trinomial (X^{@code m} + X^{@code k} + 1
+ * with {@code m} > {@code k} >= 1) or a
+ * pentanomial (X^{@code m} + X^{@code k3}
+ * + X^{@code k2} + X^{@code k1} + 1 with
+ * {@code m} > {@code k3} > {@code k2}
+ * > {@code k1} >= 1).
+ * @param m with 2^{@code m} being the number of elements.
* @param rp the BigInteger whose i-th bit corresponds to
* the i-th coefficient of the reduction polynomial.
- * @exception NullPointerException if <code>rp</code> is null.
- * @exception IllegalArgumentException if <code>m</code>
- * is not positive, or <code>rp</code> does not represent
+ * @exception NullPointerException if {@code rp} is null.
+ * @exception IllegalArgumentException if {@code m}
+ * is not positive, or {@code rp} does not represent
* a valid reduction polynomial.
*/
public ECFieldF2m(int m, BigInteger rp) {
@@ -106,28 +106,28 @@
/**
* Creates an elliptic curve characteristic 2 finite
- * field which has 2^<code>m</code> elements with
+ * field which has 2^{@code m} elements with
* polynomial basis. The reduction polynomial for this
- * field is based on <code>ks</code> whose content
+ * field is based on {@code ks} whose content
* contains the order of the middle term(s) of the
* reduction polynomial.
* Note: A valid reduction polynomial is either a
- * trinomial (X^<code>m</code> + X^<code>k</code> + 1
- * with <code>m</code> > <code>k</code> >= 1) or a
- * pentanomial (X^<code>m</code> + X^<code>k3</code>
- * + X^<code>k2</code> + X^<code>k1</code> + 1 with
- * <code>m</code> > <code>k3</code> > <code>k2</code>
- * > <code>k1</code> >= 1), so <code>ks</code> should
+ * trinomial (X^{@code m} + X^{@code k} + 1
+ * with {@code m} > {@code k} >= 1) or a
+ * pentanomial (X^{@code m} + X^{@code k3}
+ * + X^{@code k2} + X^{@code k1} + 1 with
+ * {@code m} > {@code k3} > {@code k2}
+ * > {@code k1} >= 1), so {@code ks} should
* have length 1 or 3.
- * @param m with 2^<code>m</code> being the number of elements.
+ * @param m with 2^{@code m} being the number of elements.
* @param ks the order of the middle term(s) of the
* reduction polynomial. Contents of this array are copied
* to protect against subsequent modification.
- * @exception NullPointerException if <code>ks</code> is null.
- * @exception IllegalArgumentException if<code>m</code>
- * is not positive, or the length of <code>ks</code>
- * is neither 1 nor 3, or values in <code>ks</code>
- * are not between <code>m</code>-1 and 1 (inclusive)
+ * @exception NullPointerException if {@code ks} is null.
+ * @exception IllegalArgumentException if{@code m}
+ * is not positive, or the length of {@code ks}
+ * is neither 1 nor 3, or values in {@code ks}
+ * are not between {@code m}-1 and 1 (inclusive)
* and in descending order.
*/
public ECFieldF2m(int m, int[] ks) {
@@ -160,7 +160,7 @@
}
/**
- * Returns the field size in bits which is <code>m</code>
+ * Returns the field size in bits which is {@code m}
* for this characteristic 2 finite field.
* @return the field size in bits.
*/
@@ -169,9 +169,9 @@
}
/**
- * Returns the value <code>m</code> of this characteristic
+ * Returns the value {@code m} of this characteristic
* 2 finite field.
- * @return <code>m</code> with 2^<code>m</code> being the
+ * @return {@code m} with 2^{@code m} being the
* number of elements.
*/
public int getM() {
@@ -211,8 +211,8 @@
* Compares this finite field for equality with the
* specified object.
* @param obj the object to be compared.
- * @return true if <code>obj</code> is an instance
- * of ECFieldF2m and both <code>m</code> and the reduction
+ * @return true if {@code obj} is an instance
+ * of ECFieldF2m and both {@code m} and the reduction
* polynomial match, false otherwise.
*/
public boolean equals(Object obj) {
--- a/jdk/src/share/classes/java/security/spec/ECFieldFp.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/ECFieldFp.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -43,10 +43,10 @@
/**
* Creates an elliptic curve prime finite field
- * with the specified prime <code>p</code>.
+ * with the specified prime {@code p}.
* @param p the prime.
- * @exception NullPointerException if <code>p</code> is null.
- * @exception IllegalArgumentException if <code>p</code>
+ * @exception NullPointerException if {@code p} is null.
+ * @exception IllegalArgumentException if {@code p}
* is not positive.
*/
public ECFieldFp(BigInteger p) {
@@ -66,7 +66,7 @@
};
/**
- * Returns the prime <code>p</code> of this prime finite field.
+ * Returns the prime {@code p} of this prime finite field.
* @return the prime.
*/
public BigInteger getP() {
@@ -77,7 +77,7 @@
* Compares this prime finite field for equality with the
* specified object.
* @param obj the object to be compared.
- * @return true if <code>obj</code> is an instance
+ * @return true if {@code obj} is an instance
* of ECFieldFp and the prime value match, false otherwise.
*/
public boolean equals(Object obj) {
--- a/jdk/src/share/classes/java/security/spec/ECGenParameterSpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/ECGenParameterSpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -41,13 +41,13 @@
/**
* Creates a parameter specification for EC parameter
* generation using a standard (or predefined) name
- * <code>stdName</code> in order to generate the corresponding
+ * {@code stdName} in order to generate the corresponding
* (precomputed) elliptic curve domain parameters. For the
* list of supported names, please consult the documentation
* of provider whose implementation will be used.
* @param stdName the standard name of the to-be-generated EC
* domain parameters.
- * @exception NullPointerException if <code>stdName</code>
+ * @exception NullPointerException if {@code stdName}
* is null.
*/
public ECGenParameterSpec(String stdName) {
--- a/jdk/src/share/classes/java/security/spec/ECParameterSpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/ECParameterSpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -49,12 +49,12 @@
* @param curve the elliptic curve which this parameter
* defines.
* @param g the generator which is also known as the base point.
- * @param n the order of the generator <code>g</code>.
+ * @param n the order of the generator {@code g}.
* @param h the cofactor.
- * @exception NullPointerException if <code>curve</code>,
- * <code>g</code>, or <code>n</code> is null.
- * @exception IllegalArgumentException if <code>n</code>
- * or <code>h</code> is not positive.
+ * @exception NullPointerException if {@code curve},
+ * {@code g}, or {@code n} is null.
+ * @exception IllegalArgumentException if {@code n}
+ * or {@code h} is not positive.
*/
public ECParameterSpec(EllipticCurve curve, ECPoint g,
BigInteger n, int h) {
--- a/jdk/src/share/classes/java/security/spec/ECPoint.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/ECPoint.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -54,11 +54,11 @@
/**
* Creates an ECPoint from the specified affine x-coordinate
- * <code>x</code> and affine y-coordinate <code>y</code>.
+ * {@code x} and affine y-coordinate {@code y}.
* @param x the affine x-coordinate.
* @param y the affine y-coordinate.
- * @exception NullPointerException if <code>x</code> or
- * <code>y</code> is null.
+ * @exception NullPointerException if {@code x} or
+ * {@code y} is null.
*/
public ECPoint(BigInteger x, BigInteger y) {
if ((x==null) || (y==null)) {
@@ -69,7 +69,7 @@
}
/**
- * Returns the affine x-coordinate <code>x</code>.
+ * Returns the affine x-coordinate {@code x}.
* Note: POINT_INFINITY has a null affine x-coordinate.
* @return the affine x-coordinate.
*/
@@ -78,7 +78,7 @@
}
/**
- * Returns the affine y-coordinate <code>y</code>.
+ * Returns the affine y-coordinate {@code y}.
* Note: POINT_INFINITY has a null affine y-coordinate.
* @return the affine y-coordinate.
*/
@@ -90,7 +90,7 @@
* Compares this elliptic curve point for equality with
* the specified object.
* @param obj the object to be compared.
- * @return true if <code>obj</code> is an instance of
+ * @return true if {@code obj} is an instance of
* ECPoint and the affine coordinates match, false otherwise.
*/
public boolean equals(Object obj) {
--- a/jdk/src/share/classes/java/security/spec/ECPrivateKeySpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/ECPrivateKeySpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -48,8 +48,8 @@
* @param s the private value.
* @param params the associated elliptic curve domain
* parameters.
- * @exception NullPointerException if <code>s</code>
- * or <code>params</code> is null.
+ * @exception NullPointerException if {@code s}
+ * or {@code params} is null.
*/
public ECPrivateKeySpec(BigInteger s, ECParameterSpec params) {
if (s == null) {
--- a/jdk/src/share/classes/java/security/spec/ECPublicKeySpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/ECPublicKeySpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -47,9 +47,9 @@
* @param w the public point.
* @param params the associated elliptic curve domain
* parameters.
- * @exception NullPointerException if <code>w</code>
- * or <code>params</code> is null.
- * @exception IllegalArgumentException if <code>w</code>
+ * @exception NullPointerException if {@code w}
+ * or {@code params} is null.
+ * @exception IllegalArgumentException if {@code w}
* is point at infinity, i.e. ECPoint.POINT_INFINITY
*/
public ECPublicKeySpec(ECPoint w, ECParameterSpec params) {
--- a/jdk/src/share/classes/java/security/spec/EllipticCurve.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/EllipticCurve.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -68,15 +68,15 @@
/**
* Creates an elliptic curve with the specified elliptic field
- * <code>field</code> and the coefficients <code>a</code> and
- * <code>b</code>.
+ * {@code field} and the coefficients {@code a} and
+ * {@code b}.
* @param field the finite field that this elliptic curve is over.
* @param a the first coefficient of this elliptic curve.
* @param b the second coefficient of this elliptic curve.
- * @exception NullPointerException if <code>field</code>,
- * <code>a</code>, or <code>b</code> is null.
- * @exception IllegalArgumentException if <code>a</code>
- * or <code>b</code> is not null and not in <code>field</code>.
+ * @exception NullPointerException if {@code field},
+ * {@code a}, or {@code b} is null.
+ * @exception IllegalArgumentException if {@code a}
+ * or {@code b} is not null and not in {@code field}.
*/
public EllipticCurve(ECField field, BigInteger a,
BigInteger b) {
@@ -85,18 +85,18 @@
/**
* Creates an elliptic curve with the specified elliptic field
- * <code>field</code>, the coefficients <code>a</code> and
- * <code>b</code>, and the <code>seed</code> used for curve generation.
+ * {@code field}, the coefficients {@code a} and
+ * {@code b}, and the {@code seed} used for curve generation.
* @param field the finite field that this elliptic curve is over.
* @param a the first coefficient of this elliptic curve.
* @param b the second coefficient of this elliptic curve.
* @param seed the bytes used during curve generation for later
* validation. Contents of this array are copied to protect against
* subsequent modification.
- * @exception NullPointerException if <code>field</code>,
- * <code>a</code>, or <code>b</code> is null.
- * @exception IllegalArgumentException if <code>a</code>
- * or <code>b</code> is not null and not in <code>field</code>.
+ * @exception NullPointerException if {@code field},
+ * {@code a}, or {@code b} is null.
+ * @exception IllegalArgumentException if {@code a}
+ * or {@code b} is not null and not in {@code field}.
*/
public EllipticCurve(ECField field, BigInteger a,
BigInteger b, byte[] seed) {
@@ -122,9 +122,9 @@
}
/**
- * Returns the finite field <code>field</code> that this
+ * Returns the finite field {@code field} that this
* elliptic curve is over.
- * @return the field <code>field</code> that this curve
+ * @return the field {@code field} that this curve
* is over.
*/
public ECField getField() {
@@ -132,27 +132,27 @@
}
/**
- * Returns the first coefficient <code>a</code> of the
+ * Returns the first coefficient {@code a} of the
* elliptic curve.
- * @return the first coefficient <code>a</code>.
+ * @return the first coefficient {@code a}.
*/
public BigInteger getA() {
return a;
}
/**
- * Returns the second coefficient <code>b</code> of the
+ * Returns the second coefficient {@code b} of the
* elliptic curve.
- * @return the second coefficient <code>b</code>.
+ * @return the second coefficient {@code b}.
*/
public BigInteger getB() {
return b;
}
/**
- * Returns the seeding bytes <code>seed</code> used
+ * Returns the seeding bytes {@code seed} used
* during curve generation. May be null if not specified.
- * @return the seeding bytes <code>seed</code>. A new
+ * @return the seeding bytes {@code seed}. A new
* array is returned each time this method is called.
*/
public byte[] getSeed() {
@@ -164,7 +164,7 @@
* Compares this elliptic curve for equality with the
* specified object.
* @param obj the object to be compared.
- * @return true if <code>obj</code> is an instance of
+ * @return true if {@code obj} is an instance of
* EllipticCurve and the field, A, and B match, false otherwise.
*/
public boolean equals(Object obj) {
--- a/jdk/src/share/classes/java/security/spec/EncodedKeySpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/EncodedKeySpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -49,7 +49,7 @@
*
* @param encodedKey the encoded key. The contents of the
* array are copied to protect against subsequent modification.
- * @exception NullPointerException if <code>encodedKey</code>
+ * @exception NullPointerException if {@code encodedKey}
* is null.
*/
public EncodedKeySpec(byte[] encodedKey) {
@@ -74,9 +74,9 @@
* (see {@link java.security.Key Key}) can be transformed
* (see {@link java.security.KeyFactory KeyFactory})
* into this key specification (or a subclass of it),
- * <code>getFormat</code> called
+ * {@code getFormat} called
* on the opaque key returns the same value as the
- * <code>getFormat</code> method
+ * {@code getFormat} method
* of this key specification.
*
* @return a string representation of the encoding format.
--- a/jdk/src/share/classes/java/security/spec/InvalidKeySpecException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/InvalidKeySpecException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -63,13 +63,13 @@
}
/**
- * Creates a <code>InvalidKeySpecException</code> with the specified
+ * Creates a {@code InvalidKeySpecException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -78,13 +78,13 @@
}
/**
- * Creates a <code>InvalidKeySpecException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code InvalidKeySpecException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/share/classes/java/security/spec/KeySpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/KeySpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -36,7 +36,7 @@
* <P> A key may be specified in an algorithm-specific way, or in an
* algorithm-independent encoding format (such as ASN.1).
* For example, a DSA private key may be specified by its components
- * <code>x</code>, <code>p</code>, <code>q</code>, and <code>g</code>
+ * {@code x}, {@code p}, {@code q}, and {@code g}
* (see {@link DSAPrivateKeySpec}), or it may be
* specified using its DER encoding
* (see {@link PKCS8EncodedKeySpec}).
--- a/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -92,7 +92,7 @@
*
* @param mdName the algorithm name for the message digest
* used in this mask generation function MGF1.
- * @exception NullPointerException if <code>mdName</code> is null.
+ * @exception NullPointerException if {@code mdName} is null.
*/
public MGF1ParameterSpec(String mdName) {
if (mdName == null) {
--- a/jdk/src/share/classes/java/security/spec/PKCS8EncodedKeySpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/PKCS8EncodedKeySpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,8 +27,8 @@
/**
* This class represents the ASN.1 encoding of a private key,
- * encoded according to the ASN.1 type <code>PrivateKeyInfo</code>.
- * The <code>PrivateKeyInfo</code> syntax is defined in the PKCS#8 standard
+ * encoded according to the ASN.1 type {@code PrivateKeyInfo}.
+ * The {@code PrivateKeyInfo} syntax is defined in the PKCS#8 standard
* as follows:
*
* <pre>
@@ -67,7 +67,7 @@
* @param encodedKey the key, which is assumed to be
* encoded according to the PKCS #8 standard. The contents of
* the array are copied to protect against subsequent modification.
- * @exception NullPointerException if <code>encodedKey</code>
+ * @exception NullPointerException if {@code encodedKey}
* is null.
*/
public PKCS8EncodedKeySpec(byte[] encodedKey) {
@@ -88,7 +88,7 @@
* Returns the name of the encoding format associated with this
* key specification.
*
- * @return the string <code>"PKCS#8"</code>.
+ * @return the string {@code "PKCS#8"}.
*/
public final String getFormat() {
return "PKCS#8";
--- a/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -91,14 +91,14 @@
public static final PSSParameterSpec DEFAULT = new PSSParameterSpec();
/**
- * Constructs a new <code>PSSParameterSpec</code> as defined in
+ * Constructs a new {@code PSSParameterSpec} as defined in
* the PKCS #1 standard using the default values.
*/
private PSSParameterSpec() {
}
/**
- * Creates a new <code>PSSParameterSpec</code> as defined in
+ * Creates a new {@code PSSParameterSpec} as defined in
* the PKCS #1 standard using the specified message digest,
* mask generation function, parameters for mask generation
* function, salt length, and trailer field values.
@@ -111,10 +111,10 @@
* getMGFParameters().
* @param saltLen the length of salt.
* @param trailerField the value of the trailer field.
- * @exception NullPointerException if <code>mdName</code>,
- * or <code>mgfName</code> is null.
- * @exception IllegalArgumentException if <code>saltLen</code>
- * or <code>trailerField</code> is less than 0.
+ * @exception NullPointerException if {@code mdName},
+ * or {@code mgfName} is null.
+ * @exception IllegalArgumentException if {@code saltLen}
+ * or {@code trailerField} is less than 0.
* @since 1.5
*/
public PSSParameterSpec(String mdName, String mgfName,
@@ -143,13 +143,13 @@
}
/**
- * Creates a new <code>PSSParameterSpec</code>
+ * Creates a new {@code PSSParameterSpec}
* using the specified salt length and other default values as
* defined in PKCS#1.
*
* @param saltLen the length of salt in bits to be used in PKCS#1
* PSS encoding.
- * @exception IllegalArgumentException if <code>saltLen</code> is
+ * @exception IllegalArgumentException if {@code saltLen} is
* less than 0.
*/
public PSSParameterSpec(int saltLen) {
--- a/jdk/src/share/classes/java/security/spec/RSAKeyGenParameterSpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/RSAKeyGenParameterSpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -55,7 +55,7 @@
public static final BigInteger F4 = BigInteger.valueOf(65537);
/**
- * Constructs a new <code>RSAParameterSpec</code> object from the
+ * Constructs a new {@code RSAParameterSpec} object from the
* given keysize and public-exponent value.
*
* @param keysize the modulus size (specified in number of bits)
--- a/jdk/src/share/classes/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -57,12 +57,12 @@
private final RSAOtherPrimeInfo otherPrimeInfo[];
/**
- * Creates a new <code>RSAMultiPrimePrivateCrtKeySpec</code>
+ * Creates a new {@code RSAMultiPrimePrivateCrtKeySpec}
* given the modulus, publicExponent, privateExponent,
* primeP, primeQ, primeExponentP, primeExponentQ,
* crtCoefficient, and otherPrimeInfo as defined in PKCS#1 v2.1.
*
- * <p>Note that the contents of <code>otherPrimeInfo</code>
+ * <p>Note that the contents of {@code otherPrimeInfo}
* are copied to protect against subsequent modification when
* constructing this object.
*
@@ -78,13 +78,13 @@
* @param otherPrimeInfo triplets of the rest of primes, null can be
* specified if there are only two prime factors (p and q).
* @exception NullPointerException if any of the parameters, i.e.
- * <code>modulus</code>,
- * <code>publicExponent</code>, <code>privateExponent</code>,
- * <code>primeP</code>, <code>primeQ</code>,
- * <code>primeExponentP</code>, <code>primeExponentQ</code>,
- * <code>crtCoefficient</code>, is null.
+ * {@code modulus},
+ * {@code publicExponent}, {@code privateExponent},
+ * {@code primeP}, {@code primeQ},
+ * {@code primeExponentP}, {@code primeExponentQ},
+ * {@code crtCoefficient}, is null.
* @exception IllegalArgumentException if an empty, i.e. 0-length,
- * <code>otherPrimeInfo</code> is specified.
+ * {@code otherPrimeInfo} is specified.
*/
public RSAMultiPrimePrivateCrtKeySpec(BigInteger modulus,
BigInteger publicExponent,
--- a/jdk/src/share/classes/java/security/spec/RSAOtherPrimeInfo.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/RSAOtherPrimeInfo.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -58,7 +58,7 @@
/**
- * Creates a new <code>RSAOtherPrimeInfo</code>
+ * Creates a new {@code RSAOtherPrimeInfo}
* given the prime, primeExponent, and
* crtCoefficient as defined in PKCS#1.
*
@@ -67,8 +67,8 @@
* @param crtCoefficient the Chinese Remainder Theorem
* coefficient.
* @exception NullPointerException if any of the parameters, i.e.
- * <code>prime</code>, <code>primeExponent</code>,
- * <code>crtCoefficient</code>, is null.
+ * {@code prime}, {@code primeExponent},
+ * {@code crtCoefficient}, is null.
*
*/
public RSAOtherPrimeInfo(BigInteger prime,
--- a/jdk/src/share/classes/java/security/spec/RSAPrivateCrtKeySpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/RSAPrivateCrtKeySpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -55,7 +55,7 @@
/**
- * Creates a new <code>RSAPrivateCrtKeySpec</code>
+ * Creates a new {@code RSAPrivateCrtKeySpec}
* given the modulus, publicExponent, privateExponent,
* primeP, primeQ, primeExponentP, primeExponentQ, and
* crtCoefficient as defined in PKCS#1.
--- a/jdk/src/share/classes/java/security/spec/X509EncodedKeySpec.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/X509EncodedKeySpec.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,8 +27,8 @@
/**
* This class represents the ASN.1 encoding of a public key,
- * encoded according to the ASN.1 type <code>SubjectPublicKeyInfo</code>.
- * The <code>SubjectPublicKeyInfo</code> syntax is defined in the X.509
+ * encoded according to the ASN.1 type {@code SubjectPublicKeyInfo}.
+ * The {@code SubjectPublicKeyInfo} syntax is defined in the X.509
* standard as follows:
*
* <pre>
@@ -57,7 +57,7 @@
* @param encodedKey the key, which is assumed to be
* encoded according to the X.509 standard. The contents of the
* array are copied to protect against subsequent modification.
- * @exception NullPointerException if <code>encodedKey</code>
+ * @exception NullPointerException if {@code encodedKey}
* is null.
*/
public X509EncodedKeySpec(byte[] encodedKey) {
@@ -78,7 +78,7 @@
* Returns the name of the encoding format associated with this
* key specification.
*
- * @return the string <code>"X.509"</code>.
+ * @return the string {@code "X.509"}.
*/
public final String getFormat() {
return "X.509";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/security/spec/package-info.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 1998, 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. 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.
+ */
+
+/**
+ * Provides classes and interfaces for key specifications and algorithm
+ * parameter specifications.
+ *
+ * <p>A key specification is a transparent representation of the key material
+ * that constitutes a key. A key may be specified in an algorithm-specific
+ * way, or in an algorithm-independent encoding format (such as ASN.1).
+ * This package contains key specifications for DSA public and private keys,
+ * RSA public and private keys, PKCS #8 private keys in DER-encoded format,
+ * and X.509 public and private keys in DER-encoded format.
+ *
+ * <p>An algorithm parameter specification is a transparent representation
+ * of the sets of parameters used with an algorithm. This package contains
+ * an algorithm parameter specification for parameters used with the
+ * DSA algorithm.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>PKCS #1: RSA Encryption Standard, Version 1.5, November 1993</li>
+ * <li>PKCS #8: Private-Key Information Syntax Standard,
+ * Version 1.2, November 1993</li>
+ * <li>Federal Information Processing Standards Publication (FIPS PUB) 186:
+ * Digital Signature Standard (DSS)</li>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * For documentation that includes information about algorithm parameter
+ * and key specifications, please see:
+ * <ul>
+ * <li>
+ * <a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
+ * <b>Java™
+ * Cryptography Architecture API Specification and Reference
+ * </b></a></li>
+ * <li>
+ * <a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
+ * <b>How to Implement a Provider for the
+ * Java™ Cryptography Architecture
+ * </b></a></li>
+ * </ul>
+ *
+ * @since 1.2
+ */
+package java.security.spec;
--- a/jdk/src/share/classes/java/security/spec/package.html Tue Jul 02 15:20:55 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 1998, 2006, 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.
--->
-
-</head>
-<body bgcolor="white">
-
-Provides classes and interfaces for key specifications and algorithm
-parameter specifications.
-
-<p>A key specification is a transparent representation of the key material
-that constitutes a key. A key may be specified in an algorithm-specific
-way, or in an algorithm-independent encoding format (such as ASN.1).
-This package contains key specifications for DSA public and private keys,
-RSA public and private keys, PKCS #8 private keys in DER-encoded format,
-and X.509 public and private keys in DER-encoded format.
-
-<p>An algorithm parameter specification is a transparent representation
-of the sets of parameters used with an algorithm. This package contains
-an algorithm parameter specification for parameters used with the
-DSA algorithm.
-
-<h2>Package Specification</h2>
-
-<ul>
- <li>PKCS #1: RSA Encryption Standard, Version 1.5, November 1993</li>
- <li>PKCS #8: Private-Key Information Syntax Standard,
- Version 1.2, November 1993</li>
- <li>Federal Information Processing Standards Publication (FIPS PUB) 186:
- Digital Signature Standard (DSS)</li>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For documentation that includes information about algorithm parameter
-and key specifications, please see:
-<ul>
- <li>
- <a href=
- "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- <b>Java<FONT SIZE=-2><SUP>TM</SUP></FONT>
- Cryptography Architecture API Specification and Reference
- </b></a></li>
- <li>
- <a href=
- "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- <b>How to Implement a Provider for the
- Java<FONT SIZE=-2><SUP>TM</SUP></FONT> Cryptography Architecture
- </b></a></li>
-</ul>
-
-@since 1.2
-</body>
-</html>
--- a/jdk/src/share/classes/java/sql/Blob.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/Blob.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -29,7 +29,7 @@
/**
* The representation (mapping) in
- * the Java<sup><font size=-2>TM</font></sup> programming
+ * the Java™ programming
* language of an SQL
* <code>BLOB</code> value. An SQL <code>BLOB</code> is a built-in type
* that stores a Binary Large Object as a column value in a row of
--- a/jdk/src/share/classes/java/sql/CallableStatement.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/CallableStatement.java Tue Jul 02 15:23:23 2013 -0700
@@ -2445,6 +2445,7 @@
* @param parameterIndex the first parameter is 1, the second is 2, and so on
* @param type Class representing the Java data type to convert the
* designated parameter to.
+ * @param <T> the type of the class modeled by this Class object
* @return an instance of {@code type} holding the OUT parameter value
* @throws SQLException if conversion is not supported, type is null or
* another error occurs. The getCause() method of the
@@ -2473,6 +2474,7 @@
* @param parameterName the name of the parameter
* @param type Class representing the Java data type to convert
* the designated parameter to.
+ * @param <T> the type of the class modeled by this Class object
* @return an instance of {@code type} holding the OUT parameter
* value
* @throws SQLException if conversion is not supported, type is null or
--- a/jdk/src/share/classes/java/sql/Clob.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/Clob.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -28,7 +28,7 @@
import java.io.Reader;
/**
- * The mapping in the Java<sup><font size=-2>TM</font></sup> programming language
+ * The mapping in the Java™ programming language
* for the SQL <code>CLOB</code> type.
* An SQL <code>CLOB</code> is a built-in type
* that stores a Character Large Object as a column value in a row of
--- a/jdk/src/share/classes/java/sql/DatabaseMetaData.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/DatabaseMetaData.java Tue Jul 02 15:23:23 2013 -0700
@@ -31,7 +31,7 @@
* <P>
* This interface is implemented by driver vendors to let users know the capabilities
* of a Database Management System (DBMS) in combination with
- * the driver based on JDBC<sup><font size=-2>TM</font></sup> technology
+ * the driver based on JDBC™ technology
* ("JDBC driver") that is used with it. Different relational DBMSs often support
* different features, implement features in different ways, and use different
* data types. In addition, a driver may implement a feature on top of what the
@@ -3074,7 +3074,7 @@
*
* @param holdability one of the following constants:
* <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
- * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT<code>
+ * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
* @return <code>true</code> if so; <code>false</code> otherwise
* @exception SQLException if a database access error occurs
* @see Connection
--- a/jdk/src/share/classes/java/sql/Driver.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/Driver.java Tue Jul 02 15:23:23 2013 -0700
@@ -144,7 +144,7 @@
/**
* Reports whether this driver is a genuine JDBC
- * Compliant<sup><font size=-2>TM</font></sup> driver.
+ * Compliant™ driver.
* A driver may only report <code>true</code> here if it passes the JDBC
* compliance tests; otherwise it is required to return <code>false</code>.
* <P>
@@ -173,7 +173,8 @@
* In the worst case, this may be the root Logger.
*
* @return the parent Logger for this driver
- * @throws SQLFeatureNotSupportedException if the driver does not use <code>java.util.logging<code>.
+ * @throws SQLFeatureNotSupportedException if the driver does not use
+ * {@code java.util.logging}.
* @since 1.7
*/
public Logger getParentLogger() throws SQLFeatureNotSupportedException;
--- a/jdk/src/share/classes/java/sql/DriverAction.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/DriverAction.java Tue Jul 02 15:23:23 2013 -0700
@@ -33,7 +33,7 @@
* directly by applications. A JDBC Driver may choose
* to create its {@code DriverAction} implementation in a private class
* to avoid it being called directly.
- * <o>
+ * <p>
* The JDBC driver's static initialization block must call
* {@linkplain DriverManager#registerDriver(java.sql.Driver, java.sql.DriverAction) } in order
* to inform {@code DriverManager} which {@code DriverAction} implementation to
--- a/jdk/src/share/classes/java/sql/NClob.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/NClob.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -28,7 +28,7 @@
import java.sql.Clob;
/**
- * The mapping in the Java<sup><font size=-2>TM</font></sup> programming language
+ * The mapping in the Java™ programming language
* for the SQL <code>NCLOB</code> type.
* An SQL <code>NCLOB</code> is a built-in type
* that stores a Character Large Object using the National Character Set
--- a/jdk/src/share/classes/java/sql/ResultSet.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/ResultSet.java Tue Jul 02 15:23:23 2013 -0700
@@ -90,7 +90,7 @@
* the intended columns, which can be assured with the SQL <i>AS</i> clause.
* <P>
* A set of updater methods were added to this interface
- * in the JDBC 2.0 API (Java<sup><font size=-2>TM</font></sup> 2 SDK,
+ * in the JDBC 2.0 API (Java™ 2 SDK,
* Standard Edition, version 1.2). The comments regarding parameters
* to the getter methods also apply to parameters to the
* updater methods.
@@ -148,7 +148,7 @@
public interface ResultSet extends Wrapper, AutoCloseable {
/**
- * Moves the cursor froward one row from its current position.
+ * Moves the cursor forward one row from its current position.
* A <code>ResultSet</code> cursor is initially positioned
* before the first row; the first call to the method
* <code>next</code> makes the first row the current row; the
@@ -4101,7 +4101,7 @@
* Appendix B, Table B-3 and conversion of appropriate user defined SQL
* types to a Java type which implements {@code SQLData}, or {@code Struct}.
* Additional conversions may be supported and are vendor defined.
- *
+ * @param <T> the type of the class modeled by this Class object
* @param columnIndex the first column is 1, the second is 2, ...
* @param type Class representing the Java data type to convert the designated
* column to.
@@ -4135,6 +4135,7 @@
* of the column
* @param type Class representing the Java data type to convert the designated
* column to.
+ * @param <T> the type of the class modeled by this Class object
* @return an instance of {@code type} holding the column value
* @throws SQLException if conversion is not supported, type is null or
* another error occurs. The getCause() method of the
@@ -4208,6 +4209,7 @@
* @param columnLabel the label for the column specified with the SQL AS
* clause. If the SQL AS clause was not specified, then the label is
* the name of the column
+ * @param x the new column value
* @param targetSqlType the SQL type to be sent to the database
* @param scaleOrLength for an object of {@code java.math.BigDecimal} ,
* this is the number of digits after the decimal point. For
--- a/jdk/src/share/classes/java/sql/SQLInput.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLInput.java Tue Jul 02 15:23:23 2013 -0700
@@ -444,6 +444,7 @@
*<p>
* The default implementation will throw {@code SQLFeatureNotSupportedException}
*
+ * @param <T> the type of the class modeled by this Class object
* @param type Class representing the Java data type to convert the attribute to.
* @return the attribute at the head of the stream as an {@code Object} in the
* Java programming language;{@code null} if the attribute is SQL {@code NULL}
--- a/jdk/src/share/classes/java/sql/SQLPermission.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLPermission.java Tue Jul 02 15:23:23 2013 -0700
@@ -103,7 +103,6 @@
* <td>Permits an application to remove a JDBC driver from the list of
* registered Drivers and release its resources.</td>
* </tr>
- * </tr>
* </table>
*<p>
* @since 1.3
--- a/jdk/src/share/classes/java/sql/SQLXML.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLXML.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -360,6 +360,7 @@
* xmlReader.parse(saxSource.getInputSource());
* </pre>
*
+ * @param <T> the type of the class modeled by this Class object
* @param sourceClass The class of the source, or null.
* If the class is null, a vendor specifc Source implementation will be returned.
* The following classes are supported at a minimum:
@@ -401,6 +402,7 @@
* contentHandler.endDocument();
* </pre>
*
+ * @param <T> the type of the class modeled by this Class object
* @param resultClass The class of the result, or null.
* If resultClass is null, a vendor specific Result implementation will be returned.
* The following classes are supported at a minimum:
--- a/jdk/src/share/classes/java/sql/Wrapper.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/sql/Wrapper.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -53,6 +53,7 @@
* or a proxy for that result. If the receiver is not a
* wrapper and does not implement the interface, then an <code>SQLException</code> is thrown.
*
+ * @param <T> the type of the class modeled by this Class object
* @param iface A Class defining an interface that the result must implement.
* @return an object that implements the interface. May be a proxy for the actual implementing object.
* @throws java.sql.SQLException If no object found that implements the interface
--- a/jdk/src/share/classes/java/time/format/DateTimeFormatter.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/time/format/DateTimeFormatter.java Tue Jul 02 15:23:23 2013 -0700
@@ -1304,6 +1304,7 @@
* LocalTime time = parsed.query(LocalTime::from);
* Period extraDays = parsed.query(DateTimeFormatter.parsedExcessDays());
* </pre>
+ * @return a query that provides access to the excess days that were parsed
*/
public static final TemporalQuery<Period> parsedExcessDays() {
return PARSED_EXCESS_DAYS;
@@ -1344,6 +1345,7 @@
* // validate leap-second is correct and apply correct smoothing
* }
* </pre>
+ * @return a query that provides access to whether a leap-second was parsed
*/
public static final TemporalQuery<Boolean> parsedLeapSecond() {
return PARSED_LEAP_SECOND;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/ArrayPrefixHelpers.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,697 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util;
+
+/*
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.CountedCompleter;
+import java.util.function.BinaryOperator;
+import java.util.function.IntBinaryOperator;
+import java.util.function.LongBinaryOperator;
+import java.util.function.DoubleBinaryOperator;
+
+/**
+ * ForkJoin tasks to perform Arrays.parallelPrefix operations.
+ *
+ * @author Doug Lea
+ * @since 1.8
+ */
+class ArrayPrefixHelpers {
+ private ArrayPrefixHelpers() {}; // non-instantiable
+
+ /*
+ * Parallel prefix (aka cumulate, scan) task classes
+ * are based loosely on Guy Blelloch's original
+ * algorithm (http://www.cs.cmu.edu/~scandal/alg/scan.html):
+ * Keep dividing by two to threshold segment size, and then:
+ * Pass 1: Create tree of partial sums for each segment
+ * Pass 2: For each segment, cumulate with offset of left sibling
+ *
+ * This version improves performance within FJ framework mainly by
+ * allowing the second pass of ready left-hand sides to proceed
+ * even if some right-hand side first passes are still executing.
+ * It also combines first and second pass for leftmost segment,
+ * and skips the first pass for rightmost segment (whose result is
+ * not needed for second pass). It similarly manages to avoid
+ * requiring that users supply an identity basis for accumulations
+ * by tracking those segments/subtasks for which the first
+ * existing element is used as base.
+ *
+ * Managing this relies on ORing some bits in the pendingCount for
+ * phases/states: CUMULATE, SUMMED, and FINISHED. CUMULATE is the
+ * main phase bit. When false, segments compute only their sum.
+ * When true, they cumulate array elements. CUMULATE is set at
+ * root at beginning of second pass and then propagated down. But
+ * it may also be set earlier for subtrees with lo==0 (the left
+ * spine of tree). SUMMED is a one bit join count. For leafs, it
+ * is set when summed. For internal nodes, it becomes true when
+ * one child is summed. When the second child finishes summing,
+ * we then moves up tree to trigger the cumulate phase. FINISHED
+ * is also a one bit join count. For leafs, it is set when
+ * cumulated. For internal nodes, it becomes true when one child
+ * is cumulated. When the second child finishes cumulating, it
+ * then moves up tree, completing at the root.
+ *
+ * To better exploit locality and reduce overhead, the compute
+ * method loops starting with the current task, moving if possible
+ * to one of its subtasks rather than forking.
+ *
+ * As usual for this sort of utility, there are 4 versions, that
+ * are simple copy/paste/adapt variants of each other. (The
+ * double and int versions differ from long version soley by
+ * replacing "long" (with case-matching)).
+ */
+
+ // see above
+ static final int CUMULATE = 1;
+ static final int SUMMED = 2;
+ static final int FINISHED = 4;
+
+ /** The smallest subtask array partition size to use as threshold */
+ static final int MIN_PARTITION = 16;
+
+ static final class CumulateTask<T> extends CountedCompleter<Void> {
+ final T[] array;
+ final BinaryOperator<T> function;
+ CumulateTask<T> left, right;
+ T in, out;
+ final int lo, hi, origin, fence, threshold;
+
+ /** Root task constructor */
+ public CumulateTask(CumulateTask<T> parent,
+ BinaryOperator<T> function,
+ T[] array, int lo, int hi) {
+ super(parent);
+ this.function = function; this.array = array;
+ this.lo = this.origin = lo; this.hi = this.fence = hi;
+ int p;
+ this.threshold =
+ (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
+ <= MIN_PARTITION ? MIN_PARTITION : p;
+ }
+
+ /** Subtask constructor */
+ CumulateTask(CumulateTask<T> parent, BinaryOperator<T> function,
+ T[] array, int origin, int fence, int threshold,
+ int lo, int hi) {
+ super(parent);
+ this.function = function; this.array = array;
+ this.origin = origin; this.fence = fence;
+ this.threshold = threshold;
+ this.lo = lo; this.hi = hi;
+ }
+
+ public final void compute() {
+ final BinaryOperator<T> fn;
+ final T[] a;
+ if ((fn = this.function) == null || (a = this.array) == null)
+ throw new NullPointerException(); // hoist checks
+ int th = threshold, org = origin, fnc = fence, l, h;
+ CumulateTask<T> t = this;
+ outer: while ((l = t.lo) >= 0 && (h = t.hi) <= a.length) {
+ if (h - l > th) {
+ CumulateTask<T> lt = t.left, rt = t.right, f;
+ if (lt == null) { // first pass
+ int mid = (l + h) >>> 1;
+ f = rt = t.right =
+ new CumulateTask<T>(t, fn, a, org, fnc, th, mid, h);
+ t = lt = t.left =
+ new CumulateTask<T>(t, fn, a, org, fnc, th, l, mid);
+ }
+ else { // possibly refork
+ T pin = t.in;
+ lt.in = pin;
+ f = t = null;
+ if (rt != null) {
+ T lout = lt.out;
+ rt.in = (l == org ? lout :
+ fn.apply(pin, lout));
+ for (int c;;) {
+ if (((c = rt.getPendingCount()) & CUMULATE) != 0)
+ break;
+ if (rt.compareAndSetPendingCount(c, c|CUMULATE)){
+ t = rt;
+ break;
+ }
+ }
+ }
+ for (int c;;) {
+ if (((c = lt.getPendingCount()) & CUMULATE) != 0)
+ break;
+ if (lt.compareAndSetPendingCount(c, c|CUMULATE)) {
+ if (t != null)
+ f = t;
+ t = lt;
+ break;
+ }
+ }
+ if (t == null)
+ break;
+ }
+ if (f != null)
+ f.fork();
+ }
+ else {
+ int state; // Transition to sum, cumulate, or both
+ for (int b;;) {
+ if (((b = t.getPendingCount()) & FINISHED) != 0)
+ break outer; // already done
+ state = ((b & CUMULATE) != 0? FINISHED :
+ (l > org) ? SUMMED : (SUMMED|FINISHED));
+ if (t.compareAndSetPendingCount(b, b|state))
+ break;
+ }
+
+ T sum;
+ if (state != SUMMED) {
+ int first;
+ if (l == org) { // leftmost; no in
+ sum = a[org];
+ first = org + 1;
+ }
+ else {
+ sum = t.in;
+ first = l;
+ }
+ for (int i = first; i < h; ++i) // cumulate
+ a[i] = sum = fn.apply(sum, a[i]);
+ }
+ else if (h < fnc) { // skip rightmost
+ sum = a[l];
+ for (int i = l + 1; i < h; ++i) // sum only
+ sum = fn.apply(sum, a[i]);
+ }
+ else
+ sum = t.in;
+ t.out = sum;
+ for (CumulateTask<T> par;;) { // propagate
+ if ((par = (CumulateTask<T>)t.getCompleter()) == null) {
+ if ((state & FINISHED) != 0) // enable join
+ t.quietlyComplete();
+ break outer;
+ }
+ int b = par.getPendingCount();
+ if ((b & state & FINISHED) != 0)
+ t = par; // both done
+ else if ((b & state & SUMMED) != 0) { // both summed
+ int nextState; CumulateTask<T> lt, rt;
+ if ((lt = par.left) != null &&
+ (rt = par.right) != null) {
+ T lout = lt.out;
+ par.out = (rt.hi == fnc ? lout :
+ fn.apply(lout, rt.out));
+ }
+ int refork = (((b & CUMULATE) == 0 &&
+ par.lo == org) ? CUMULATE : 0);
+ if ((nextState = b|state|refork) == b ||
+ par.compareAndSetPendingCount(b, nextState)) {
+ state = SUMMED; // drop finished
+ t = par;
+ if (refork != 0)
+ par.fork();
+ }
+ }
+ else if (par.compareAndSetPendingCount(b, b|state))
+ break outer; // sib not ready
+ }
+ }
+ }
+ }
+ }
+
+ static final class LongCumulateTask extends CountedCompleter<Void> {
+ final long[] array;
+ final LongBinaryOperator function;
+ LongCumulateTask left, right;
+ long in, out;
+ final int lo, hi, origin, fence, threshold;
+
+ /** Root task constructor */
+ public LongCumulateTask(LongCumulateTask parent,
+ LongBinaryOperator function,
+ long[] array, int lo, int hi) {
+ super(parent);
+ this.function = function; this.array = array;
+ this.lo = this.origin = lo; this.hi = this.fence = hi;
+ int p;
+ this.threshold =
+ (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
+ <= MIN_PARTITION ? MIN_PARTITION : p;
+ }
+
+ /** Subtask constructor */
+ LongCumulateTask(LongCumulateTask parent, LongBinaryOperator function,
+ long[] array, int origin, int fence, int threshold,
+ int lo, int hi) {
+ super(parent);
+ this.function = function; this.array = array;
+ this.origin = origin; this.fence = fence;
+ this.threshold = threshold;
+ this.lo = lo; this.hi = hi;
+ }
+
+ public final void compute() {
+ final LongBinaryOperator fn;
+ final long[] a;
+ if ((fn = this.function) == null || (a = this.array) == null)
+ throw new NullPointerException(); // hoist checks
+ int th = threshold, org = origin, fnc = fence, l, h;
+ LongCumulateTask t = this;
+ outer: while ((l = t.lo) >= 0 && (h = t.hi) <= a.length) {
+ if (h - l > th) {
+ LongCumulateTask lt = t.left, rt = t.right, f;
+ if (lt == null) { // first pass
+ int mid = (l + h) >>> 1;
+ f = rt = t.right =
+ new LongCumulateTask(t, fn, a, org, fnc, th, mid, h);
+ t = lt = t.left =
+ new LongCumulateTask(t, fn, a, org, fnc, th, l, mid);
+ }
+ else { // possibly refork
+ long pin = t.in;
+ lt.in = pin;
+ f = t = null;
+ if (rt != null) {
+ long lout = lt.out;
+ rt.in = (l == org ? lout :
+ fn.applyAsLong(pin, lout));
+ for (int c;;) {
+ if (((c = rt.getPendingCount()) & CUMULATE) != 0)
+ break;
+ if (rt.compareAndSetPendingCount(c, c|CUMULATE)){
+ t = rt;
+ break;
+ }
+ }
+ }
+ for (int c;;) {
+ if (((c = lt.getPendingCount()) & CUMULATE) != 0)
+ break;
+ if (lt.compareAndSetPendingCount(c, c|CUMULATE)) {
+ if (t != null)
+ f = t;
+ t = lt;
+ break;
+ }
+ }
+ if (t == null)
+ break;
+ }
+ if (f != null)
+ f.fork();
+ }
+ else {
+ int state; // Transition to sum, cumulate, or both
+ for (int b;;) {
+ if (((b = t.getPendingCount()) & FINISHED) != 0)
+ break outer; // already done
+ state = ((b & CUMULATE) != 0? FINISHED :
+ (l > org) ? SUMMED : (SUMMED|FINISHED));
+ if (t.compareAndSetPendingCount(b, b|state))
+ break;
+ }
+
+ long sum;
+ if (state != SUMMED) {
+ int first;
+ if (l == org) { // leftmost; no in
+ sum = a[org];
+ first = org + 1;
+ }
+ else {
+ sum = t.in;
+ first = l;
+ }
+ for (int i = first; i < h; ++i) // cumulate
+ a[i] = sum = fn.applyAsLong(sum, a[i]);
+ }
+ else if (h < fnc) { // skip rightmost
+ sum = a[l];
+ for (int i = l + 1; i < h; ++i) // sum only
+ sum = fn.applyAsLong(sum, a[i]);
+ }
+ else
+ sum = t.in;
+ t.out = sum;
+ for (LongCumulateTask par;;) { // propagate
+ if ((par = (LongCumulateTask)t.getCompleter()) == null) {
+ if ((state & FINISHED) != 0) // enable join
+ t.quietlyComplete();
+ break outer;
+ }
+ int b = par.getPendingCount();
+ if ((b & state & FINISHED) != 0)
+ t = par; // both done
+ else if ((b & state & SUMMED) != 0) { // both summed
+ int nextState; LongCumulateTask lt, rt;
+ if ((lt = par.left) != null &&
+ (rt = par.right) != null) {
+ long lout = lt.out;
+ par.out = (rt.hi == fnc ? lout :
+ fn.applyAsLong(lout, rt.out));
+ }
+ int refork = (((b & CUMULATE) == 0 &&
+ par.lo == org) ? CUMULATE : 0);
+ if ((nextState = b|state|refork) == b ||
+ par.compareAndSetPendingCount(b, nextState)) {
+ state = SUMMED; // drop finished
+ t = par;
+ if (refork != 0)
+ par.fork();
+ }
+ }
+ else if (par.compareAndSetPendingCount(b, b|state))
+ break outer; // sib not ready
+ }
+ }
+ }
+ }
+ }
+
+ static final class DoubleCumulateTask extends CountedCompleter<Void> {
+ final double[] array;
+ final DoubleBinaryOperator function;
+ DoubleCumulateTask left, right;
+ double in, out;
+ final int lo, hi, origin, fence, threshold;
+
+ /** Root task constructor */
+ public DoubleCumulateTask(DoubleCumulateTask parent,
+ DoubleBinaryOperator function,
+ double[] array, int lo, int hi) {
+ super(parent);
+ this.function = function; this.array = array;
+ this.lo = this.origin = lo; this.hi = this.fence = hi;
+ int p;
+ this.threshold =
+ (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
+ <= MIN_PARTITION ? MIN_PARTITION : p;
+ }
+
+ /** Subtask constructor */
+ DoubleCumulateTask(DoubleCumulateTask parent, DoubleBinaryOperator function,
+ double[] array, int origin, int fence, int threshold,
+ int lo, int hi) {
+ super(parent);
+ this.function = function; this.array = array;
+ this.origin = origin; this.fence = fence;
+ this.threshold = threshold;
+ this.lo = lo; this.hi = hi;
+ }
+
+ public final void compute() {
+ final DoubleBinaryOperator fn;
+ final double[] a;
+ if ((fn = this.function) == null || (a = this.array) == null)
+ throw new NullPointerException(); // hoist checks
+ int th = threshold, org = origin, fnc = fence, l, h;
+ DoubleCumulateTask t = this;
+ outer: while ((l = t.lo) >= 0 && (h = t.hi) <= a.length) {
+ if (h - l > th) {
+ DoubleCumulateTask lt = t.left, rt = t.right, f;
+ if (lt == null) { // first pass
+ int mid = (l + h) >>> 1;
+ f = rt = t.right =
+ new DoubleCumulateTask(t, fn, a, org, fnc, th, mid, h);
+ t = lt = t.left =
+ new DoubleCumulateTask(t, fn, a, org, fnc, th, l, mid);
+ }
+ else { // possibly refork
+ double pin = t.in;
+ lt.in = pin;
+ f = t = null;
+ if (rt != null) {
+ double lout = lt.out;
+ rt.in = (l == org ? lout :
+ fn.applyAsDouble(pin, lout));
+ for (int c;;) {
+ if (((c = rt.getPendingCount()) & CUMULATE) != 0)
+ break;
+ if (rt.compareAndSetPendingCount(c, c|CUMULATE)){
+ t = rt;
+ break;
+ }
+ }
+ }
+ for (int c;;) {
+ if (((c = lt.getPendingCount()) & CUMULATE) != 0)
+ break;
+ if (lt.compareAndSetPendingCount(c, c|CUMULATE)) {
+ if (t != null)
+ f = t;
+ t = lt;
+ break;
+ }
+ }
+ if (t == null)
+ break;
+ }
+ if (f != null)
+ f.fork();
+ }
+ else {
+ int state; // Transition to sum, cumulate, or both
+ for (int b;;) {
+ if (((b = t.getPendingCount()) & FINISHED) != 0)
+ break outer; // already done
+ state = ((b & CUMULATE) != 0? FINISHED :
+ (l > org) ? SUMMED : (SUMMED|FINISHED));
+ if (t.compareAndSetPendingCount(b, b|state))
+ break;
+ }
+
+ double sum;
+ if (state != SUMMED) {
+ int first;
+ if (l == org) { // leftmost; no in
+ sum = a[org];
+ first = org + 1;
+ }
+ else {
+ sum = t.in;
+ first = l;
+ }
+ for (int i = first; i < h; ++i) // cumulate
+ a[i] = sum = fn.applyAsDouble(sum, a[i]);
+ }
+ else if (h < fnc) { // skip rightmost
+ sum = a[l];
+ for (int i = l + 1; i < h; ++i) // sum only
+ sum = fn.applyAsDouble(sum, a[i]);
+ }
+ else
+ sum = t.in;
+ t.out = sum;
+ for (DoubleCumulateTask par;;) { // propagate
+ if ((par = (DoubleCumulateTask)t.getCompleter()) == null) {
+ if ((state & FINISHED) != 0) // enable join
+ t.quietlyComplete();
+ break outer;
+ }
+ int b = par.getPendingCount();
+ if ((b & state & FINISHED) != 0)
+ t = par; // both done
+ else if ((b & state & SUMMED) != 0) { // both summed
+ int nextState; DoubleCumulateTask lt, rt;
+ if ((lt = par.left) != null &&
+ (rt = par.right) != null) {
+ double lout = lt.out;
+ par.out = (rt.hi == fnc ? lout :
+ fn.applyAsDouble(lout, rt.out));
+ }
+ int refork = (((b & CUMULATE) == 0 &&
+ par.lo == org) ? CUMULATE : 0);
+ if ((nextState = b|state|refork) == b ||
+ par.compareAndSetPendingCount(b, nextState)) {
+ state = SUMMED; // drop finished
+ t = par;
+ if (refork != 0)
+ par.fork();
+ }
+ }
+ else if (par.compareAndSetPendingCount(b, b|state))
+ break outer; // sib not ready
+ }
+ }
+ }
+ }
+ }
+
+ static final class IntCumulateTask extends CountedCompleter<Void> {
+ final int[] array;
+ final IntBinaryOperator function;
+ IntCumulateTask left, right;
+ int in, out;
+ final int lo, hi, origin, fence, threshold;
+
+ /** Root task constructor */
+ public IntCumulateTask(IntCumulateTask parent,
+ IntBinaryOperator function,
+ int[] array, int lo, int hi) {
+ super(parent);
+ this.function = function; this.array = array;
+ this.lo = this.origin = lo; this.hi = this.fence = hi;
+ int p;
+ this.threshold =
+ (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
+ <= MIN_PARTITION ? MIN_PARTITION : p;
+ }
+
+ /** Subtask constructor */
+ IntCumulateTask(IntCumulateTask parent, IntBinaryOperator function,
+ int[] array, int origin, int fence, int threshold,
+ int lo, int hi) {
+ super(parent);
+ this.function = function; this.array = array;
+ this.origin = origin; this.fence = fence;
+ this.threshold = threshold;
+ this.lo = lo; this.hi = hi;
+ }
+
+ public final void compute() {
+ final IntBinaryOperator fn;
+ final int[] a;
+ if ((fn = this.function) == null || (a = this.array) == null)
+ throw new NullPointerException(); // hoist checks
+ int th = threshold, org = origin, fnc = fence, l, h;
+ IntCumulateTask t = this;
+ outer: while ((l = t.lo) >= 0 && (h = t.hi) <= a.length) {
+ if (h - l > th) {
+ IntCumulateTask lt = t.left, rt = t.right, f;
+ if (lt == null) { // first pass
+ int mid = (l + h) >>> 1;
+ f = rt = t.right =
+ new IntCumulateTask(t, fn, a, org, fnc, th, mid, h);
+ t = lt = t.left =
+ new IntCumulateTask(t, fn, a, org, fnc, th, l, mid);
+ }
+ else { // possibly refork
+ int pin = t.in;
+ lt.in = pin;
+ f = t = null;
+ if (rt != null) {
+ int lout = lt.out;
+ rt.in = (l == org ? lout :
+ fn.applyAsInt(pin, lout));
+ for (int c;;) {
+ if (((c = rt.getPendingCount()) & CUMULATE) != 0)
+ break;
+ if (rt.compareAndSetPendingCount(c, c|CUMULATE)){
+ t = rt;
+ break;
+ }
+ }
+ }
+ for (int c;;) {
+ if (((c = lt.getPendingCount()) & CUMULATE) != 0)
+ break;
+ if (lt.compareAndSetPendingCount(c, c|CUMULATE)) {
+ if (t != null)
+ f = t;
+ t = lt;
+ break;
+ }
+ }
+ if (t == null)
+ break;
+ }
+ if (f != null)
+ f.fork();
+ }
+ else {
+ int state; // Transition to sum, cumulate, or both
+ for (int b;;) {
+ if (((b = t.getPendingCount()) & FINISHED) != 0)
+ break outer; // already done
+ state = ((b & CUMULATE) != 0? FINISHED :
+ (l > org) ? SUMMED : (SUMMED|FINISHED));
+ if (t.compareAndSetPendingCount(b, b|state))
+ break;
+ }
+
+ int sum;
+ if (state != SUMMED) {
+ int first;
+ if (l == org) { // leftmost; no in
+ sum = a[org];
+ first = org + 1;
+ }
+ else {
+ sum = t.in;
+ first = l;
+ }
+ for (int i = first; i < h; ++i) // cumulate
+ a[i] = sum = fn.applyAsInt(sum, a[i]);
+ }
+ else if (h < fnc) { // skip rightmost
+ sum = a[l];
+ for (int i = l + 1; i < h; ++i) // sum only
+ sum = fn.applyAsInt(sum, a[i]);
+ }
+ else
+ sum = t.in;
+ t.out = sum;
+ for (IntCumulateTask par;;) { // propagate
+ if ((par = (IntCumulateTask)t.getCompleter()) == null) {
+ if ((state & FINISHED) != 0) // enable join
+ t.quietlyComplete();
+ break outer;
+ }
+ int b = par.getPendingCount();
+ if ((b & state & FINISHED) != 0)
+ t = par; // both done
+ else if ((b & state & SUMMED) != 0) { // both summed
+ int nextState; IntCumulateTask lt, rt;
+ if ((lt = par.left) != null &&
+ (rt = par.right) != null) {
+ int lout = lt.out;
+ par.out = (rt.hi == fnc ? lout :
+ fn.applyAsInt(lout, rt.out));
+ }
+ int refork = (((b & CUMULATE) == 0 &&
+ par.lo == org) ? CUMULATE : 0);
+ if ((nextState = b|state|refork) == b ||
+ par.compareAndSetPendingCount(b, nextState)) {
+ state = SUMMED; // drop finished
+ t = par;
+ if (refork != 0)
+ par.fork();
+ }
+ }
+ else if (par.compareAndSetPendingCount(b, b|state))
+ break outer; // sib not ready
+ }
+ }
+ }
+ }
+ }
+
+
+}
\ No newline at end of file
--- a/jdk/src/share/classes/java/util/Arrays.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/Arrays.java Tue Jul 02 15:23:23 2013 -0700
@@ -1559,6 +1559,183 @@
}
}
+ // Parallel prefix
+
+ /**
+ * Cumulates, in parallel, each element of the given array in place,
+ * using the supplied function. For example if the array initially
+ * holds {@code [2, 1, 0, 3]} and the operation performs addition,
+ * then upon return the array holds {@code [2, 3, 3, 6]}.
+ * Parallel prefix computation is usually more efficient than
+ * sequential loops for large arrays.
+ *
+ * @param array the array, which is modified in-place by this method
+ * @param op a side-effect-free, associative function to perform the
+ * cumulation
+ * @throws NullPointerException if the specified array or function is null
+ * @since 1.8
+ */
+ public static <T> void parallelPrefix(T[] array, BinaryOperator<T> op) {
+ if (array.length > 0)
+ new ArrayPrefixHelpers.CumulateTask<>
+ (null, op, array, 0, array.length).invoke();
+ }
+
+ /**
+ * Performs {@link #parallelPrefix(Object[], BinaryOperator)}
+ * for the given subrange of the array.
+ *
+ * @param array the array
+ * @param fromIndex the index of the first element, inclusive
+ * @param toIndex the index of the last element, exclusive
+ * @param op a side-effect-free, associative function to perform the
+ * cumulation
+ * @throws IllegalArgumentException if {@code fromIndex > toIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code fromIndex < 0} or {@code toIndex > array.length}
+ * @throws NullPointerException if the specified array or function is null
+ * @since 1.8
+ */
+ public static <T> void parallelPrefix(T[] array, int fromIndex,
+ int toIndex, BinaryOperator<T> op) {
+ rangeCheck(array.length, fromIndex, toIndex);
+ if (fromIndex < toIndex)
+ new ArrayPrefixHelpers.CumulateTask<>
+ (null, op, array, fromIndex, toIndex).invoke();
+ }
+
+ /**
+ * Cumulates, in parallel, each element of the given array in place,
+ * using the supplied function. For example if the array initially
+ * holds {@code [2, 1, 0, 3]} and the operation performs addition,
+ * then upon return the array holds {@code [2, 3, 3, 6]}.
+ * Parallel prefix computation is usually more efficient than
+ * sequential loops for large arrays.
+ *
+ * @param array the array, which is modified in-place by this method
+ * @param op a side-effect-free, associative function to perform the
+ * cumulation
+ * @throws NullPointerException if the specified array or function is null
+ * @since 1.8
+ */
+ public static void parallelPrefix(long[] array, LongBinaryOperator op) {
+ if (array.length > 0)
+ new ArrayPrefixHelpers.LongCumulateTask
+ (null, op, array, 0, array.length).invoke();
+ }
+
+ /**
+ * Performs {@link #parallelPrefix(long[], LongBinaryOperator)}
+ * for the given subrange of the array.
+ *
+ * @param array the array
+ * @param fromIndex the index of the first element, inclusive
+ * @param toIndex the index of the last element, exclusive
+ * @param op a side-effect-free, associative function to perform the
+ * cumulation
+ * @throws IllegalArgumentException if {@code fromIndex > toIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code fromIndex < 0} or {@code toIndex > array.length}
+ * @throws NullPointerException if the specified array or function is null
+ * @since 1.8
+ */
+ public static void parallelPrefix(long[] array, int fromIndex,
+ int toIndex, LongBinaryOperator op) {
+ rangeCheck(array.length, fromIndex, toIndex);
+ if (fromIndex < toIndex)
+ new ArrayPrefixHelpers.LongCumulateTask
+ (null, op, array, fromIndex, toIndex).invoke();
+ }
+
+ /**
+ * Cumulates, in parallel, each element of the given array in place,
+ * using the supplied function. For example if the array initially
+ * holds {@code [2.0, 1.0, 0.0, 3.0]} and the operation performs addition,
+ * then upon return the array holds {@code [2.0, 3.0, 3.0, 6.0]}.
+ * Parallel prefix computation is usually more efficient than
+ * sequential loops for large arrays.
+ *
+ * <p> Because floating-point operations may not be strictly associative,
+ * the returned result may not be identical to the value that would be
+ * obtained if the operation was performed sequentially.
+ *
+ * @param array the array, which is modified in-place by this method
+ * @param op a side-effect-free function to perform the cumulation
+ * @throws NullPointerException if the specified array or function is null
+ * @since 1.8
+ */
+ public static void parallelPrefix(double[] array, DoubleBinaryOperator op) {
+ if (array.length > 0)
+ new ArrayPrefixHelpers.DoubleCumulateTask
+ (null, op, array, 0, array.length).invoke();
+ }
+
+ /**
+ * Performs {@link #parallelPrefix(double[], DoubleBinaryOperator)}
+ * for the given subrange of the array.
+ *
+ * @param array the array
+ * @param fromIndex the index of the first element, inclusive
+ * @param toIndex the index of the last element, exclusive
+ * @param op a side-effect-free, associative function to perform the
+ * cumulation
+ * @throws IllegalArgumentException if {@code fromIndex > toIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code fromIndex < 0} or {@code toIndex > array.length}
+ * @throws NullPointerException if the specified array or function is null
+ * @since 1.8
+ */
+ public static void parallelPrefix(double[] array, int fromIndex,
+ int toIndex, DoubleBinaryOperator op) {
+ rangeCheck(array.length, fromIndex, toIndex);
+ if (fromIndex < toIndex)
+ new ArrayPrefixHelpers.DoubleCumulateTask
+ (null, op, array, fromIndex, toIndex).invoke();
+ }
+
+ /**
+ * Cumulates, in parallel, each element of the given array in place,
+ * using the supplied function. For example if the array initially
+ * holds {@code [2, 1, 0, 3]} and the operation performs addition,
+ * then upon return the array holds {@code [2, 3, 3, 6]}.
+ * Parallel prefix computation is usually more efficient than
+ * sequential loops for large arrays.
+ *
+ * @param array the array, which is modified in-place by this method
+ * @param op a side-effect-free, associative function to perform the
+ * cumulation
+ * @throws NullPointerException if the specified array or function is null
+ * @since 1.8
+ */
+ public static void parallelPrefix(int[] array, IntBinaryOperator op) {
+ if (array.length > 0)
+ new ArrayPrefixHelpers.IntCumulateTask
+ (null, op, array, 0, array.length).invoke();
+ }
+
+ /**
+ * Performs {@link #parallelPrefix(int[], IntBinaryOperator)}
+ * for the given subrange of the array.
+ *
+ * @param array the array
+ * @param fromIndex the index of the first element, inclusive
+ * @param toIndex the index of the last element, exclusive
+ * @param op a side-effect-free, associative function to perform the
+ * cumulation
+ * @throws IllegalArgumentException if {@code fromIndex > toIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code fromIndex < 0} or {@code toIndex > array.length}
+ * @throws NullPointerException if the specified array or function is null
+ * @since 1.8
+ */
+ public static void parallelPrefix(int[] array, int fromIndex,
+ int toIndex, IntBinaryOperator op) {
+ rangeCheck(array.length, fromIndex, toIndex);
+ if (fromIndex < toIndex)
+ new ArrayPrefixHelpers.IntCumulateTask
+ (null, op, array, fromIndex, toIndex).invoke();
+ }
+
// Searching
/**
--- a/jdk/src/share/classes/java/util/Collections.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/Collections.java Tue Jul 02 15:23:23 2013 -0700
@@ -4304,6 +4304,11 @@
}
private Object readResolve() { return Collections.reverseOrder(); }
+
+ @Override
+ public Comparator<Comparable<Object>> reversed() {
+ return Comparator.naturalOrder();
+ }
}
/**
@@ -4367,6 +4372,11 @@
public int hashCode() {
return cmp.hashCode() ^ Integer.MIN_VALUE;
}
+
+ @Override
+ public Comparator<T> reversed() {
+ return cmp;
+ }
}
/**
--- a/jdk/src/share/classes/java/util/Comparator.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/Comparator.java Tue Jul 02 15:23:23 2013 -0700
@@ -25,10 +25,12 @@
package java.util;
+import java.io.Serializable;
import java.util.function.Function;
import java.util.function.ToIntFunction;
import java.util.function.ToLongFunction;
import java.util.function.ToDoubleFunction;
+import java.util.Comparators;
/**
* A comparison function, which imposes a <i>total ordering</i> on some
@@ -175,88 +177,357 @@
* Returns a comparator that imposes the reverse ordering of this
* comparator.
*
- * @return A comparator that imposes the reverse ordering of this
+ * @return a comparator that imposes the reverse ordering of this
* comparator.
* @since 1.8
*/
- default Comparator<T> reverseOrder() {
+ default Comparator<T> reversed() {
return Collections.reverseOrder(this);
}
/**
- * Constructs a lexicographic order comparator with another comparator.
- * For example, a {@code Comparator<Person> byLastName} can be composed
- * with another {@code Comparator<Person> byFirstName}, then {@code
- * byLastName.thenComparing(byFirstName)} creates a {@code
- * Comparator<Person>} which sorts by last name, and for equal last names
- * sorts by first name.
+ * Returns a lexicographic-order comparator with another comparator.
+ * If this {@code Comparator} considers two elements equal, i.e.
+ * {@code compare(a, b) == 0}, {@code other} is used to determine the order.
+ *
+ * <p>The returned comparator is serializable if the specified comparator
+ * is also serializable.
*
- * @param other the other comparator used when equals on this.
+ * @apiNote
+ * For example, to sort a collection of {@code String} based on the length
+ * and then case-insensitive natural ordering, the comparator can be
+ * composed using following code,
+ *
+ * <pre>{@code
+ * Comparator<String> cmp = Comparator.comparing(String::length)
+ * .thenComparing(String.CASE_INSENSITIVE_ORDER);
+ * }</pre>
+ *
+ * @param other the other comparator to be used when this comparator
+ * compares two objects that are equal.
+ * @return a lexicographic-order comparator composed of this and then the
+ * other comparator
* @throws NullPointerException if the argument is null.
* @since 1.8
*/
default Comparator<T> thenComparing(Comparator<? super T> other) {
- return Comparators.compose(this, other);
+ Objects.requireNonNull(other);
+ return (Comparator<T> & Serializable) (c1, c2) -> {
+ int res = compare(c1, c2);
+ return (res != 0) ? res : other.compare(c1, c2);
+ };
+ }
+
+ /**
+ * Returns a lexicographic-order comparator with a function that
+ * extracts a key to be compared with the given {@code Comparator}.
+ *
+ * @implSpec This default implementation behaves as if {@code
+ * thenComparing(comparing(keyExtractor, cmp))}.
+ *
+ * @param <U> the type of the sort key
+ * @param keyExtractor the function used to extract the sort key
+ * @param keyComparator the {@code Comparator} used to compare the sort key
+ * @return a lexicographic-order comparator composed of this comparator
+ * and then comparing on the key extracted by the keyExtractor function
+ * @throws NullPointerException if the argument is null.
+ * @see #comparing(Function, Comparator)
+ * @see #thenComparing(Comparator)
+ * @since 1.8
+ */
+ default <U extends Comparable<? super U>> Comparator<T> thenComparing(
+ Function<? super T, ? extends U> keyExtractor,
+ Comparator<? super U> keyComparator)
+ {
+ return thenComparing(comparing(keyExtractor, keyComparator));
}
/**
- * Constructs a lexicographic order comparator with a function that
- * extracts a {@code Comparable} key. This default implementation calls
- * {@code thenComparing(this, Comparators.comparing(keyExtractor))}.
+ * Returns a lexicographic-order comparator with a function that
+ * extracts a {@code Comparable} sort key.
+ *
+ * @implSpec This default implementation behaves as if {@code
+ * thenComparing(comparing(keyExtractor))}.
*
- * @param <U> the {@link Comparable} type for comparison
- * @param keyExtractor the function used to extract the {@link Comparable} sort key
+ * @param <U> the type of the {@link Comparable} sort key
+ * @param keyExtractor the function used to extract the {@link
+ * Comparable} sort key
+ * @return a lexicographic-order comparator composed of this and then the
+ * {@link Comparable} sort key.
* @throws NullPointerException if the argument is null.
- * @see Comparators#comparing(Function)
+ * @see #comparing(Function)
* @see #thenComparing(Comparator)
* @since 1.8
*/
- default <U extends Comparable<? super U>> Comparator<T> thenComparing(Function<? super T, ? extends U> keyExtractor) {
- return thenComparing(Comparators.comparing(keyExtractor));
+ default <U extends Comparable<? super U>> Comparator<T> thenComparing(
+ Function<? super T, ? extends U> keyExtractor)
+ {
+ return thenComparing(comparing(keyExtractor));
}
/**
- * Constructs a lexicographic order comparator with a function that
- * extracts a {@code int} value. This default implementation calls {@code
- * thenComparing(this, Comparators.comparing(keyExtractor))}.
+ * Returns a lexicographic-order comparator with a function that
+ * extracts a {@code int} sort key.
+ *
+ * @implSpec This default implementation behaves as if {@code
+ * thenComparing(comparing(keyExtractor))}.
*
- * @param keyExtractor the function used to extract the integer value
+ * @param keyExtractor the function used to extract the integer sort key
+ * @return a lexicographic-order comparator composed of this and then the
+ * {@code int} sort key
* @throws NullPointerException if the argument is null.
- * @see Comparators#comparing(ToIntFunction)
+ * @see #comparing(ToIntFunction)
* @see #thenComparing(Comparator)
* @since 1.8
*/
default Comparator<T> thenComparing(ToIntFunction<? super T> keyExtractor) {
- return thenComparing(Comparators.comparing(keyExtractor));
+ return thenComparing(comparing(keyExtractor));
}
/**
- * Constructs a lexicographic order comparator with a function that
- * extracts a {@code long} value. This default implementation calls
- * {@code thenComparing(this, Comparators.comparing(keyExtractor))}.
+ * Returns a lexicographic-order comparator with a function that
+ * extracts a {@code long} sort key.
+ *
+ * @implSpec This default implementation behaves as if {@code
+ * thenComparing(comparing(keyExtractor))}.
*
- * @param keyExtractor the function used to extract the long value
+ * @param keyExtractor the function used to extract the long sort key
+ * @return a lexicographic-order comparator composed of this and then the
+ * {@code long} sort key
* @throws NullPointerException if the argument is null.
- * @see Comparators#comparing(ToLongFunction)
+ * @see #comparing(ToLongFunction)
* @see #thenComparing(Comparator)
* @since 1.8
*/
default Comparator<T> thenComparing(ToLongFunction<? super T> keyExtractor) {
- return thenComparing(Comparators.comparing(keyExtractor));
+ return thenComparing(comparing(keyExtractor));
}
/**
- * Constructs a lexicographic order comparator with a function that
- * extracts a {@code double} value. This default implementation calls
- * {@code thenComparing(this, Comparators.comparing(keyExtractor))}.
+ * Returns a lexicographic-order comparator with a function that
+ * extracts a {@code double} sort key.
+ *
+ * @implSpec This default implementation behaves as if {@code
+ * thenComparing(comparing(keyExtractor))}.
*
- * @param keyExtractor the function used to extract the double value
+ * @param keyExtractor the function used to extract the double sort key
+ * @return a lexicographic-order comparator composed of this and then the
+ * {@code double} sort key
* @throws NullPointerException if the argument is null.
- * @see Comparators#comparing(ToDoubleFunction)
+ * @see #comparing(ToDoubleFunction)
* @see #thenComparing(Comparator)
* @since 1.8
*/
default Comparator<T> thenComparing(ToDoubleFunction<? super T> keyExtractor) {
- return thenComparing(Comparators.comparing(keyExtractor));
+ return thenComparing(comparing(keyExtractor));
+ }
+
+ /**
+ * Returns a comparator that imposes the reverse of the <em>natural
+ * ordering</em>.
+ *
+ * <p>The returned comparator is serializable and throws {@link
+ * NullPointerException} when comparing {@code null}.
+ *
+ * @param <T> the {@link Comparable} type of element to be compared
+ * @return a comparator that imposes the reverse of the <i>natural
+ * ordering</i> on {@code Comparable} objects.
+ * @see Comparable
+ * @since 1.8
+ */
+ public static <T extends Comparable<? super T>> Comparator<T> reverseOrder() {
+ return Collections.reverseOrder();
+ }
+
+ /**
+ * Returns a comparator that compares {@link Comparable} objects in natural
+ * order.
+ *
+ * <p>The returned comparator is serializable and throws {@link
+ * NullPointerException} when comparing {@code null}.
+ *
+ * @param <T> the {@link Comparable} type of element to be compared
+ * @return a comparator that imposes the <i>natural ordering</i> on {@code
+ * Comparable} objects.
+ * @see Comparable
+ * @since 1.8
+ */
+ public static <T extends Comparable<? super T>> Comparator<T> naturalOrder() {
+ return (Comparator<T>) Comparators.NaturalOrderComparator.INSTANCE;
+ }
+
+ /**
+ * Returns a null-friendly comparator that considers {@code null} to be
+ * less than non-null. When both are {@code null}, they are considered
+ * equal. If both are non-null, the specified {@code Comparator} is used
+ * to determine the order. If the specified comparator is {@code null},
+ * then the returned comparator considers all non-null values to be equal.
+ *
+ * <p>The returned comparator is serializable if the specified comparator
+ * is serializable.
+ *
+ * @param <T> the type of the elements to be compared
+ * @param comparator a {@code Comparator} for comparing non-null values
+ * @return a comparator that considers {@code null} to be less than
+ * non-null, and compares non-null objects with the supplied
+ * {@code Comparator}.
+ * @since 1.8
+ */
+ public static <T> Comparator<T> nullsFirst(Comparator<? super T> comparator) {
+ return new Comparators.NullComparator(true, comparator);
+ }
+
+ /**
+ * Returns a null-friendly comparator that considers {@code null} to be
+ * greater than non-null. When both are {@code null}, they are considered
+ * equal. If both are non-null, the specified {@code Comparator} is used
+ * to determine the order. If the specified comparator is {@code null},
+ * then the returned comparator considers all non-null values to be equal.
+ *
+ * <p>The returned comparator is serializable if the specified comparator
+ * is serializable.
+ *
+ * @param <T> the type of the elements to be compared
+ * @param comparator a {@code Comparator} for comparing non-null values
+ * @return a comparator that considers {@code null} to be greater than
+ * non-null, and compares non-null objects with the supplied
+ * {@code Comparator}.
+ * @since 1.8
+ */
+ public static <T> Comparator<T> nullsLast(Comparator<? super T> comparator) {
+ return new Comparators.NullComparator(false, comparator);
+ }
+
+ /**
+ * Accepts a function that extracts a sort key from a type {@code T}, and
+ * returns a {@code Comparator<T>} that compares by that sort key using
+ * the specified {@link Comparator}.
+ *
+ * <p>The returned comparator is serializable if the specified function
+ * and comparator are both serializable.
+ *
+ * @apiNote
+ * For example, to obtain a {@code Comparator} that compares {@code
+ * Person} objects by their last name ignoring case differences,
+ *
+ * <pre>{@code
+ * Comparator<Person> cmp = Comparator.comparing(
+ * Person::getLastName,
+ * String.CASE_INSENSITIVE_ORDER);
+ * }</pre>
+ *
+ * @param <T> the type of element to be compared
+ * @param <U> the type of the sort key
+ * @param keyExtractor the function used to extract the sort key
+ * @param keyComparator the {@code Comparator} used to compare the sort key
+ * @return a comparator that compares by an extracted key using the
+ * specified {@code Comparator}
+ * @throws NullPointerException if either argument is null
+ * @since 1.8
+ */
+ public static <T, U> Comparator<T> comparing(
+ Function<? super T, ? extends U> keyExtractor,
+ Comparator<? super U> keyComparator)
+ {
+ Objects.requireNonNull(keyExtractor);
+ Objects.requireNonNull(keyComparator);
+ return (Comparator<T> & Serializable)
+ (c1, c2) -> keyComparator.compare(keyExtractor.apply(c1),
+ keyExtractor.apply(c2));
+ }
+
+ /**
+ * Accepts a function that extracts a {@link java.lang.Comparable
+ * Comparable} sort key from a type {@code T}, and returns a {@code
+ * Comparator<T>} that compares by that sort key.
+ *
+ * <p>The returned comparator is serializable if the specified function
+ * is also serializable.
+ *
+ * @apiNote
+ * For example, to obtain a {@code Comparator} that compares {@code
+ * Person} objects by their last name,
+ *
+ * <pre>{@code
+ * Comparator<Person> byLastName = Comparator.comparing(Person::getLastName);
+ * }</pre>
+ *
+ * @param <T> the type of element to be compared
+ * @param <U> the type of the {@code Comparable} sort key
+ * @param keyExtractor the function used to extract the {@link
+ * Comparable} sort key
+ * @return a comparator that compares by an extracted key
+ * @throws NullPointerException if the argument is null
+ * @since 1.8
+ */
+ public static <T, U extends Comparable<? super U>> Comparator<T> comparing(
+ Function<? super T, ? extends U> keyExtractor)
+ {
+ Objects.requireNonNull(keyExtractor);
+ return (Comparator<T> & Serializable)
+ (c1, c2) -> keyExtractor.apply(c1).compareTo(keyExtractor.apply(c2));
+ }
+
+ /**
+ * Accepts a function that extracts an {@code int} sort key from a type
+ * {@code T}, and returns a {@code Comparator<T>} that compares by that
+ * sort key.
+ *
+ * <p>The returned comparator is serializable if the specified function
+ * is also serializable.
+ *
+ * @param <T> the type of element to be compared
+ * @param keyExtractor the function used to extract the integer sort key
+ * @return a comparator that compares by an extracted key
+ * @see #comparing(Function)
+ * @throws NullPointerException if the argument is null
+ * @since 1.8
+ */
+ public static <T> Comparator<T> comparing(ToIntFunction<? super T> keyExtractor) {
+ Objects.requireNonNull(keyExtractor);
+ return (Comparator<T> & Serializable)
+ (c1, c2) -> Integer.compare(keyExtractor.applyAsInt(c1), keyExtractor.applyAsInt(c2));
+ }
+
+ /**
+ * Accepts a function that extracts a {@code long} sort key from a type
+ * {@code T}, and returns a {@code Comparator<T>} that compares by that
+ * sort key.
+ *
+ * <p>The returned comparator is serializable if the specified function is
+ * also serializable.
+ *
+ * @param <T> the type of element to be compared
+ * @param keyExtractor the function used to extract the long sort key
+ * @return a comparator that compares by an extracted key
+ * @see #comparing(Function)
+ * @throws NullPointerException if the argument is null
+ * @since 1.8
+ */
+ public static <T> Comparator<T> comparing(ToLongFunction<? super T> keyExtractor) {
+ Objects.requireNonNull(keyExtractor);
+ return (Comparator<T> & Serializable)
+ (c1, c2) -> Long.compare(keyExtractor.applyAsLong(c1), keyExtractor.applyAsLong(c2));
+ }
+
+ /**
+ * Accepts a function that extracts a {@code double} sort key from a type
+ * {@code T}, and returns a {@code Comparator<T>} that compares by that
+ * sort key.
+ *
+ * <p>The returned comparator is serializable if the specified function
+ * is also serializable.
+ *
+ * @param <T> the type of element to be compared
+ * @param keyExtractor the function used to extract the double sort key
+ * @return a comparator that compares by an extracted key
+ * @see #comparing(Function)
+ * @throws NullPointerException if the argument is null
+ * @since 1.8
+ */
+ public static<T> Comparator<T> comparing(ToDoubleFunction<? super T> keyExtractor) {
+ Objects.requireNonNull(keyExtractor);
+ return (Comparator<T> & Serializable)
+ (c1, c2) -> Double.compare(keyExtractor.applyAsDouble(c1), keyExtractor.applyAsDouble(c2));
}
}
--- a/jdk/src/share/classes/java/util/Comparators.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/Comparators.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -32,16 +32,9 @@
import java.util.function.ToLongFunction;
/**
- * This class consists of {@code static} utility methods for comparators. Mostly
- * factory method that returns a {@link Comparator}.
- *
- * <p> Unless otherwise noted, passing a {@code null} argument to a method in
- * this class will cause a {@link NullPointerException} to be thrown.
- *
- * @see Comparator
- * @since 1.8
+ * Package private supporting class for {@link Comparator}.
*/
-public class Comparators {
+class Comparators {
private Comparators() {
throw new AssertionError("no instances");
}
@@ -51,231 +44,55 @@
*
* @see Comparable
*/
- private enum NaturalOrderComparator implements Comparator<Comparable<Object>> {
+ enum NaturalOrderComparator implements Comparator<Comparable<Object>> {
INSTANCE;
@Override
public int compare(Comparable<Object> c1, Comparable<Object> c2) {
return c1.compareTo(c2);
}
- }
- /**
- * Returns a comparator that imposes the reverse of the <em>natural
- * ordering</em>.
- *
- * <p>The returned comparator is serializable.
- *
- * @param <T> {@link Comparable} type
- *
- * @return A comparator that imposes the reverse of the <i>natural
- * ordering</i> on a collection of objects that implement
- * the {@link Comparable} interface.
- * @see Comparable
- */
- public static <T extends Comparable<? super T>> Comparator<T> reverseOrder() {
- return Collections.reverseOrder();
- }
-
- /**
- * Returns a comparator that imposes the reverse ordering of the specified
- * {@link Comparator}.
- *
- * <p>The returned comparator is serializable (assuming the specified
- * comparator is also serializable).
- *
- * @param <T> the element type to be compared
- * @param cmp a comparator whose ordering is to be reversed by the returned
- * comparator
- * @return A comparator that imposes the reverse ordering of the
- * specified comparator.
- */
- public static <T> Comparator<T> reverseOrder(Comparator<T> cmp) {
- Objects.requireNonNull(cmp);
- return Collections.reverseOrder(cmp);
- }
-
- /**
- * Gets a comparator compares {@link Comparable} type in natural order.
- *
- * @param <T> {@link Comparable} type
- */
- public static <T extends Comparable<? super T>> Comparator<T> naturalOrder() {
- return (Comparator<T>) NaturalOrderComparator.INSTANCE;
- }
-
- /**
- * Gets a comparator compares {@link Map.Entry} in natural order on key.
- *
- * @param <K> {@link Comparable} key type
- * @param <V> value type
- */
- public static <K extends Comparable<? super K>, V> Comparator<Map.Entry<K,V>> naturalOrderKeys() {
- return (Comparator<Map.Entry<K, V>> & Serializable)
- (c1, c2) -> c1.getKey().compareTo(c2.getKey());
- }
-
- /**
- * Gets a comparator compares {@link Map.Entry} in natural order on value.
- *
- * @param <K> key type
- * @param <V> {@link Comparable} value type
- */
- public static <K, V extends Comparable<? super V>> Comparator<Map.Entry<K,V>> naturalOrderValues() {
- return (Comparator<Map.Entry<K, V>> & Serializable)
- (c1, c2) -> c1.getValue().compareTo(c2.getValue());
- }
-
- /**
- * Gets a comparator compares {@link Map.Entry} by key using the given
- * {@link Comparator}.
- *
- * <p>The returned comparator is serializable assuming the specified
- * comparators are also serializable.
- *
- * @param <K> key type
- * @param <V> value type
- * @param cmp the key {@link Comparator}
- */
- public static <K, V> Comparator<Map.Entry<K, V>> byKey(Comparator<? super K> cmp) {
- Objects.requireNonNull(cmp);
- return (Comparator<Map.Entry<K, V>> & Serializable)
- (c1, c2) -> cmp.compare(c1.getKey(), c2.getKey());
- }
-
- /**
- * Gets a comparator compares {@link Map.Entry} by value using the given
- * {@link Comparator}.
- *
- * @param <K> key type
- * @param <V> value type
- * @param cmp the value {@link Comparator}
- */
- public static <K, V> Comparator<Map.Entry<K, V>> byValue(Comparator<? super V> cmp) {
- Objects.requireNonNull(cmp);
- return (Comparator<Map.Entry<K, V>> & Serializable)
- (c1, c2) -> cmp.compare(c1.getValue(), c2.getValue());
+ @Override
+ public Comparator<Comparable<Object>> reversed() {
+ return Comparator.reverseOrder();
+ }
}
/**
- * Accepts a function that extracts a {@link java.lang.Comparable
- * Comparable} sort key from a type {@code T}, and returns a {@code
- * Comparator<T>} that compares by that sort key. For example, if a class
- * {@code Person} has a {@code String}-valued getter {@code getLastName},
- * then {@code comparing(Person::getLastName)} would return a {@code
- * Comparator<Person>} that compares {@code Person} objects by their last
- * name.
- *
- * @param <T> the original element type
- * @param <U> the {@link Comparable} type for comparison
- * @param keyExtractor the function used to extract the {@link Comparable} sort key
+ * Null-friendly comparators
*/
- public static <T, U extends Comparable<? super U>> Comparator<T> comparing(Function<? super T, ? extends U> keyExtractor) {
- Objects.requireNonNull(keyExtractor);
- return (Comparator<T> & Serializable)
- (c1, c2) -> keyExtractor.apply(c1).compareTo(keyExtractor.apply(c2));
- }
+ final static class NullComparator<T> implements Comparator<T>, Serializable {
+ private static final long serialVersionUID = -7569533591570686392L;
+ private final boolean nullFirst;
+ // if null, non-null Ts are considered equal
+ private final Comparator<T> real;
- /**
- * Accepts a function that extracts an {@code int} value from a type {@code
- * T}, and returns a {@code Comparator<T>} that compares by that value.
- *
- * <p>The returned comparator is serializable assuming the specified
- * function is also serializable.
- *
- * @see #comparing(Function)
- * @param <T> the original element type
- * @param keyExtractor the function used to extract the integer value
- */
- public static <T> Comparator<T> comparing(ToIntFunction<? super T> keyExtractor) {
- Objects.requireNonNull(keyExtractor);
- return (Comparator<T> & Serializable)
- (c1, c2) -> Integer.compare(keyExtractor.applyAsInt(c1), keyExtractor.applyAsInt(c2));
- }
-
- /**
- * Accepts a function that extracts a {@code long} value from a type {@code
- * T}, and returns a {@code Comparator<T>} that compares by that value.
- *
- * <p>The returned comparator is serializable assuming the specified
- * function is also serializable.
- *
- * @see #comparing(Function)
- * @param <T> the original element type
- * @param keyExtractor the function used to extract the long value
- */
- public static <T> Comparator<T> comparing(ToLongFunction<? super T> keyExtractor) {
- Objects.requireNonNull(keyExtractor);
- return (Comparator<T> & Serializable)
- (c1, c2) -> Long.compare(keyExtractor.applyAsLong(c1), keyExtractor.applyAsLong(c2));
- }
+ @SuppressWarnings("unchecked")
+ NullComparator(boolean nullFirst, Comparator<? super T> real) {
+ this.nullFirst = nullFirst;
+ this.real = (Comparator<T>) real;
+ }
- /**
- * Accepts a function that extracts a {@code double} value from a type
- * {@code T}, and returns a {@code Comparator<T>} that compares by that
- * value.
- *
- * <p>The returned comparator is serializable assuming the specified
- * function is also serializable.
- *
- * @see #comparing(Function)
- * @param <T> the original element type
- * @param keyExtractor the function used to extract the double value
- */
- public static<T> Comparator<T> comparing(ToDoubleFunction<? super T> keyExtractor) {
- Objects.requireNonNull(keyExtractor);
- return (Comparator<T> & Serializable)
- (c1, c2) -> Double.compare(keyExtractor.applyAsDouble(c1), keyExtractor.applyAsDouble(c2));
- }
+ @Override
+ public int compare(T a, T b) {
+ if (a == null) {
+ return (b == null) ? 0 : (nullFirst ? -1 : 1);
+ } else if (b == null) {
+ return nullFirst ? 1: -1;
+ } else {
+ return (real == null) ? 0 : real.compare(a, b);
+ }
+ }
- /**
- * Constructs a lexicographic order from two {@link Comparator}s. For
- * example, if you have comparators {@code byLastName} and {@code
- * byFirstName}, each of type {@code Comparator<Person>}, then {@code
- * compose(byLastName, byFirstName)} creates a {@code Comparator<Person>}
- * which sorts by last name, and for equal last names sorts by first name.
- *
- * <p>The returned comparator is serializable assuming the specified
- * comparators are also serializable.
- *
- * @param <T> the element type to be compared
- * @param first the first comparator
- * @param second the secondary comparator used when equals on the first
- */
- public static<T> Comparator<T> compose(Comparator<? super T> first, Comparator<? super T> second) {
- Objects.requireNonNull(first);
- Objects.requireNonNull(second);
- return (Comparator<T> & Serializable) (c1, c2) -> {
- int res = first.compare(c1, c2);
- return (res != 0) ? res : second.compare(c1, c2);
- };
- }
+ @Override
+ public Comparator<T> thenComparing(Comparator<? super T> other) {
+ Objects.requireNonNull(other);
+ return new NullComparator(nullFirst, real == null ? other : real.thenComparing(other));
+ }
- /**
- * Constructs a {@link BinaryOperator} which returns the lesser of two elements
- * according to the specified {@code Comparator}
- *
- * @param comparator A {@code Comparator} for comparing the two values
- * @param <T> the type of the elements to be compared
- * @return a {@code BinaryOperator} which returns the lesser of its operands,
- * according to the supplied {@code Comparator}
- */
- public static<T> BinaryOperator<T> lesserOf(Comparator<? super T> comparator) {
- Objects.requireNonNull(comparator);
- return (a, b) -> comparator.compare(a, b) <= 0 ? a : b;
- }
-
- /**
- * Constructs a {@link BinaryOperator} which returns the greater of two elements
- * according to the specified {@code Comparator}
- *
- * @param comparator A {@code Comparator} for comparing the two values
- * @param <T> the type of the elements to be compared
- * @return a {@code BinaryOperator} which returns the greater of its operands,
- * according to the supplied {@code Comparator}
- */
- public static<T> BinaryOperator<T> greaterOf(Comparator<? super T> comparator) {
- Objects.requireNonNull(comparator);
- return (a, b) -> comparator.compare(a, b) >= 0 ? a : b;
+ @Override
+ public Comparator<T> reversed() {
+ return new NullComparator(!nullFirst, real == null ? null : real.reversed());
+ }
}
}
--- a/jdk/src/share/classes/java/util/Formatter.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/Formatter.java Tue Jul 02 15:23:23 2013 -0700
@@ -3297,18 +3297,29 @@
else if (precision == 0)
prec = 1;
- FormattedFloatingDecimal fd
+ char[] exp;
+ char[] mant;
+ int expRounded;
+ if (value == 0.0) {
+ exp = null;
+ mant = new char[] {'0'};
+ expRounded = 0;
+ } else {
+ FormattedFloatingDecimal fd
= FormattedFloatingDecimal.valueOf(value, prec,
FormattedFloatingDecimal.Form.GENERAL);
-
- char[] exp = fd.getExponent();
+ exp = fd.getExponent();
+ mant = fd.getMantissa();
+ expRounded = fd.getExponentRounded();
+ }
+
if (exp != null) {
prec -= 1;
} else {
- prec = prec - (value == 0 ? 0 : fd.getExponentRounded()) - 1;
+ prec -= expRounded + 1;
}
- char[] mant = addZeros(fd.getMantissa(), prec);
+ mant = addZeros(mant, prec);
// If the precision is zero and the '#' flag is set, add the
// requested decimal point.
if (f.contains(Flags.ALTERNATE) && (prec == 0))
--- a/jdk/src/share/classes/java/util/HashMap.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/HashMap.java Tue Jul 02 15:23:23 2013 -0700
@@ -1749,25 +1749,25 @@
V oldValue = pEntry.value;
if (oldValue != null) {
V newValue = remappingFunction.apply(key, oldValue);
- if (newValue == null) { // remove mapping
- modCount++;
- size--;
- tb.deleteTreeNode(p);
- pEntry.recordRemoval(this);
- if (tb.root == null || tb.first == null) {
- // assert tb.root == null && tb.first == null :
- // "TreeBin.first and root should both be null";
- // TreeBin is now empty, we should blank this bin
- table[i] = null;
- }
- } else {
- pEntry.value = newValue;
- pEntry.recordAccess(this);
+ if (newValue == null) { // remove mapping
+ modCount++;
+ size--;
+ tb.deleteTreeNode(p);
+ pEntry.recordRemoval(this);
+ if (tb.root == null || tb.first == null) {
+ // assert tb.root == null && tb.first == null :
+ // "TreeBin.first and root should both be null";
+ // TreeBin is now empty, we should blank this bin
+ table[i] = null;
}
- return newValue;
+ } else {
+ pEntry.value = newValue;
+ pEntry.recordAccess(this);
}
+ return newValue;
}
}
+ }
return null;
}
@@ -1779,7 +1779,7 @@
if (key == null) {
V oldValue = nullKeyEntry == null ? null : nullKeyEntry.value;
V newValue = remappingFunction.apply(key, oldValue);
- if (newValue != oldValue) {
+ if (newValue != oldValue || (oldValue == null && nullKeyEntry != null)) {
if (newValue == null) {
removeNullKey();
} else {
@@ -1803,7 +1803,7 @@
if (e.hash == hash && Objects.equals(e.key, key)) {
V oldValue = e.value;
V newValue = remappingFunction.apply(key, oldValue);
- if (newValue != oldValue) {
+ if (newValue != oldValue || oldValue == null) {
if (newValue == null) {
modCount++;
size--;
@@ -1829,7 +1829,7 @@
TreeNode p = tb.getTreeNode(hash, key);
V oldValue = p == null ? null : (V)p.entry.value;
V newValue = remappingFunction.apply(key, oldValue);
- if (newValue != oldValue) {
+ if (newValue != oldValue || (oldValue == null && p != null)) {
if (newValue == null) {
Entry<K,V> pEntry = (Entry<K,V>)p.entry;
modCount++;
--- a/jdk/src/share/classes/java/util/Map.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/Map.java Tue Jul 02 15:23:23 2013 -0700
@@ -28,6 +28,7 @@
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Function;
+import java.io.Serializable;
/**
* An object that maps keys to values. A map cannot contain duplicate keys;
@@ -446,6 +447,74 @@
* @see #equals(Object)
*/
int hashCode();
+
+ /**
+ * Returns a comparator that compares {@link Map.Entry} in natural order on key.
+ *
+ * <p>The returned comparator is serializable and throws {@link
+ * NullPointerException} when comparing an entry with a null key.
+ *
+ * @param <K> the {@link Comparable} type of then map keys
+ * @param <V> the type of the map values
+ * @return a comparator that compares {@link Map.Entry} in natural order on key.
+ * @see Comparable
+ */
+ public static <K extends Comparable<? super K>, V> Comparator<Map.Entry<K,V>> comparingByKey() {
+ return (Comparator<Map.Entry<K, V>> & Serializable)
+ (c1, c2) -> c1.getKey().compareTo(c2.getKey());
+ }
+
+ /**
+ * Returns a comparator that compares {@link Map.Entry} in natural order on value.
+ *
+ * <p>The returned comparator is serializable and throws {@link
+ * NullPointerException} when comparing an entry with null values.
+ *
+ * @param <K> the type of the map keys
+ * @param <V> the {@link Comparable} type of the map values
+ * @return a comparator that compares {@link Map.Entry} in natural order on value.
+ * @see Comparable
+ */
+ public static <K, V extends Comparable<? super V>> Comparator<Map.Entry<K,V>> comparingByValue() {
+ return (Comparator<Map.Entry<K, V>> & Serializable)
+ (c1, c2) -> c1.getValue().compareTo(c2.getValue());
+ }
+
+ /**
+ * Returns a comparator that compares {@link Map.Entry} by key using the given
+ * {@link Comparator}.
+ *
+ * <p>The returned comparator is serializable if the specified comparator
+ * is also serializable.
+ *
+ * @param <K> the type of the map keys
+ * @param <V> the type of the map values
+ * @param cmp the key {@link Comparator}
+ * @return a comparator that compares {@link Map.Entry} by the key.
+ */
+ public static <K, V> Comparator<Map.Entry<K, V>> comparingByKey(Comparator<? super K> cmp) {
+ Objects.requireNonNull(cmp);
+ return (Comparator<Map.Entry<K, V>> & Serializable)
+ (c1, c2) -> cmp.compare(c1.getKey(), c2.getKey());
+ }
+
+ /**
+ * Returns a comparator that compares {@link Map.Entry} by value using the given
+ * {@link Comparator}.
+ *
+ * <p>The returned comparator is serializable if the specified comparator
+ * is also serializable.
+ *
+ * @param <K> the type of the map keys
+ * @param <V> the type of the map values
+ * @param cmp the value {@link Comparator}
+ * @return a comparator that compares {@link Map.Entry} by the value.
+ */
+ public static <K, V> Comparator<Map.Entry<K, V>> comparingByValue(Comparator<? super V> cmp) {
+ Objects.requireNonNull(cmp);
+ return (Comparator<Map.Entry<K, V>> & Serializable)
+ (c1, c2) -> cmp.compare(c1.getValue(), c2.getValue());
+ }
}
// Comparison and hashing
@@ -640,7 +709,7 @@
* @param key key with which the specified value is to be associated
* @param value value to be associated with the specified key
* @return the previous value associated with the specified key, or
- * {@code 1} if there was no mapping for the key.
+ * {@code null} if there was no mapping for the key.
* (A {@code null} return can also indicate that the map
* previously associated {@code null} with the key,
* if the implementation supports null values.)
@@ -994,20 +1063,40 @@
V oldValue = get(key);
for (;;) {
V newValue = remappingFunction.apply(key, oldValue);
- if (oldValue != null) {
- if (newValue != null) {
- if (replace(key, oldValue, newValue))
- return newValue;
- } else if (remove(key, oldValue)) {
+ if (newValue == null) {
+ // delete mapping
+ if(oldValue != null || containsKey(key)) {
+ // something to remove
+ if (remove(key, oldValue)) {
+ // removed the old value as expected
+ return null;
+ }
+
+ // some other value replaced old value. try again.
+ oldValue = get(key);
+ } else {
+ // nothing to do. Leave things as they were.
return null;
}
- oldValue = get(key);
} else {
- if (newValue != null) {
- if ((oldValue = putIfAbsent(key, newValue)) == null)
+ // add or replace old mapping
+ if (oldValue != null) {
+ // replace
+ if (replace(key, oldValue, newValue)) {
+ // replaced as expected.
return newValue;
+ }
+
+ // some other value replaced old value. try again.
+ oldValue = get(key);
} else {
- return null;
+ // add (replace if oldValue was null)
+ if ((oldValue = putIfAbsent(key, newValue)) == null) {
+ // replaced
+ return newValue;
+ }
+
+ // some other value replaced old value. try again.
}
}
}
--- a/jdk/src/share/classes/java/util/PrimitiveIterator.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/PrimitiveIterator.java Tue Jul 02 15:23:23 2013 -0700
@@ -55,16 +55,34 @@
* is set to {@code true} then diagnostic warnings are reported if boxing of
* primitive values occur when operating on primitive subtype specializations.
*
- * @param <T> the boxed type of the primitive type
+ * @param <T> the type of elements returned by this PrimitiveIterator. The
+ * type must be a wrapper type for a primitive type, such as
+ * {@code Integer} for the primitive {@code int} type.
+ * @param <T_CONS> the type of primitive consumer. The type must be a
+ * primitive specialization of {@link java.util.function.Consumer} for
+ * {@code T}, such as {@link java.util.function.IntConsumer} for
+ * {@code Integer}.
+ *
* @since 1.8
*/
-public interface PrimitiveIterator<T> extends Iterator<T> {
+public interface PrimitiveIterator<T, T_CONS> extends Iterator<T> {
+
+ /**
+ * Performs the given action for each remaining element, in the order
+ * elements occur when iterating, until all elements have been processed
+ * or the action throws an exception. Errors or runtime exceptions
+ * thrown by the action are relayed to the caller.
+ *
+ * @param action The action to be performed for each element
+ * @throws NullPointerException if the specified action is null
+ */
+ void forEachRemaining(T_CONS action);
/**
* An Iterator specialized for {@code int} values.
* @since 1.8
*/
- public static interface OfInt extends PrimitiveIterator<Integer> {
+ public static interface OfInt extends PrimitiveIterator<Integer, IntConsumer> {
/**
* Returns the next {@code int} element in the iteration.
@@ -138,7 +156,7 @@
* An Iterator specialized for {@code long} values.
* @since 1.8
*/
- public static interface OfLong extends PrimitiveIterator<Long> {
+ public static interface OfLong extends PrimitiveIterator<Long, LongConsumer> {
/**
* Returns the next {@code long} element in the iteration.
@@ -211,7 +229,7 @@
* An Iterator specialized for {@code double} values.
* @since 1.8
*/
- public static interface OfDouble extends PrimitiveIterator<Double> {
+ public static interface OfDouble extends PrimitiveIterator<Double, DoubleConsumer> {
/**
* Returns the next {@code double} element in the iteration.
--- a/jdk/src/share/classes/java/util/Properties.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/Properties.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -443,6 +443,9 @@
if (len == 0 || isCommentLine) {
return -1;
}
+ if (precedingBackslash) {
+ len--;
+ }
return len;
}
}
@@ -510,6 +513,9 @@
:inStream.read(inByteBuf);
inOff = 0;
if (inLimit <= 0) {
+ if (precedingBackslash) {
+ len--;
+ }
return len;
}
}
--- a/jdk/src/share/classes/java/util/TimeZone.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/TimeZone.java Tue Jul 02 15:23:23 2013 -0700
@@ -419,17 +419,6 @@
return ZoneInfoFile.toCustomID(offset);
}
- private static class DisplayNames {
- // Cache for managing display names per timezone per locale
- // The structure is:
- // Map(key=id, value=SoftReference(Map(key=locale, value=displaynames)))
- private static final Map<String, SoftReference<Map<Locale, String[]>>> CACHE =
- new ConcurrentHashMap<>();
-
- private DisplayNames() {
- }
- }
-
private static String[] getDisplayNames(String id, Locale locale) {
return TimeZoneNameUtility.retrieveDisplayNames(id, locale);
}
--- a/jdk/src/share/classes/java/util/TreeMap.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/TreeMap.java Tue Jul 02 15:23:23 2013 -0700
@@ -2938,13 +2938,13 @@
public int characteristics() {
return (side == 0 ? Spliterator.SIZED : 0) |
- Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED;
+ Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED;
}
@Override
public Comparator<? super Map.Entry<K, V>> getComparator() {
return tree.comparator != null ?
- Comparators.byKey(tree.comparator) : null;
+ Map.Entry.comparingByKey(tree.comparator) : null;
}
}
}
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java Tue Jul 02 15:23:23 2013 -0700
@@ -92,7 +92,7 @@
*
* @param expect the expected value
* @param update the new value
- * @return true if successful. False return indicates that
+ * @return {@code true} if successful. False return indicates that
* the actual value was not equal to the expected value.
*/
public final boolean compareAndSet(boolean expect, boolean update) {
@@ -105,13 +105,13 @@
* Atomically sets the value to the given updated value
* if the current value {@code ==} the expected value.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
*/
public boolean weakCompareAndSet(boolean expect, boolean update) {
int e = expect ? 1 : 0;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java Tue Jul 02 15:23:23 2013 -0700
@@ -126,7 +126,7 @@
*
* @param expect the expected value
* @param update the new value
- * @return true if successful. False return indicates that
+ * @return {@code true} if successful. False return indicates that
* the actual value was not equal to the expected value.
*/
public final boolean compareAndSet(int expect, int update) {
@@ -137,13 +137,13 @@
* Atomically sets the value to the given updated value
* if the current value {@code ==} the expected value.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
*/
public final boolean weakCompareAndSet(int expect, int update) {
return unsafe.compareAndSwapInt(this, valueOffset, expect, update);
@@ -155,7 +155,7 @@
* @return the previous value
*/
public final int getAndIncrement() {
- return getAndAdd(1);
+ return unsafe.getAndAddInt(this, valueOffset, 1);
}
/**
@@ -164,7 +164,7 @@
* @return the previous value
*/
public final int getAndDecrement() {
- return getAndAdd(-1);
+ return unsafe.getAndAddInt(this, valueOffset, -1);
}
/**
@@ -183,7 +183,7 @@
* @return the updated value
*/
public final int incrementAndGet() {
- return getAndAdd(1) + 1;
+ return unsafe.getAndAddInt(this, valueOffset, 1) + 1;
}
/**
@@ -192,7 +192,7 @@
* @return the updated value
*/
public final int decrementAndGet() {
- return getAndAdd(-1) - 1;
+ return unsafe.getAndAddInt(this, valueOffset, -1) - 1;
}
/**
@@ -202,7 +202,7 @@
* @return the updated value
*/
public final int addAndGet(int delta) {
- return getAndAdd(delta) + delta;
+ return unsafe.getAndAddInt(this, valueOffset, delta) + delta;
}
/**
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Tue Jul 02 15:23:23 2013 -0700
@@ -157,7 +157,7 @@
* @param i the index
* @param expect the expected value
* @param update the new value
- * @return true if successful. False return indicates that
+ * @return {@code true} if successful. False return indicates that
* the actual value was not equal to the expected value.
*/
public final boolean compareAndSet(int i, int expect, int update) {
@@ -172,14 +172,14 @@
* Atomically sets the element at position {@code i} to the given
* updated value if the current value {@code ==} the expected value.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param i the index
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
*/
public final boolean weakCompareAndSet(int i, int expect, int update) {
return compareAndSet(i, expect, update);
@@ -247,6 +247,7 @@
return getAndAdd(i, delta) + delta;
}
+
/**
* Atomically updates the element at index {@code i} with the results
* of applying the given function, returning the previous value. The
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java Tue Jul 02 15:23:23 2013 -0700
@@ -37,14 +37,13 @@
import java.util.function.IntUnaryOperator;
import java.util.function.IntBinaryOperator;
import sun.misc.Unsafe;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
-
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException;
+import sun.reflect.CallerSensitive;
+import sun.reflect.Reflection;
/**
* A reflection-based utility that enables atomic updates to
@@ -81,8 +80,10 @@
* access control
*/
@CallerSensitive
- public static <U> AtomicIntegerFieldUpdater<U> newUpdater(Class<U> tclass, String fieldName) {
- return new AtomicIntegerFieldUpdaterImpl<U>(tclass, fieldName, Reflection.getCallerClass());
+ public static <U> AtomicIntegerFieldUpdater<U> newUpdater(Class<U> tclass,
+ String fieldName) {
+ return new AtomicIntegerFieldUpdaterImpl<U>
+ (tclass, fieldName, Reflection.getCallerClass());
}
/**
@@ -101,7 +102,7 @@
* @param obj An object whose field to conditionally set
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
* @throws ClassCastException if {@code obj} is not an instance
* of the class possessing the field established in the constructor
*/
@@ -114,14 +115,14 @@
* other calls to {@code compareAndSet} and {@code set}, but not
* necessarily with respect to other changes in the field.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param obj An object whose field to conditionally set
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
* @throws ClassCastException if {@code obj} is not an instance
* of the class possessing the field established in the constructor
*/
@@ -363,7 +364,8 @@
/**
* Standard hotspot implementation using intrinsics
*/
- private static class AtomicIntegerFieldUpdaterImpl<T> extends AtomicIntegerFieldUpdater<T> {
+ private static class AtomicIntegerFieldUpdaterImpl<T>
+ extends AtomicIntegerFieldUpdater<T> {
private static final Unsafe unsafe = Unsafe.getUnsafe();
private final long offset;
private final Class<T> tclass;
@@ -371,8 +373,7 @@
AtomicIntegerFieldUpdaterImpl(final Class<T> tclass,
final String fieldName,
- final Class<?> caller)
- {
+ final Class<?> caller) {
final Field field;
final int modifiers;
try {
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java Tue Jul 02 15:23:23 2013 -0700
@@ -140,7 +140,7 @@
*
* @param expect the expected value
* @param update the new value
- * @return true if successful. False return indicates that
+ * @return {@code true} if successful. False return indicates that
* the actual value was not equal to the expected value.
*/
public final boolean compareAndSet(long expect, long update) {
@@ -151,13 +151,13 @@
* Atomically sets the value to the given updated value
* if the current value {@code ==} the expected value.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
*/
public final boolean weakCompareAndSet(long expect, long update) {
return unsafe.compareAndSwapLong(this, valueOffset, expect, update);
@@ -169,7 +169,7 @@
* @return the previous value
*/
public final long getAndIncrement() {
- return getAndAdd(1);
+ return unsafe.getAndAddLong(this, valueOffset, 1L);
}
/**
@@ -178,7 +178,7 @@
* @return the previous value
*/
public final long getAndDecrement() {
- return getAndAdd(-1);
+ return unsafe.getAndAddLong(this, valueOffset, -1L);
}
/**
@@ -197,7 +197,7 @@
* @return the updated value
*/
public final long incrementAndGet() {
- return getAndAdd(1) + 1;
+ return unsafe.getAndAddLong(this, valueOffset, 1L) + 1L;
}
/**
@@ -206,7 +206,7 @@
* @return the updated value
*/
public final long decrementAndGet() {
- return getAndAdd(-1) - 1;
+ return unsafe.getAndAddLong(this, valueOffset, -1L) - 1L;
}
/**
@@ -216,7 +216,7 @@
* @return the updated value
*/
public final long addAndGet(long delta) {
- return getAndAdd(delta) + delta;
+ return unsafe.getAndAddLong(this, valueOffset, delta) + delta;
}
/**
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Tue Jul 02 15:23:23 2013 -0700
@@ -156,7 +156,7 @@
* @param i the index
* @param expect the expected value
* @param update the new value
- * @return true if successful. False return indicates that
+ * @return {@code true} if successful. False return indicates that
* the actual value was not equal to the expected value.
*/
public final boolean compareAndSet(int i, long expect, long update) {
@@ -171,14 +171,14 @@
* Atomically sets the element at position {@code i} to the given
* updated value if the current value {@code ==} the expected value.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param i the index
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
*/
public final boolean weakCompareAndSet(int i, long expect, long update) {
return compareAndSet(i, expect, update);
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java Tue Jul 02 15:23:23 2013 -0700
@@ -37,14 +37,13 @@
import java.util.function.LongUnaryOperator;
import java.util.function.LongBinaryOperator;
import sun.misc.Unsafe;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
-
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException;
+import sun.reflect.CallerSensitive;
+import sun.reflect.Reflection;
/**
* A reflection-based utility that enables atomic updates to
@@ -71,17 +70,18 @@
* generic types match.
*
* @param tclass the class of the objects holding the field
- * @param fieldName the name of the field to be updated.
+ * @param fieldName the name of the field to be updated
* @return the updater
* @throws IllegalArgumentException if the field is not a
- * volatile long type.
+ * volatile long type
* @throws RuntimeException with a nested reflection-based
* exception if the class does not hold field or is the wrong type,
* or the field is inaccessible to the caller according to Java language
* access control
*/
@CallerSensitive
- public static <U> AtomicLongFieldUpdater<U> newUpdater(Class<U> tclass, String fieldName) {
+ public static <U> AtomicLongFieldUpdater<U> newUpdater(Class<U> tclass,
+ String fieldName) {
Class<?> caller = Reflection.getCallerClass();
if (AtomicLong.VM_SUPPORTS_LONG_CAS)
return new CASUpdater<U>(tclass, fieldName, caller);
@@ -105,9 +105,9 @@
* @param obj An object whose field to conditionally set
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
* @throws ClassCastException if {@code obj} is not an instance
- * of the class possessing the field established in the constructor.
+ * of the class possessing the field established in the constructor
*/
public abstract boolean compareAndSet(T obj, long expect, long update);
@@ -118,16 +118,16 @@
* other calls to {@code compareAndSet} and {@code set}, but not
* necessarily with respect to other changes in the field.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param obj An object whose field to conditionally set
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
* @throws ClassCastException if {@code obj} is not an instance
- * of the class possessing the field established in the constructor.
+ * of the class possessing the field established in the constructor
*/
public abstract boolean weakCompareAndSet(T obj, long expect, long update);
@@ -370,7 +370,8 @@
private final Class<T> tclass;
private final Class<?> cclass;
- CASUpdater(final Class<T> tclass, final String fieldName, final Class<?> caller) {
+ CASUpdater(final Class<T> tclass, final String fieldName,
+ final Class<?> caller) {
final Field field;
final int modifiers;
try {
@@ -493,7 +494,8 @@
private final Class<T> tclass;
private final Class<?> cclass;
- LockedUpdater(final Class<T> tclass, final String fieldName, final Class<?> caller) {
+ LockedUpdater(final Class<T> tclass, final String fieldName,
+ final Class<?> caller) {
Field field = null;
int modifiers = 0;
try {
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java Tue Jul 02 15:23:23 2013 -0700
@@ -112,15 +112,15 @@
* current reference is {@code ==} to the expected reference
* and the current mark is equal to the expected mark.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param expectedReference the expected value of the reference
* @param newReference the new value for the reference
* @param expectedMark the expected value of the mark
* @param newMark the new value for the mark
- * @return true if successful
+ * @return {@code true} if successful
*/
public boolean weakCompareAndSet(V expectedReference,
V newReference,
@@ -140,7 +140,7 @@
* @param newReference the new value for the reference
* @param expectedMark the expected value of the mark
* @param newMark the new value for the mark
- * @return true if successful
+ * @return {@code true} if successful
*/
public boolean compareAndSet(V expectedReference,
V newReference,
@@ -178,7 +178,7 @@
*
* @param expectedReference the expected value of the reference
* @param newMark the new value for the mark
- * @return true if successful
+ * @return {@code true} if successful
*/
public boolean attemptMark(V expectedReference, boolean newMark) {
Pair<V> current = pair;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java Tue Jul 02 15:23:23 2013 -0700
@@ -109,7 +109,7 @@
* if the current value {@code ==} the expected value.
* @param expect the expected value
* @param update the new value
- * @return true if successful. False return indicates that
+ * @return {@code true} if successful. False return indicates that
* the actual value was not equal to the expected value.
*/
public final boolean compareAndSet(V expect, V update) {
@@ -120,13 +120,13 @@
* Atomically sets the value to the given updated value
* if the current value {@code ==} the expected value.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
*/
public final boolean weakCompareAndSet(V expect, V update) {
return unsafe.compareAndSwapObject(this, valueOffset, expect, update);
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Tue Jul 02 15:23:23 2013 -0700
@@ -34,10 +34,9 @@
*/
package java.util.concurrent.atomic;
-
-import java.util.Arrays;
import java.util.function.UnaryOperator;
import java.util.function.BinaryOperator;
+import java.util.Arrays;
import java.lang.reflect.Array;
import sun.misc.Unsafe;
@@ -60,19 +59,18 @@
private final Object[] array; // must have exact type Object[]
static {
- int scale;
try {
unsafe = Unsafe.getUnsafe();
arrayFieldOffset = unsafe.objectFieldOffset
(AtomicReferenceArray.class.getDeclaredField("array"));
base = unsafe.arrayBaseOffset(Object[].class);
- scale = unsafe.arrayIndexScale(Object[].class);
+ int scale = unsafe.arrayIndexScale(Object[].class);
+ if ((scale & (scale - 1)) != 0)
+ throw new Error("data type scale not a power of two");
+ shift = 31 - Integer.numberOfLeadingZeros(scale);
} catch (Exception e) {
throw new Error(e);
}
- if ((scale & (scale - 1)) != 0)
- throw new Error("data type scale not a power of two");
- shift = 31 - Integer.numberOfLeadingZeros(scale);
}
private long checkedByteOffset(int i) {
@@ -173,7 +171,7 @@
* @param i the index
* @param expect the expected value
* @param update the new value
- * @return true if successful. False return indicates that
+ * @return {@code true} if successful. False return indicates that
* the actual value was not equal to the expected value.
*/
public final boolean compareAndSet(int i, E expect, E update) {
@@ -188,20 +186,20 @@
* Atomically sets the element at position {@code i} to the given
* updated value if the current value {@code ==} the expected value.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param i the index
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
*/
public final boolean weakCompareAndSet(int i, E expect, E update) {
return compareAndSet(i, expect, update);
}
- /**
+ /**
* Atomically updates the element at index {@code i} with the results
* of applying the given function, returning the previous value. The
* function should be side-effect-free, since it may be re-applied
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Tue Jul 02 15:23:23 2013 -0700
@@ -37,14 +37,13 @@
import java.util.function.UnaryOperator;
import java.util.function.BinaryOperator;
import sun.misc.Unsafe;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
-
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException;
+import sun.reflect.CallerSensitive;
+import sun.reflect.Reflection;
/**
* A reflection-based utility that enables atomic updates to
@@ -82,29 +81,30 @@
* @param <T> The type of the object holding the updatable field
* @param <V> The type of the field
*/
-public abstract class AtomicReferenceFieldUpdater<T, V> {
+public abstract class AtomicReferenceFieldUpdater<T,V> {
/**
* Creates and returns an updater for objects with the given field.
* The Class arguments are needed to check that reflective types and
* generic types match.
*
- * @param tclass the class of the objects holding the field.
+ * @param tclass the class of the objects holding the field
* @param vclass the class of the field
- * @param fieldName the name of the field to be updated.
+ * @param fieldName the name of the field to be updated
* @return the updater
- * @throws IllegalArgumentException if the field is not a volatile reference type.
+ * @throws ClassCastException if the field is of the wrong type
+ * @throws IllegalArgumentException if the field is not volatile
* @throws RuntimeException with a nested reflection-based
* exception if the class does not hold field or is the wrong type,
* or the field is inaccessible to the caller according to Java language
* access control
*/
@CallerSensitive
- public static <U, W> AtomicReferenceFieldUpdater<U,W> newUpdater(Class<U> tclass, Class<W> vclass, String fieldName) {
- return new AtomicReferenceFieldUpdaterImpl<U,W>(tclass,
- vclass,
- fieldName,
- Reflection.getCallerClass());
+ public static <U,W> AtomicReferenceFieldUpdater<U,W> newUpdater(Class<U> tclass,
+ Class<W> vclass,
+ String fieldName) {
+ return new AtomicReferenceFieldUpdaterImpl<U,W>
+ (tclass, vclass, fieldName, Reflection.getCallerClass());
}
/**
@@ -123,7 +123,7 @@
* @param obj An object whose field to conditionally set
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
*/
public abstract boolean compareAndSet(T obj, V expect, V update);
@@ -134,14 +134,14 @@
* other calls to {@code compareAndSet} and {@code set}, but not
* necessarily with respect to other changes in the field.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param obj An object whose field to conditionally set
* @param expect the expected value
* @param update the new value
- * @return true if successful
+ * @return {@code true} if successful
*/
public abstract boolean weakCompareAndSet(T obj, V expect, V update);
@@ -301,10 +301,9 @@
*/
AtomicReferenceFieldUpdaterImpl(final Class<T> tclass,
- Class<V> vclass,
+ final Class<V> vclass,
final String fieldName,
- final Class<?> caller)
- {
+ final Class<?> caller) {
final Field field;
final Class<?> fieldClass;
final int modifiers;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java Tue Jul 02 15:23:23 2013 -0700
@@ -112,15 +112,15 @@
* current reference is {@code ==} to the expected reference
* and the current stamp is equal to the expected stamp.
*
- * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
- * and does not provide ordering guarantees, so is only rarely an
- * appropriate alternative to {@code compareAndSet}.
+ * <p><a href="package-summary.html#weakCompareAndSet">May fail
+ * spuriously and does not provide ordering guarantees</a>, so is
+ * only rarely an appropriate alternative to {@code compareAndSet}.
*
* @param expectedReference the expected value of the reference
* @param newReference the new value for the reference
* @param expectedStamp the expected value of the stamp
* @param newStamp the new value for the stamp
- * @return true if successful
+ * @return {@code true} if successful
*/
public boolean weakCompareAndSet(V expectedReference,
V newReference,
@@ -140,7 +140,7 @@
* @param newReference the new value for the reference
* @param expectedStamp the expected value of the stamp
* @param newStamp the new value for the stamp
- * @return true if successful
+ * @return {@code true} if successful
*/
public boolean compareAndSet(V expectedReference,
V newReference,
@@ -178,7 +178,7 @@
*
* @param expectedReference the expected value of the reference
* @param newStamp the new value for the stamp
- * @return true if successful
+ * @return {@code true} if successful
*/
public boolean attemptStamp(V expectedReference, int newStamp) {
Pair<V> current = pair;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java Tue Jul 02 15:23:23 2013 -0700
@@ -65,7 +65,7 @@
* <p>Class {@link DoubleAdder} provides analogs of the functionality
* of this class for the common special case of maintaining sums. The
* call {@code new DoubleAdder()} is equivalent to {@code new
- * DoubleAccumulator((x, y) -> x + y, 0.0}.
+ * DoubleAccumulator((x, y) -> x + y, 0.0)}.
*
* <p>This class extends {@link Number}, but does <em>not</em> define
* methods such as {@code equals}, {@code hashCode} and {@code
@@ -84,11 +84,13 @@
/**
* Creates a new instance using the given accumulator function
* and identity element.
+ * @param accumulatorFunction a side-effect-free function of two arguments
+ * @param identity identity (initial value) for the accumulator function
*/
public DoubleAccumulator(DoubleBinaryOperator accumulatorFunction,
double identity) {
this.function = accumulatorFunction;
- base = this.identity = Double.doubleToRawLongBits(identity);
+ base = this.identity = Double.doubleToRawLongBits(identity);
}
/**
--- a/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAdder.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAdder.java Tue Jul 02 15:23:23 2013 -0700
@@ -63,7 +63,7 @@
public class DoubleAdder extends Striped64 implements Serializable {
private static final long serialVersionUID = 7249069246863182397L;
- /**
+ /*
* Note that we must use "long" for underlying representations,
* because there is no compareAndSet for double, due to the fact
* that the bitwise equals used in any CAS implementation is not
--- a/jdk/src/share/classes/java/util/concurrent/atomic/LongAccumulator.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/LongAccumulator.java Tue Jul 02 15:23:23 2013 -0700
@@ -86,6 +86,8 @@
/**
* Creates a new instance using the given accumulator function
* and identity element.
+ * @param accumulatorFunction a side-effect-free function of two arguments
+ * @param identity identity (initial value) for the accumulator function
*/
public LongAccumulator(LongBinaryOperator accumulatorFunction,
long identity) {
--- a/jdk/src/share/classes/java/util/concurrent/atomic/Striped64.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/Striped64.java Tue Jul 02 15:23:23 2013 -0700
@@ -52,13 +52,13 @@
* accessed directly by subclasses.
*
* Table entries are of class Cell; a variant of AtomicLong padded
- * to reduce cache contention on most processors. Padding is
- * overkill for most Atomics because they are usually irregularly
- * scattered in memory and thus don't interfere much with each
- * other. But Atomic objects residing in arrays will tend to be
- * placed adjacent to each other, and so will most often share
- * cache lines (with a huge negative performance impact) without
- * this precaution.
+ * (via @sun.misc.Contended) to reduce cache contention. Padding
+ * is overkill for most Atomics because they are usually
+ * irregularly scattered in memory and thus don't interfere much
+ * with each other. But Atomic objects residing in arrays will
+ * tend to be placed adjacent to each other, and so will most
+ * often share cache lines (with a huge negative performance
+ * impact) without this precaution.
*
* In part because Cells are relatively large, we avoid creating
* them until they are needed. When there is no contention, all
@@ -112,18 +112,13 @@
/**
* Padded variant of AtomicLong supporting only raw accesses plus CAS.
- * The value field is placed between pads, hoping that the JVM doesn't
- * reorder them.
*
* JVM intrinsics note: It would be possible to use a release-only
* form of CAS here, if it were provided.
*/
- static final class Cell {
- volatile long p0, p1, p2, p3, p4, p5, p6;
+ @sun.misc.Contended static final class Cell {
volatile long value;
- volatile long q0, q1, q2, q3, q4, q5, q6;
Cell(long x) { value = x; }
-
final boolean cas(long cmp, long val) {
return UNSAFE.compareAndSwapLong(this, valueOffset, cmp, val);
}
--- a/jdk/src/share/classes/java/util/concurrent/atomic/package-info.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/package-info.java Tue Jul 02 15:23:23 2013 -0700
@@ -84,19 +84,18 @@
* write your utility method as follows:
* <pre> {@code
* long getAndTransform(AtomicLong var) {
- * while (true) {
- * long current = var.get();
- * long next = transform(current);
- * if (var.compareAndSet(current, next))
- * return current;
- * // return next; for transformAndGet
- * }
+ * long prev, next;
+ * do {
+ * prev = var.get();
+ * next = transform(prev);
+ * } while (!var.compareAndSet(prev, next));
+ * return prev; // return next; for transformAndGet
* }}</pre>
*
* <p>The memory effects for accesses and updates of atomics generally
* follow the rules for volatiles, as stated in
- * <a href="http://docs.oracle.com/javase/specs/jls/se7/html/index.html">
- * The Java Language Specification, Third Edition (17.4 Memory Model)</a>:
+ * <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4">
+ * The Java Language Specification (17.4 Memory Model)</a>:
*
* <ul>
*
@@ -152,13 +151,12 @@
* semantics for their array elements, which is not supported for
* ordinary arrays.
*
- * <a name="Spurious">
- * <p>The atomic classes also support method {@code weakCompareAndSet},
- * which has limited applicability. On some platforms, the weak version
- * may be more efficient than {@code compareAndSet} in the normal case,
- * but differs in that any given invocation of the
- * {@code weakCompareAndSet} method may return {@code false}
- * <em>spuriously</em> (that is, for no apparent reason)</a>. A
+ * <p id="weakCompareAndSet">The atomic classes also support method
+ * {@code weakCompareAndSet}, which has limited applicability. On some
+ * platforms, the weak version may be more efficient than {@code
+ * compareAndSet} in the normal case, but differs in that any given
+ * invocation of the {@code weakCompareAndSet} method may return {@code
+ * false} <em>spuriously</em> (that is, for no apparent reason). A
* {@code false} return means only that the operation may be retried if
* desired, relying on the guarantee that repeated invocation when the
* variable holds {@code expectedValue} and no other thread is also
@@ -194,7 +192,7 @@
*
* <p>Atomic classes are not general purpose replacements for
* {@code java.lang.Integer} and related classes. They do <em>not</em>
- * define methods such as {@code hashCode} and
+ * define methods such as {@code equals}, {@code hashCode} and
* {@code compareTo}. (Because atomic variables are expected to be
* mutated, they are poor choices for hash table keys.) Additionally,
* classes are provided only for those types that are commonly useful in
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java Tue Jul 02 15:23:23 2013 -0700
@@ -39,7 +39,7 @@
* A synchronizer that may be exclusively owned by a thread. This
* class provides a basis for creating locks and related synchronizers
* that may entail a notion of ownership. The
- * <tt>AbstractOwnableSynchronizer</tt> class itself does not manage or
+ * {@code AbstractOwnableSynchronizer} class itself does not manage or
* use this information. However, subclasses and tools may use
* appropriately maintained values to help control and monitor access
* and provide diagnostics.
@@ -64,20 +64,20 @@
private transient Thread exclusiveOwnerThread;
/**
- * Sets the thread that currently owns exclusive access. A
- * <tt>null</tt> argument indicates that no thread owns access.
+ * Sets the thread that currently owns exclusive access.
+ * A {@code null} argument indicates that no thread owns access.
* This method does not otherwise impose any synchronization or
- * <tt>volatile</tt> field accesses.
+ * {@code volatile} field accesses.
+ * @param thread the owner thread
*/
- protected final void setExclusiveOwnerThread(Thread t) {
- exclusiveOwnerThread = t;
+ protected final void setExclusiveOwnerThread(Thread thread) {
+ exclusiveOwnerThread = thread;
}
/**
- * Returns the thread last set by
- * <tt>setExclusiveOwnerThread</tt>, or <tt>null</tt> if never
- * set. This method does not otherwise impose any synchronization
- * or <tt>volatile</tt> field accesses.
+ * Returns the thread last set by {@code setExclusiveOwnerThread},
+ * or {@code null} if never set. This method does not otherwise
+ * impose any synchronization or {@code volatile} field accesses.
* @return the owner thread
*/
protected final Thread getExclusiveOwnerThread() {
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Tue Jul 02 15:23:23 2013 -0700
@@ -42,11 +42,11 @@
/**
* A version of {@link AbstractQueuedSynchronizer} in
- * which synchronization state is maintained as a <tt>long</tt>.
+ * which synchronization state is maintained as a {@code long}.
* This class has exactly the same structure, properties, and methods
- * as <tt>AbstractQueuedSynchronizer</tt> with the exception
+ * as {@code AbstractQueuedSynchronizer} with the exception
* that all state-related parameters and results are defined
- * as <tt>long</tt> rather than <tt>int</tt>. This class
+ * as {@code long} rather than {@code int}. This class
* may be useful when creating synchronizers such as
* multilevel locks and barriers that require
* 64 bits of state.
@@ -71,7 +71,7 @@
*/
/**
- * Creates a new <tt>AbstractQueuedLongSynchronizer</tt> instance
+ * Creates a new {@code AbstractQueuedLongSynchronizer} instance
* with initial synchronization state of zero.
*/
protected AbstractQueuedLongSynchronizer() { }
@@ -104,7 +104,7 @@
*
* <p>Insertion into a CLH queue requires only a single atomic
* operation on "tail", so there is a simple atomic point of
- * demarcation from unqueued to queued. Similarly, dequeing
+ * demarcation from unqueued to queued. Similarly, dequeuing
* involves only updating the "head". However, it takes a bit
* more work for nodes to determine who their successors are,
* in part to deal with possible cancellation due to timeouts
@@ -211,7 +211,7 @@
/**
* Link to predecessor node that current node/thread relies on
- * for checking waitStatus. Assigned during enqueing, and nulled
+ * for checking waitStatus. Assigned during enqueuing, and nulled
* out (for sake of GC) only upon dequeuing. Also, upon
* cancellation of a predecessor, we short-circuit while
* finding a non-cancelled one, which will always exist
@@ -256,7 +256,7 @@
Node nextWaiter;
/**
- * Returns true if node is waiting in shared mode
+ * Returns true if node is waiting in shared mode.
*/
final boolean isShared() {
return nextWaiter == SHARED;
@@ -312,7 +312,7 @@
/**
* Returns the current value of synchronization state.
- * This operation has memory semantics of a <tt>volatile</tt> read.
+ * This operation has memory semantics of a {@code volatile} read.
* @return current state value
*/
protected final long getState() {
@@ -321,7 +321,7 @@
/**
* Sets the value of synchronization state.
- * This operation has memory semantics of a <tt>volatile</tt> write.
+ * This operation has memory semantics of a {@code volatile} write.
* @param newState the new state value
*/
protected final void setState(long newState) {
@@ -331,12 +331,12 @@
/**
* Atomically sets synchronization state to the given updated
* value if the current state value equals the expected value.
- * This operation has memory semantics of a <tt>volatile</tt> read
+ * This operation has memory semantics of a {@code volatile} read
* and write.
*
* @param expect the expected value
* @param update the new value
- * @return true if successful. False return indicates that the actual
+ * @return {@code true} if successful. False return indicates that the actual
* value was not equal to the expected value.
*/
protected final boolean compareAndSetState(long expect, long update) {
@@ -441,7 +441,7 @@
}
/**
- * Release action for shared mode -- signal successor and ensure
+ * Release action for shared mode -- signals successor and ensures
* propagation. (Note: For exclusive mode, release just amounts
* to calling unparkSuccessor of head if it needs signal.)
*/
@@ -562,7 +562,7 @@
/**
* Checks and updates status for a node that failed to acquire.
* Returns true if thread should block. This is the main signal
- * control in all acquire loops. Requires that pred == node.prev
+ * control in all acquire loops. Requires that pred == node.prev.
*
* @param pred node's predecessor holding status
* @param node the node
@@ -1066,7 +1066,7 @@
* thread is queued, possibly repeatedly blocking and unblocking,
* invoking {@link #tryAcquireShared} until success or the thread
* is interrupted.
- * @param arg the acquire argument
+ * @param arg the acquire argument.
* This value is conveyed to {@link #tryAcquireShared} but is
* otherwise uninterpreted and can represent anything
* you like.
@@ -1441,7 +1441,7 @@
* Returns true if successful.
* @param node the node
* @return true if successfully transferred (else the node was
- * cancelled before signal).
+ * cancelled before signal)
*/
final boolean transferForSignal(Node node) {
/*
@@ -1464,11 +1464,10 @@
}
/**
- * Transfers node, if necessary, to sync queue after a cancelled
- * wait. Returns true if thread was cancelled before being
- * signalled.
- * @param current the waiting thread
- * @param node its node
+ * Transfers node, if necessary, to sync queue after a cancelled wait.
+ * Returns true if thread was cancelled before being signalled.
+ *
+ * @param node the node
* @return true if cancelled before the node was signalled
*/
final boolean transferAfterCancelledWait(Node node) {
@@ -1516,7 +1515,7 @@
* uses this synchronizer as its lock.
*
* @param condition the condition
- * @return <tt>true</tt> if owned
+ * @return {@code true} if owned
* @throws NullPointerException if the condition is null
*/
public final boolean owns(ConditionObject condition) {
@@ -1526,13 +1525,13 @@
/**
* Queries whether any threads are waiting on the given condition
* associated with this synchronizer. Note that because timeouts
- * and interrupts may occur at any time, a <tt>true</tt> return
- * does not guarantee that a future <tt>signal</tt> will awaken
+ * and interrupts may occur at any time, a {@code true} return
+ * does not guarantee that a future {@code signal} will awaken
* any threads. This method is designed primarily for use in
* monitoring of the system state.
*
* @param condition the condition
- * @return <tt>true</tt> if there are any waiting threads
+ * @return {@code true} if there are any waiting threads
* @throws IllegalMonitorStateException if exclusive synchronization
* is not held
* @throws IllegalArgumentException if the given condition is
@@ -1599,7 +1598,7 @@
* and Condition users. Exported versions of this class will in
* general need to be accompanied by documentation describing
* condition semantics that rely on those of the associated
- * <tt>AbstractQueuedLongSynchronizer</tt>.
+ * {@code AbstractQueuedLongSynchronizer}.
*
* <p>This class is Serializable, but all fields are transient,
* so deserialized conditions have no waiters.
@@ -1614,7 +1613,7 @@
private transient Node lastWaiter;
/**
- * Creates a new <tt>ConditionObject</tt> instance.
+ * Creates a new {@code ConditionObject} instance.
*/
public ConditionObject() { }
@@ -1967,7 +1966,7 @@
/**
* Queries whether any threads are waiting on this condition.
- * Implements {@link AbstractQueuedLongSynchronizer#hasWaiters}.
+ * Implements {@link AbstractQueuedLongSynchronizer#hasWaiters(ConditionObject)}.
*
* @return {@code true} if there are any waiting threads
* @throws IllegalMonitorStateException if {@link #isHeldExclusively}
@@ -1986,7 +1985,7 @@
/**
* Returns an estimate of the number of threads waiting on
* this condition.
- * Implements {@link AbstractQueuedLongSynchronizer#getWaitQueueLength}.
+ * Implements {@link AbstractQueuedLongSynchronizer#getWaitQueueLength(ConditionObject)}.
*
* @return the estimated number of waiting threads
* @throws IllegalMonitorStateException if {@link #isHeldExclusively}
@@ -2006,7 +2005,7 @@
/**
* Returns a collection containing those threads that may be
* waiting on this Condition.
- * Implements {@link AbstractQueuedLongSynchronizer#getWaitingThreads}.
+ * Implements {@link AbstractQueuedLongSynchronizer#getWaitingThreads(ConditionObject)}.
*
* @return the collection of threads
* @throws IllegalMonitorStateException if {@link #isHeldExclusively}
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Tue Jul 02 15:23:23 2013 -0700
@@ -45,12 +45,12 @@
* synchronizers (semaphores, events, etc) that rely on
* first-in-first-out (FIFO) wait queues. This class is designed to
* be a useful basis for most kinds of synchronizers that rely on a
- * single atomic <tt>int</tt> value to represent state. Subclasses
+ * single atomic {@code int} value to represent state. Subclasses
* must define the protected methods that change this state, and which
* define what that state means in terms of this object being acquired
* or released. Given these, the other methods in this class carry
* out all queuing and blocking mechanics. Subclasses can maintain
- * other state fields, but only the atomically updated <tt>int</tt>
+ * other state fields, but only the atomically updated {@code int}
* value manipulated using methods {@link #getState}, {@link
* #setState} and {@link #compareAndSetState} is tracked with respect
* to synchronization.
@@ -58,7 +58,7 @@
* <p>Subclasses should be defined as non-public internal helper
* classes that are used to implement the synchronization properties
* of their enclosing class. Class
- * <tt>AbstractQueuedSynchronizer</tt> does not implement any
+ * {@code AbstractQueuedSynchronizer} does not implement any
* synchronization interface. Instead it defines methods such as
* {@link #acquireInterruptibly} that can be invoked as
* appropriate by concrete locks and related synchronizers to
@@ -85,7 +85,7 @@
* invoked with the current {@link #getState} value fully releases
* this object, and {@link #acquire}, given this saved state value,
* eventually restores this object to its previous acquired state. No
- * <tt>AbstractQueuedSynchronizer</tt> method otherwise creates such a
+ * {@code AbstractQueuedSynchronizer} method otherwise creates such a
* condition, so if this constraint cannot be met, do not use it. The
* behavior of {@link ConditionObject} depends of course on the
* semantics of its synchronizer implementation.
@@ -93,13 +93,13 @@
* <p>This class provides inspection, instrumentation, and monitoring
* methods for the internal queue, as well as similar methods for
* condition objects. These can be exported as desired into classes
- * using an <tt>AbstractQueuedSynchronizer</tt> for their
+ * using an {@code AbstractQueuedSynchronizer} for their
* synchronization mechanics.
*
* <p>Serialization of this class stores only the underlying atomic
* integer maintaining state, so deserialized objects have empty
* thread queues. Typical subclasses requiring serializability will
- * define a <tt>readObject</tt> method that restores this to a known
+ * define a {@code readObject} method that restores this to a known
* initial state upon deserialization.
*
* <h3>Usage</h3>
@@ -115,14 +115,14 @@
* <li> {@link #tryAcquireShared}
* <li> {@link #tryReleaseShared}
* <li> {@link #isHeldExclusively}
- *</ul>
+ * </ul>
*
* Each of these methods by default throws {@link
* UnsupportedOperationException}. Implementations of these methods
* must be internally thread-safe, and should in general be short and
* not block. Defining these methods is the <em>only</em> supported
* means of using this class. All other methods are declared
- * <tt>final</tt> because they cannot be independently varied.
+ * {@code final} because they cannot be independently varied.
*
* <p>You may also find the inherited methods from {@link
* AbstractOwnableSynchronizer} useful to keep track of the thread
@@ -148,16 +148,16 @@
*
* (Shared mode is similar but may involve cascading signals.)
*
- * <p><a name="barging">Because checks in acquire are invoked before
+ * <p id="barging">Because checks in acquire are invoked before
* enqueuing, a newly acquiring thread may <em>barge</em> ahead of
* others that are blocked and queued. However, you can, if desired,
- * define <tt>tryAcquire</tt> and/or <tt>tryAcquireShared</tt> to
+ * define {@code tryAcquire} and/or {@code tryAcquireShared} to
* disable barging by internally invoking one or more of the inspection
* methods, thereby providing a <em>fair</em> FIFO acquisition order.
- * In particular, most fair synchronizers can define <tt>tryAcquire</tt>
- * to return <tt>false</tt> if {@link #hasQueuedPredecessors} (a method
+ * In particular, most fair synchronizers can define {@code tryAcquire}
+ * to return {@code false} if {@link #hasQueuedPredecessors} (a method
* specifically designed to be used by fair synchronizers) returns
- * <tt>true</tt>. Other variations are possible.
+ * {@code true}. Other variations are possible.
*
* <p>Throughput and scalability are generally highest for the
* default barging (also known as <em>greedy</em>,
@@ -167,7 +167,7 @@
* threads, and each recontention has an unbiased chance to succeed
* against incoming threads. Also, while acquires do not
* "spin" in the usual sense, they may perform multiple
- * invocations of <tt>tryAcquire</tt> interspersed with other
+ * invocations of {@code tryAcquire} interspersed with other
* computations before blocking. This gives most of the benefits of
* spins when exclusive synchronization is only briefly held, without
* most of the liabilities when it isn't. If so desired, you can
@@ -178,7 +178,7 @@
*
* <p>This class provides an efficient and scalable basis for
* synchronization in part by specializing its range of use to
- * synchronizers that can rely on <tt>int</tt> state, acquire, and
+ * synchronizers that can rely on {@code int} state, acquire, and
* release parameters, and an internal FIFO wait queue. When this does
* not suffice, you can build synchronizers from a lower level using
* {@link java.util.concurrent.atomic atomic} classes, your own custom
@@ -200,12 +200,12 @@
*
* // Our internal helper class
* private static class Sync extends AbstractQueuedSynchronizer {
- * // Report whether in locked state
+ * // Reports whether in locked state
* protected boolean isHeldExclusively() {
* return getState() == 1;
* }
*
- * // Acquire the lock if state is zero
+ * // Acquires the lock if state is zero
* public boolean tryAcquire(int acquires) {
* assert acquires == 1; // Otherwise unused
* if (compareAndSetState(0, 1)) {
@@ -215,7 +215,7 @@
* return false;
* }
*
- * // Release the lock by setting state to zero
+ * // Releases the lock by setting state to zero
* protected boolean tryRelease(int releases) {
* assert releases == 1; // Otherwise unused
* if (getState() == 0) throw new IllegalMonitorStateException();
@@ -224,10 +224,10 @@
* return true;
* }
*
- * // Provide a Condition
+ * // Provides a Condition
* Condition newCondition() { return new ConditionObject(); }
*
- * // Deserialize properly
+ * // Deserializes properly
* private void readObject(ObjectInputStream s)
* throws IOException, ClassNotFoundException {
* s.defaultReadObject();
@@ -255,8 +255,8 @@
*
* <p>Here is a latch class that is like a
* {@link java.util.concurrent.CountDownLatch CountDownLatch}
- * except that it only requires a single <tt>signal</tt> to
- * fire. Because a latch is non-exclusive, it uses the <tt>shared</tt>
+ * except that it only requires a single {@code signal} to
+ * fire. Because a latch is non-exclusive, it uses the {@code shared}
* acquire and release methods.
*
* <pre> {@code
@@ -293,7 +293,7 @@
private static final long serialVersionUID = 7373984972572414691L;
/**
- * Creates a new <tt>AbstractQueuedSynchronizer</tt> instance
+ * Creates a new {@code AbstractQueuedSynchronizer} instance
* with initial synchronization state of zero.
*/
protected AbstractQueuedSynchronizer() { }
@@ -326,7 +326,7 @@
*
* <p>Insertion into a CLH queue requires only a single atomic
* operation on "tail", so there is a simple atomic point of
- * demarcation from unqueued to queued. Similarly, dequeing
+ * demarcation from unqueued to queued. Similarly, dequeuing
* involves only updating the "head". However, it takes a bit
* more work for nodes to determine who their successors are,
* in part to deal with possible cancellation due to timeouts
@@ -433,7 +433,7 @@
/**
* Link to predecessor node that current node/thread relies on
- * for checking waitStatus. Assigned during enqueing, and nulled
+ * for checking waitStatus. Assigned during enqueuing, and nulled
* out (for sake of GC) only upon dequeuing. Also, upon
* cancellation of a predecessor, we short-circuit while
* finding a non-cancelled one, which will always exist
@@ -478,7 +478,7 @@
Node nextWaiter;
/**
- * Returns true if node is waiting in shared mode
+ * Returns true if node is waiting in shared mode.
*/
final boolean isShared() {
return nextWaiter == SHARED;
@@ -534,7 +534,7 @@
/**
* Returns the current value of synchronization state.
- * This operation has memory semantics of a <tt>volatile</tt> read.
+ * This operation has memory semantics of a {@code volatile} read.
* @return current state value
*/
protected final int getState() {
@@ -543,7 +543,7 @@
/**
* Sets the value of synchronization state.
- * This operation has memory semantics of a <tt>volatile</tt> write.
+ * This operation has memory semantics of a {@code volatile} write.
* @param newState the new state value
*/
protected final void setState(int newState) {
@@ -553,12 +553,12 @@
/**
* Atomically sets synchronization state to the given updated
* value if the current state value equals the expected value.
- * This operation has memory semantics of a <tt>volatile</tt> read
+ * This operation has memory semantics of a {@code volatile} read
* and write.
*
* @param expect the expected value
* @param update the new value
- * @return true if successful. False return indicates that the actual
+ * @return {@code true} if successful. False return indicates that the actual
* value was not equal to the expected value.
*/
protected final boolean compareAndSetState(int expect, int update) {
@@ -663,7 +663,7 @@
}
/**
- * Release action for shared mode -- signal successor and ensure
+ * Release action for shared mode -- signals successor and ensures
* propagation. (Note: For exclusive mode, release just amounts
* to calling unparkSuccessor of head if it needs signal.)
*/
@@ -784,7 +784,7 @@
/**
* Checks and updates status for a node that failed to acquire.
* Returns true if thread should block. This is the main signal
- * control in all acquire loops. Requires that pred == node.prev
+ * control in all acquire loops. Requires that pred == node.prev.
*
* @param pred node's predecessor holding status
* @param node the node
@@ -1288,7 +1288,7 @@
* thread is queued, possibly repeatedly blocking and unblocking,
* invoking {@link #tryAcquireShared} until success or the thread
* is interrupted.
- * @param arg the acquire argument
+ * @param arg the acquire argument.
* This value is conveyed to {@link #tryAcquireShared} but is
* otherwise uninterpreted and can represent anything
* you like.
@@ -1663,7 +1663,7 @@
* Returns true if successful.
* @param node the node
* @return true if successfully transferred (else the node was
- * cancelled before signal).
+ * cancelled before signal)
*/
final boolean transferForSignal(Node node) {
/*
@@ -1686,11 +1686,10 @@
}
/**
- * Transfers node, if necessary, to sync queue after a cancelled
- * wait. Returns true if thread was cancelled before being
- * signalled.
- * @param current the waiting thread
- * @param node its node
+ * Transfers node, if necessary, to sync queue after a cancelled wait.
+ * Returns true if thread was cancelled before being signalled.
+ *
+ * @param node the node
* @return true if cancelled before the node was signalled
*/
final boolean transferAfterCancelledWait(Node node) {
@@ -1738,7 +1737,7 @@
* uses this synchronizer as its lock.
*
* @param condition the condition
- * @return <tt>true</tt> if owned
+ * @return {@code true} if owned
* @throws NullPointerException if the condition is null
*/
public final boolean owns(ConditionObject condition) {
@@ -1748,13 +1747,13 @@
/**
* Queries whether any threads are waiting on the given condition
* associated with this synchronizer. Note that because timeouts
- * and interrupts may occur at any time, a <tt>true</tt> return
- * does not guarantee that a future <tt>signal</tt> will awaken
+ * and interrupts may occur at any time, a {@code true} return
+ * does not guarantee that a future {@code signal} will awaken
* any threads. This method is designed primarily for use in
* monitoring of the system state.
*
* @param condition the condition
- * @return <tt>true</tt> if there are any waiting threads
+ * @return {@code true} if there are any waiting threads
* @throws IllegalMonitorStateException if exclusive synchronization
* is not held
* @throws IllegalArgumentException if the given condition is
@@ -1821,7 +1820,7 @@
* and Condition users. Exported versions of this class will in
* general need to be accompanied by documentation describing
* condition semantics that rely on those of the associated
- * <tt>AbstractQueuedSynchronizer</tt>.
+ * {@code AbstractQueuedSynchronizer}.
*
* <p>This class is Serializable, but all fields are transient,
* so deserialized conditions have no waiters.
@@ -1834,7 +1833,7 @@
private transient Node lastWaiter;
/**
- * Creates a new <tt>ConditionObject</tt> instance.
+ * Creates a new {@code ConditionObject} instance.
*/
public ConditionObject() { }
@@ -2187,7 +2186,7 @@
/**
* Queries whether any threads are waiting on this condition.
- * Implements {@link AbstractQueuedSynchronizer#hasWaiters}.
+ * Implements {@link AbstractQueuedSynchronizer#hasWaiters(ConditionObject)}.
*
* @return {@code true} if there are any waiting threads
* @throws IllegalMonitorStateException if {@link #isHeldExclusively}
@@ -2206,7 +2205,7 @@
/**
* Returns an estimate of the number of threads waiting on
* this condition.
- * Implements {@link AbstractQueuedSynchronizer#getWaitQueueLength}.
+ * Implements {@link AbstractQueuedSynchronizer#getWaitQueueLength(ConditionObject)}.
*
* @return the estimated number of waiting threads
* @throws IllegalMonitorStateException if {@link #isHeldExclusively}
@@ -2226,7 +2225,7 @@
/**
* Returns a collection containing those threads that may be
* waiting on this Condition.
- * Implements {@link AbstractQueuedSynchronizer#getWaitingThreads}.
+ * Implements {@link AbstractQueuedSynchronizer#getWaitingThreads(ConditionObject)}.
*
* @return the collection of threads
* @throws IllegalMonitorStateException if {@link #isHeldExclusively}
--- a/jdk/src/share/classes/java/util/concurrent/locks/Condition.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/Condition.java Tue Jul 02 15:23:23 2013 -0700
@@ -324,7 +324,7 @@
* }
* }}</pre>
*
- * <p> Design note: This method requires a nanosecond argument so
+ * <p>Design note: This method requires a nanosecond argument so
* as to avoid truncation errors in reporting remaining times.
* Such precision loss would make it difficult for programmers to
* ensure that total waiting times are not systematically shorter
--- a/jdk/src/share/classes/java/util/concurrent/locks/Lock.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/Lock.java Tue Jul 02 15:23:23 2013 -0700
@@ -121,8 +121,8 @@
* <p>All {@code Lock} implementations <em>must</em> enforce the same
* memory synchronization semantics as provided by the built-in monitor
* lock, as described in
- * <a href="http://docs.oracle.com/javase/specs/jls/se7/html/index.html">
- * The Java Language Specification, Third Edition (17.4 Memory Model)</a>:
+ * <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4">
+ * The Java Language Specification (17.4 Memory Model)</a>:
* <ul>
* <li>A successful {@code lock} operation has the same memory
* synchronization effects as a successful <em>Lock</em> action.
@@ -136,7 +136,7 @@
*
* <h3>Implementation Considerations</h3>
*
- * <p> The three forms of lock acquisition (interruptible,
+ * <p>The three forms of lock acquisition (interruptible,
* non-interruptible, and timed) may differ in their performance
* characteristics, ordering guarantees, or other implementation
* qualities. Further, the ability to interrupt the <em>ongoing</em>
@@ -227,7 +227,7 @@
*
* @throws InterruptedException if the current thread is
* interrupted while acquiring the lock (and interruption
- * of lock acquisition is supported).
+ * of lock acquisition is supported)
*/
void lockInterruptibly() throws InterruptedException;
--- a/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java Tue Jul 02 15:23:23 2013 -0700
@@ -67,10 +67,10 @@
* {@code blocker} object parameter. This object is recorded while
* the thread is blocked to permit monitoring and diagnostic tools to
* identify the reasons that threads are blocked. (Such tools may
- * access blockers using method {@link #getBlocker}.) The use of these
- * forms rather than the original forms without this parameter is
- * strongly encouraged. The normal argument to supply as a
- * {@code blocker} within a lock implementation is {@code this}.
+ * access blockers using method {@link #getBlocker(Thread)}.)
+ * The use of these forms rather than the original forms without this
+ * parameter is strongly encouraged. The normal argument to supply as
+ * a {@code blocker} within a lock implementation is {@code this}.
*
* <p>These methods are designed to be used as tools for creating
* higher-level synchronization utilities, and are not in themselves
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java Tue Jul 02 15:23:23 2013 -0700
@@ -36,16 +36,16 @@
package java.util.concurrent.locks;
/**
- * A <tt>ReadWriteLock</tt> maintains a pair of associated {@link
+ * A {@code ReadWriteLock} maintains a pair of associated {@link
* Lock locks}, one for read-only operations and one for writing.
* The {@link #readLock read lock} may be held simultaneously by
* multiple reader threads, so long as there are no writers. The
* {@link #writeLock write lock} is exclusive.
*
- * <p>All <tt>ReadWriteLock</tt> implementations must guarantee that
- * the memory synchronization effects of <tt>writeLock</tt> operations
+ * <p>All {@code ReadWriteLock} implementations must guarantee that
+ * the memory synchronization effects of {@code writeLock} operations
* (as specified in the {@link Lock} interface) also hold with respect
- * to the associated <tt>readLock</tt>. That is, a thread successfully
+ * to the associated {@code readLock}. That is, a thread successfully
* acquiring the read lock will see all updates made upon previous
* release of the write lock.
*
@@ -120,14 +120,14 @@
/**
* Returns the lock used for reading.
*
- * @return the lock used for reading.
+ * @return the lock used for reading
*/
Lock readLock();
/**
* Returns the lock used for writing.
*
- * @return the lock used for writing.
+ * @return the lock used for writing
*/
Lock writeLock();
}
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java Tue Jul 02 15:23:23 2013 -0700
@@ -64,7 +64,7 @@
* fair lock may obtain it multiple times in succession while other
* active threads are not progressing and not currently holding the
* lock.
- * Also note that the untimed {@link #tryLock() tryLock} method does not
+ * Also note that the untimed {@link #tryLock()} method does not
* honor the fairness setting. It will succeed if the lock
* is available even if other threads are waiting.
*
@@ -88,10 +88,9 @@
* }}</pre>
*
* <p>In addition to implementing the {@link Lock} interface, this
- * class defines methods {@code isLocked} and
- * {@code getLockQueueLength}, as well as some associated
- * {@code protected} access methods that may be useful for
- * instrumentation and monitoring.
+ * class defines a number of {@code public} and {@code protected}
+ * methods for inspecting the state of the lock. Some of these
+ * methods are only useful for instrumentation and monitoring.
*
* <p>Serialization of this class behaves in the same way as built-in
* locks: a deserialized lock is in the unlocked state, regardless of
@@ -124,9 +123,8 @@
abstract void lock();
/**
- * Performs non-fair tryLock. tryAcquire is
- * implemented in subclasses, but both need nonfair
- * try for trylock method.
+ * Performs non-fair tryLock. tryAcquire is implemented in
+ * subclasses, but both need nonfair try for trylock method.
*/
final boolean nonfairTryAcquire(int acquires) {
final Thread current = Thread.currentThread();
@@ -353,7 +351,7 @@
* {@link #tryLock(long, TimeUnit) tryLock(0, TimeUnit.SECONDS) }
* which is almost equivalent (it also detects interruption).
*
- * <p> If the current thread already holds this lock then the hold
+ * <p>If the current thread already holds this lock then the hold
* count is incremented by one and the method returns {@code true}.
*
* <p>If the lock is held by another thread then this method will return
@@ -538,10 +536,10 @@
/**
* Queries if this lock is held by the current thread.
*
- * <p>Analogous to the {@link Thread#holdsLock} method for built-in
- * monitor locks, this method is typically used for debugging and
- * testing. For example, a method that should only be called while
- * a lock is held can assert that this is the case:
+ * <p>Analogous to the {@link Thread#holdsLock(Object)} method for
+ * built-in monitor locks, this method is typically used for
+ * debugging and testing. For example, a method that should only be
+ * called while a lock is held can assert that this is the case:
*
* <pre> {@code
* class X {
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java Tue Jul 02 15:23:23 2013 -0700
@@ -45,7 +45,7 @@
* <ul>
* <li><b>Acquisition order</b>
*
- * <p> This class does not impose a reader or writer preference
+ * <p>This class does not impose a reader or writer preference
* ordering for lock access. However, it does support an optional
* <em>fairness</em> policy.
*
@@ -59,7 +59,7 @@
* <p>
*
* <dt><b><i>Fair mode</i></b>
- * <dd> When constructed as fair, threads contend for entry using an
+ * <dd>When constructed as fair, threads contend for entry using an
* approximately arrival-order policy. When the currently held lock
* is released, either the longest-waiting single writer thread will
* be assigned the write lock, or if there is a group of reader threads
@@ -277,7 +277,7 @@
static final class HoldCounter {
int count = 0;
// Use id, not reference, to avoid garbage retention
- final long tid = Thread.currentThread().getId();
+ final long tid = getThreadId(Thread.currentThread());
}
/**
@@ -420,7 +420,7 @@
firstReaderHoldCount--;
} else {
HoldCounter rh = cachedHoldCounter;
- if (rh == null || rh.tid != current.getId())
+ if (rh == null || rh.tid != getThreadId(current))
rh = readHolds.get();
int count = rh.count;
if (count <= 1) {
@@ -478,7 +478,7 @@
firstReaderHoldCount++;
} else {
HoldCounter rh = cachedHoldCounter;
- if (rh == null || rh.tid != current.getId())
+ if (rh == null || rh.tid != getThreadId(current))
cachedHoldCounter = rh = readHolds.get();
else if (rh.count == 0)
readHolds.set(rh);
@@ -515,7 +515,7 @@
} else {
if (rh == null) {
rh = cachedHoldCounter;
- if (rh == null || rh.tid != current.getId()) {
+ if (rh == null || rh.tid != getThreadId(current)) {
rh = readHolds.get();
if (rh.count == 0)
readHolds.remove();
@@ -536,7 +536,7 @@
} else {
if (rh == null)
rh = cachedHoldCounter;
- if (rh == null || rh.tid != current.getId())
+ if (rh == null || rh.tid != getThreadId(current))
rh = readHolds.get();
else if (rh.count == 0)
readHolds.set(rh);
@@ -592,7 +592,7 @@
firstReaderHoldCount++;
} else {
HoldCounter rh = cachedHoldCounter;
- if (rh == null || rh.tid != current.getId())
+ if (rh == null || rh.tid != getThreadId(current))
cachedHoldCounter = rh = readHolds.get();
else if (rh.count == 0)
readHolds.set(rh);
@@ -643,7 +643,7 @@
return firstReaderHoldCount;
HoldCounter rh = cachedHoldCounter;
- if (rh != null && rh.tid == current.getId())
+ if (rh != null && rh.tid == getThreadId(current))
return rh.count;
int count = readHolds.get().count;
@@ -875,7 +875,7 @@
/**
* Attempts to release this lock.
*
- * <p> If the number of readers is now zero then the lock
+ * <p>If the number of readers is now zero then the lock
* is made available for write lock attempts.
*/
public void unlock() {
@@ -1017,7 +1017,7 @@
* #tryLock(long, TimeUnit) tryLock(0, TimeUnit.SECONDS) }
* which is almost equivalent (it also detects interruption).
*
- * <p> If the current thread already holds this lock then the
+ * <p>If the current thread already holds this lock then the
* hold count is incremented by one and the method returns
* {@code true}.
*
@@ -1126,7 +1126,7 @@
* IllegalMonitorStateException} is thrown.
*
* @throws IllegalMonitorStateException if the current thread does not
- * hold this lock.
+ * hold this lock
*/
public void unlock() {
sync.release(1);
@@ -1254,7 +1254,7 @@
* Queries the number of read locks held for this lock. This
* method is designed for use in monitoring system state, not for
* synchronization control.
- * @return the number of read locks held.
+ * @return the number of read locks held
*/
public int getReadLockCount() {
return sync.getReadLockCount();
@@ -1484,4 +1484,28 @@
"[Write locks = " + w + ", Read locks = " + r + "]";
}
+ /**
+ * Returns the thread id for the given thread. We must access
+ * this directly rather than via method Thread.getId() because
+ * getId() is not final, and has been known to be overridden in
+ * ways that do not preserve unique mappings.
+ */
+ static final long getThreadId(Thread thread) {
+ return UNSAFE.getLongVolatile(thread, TID_OFFSET);
+ }
+
+ // Unsafe mechanics
+ private static final sun.misc.Unsafe UNSAFE;
+ private static final long TID_OFFSET;
+ static {
+ try {
+ UNSAFE = sun.misc.Unsafe.getUnsafe();
+ Class<?> tk = Thread.class;
+ TID_OFFSET = UNSAFE.objectFieldOffset
+ (tk.getDeclaredField("tid"));
+ } catch (Exception e) {
+ throw new Error(e);
+ }
+ }
+
}
--- a/jdk/src/share/classes/java/util/concurrent/locks/StampedLock.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/StampedLock.java Tue Jul 02 15:23:23 2013 -0700
@@ -366,6 +366,8 @@
* Behavior under timeout and interruption matches that specified
* for method {@link Lock#tryLock(long,TimeUnit)}.
*
+ * @param time the maximum time to wait for the lock
+ * @param unit the time unit of the {@code time} argument
* @return a stamp that can be used to unlock or convert mode,
* or zero if the lock is not available
* @throws InterruptedException if the current thread is interrupted
@@ -445,6 +447,8 @@
* Behavior under timeout and interruption matches that specified
* for method {@link Lock#tryLock(long,TimeUnit)}.
*
+ * @param time the maximum time to wait for the lock
+ * @param unit the time unit of the {@code time} argument
* @return a stamp that can be used to unlock or convert mode,
* or zero if the lock is not available
* @throws InterruptedException if the current thread is interrupted
@@ -510,7 +514,8 @@
* obtained from {@link #tryOptimisticRead} or a locking method
* for this lock has no defined effect or result.
*
- * @return true if the lock has not been exclusively acquired
+ * @param stamp a stamp
+ * @return {@code true} if the lock has not been exclusively acquired
* since issuance of the given stamp; else false
*/
public boolean validate(long stamp) {
@@ -723,7 +728,7 @@
* stamp value. This method may be useful for recovery after
* errors.
*
- * @return true if the lock was held, else false
+ * @return {@code true} if the lock was held, else false
*/
public boolean tryUnlockWrite() {
long s; WNode h;
@@ -741,7 +746,7 @@
* requiring a stamp value. This method may be useful for recovery
* after errors.
*
- * @return true if the read lock was held, else false
+ * @return {@code true} if the read lock was held, else false
*/
public boolean tryUnlockRead() {
long s, m; WNode h;
@@ -773,18 +778,18 @@
}
/**
- * Returns true if the lock is currently held exclusively.
+ * Returns {@code true} if the lock is currently held exclusively.
*
- * @return true if the lock is currently held exclusively
+ * @return {@code true} if the lock is currently held exclusively
*/
public boolean isWriteLocked() {
return (state & WBIT) != 0L;
}
/**
- * Returns true if the lock is currently held non-exclusively.
+ * Returns {@code true} if the lock is currently held non-exclusively.
*
- * @return true if the lock is currently held non-exclusively
+ * @return {@code true} if the lock is currently held non-exclusively
*/
public boolean isReadLocked() {
return (state & RBITS) != 0L;
--- a/jdk/src/share/classes/java/util/function/BinaryOperator.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/function/BinaryOperator.java Tue Jul 02 15:23:23 2013 -0700
@@ -24,6 +24,9 @@
*/
package java.util.function;
+import java.util.Objects;
+import java.util.Comparator;
+
/**
* An operation upon two operands yielding a result. This is a specialization of
* {@code BiFunction} where the operands and the result are all of the same type.
@@ -35,4 +38,33 @@
*/
@FunctionalInterface
public interface BinaryOperator<T> extends BiFunction<T,T,T> {
+ /**
+ * Returns a {@link BinaryOperator} which returns the lesser of two elements
+ * according to the specified {@code Comparator}
+ *
+ * @param <T> the type of values to be compared and returned
+ * @param comparator a {@code Comparator} for comparing the two values
+ * @return a {@code BinaryOperator} which returns the lesser of its operands,
+ * according to the supplied {@code Comparator}
+ * @throws NullPointerException if the argument is null
+ */
+ public static<T> BinaryOperator<T> minBy(Comparator<? super T> comparator) {
+ Objects.requireNonNull(comparator);
+ return (a, b) -> comparator.compare(a, b) <= 0 ? a : b;
+ }
+
+ /**
+ * Returns a {@link BinaryOperator} which returns the greater of two elements
+ * according to the specified {@code Comparator}
+ *
+ * @param <T> the type of values to be compared and returned
+ * @param comparator a {@code Comparator} for comparing the two values
+ * @return a {@code BinaryOperator} which returns the greater of its operands,
+ * according to the supplied {@code Comparator}
+ * @throws NullPointerException if the argument is null
+ */
+ public static<T> BinaryOperator<T> maxBy(Comparator<? super T> comparator) {
+ Objects.requireNonNull(comparator);
+ return (a, b) -> comparator.compare(a, b) >= 0 ? a : b;
+ }
}
--- a/jdk/src/share/classes/java/util/function/Function.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/function/Function.java Tue Jul 02 15:23:23 2013 -0700
@@ -87,6 +87,7 @@
* Returns a {@code Function} whose {@code apply} method returns its input.
*
* @param <T> the type of the input and output objects to the function
+ * @return a {@code Function} whose {@code apply} method returns its input
*/
static <T> Function<T, T> identity() {
return t -> t;
--- a/jdk/src/share/classes/java/util/function/UnaryOperator.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/function/UnaryOperator.java Tue Jul 02 15:23:23 2013 -0700
@@ -40,6 +40,7 @@
/**
* Returns a unary operator that provides its input value as the result.
*
+ * @param <T> the type of the input and output objects to the function
* @return a unary operator that provides its input value as the result
*/
static <T> UnaryOperator<T> identity() {
--- a/jdk/src/share/classes/java/util/jar/Pack200.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/jar/Pack200.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -112,7 +112,7 @@
// Static methods of the Pack200 class.
/**
* Obtain new instance of a class that implements Packer.
- *
+ * <ul>
* <li><p>If the system property <tt>java.util.jar.Pack200.Packer</tt>
* is defined, then the value is taken to be the fully-qualified name
* of a concrete implementation class, which must implement Packer.
@@ -122,6 +122,7 @@
* <li><p>If an implementation has not been specified with the system
* property, then the system-default implementation class is instantiated,
* and the result is returned.</p></li>
+ * </ul>
*
* <p>Note: The returned object is not guaranteed to operate
* correctly if multiple threads use it at the same time.
@@ -137,7 +138,7 @@
/**
* Obtain new instance of a class that implements Unpacker.
- *
+ * <ul>
* <li><p>If the system property <tt>java.util.jar.Pack200.Unpacker</tt>
* is defined, then the value is taken to be the fully-qualified
* name of a concrete implementation class, which must implement Unpacker.
@@ -147,6 +148,7 @@
* <li><p>If an implementation has not been specified with the
* system property, then the system-default implementation class
* is instantiated, and the result is returned.</p></li>
+ * </ul>
*
* <p>Note: The returned object is not guaranteed to operate
* correctly if multiple threads use it at the same time.
@@ -350,14 +352,14 @@
* directory will be passed also.
* <p>
* Examples:
- * <pre><code>
+ * <pre>{@code
* Map p = packer.properties();
* p.put(PASS_FILE_PFX+0, "mutants/Rogue.class");
* p.put(PASS_FILE_PFX+1, "mutants/Wolverine.class");
* p.put(PASS_FILE_PFX+2, "mutants/Storm.class");
* # Pass all files in an entire directory hierarchy:
* p.put(PASS_FILE_PFX+3, "police/");
- * </pre></code>.
+ * }</pre>
*/
String PASS_FILE_PFX = "pack.pass.file.";
@@ -378,12 +380,12 @@
* This is the default value for this property.
* <p>
* Examples:
- * <pre><code>
+ * <pre>{@code
* Map p = pack200.getProperties();
* p.put(UNKNOWN_ATTRIBUTE, ERROR);
* p.put(UNKNOWN_ATTRIBUTE, STRIP);
* p.put(UNKNOWN_ATTRIBUTE, PASS);
- * </pre></code>
+ * }</pre>
*/
String UNKNOWN_ATTRIBUTE = "pack.unknown.attribute";
--- a/jdk/src/share/classes/java/util/logging/Handler.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/logging/Handler.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -209,6 +209,7 @@
/**
* Retrieves the ErrorManager for this Handler.
*
+ * @return the ErrorManager for this Handler
* @exception SecurityException if a security manager exists and if
* the caller does not have <tt>LoggingPermission("control")</tt>.
*/
--- a/jdk/src/share/classes/java/util/logging/LogManager.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java Tue Jul 02 15:23:23 2013 -0700
@@ -193,13 +193,27 @@
// Create and retain Logger for the root of the namespace.
manager.rootLogger = manager.new RootLogger();
+ // since by design the global manager's userContext and
+ // systemContext don't have their requiresDefaultLoggers
+ // flag set - we make sure to add the root logger to
+ // the global manager's default contexts here.
manager.addLogger(manager.rootLogger);
- manager.systemContext.addLocalLogger(manager.rootLogger);
+ manager.systemContext.addLocalLogger(manager.rootLogger, false);
+ manager.userContext.addLocalLogger(manager.rootLogger, false);
// Adding the global Logger. Doing so in the Logger.<clinit>
// would deadlock with the LogManager.<clinit>.
- Logger.global.setLogManager(manager);
- manager.addLogger(Logger.global);
+ // Do not call Logger.getGlobal() here as this might trigger
+ // the deadlock too.
+ @SuppressWarnings("deprecation")
+ final Logger global = Logger.global;
+ global.setLogManager(manager);
+
+ // Make sure the global logger will be registered in the
+ // global manager's default contexts.
+ manager.addLogger(global);
+ manager.systemContext.addLocalLogger(global, false);
+ manager.userContext.addLocalLogger(global, false);
// We don't call readConfiguration() here, as we may be running
// very early in the JVM startup sequence. Instead readConfiguration
@@ -257,7 +271,8 @@
}
/**
- * Return the global LogManager object.
+ * Returns the global LogManager object.
+ * @return the global LogManager object
*/
public static LogManager getLogManager() {
if (manager != null) {
@@ -400,7 +415,11 @@
if (javaAwtAccess.isMainAppContext()) {
context = userContext;
} else {
- context = new LoggerContext();
+ // Create a new LoggerContext for the applet.
+ // The new logger context has its requiresDefaultLoggers
+ // flag set to true - so that these loggers will be
+ // lazily added when the context is firt accessed.
+ context = new LoggerContext(true);
}
javaAwtAccess.put(ecx, LoggerContext.class, context);
}
@@ -507,9 +526,13 @@
private final Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<>();
// Tree of named Loggers
private final LogNode root;
-
+ private final boolean requiresDefaultLoggers;
private LoggerContext() {
+ this(false);
+ }
+ private LoggerContext(boolean requiresDefaultLoggers) {
this.root = new LogNode(null, this);
+ this.requiresDefaultLoggers = requiresDefaultLoggers;
}
Logger demandLogger(String name, String resourceBundleName) {
@@ -518,7 +541,27 @@
return manager.demandLogger(name, resourceBundleName, null);
}
+
+ // Due to subtle deadlock issues getUserContext() no longer
+ // calls addLocalLogger(rootLogger);
+ // Therefore - we need to add the default loggers later on.
+ // Checks that the context is properly initialized
+ // This is necessary before calling e.g. find(name)
+ // or getLoggerNames()
+ //
+ private void ensureInitialized() {
+ if (requiresDefaultLoggers) {
+ // Ensure that the root and global loggers are set.
+ ensureDefaultLogger(manager.rootLogger);
+ ensureDefaultLogger(Logger.global);
+ }
+ }
+
+
synchronized Logger findLogger(String name) {
+ // ensure that this context is properly initialized before
+ // looking for loggers.
+ ensureInitialized();
LoggerWeakRef ref = namedLoggers.get(name);
if (ref == null) {
return null;
@@ -532,21 +575,76 @@
return logger;
}
- synchronized void ensureRootLogger(Logger logger) {
- if (logger.getName().isEmpty())
- return;
+ // This method is called before adding a logger to the
+ // context.
+ // 'logger' is the context that will be added.
+ // This method will ensure that the defaults loggers are added
+ // before adding 'logger'.
+ //
+ private void ensureAllDefaultLoggers(Logger logger) {
+ if (requiresDefaultLoggers) {
+ final String name = logger.getName();
+ if (!name.isEmpty()) {
+ ensureDefaultLogger(manager.rootLogger);
+ }
+ if (!Logger.GLOBAL_LOGGER_NAME.equals(name)) {
+ ensureDefaultLogger(Logger.global);
+ }
+ }
+ }
+
+ private void ensureDefaultLogger(Logger logger) {
+ // Used for lazy addition of root logger and global logger
+ // to a LoggerContext.
- // during initialization, rootLogger is null when
- // instantiating itself RootLogger
- if (findLogger("") == null && manager.rootLogger != null) {
- addLocalLogger(manager.rootLogger);
+ // This check is simple sanity: we do not want that this
+ // method be called for anything else than Logger.global
+ // or owner.rootLogger.
+ if (!requiresDefaultLoggers || logger == null
+ || logger != Logger.global && logger != manager.rootLogger) {
+
+ // the case where we have a non null logger which is neither
+ // Logger.global nor manager.rootLogger indicates a serious
+ // issue - as ensureDefaultLogger should never be called
+ // with any other loggers than one of these two (or null - if
+ // e.g manager.rootLogger is not yet initialized)...
+ assert logger == null;
+
+ return;
}
+
+ // Adds the logger if it's not already there.
+ if (!namedLoggers.containsKey(logger.getName())) {
+ // It is important to prevent addLocalLogger to
+ // call ensureAllDefaultLoggers when we're in the process
+ // off adding one of those default loggers - as this would
+ // immediately cause a stack overflow.
+ // Therefore we must pass addDefaultLoggersIfNeeded=false,
+ // even if requiresDefaultLoggers is true.
+ addLocalLogger(logger, false);
+ }
+ }
+
+ boolean addLocalLogger(Logger logger) {
+ // no need to add default loggers if it's not required
+ return addLocalLogger(logger, requiresDefaultLoggers);
}
// Add a logger to this context. This method will only set its level
// and process parent loggers. It doesn't set its handlers.
- synchronized boolean addLocalLogger(Logger logger) {
- ensureRootLogger(logger);
+ synchronized boolean addLocalLogger(Logger logger, boolean addDefaultLoggersIfNeeded) {
+ // addDefaultLoggersIfNeeded serves to break recursion when adding
+ // default loggers. If we're adding one of the default loggers
+ // (we're being called from ensureDefaultLogger()) then
+ // addDefaultLoggersIfNeeded will be false: we don't want to
+ // call ensureAllDefaultLoggers again.
+ //
+ // Note: addDefaultLoggersIfNeeded can also be false when
+ // requiresDefaultLoggers is false - since calling
+ // ensureAllDefaultLoggers would have no effect in this case.
+ if (addDefaultLoggersIfNeeded) {
+ ensureAllDefaultLoggers(logger);
+ }
final String name = logger.getName();
if (name == null) {
@@ -614,6 +712,9 @@
}
synchronized Enumeration<String> getLoggerNames() {
+ // ensure that this context is properly initialized before
+ // returning logger names.
+ ensureInitialized();
return namedLoggers.keys();
}
--- a/jdk/src/share/classes/java/util/logging/LogRecord.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/logging/LogRecord.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -211,6 +211,7 @@
* the message string before formatting it. The result may
* be null if the message is not localizable, or if no suitable
* ResourceBundle is available.
+ * @return the localization resource bundle
*/
public ResourceBundle getResourceBundle() {
return resourceBundle;
@@ -231,6 +232,7 @@
* This is the name for the ResourceBundle that should be
* used to localize the message string before formatting it.
* The result may be null if the message is not localizable.
+ * @return the localization resource bundle name
*/
public String getResourceBundleName() {
return resourceBundleName;
@@ -281,6 +283,7 @@
* <p>
* Sequence numbers are normally assigned in the LogRecord constructor,
* so it should not normally be necessary to use this method.
+ * @param seq the sequence number
*/
public void setSequenceNumber(long seq) {
sequenceNumber = seq;
--- a/jdk/src/share/classes/java/util/logging/Logger.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/logging/Logger.java Tue Jul 02 15:23:23 2013 -0700
@@ -232,6 +232,27 @@
* @since 1.7
*/
public static final Logger getGlobal() {
+ // In order to break a cyclic dependence between the LogManager
+ // and Logger static initializers causing deadlocks, the global
+ // logger is created with a special constructor that does not
+ // initialize its log manager.
+ //
+ // If an application calls Logger.getGlobal() before any logger
+ // has been initialized, it is therefore possible that the
+ // LogManager class has not been initialized yet, and therefore
+ // Logger.global.manager will be null.
+ //
+ // In order to finish the initialization of the global logger, we
+ // will therefore call LogManager.getLogManager() here.
+ //
+ // Care must be taken *not* to call Logger.getGlobal() in
+ // LogManager static initializers in order to avoid such
+ // deadlocks.
+ //
+ if (global != null && global.manager == null) {
+ // Complete initialization of the global Logger.
+ global.manager = LogManager.getLogManager();
+ }
return global;
}
--- a/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -1121,6 +1121,8 @@
* removed. (The implementor needn't check for any of these things.)
*
* <p>This method is invoked with the lock on this node held.
+ * @param key the key
+ * @param value the value
*/
protected abstract void putSpi(String key, String value);
@@ -1139,6 +1141,7 @@
*
* <p>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 <tt>null</tt> if there is no association for this
* key, or the association cannot be determined at this time.
@@ -1152,6 +1155,7 @@
* (The implementor needn't check for either of these things.)
*
* <p>This method is invoked with the lock on this node held.
+ * @param key the key
*/
protected abstract void removeSpi(String key);
--- a/jdk/src/share/classes/java/util/prefs/PreferencesFactory.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/prefs/PreferencesFactory.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -45,6 +45,7 @@
/**
* Returns the system root preference node. (Multiple calls on this
* method will return the same object reference.)
+ * @return the system root preference node
*/
Preferences systemRoot();
@@ -52,6 +53,8 @@
* Returns the user root preference node corresponding to the calling
* user. In a server, the returned value will typically depend on
* some implicit client-context.
+ * @return the user root preference node corresponding to the calling
+ * user
*/
Preferences userRoot();
}
--- a/jdk/src/share/classes/java/util/spi/LocaleServiceProvider.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/spi/LocaleServiceProvider.java Tue Jul 02 15:23:23 2013 -0700
@@ -42,7 +42,7 @@
* interfaces to offer support for locales beyond the set of locales
* supported by the Java runtime environment itself.
* <p>
- * <h4>Packaging of Locale Sensitive Service Provider Implementations</h4>
+ * <h3>Packaging of Locale Sensitive Service Provider Implementations</h3>
* Implementations of these locale sensitive services are packaged using the
* <a href="../../../../technotes/guides/extensions/index.html">Java Extension Mechanism</a>
* as installed extensions. A provider identifies itself with a
@@ -94,7 +94,7 @@
* supports the requested locale, the methods go through a list of candidate
* locales and repeat the availability check for each until a match is found.
* The algorithm used for creating a list of candidate locales is same as
- * the one used by <code>ResourceBunlde</code> by default (see
+ * the one used by <code>ResourceBundle</code> by default (see
* {@link java.util.ResourceBundle.Control#getCandidateLocales getCandidateLocales}
* for the details). Even if a locale is resolved from the candidate list,
* methods that return requested objects or names are invoked with the original
@@ -165,7 +165,7 @@
/**
* Returns {@code true} if the given {@code locale} is supported by
* this locale service provider. The given {@code locale} may contain
- * <a href="../Locale.html#def_extensions">extensions<a/> that should be
+ * <a href="../Locale.html#def_extensions">extensions</a> that should be
* taken into account for the support determination.
*
* <p>The default implementation returns {@code true} if the given {@code locale}
--- a/jdk/src/share/classes/java/util/stream/AbstractPipeline.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/AbstractPipeline.java Tue Jul 02 15:23:23 2013 -0700
@@ -375,6 +375,12 @@
// NOTE: there are no size-injecting ops
if (StreamOpFlag.SHORT_CIRCUIT.isKnown(thisOpFlags)) {
backPropagationHead = p;
+ // Clear the short circuit flag for next pipeline stage
+ // This stage encapsulates short-circuiting, the next
+ // stage may not have any short-circuit operations, and
+ // if so spliterator.forEachRemaining should be be used
+ // for traversal
+ thisOpFlags = thisOpFlags & ~StreamOpFlag.IS_SHORT_CIRCUIT;
}
depth = 0;
@@ -448,6 +454,15 @@
// PipelineHelper
@Override
+ final StreamShape getSourceShape() {
+ AbstractPipeline p = AbstractPipeline.this;
+ while (p.depth > 0) {
+ p = p.previousStage;
+ }
+ return p.getOutputShape();
+ }
+
+ @Override
final <P_IN> long exactOutputSizeIfKnown(Spliterator<P_IN> spliterator) {
return StreamOpFlag.SIZED.isKnown(getStreamAndOpFlags()) ? spliterator.getExactSizeIfKnown() : -1;
}
@@ -503,6 +518,16 @@
}
@Override
+ final <P_IN> Spliterator<E_OUT> wrapSpliterator(Spliterator<P_IN> sourceSpliterator) {
+ if (depth == 0) {
+ return (Spliterator<E_OUT>) sourceSpliterator;
+ }
+ else {
+ return wrap(this, () -> sourceSpliterator, isParallel());
+ }
+ }
+
+ @Override
@SuppressWarnings("unchecked")
final <P_IN> Node<E_OUT> evaluate(Spliterator<P_IN> spliterator,
boolean flatten,
--- a/jdk/src/share/classes/java/util/stream/AbstractTask.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/AbstractTask.java Tue Jul 02 15:23:23 2013 -0700
@@ -316,6 +316,7 @@
else {
K l = task.leftChild = task.makeChild(split);
K r = task.rightChild = task.makeChild(task.spliterator);
+ task.spliterator = null;
task.setPendingCount(1);
l.fork();
task = r;
--- a/jdk/src/share/classes/java/util/stream/Collectors.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/Collectors.java Tue Jul 02 15:23:23 2013 -0700
@@ -30,7 +30,6 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
-import java.util.Comparators;
import java.util.DoubleSummaryStatistics;
import java.util.EnumSet;
import java.util.HashMap;
@@ -78,7 +77,7 @@
*
* // Find highest-paid employee
* Employee highestPaid = employees.stream()
- * .collect(Collectors.maxBy(Comparators.comparing(Employee::getSalary)));
+ * .collect(Collectors.maxBy(Comparator.comparing(Employee::getSalary)));
*
* // Group employees by department
* Map<Department, List<Employee>> byDept
@@ -89,7 +88,7 @@
* Map<Department, Employee> highestPaidByDept
* = employees.stream()
* .collect(Collectors.groupingBy(Employee::getDepartment,
- * Collectors.maxBy(Comparators.comparing(Employee::getSalary))));
+ * Collectors.maxBy(Comparator.comparing(Employee::getSalary))));
*
* // Partition students into passing and failing
* Map<Boolean, List<Student>> passingFailing =
@@ -404,7 +403,7 @@
* @implSpec
* This produces a result equivalent to:
* <pre>{@code
- * reducing(Comparators.lesserOf(comparator))
+ * reducing(BinaryOperator.minBy(comparator))
* }</pre>
*
* @param <T> the type of the input elements
@@ -413,7 +412,7 @@
*/
public static <T> Collector<T, T>
minBy(Comparator<? super T> comparator) {
- return reducing(Comparators.lesserOf(comparator));
+ return reducing(BinaryOperator.minBy(comparator));
}
/**
@@ -423,7 +422,7 @@
* @implSpec
* This produces a result equivalent to:
* <pre>{@code
- * reducing(Comparators.greaterOf(comparator))
+ * reducing(BinaryOperator.maxBy(comparator))
* }</pre>
*
* @param <T> the type of the input elements
@@ -432,7 +431,7 @@
*/
public static <T> Collector<T, T>
maxBy(Comparator<? super T> comparator) {
- return reducing(Comparators.greaterOf(comparator));
+ return reducing(BinaryOperator.maxBy(comparator));
}
/**
@@ -491,8 +490,8 @@
* <p>For example, given a stream of {@code Person}, to calculate tallest
* person in each city:
* <pre>{@code
- * Comparator<Person> byHeight = Comparators.comparing(Person::getHeight);
- * BinaryOperator<Person> tallerOf = Comparators.greaterOf(byHeight);
+ * Comparator<Person> byHeight = Comparator.comparing(Person::getHeight);
+ * BinaryOperator<Person> tallerOf = BinaryOperator.greaterOf(byHeight);
* Map<City, Person> tallestByCity
* = people.stream().collect(groupingBy(Person::getCity, reducing(tallerOf)));
* }</pre>
@@ -531,8 +530,8 @@
* <p>For example, given a stream of {@code Person}, to calculate the longest
* last name of residents in each city:
* <pre>{@code
- * Comparator<String> byLength = Comparators.comparing(String::length);
- * BinaryOperator<String> longerOf = Comparators.greaterOf(byLength);
+ * Comparator<String> byLength = Comparator.comparing(String::length);
+ * BinaryOperator<String> longerOf = BinaryOperator.greaterOf(byLength);
* Map<City, String> longestLastNameByCity
* = people.stream().collect(groupingBy(Person::getCity,
* reducing(Person::getLastName, longerOf)));
--- a/jdk/src/share/classes/java/util/stream/DoublePipeline.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/DoublePipeline.java Tue Jul 02 15:23:23 2013 -0700
@@ -258,6 +258,12 @@
@Override
Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
return new Sink.ChainedDouble(sink) {
+ @Override
+ public void begin(long size) {
+ downstream.begin(-1);
+ }
+
+ @Override
public void accept(double t) {
// We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
DoubleStream result = mapper.apply(t);
@@ -290,6 +296,11 @@
Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
return new Sink.ChainedDouble(sink) {
@Override
+ public void begin(long size) {
+ downstream.begin(-1);
+ }
+
+ @Override
public void accept(double t) {
if (predicate.test(t))
downstream.accept(t);
--- a/jdk/src/share/classes/java/util/stream/DoubleStream.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/DoubleStream.java Tue Jul 02 15:23:23 2013 -0700
@@ -743,14 +743,7 @@
*/
public static DoubleStream generate(DoubleSupplier s) {
Objects.requireNonNull(s);
- return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize(
- new PrimitiveIterator.OfDouble() {
- @Override
- public boolean hasNext() { return true; }
-
- @Override
- public double nextDouble() { return s.getAsDouble(); }
- },
- Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+ return StreamSupport.doubleStream(
+ new StreamSpliterators.InfiniteSupplyingSpliterator.OfDouble(Long.MAX_VALUE, s));
}
}
--- a/jdk/src/share/classes/java/util/stream/ForEachOps.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/ForEachOps.java Tue Jul 02 15:23:23 2013 -0700
@@ -342,7 +342,7 @@
doCompute(this);
}
- private static<S, T> void doCompute(ForEachOrderedTask<S, T> task) {
+ private static <S, T> void doCompute(ForEachOrderedTask<S, T> task) {
while (true) {
Spliterator<S> split;
if (!AbstractTask.suggestSplit(task.spliterator, task.targetSize)
--- a/jdk/src/share/classes/java/util/stream/IntPipeline.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/IntPipeline.java Tue Jul 02 15:23:23 2013 -0700
@@ -294,6 +294,12 @@
@Override
Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
return new Sink.ChainedInt(sink) {
+ @Override
+ public void begin(long size) {
+ downstream.begin(-1);
+ }
+
+ @Override
public void accept(int t) {
// We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
IntStream result = mapper.apply(t);
@@ -326,6 +332,11 @@
Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
return new Sink.ChainedInt(sink) {
@Override
+ public void begin(long size) {
+ downstream.begin(-1);
+ }
+
+ @Override
public void accept(int t) {
if (predicate.test(t))
downstream.accept(t);
--- a/jdk/src/share/classes/java/util/stream/IntStream.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/IntStream.java Tue Jul 02 15:23:23 2013 -0700
@@ -745,15 +745,8 @@
*/
public static IntStream generate(IntSupplier s) {
Objects.requireNonNull(s);
- return StreamSupport.intStream(Spliterators.spliteratorUnknownSize(
- new PrimitiveIterator.OfInt() {
- @Override
- public boolean hasNext() { return true; }
-
- @Override
- public int nextInt() { return s.getAsInt(); }
- },
- Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+ return StreamSupport.intStream(
+ new StreamSpliterators.InfiniteSupplyingSpliterator.OfInt(Long.MAX_VALUE, s));
}
/**
--- a/jdk/src/share/classes/java/util/stream/LongPipeline.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/LongPipeline.java Tue Jul 02 15:23:23 2013 -0700
@@ -275,6 +275,12 @@
@Override
Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
return new Sink.ChainedLong(sink) {
+ @Override
+ public void begin(long size) {
+ downstream.begin(-1);
+ }
+
+ @Override
public void accept(long t) {
// We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
LongStream result = mapper.apply(t);
@@ -307,6 +313,11 @@
Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
return new Sink.ChainedLong(sink) {
@Override
+ public void begin(long size) {
+ downstream.begin(-1);
+ }
+
+ @Override
public void accept(long t) {
if (predicate.test(t))
downstream.accept(t);
--- a/jdk/src/share/classes/java/util/stream/LongStream.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/LongStream.java Tue Jul 02 15:23:23 2013 -0700
@@ -736,15 +736,8 @@
*/
public static LongStream generate(LongSupplier s) {
Objects.requireNonNull(s);
- return StreamSupport.longStream(Spliterators.spliteratorUnknownSize(
- new PrimitiveIterator.OfLong() {
- @Override
- public boolean hasNext() { return true; }
-
- @Override
- public long nextLong() { return s.getAsLong(); }
- },
- Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+ return StreamSupport.longStream(
+ new StreamSpliterators.InfiniteSupplyingSpliterator.OfLong(Long.MAX_VALUE, s));
}
/**
--- a/jdk/src/share/classes/java/util/stream/Node.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/Node.java Tue Jul 02 15:23:23 2013 -0700
@@ -105,6 +105,32 @@
}
/**
+ * Return a node describing a subsequence of the elements of this node,
+ * starting at the given inclusive start offset and ending at the given
+ * exclusive end offset.
+ *
+ * @param from The (inclusive) starting offset of elements to include, must
+ * be in range 0..count().
+ * @param to The (exclusive) end offset of elements to include, must be
+ * in range 0..count().
+ * @param generator A function to be used to create a new array, if needed,
+ * for reference nodes.
+ * @return the truncated node
+ */
+ default Node<T> truncate(long from, long to, IntFunction<T[]> generator) {
+ if (from == 0 && to == count())
+ return this;
+ Spliterator<T> spliterator = spliterator();
+ long size = to - from;
+ Node.Builder<T> nodeBuilder = Nodes.builder(size, generator);
+ nodeBuilder.begin(size);
+ for (int i = 0; i < from && spliterator.tryAdvance(e -> { }); i++) { }
+ for (int i = 0; (i < size) && spliterator.tryAdvance(nodeBuilder); i++) { }
+ nodeBuilder.end();
+ return nodeBuilder.build();
+ }
+
+ /**
* Provides an array view of the contents of this node.
*
* <p>Depending on the underlying implementation, this may return a
@@ -192,19 +218,90 @@
}
}
- /**
- * Specialized {@code Node} for int elements
- */
- interface OfInt extends Node<Integer> {
+ public interface OfPrimitive<T, T_CONS, T_ARR,
+ T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>,
+ T_NODE extends OfPrimitive<T, T_CONS, T_ARR, T_SPLITR, T_NODE>>
+ extends Node<T> {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return a {@link Spliterator.OfPrimitive} describing the elements of
+ * this node
+ */
+ @Override
+ T_SPLITR spliterator();
+
+ /**
+ * Traverses the elements of this node, and invoke the provided
+ * {@code action} with each element.
+ *
+ * @param action a consumer that is to be invoked with each
+ * element in this {@code Node.OfPrimitive}
+ */
+ void forEach(T_CONS action);
+
+ @Override
+ default T_NODE getChild(int i) {
+ throw new IndexOutOfBoundsException();
+ }
+
+ T_NODE truncate(long from, long to, IntFunction<T[]> generator);
/**
* {@inheritDoc}
*
- * @return a {@link Spliterator.OfInt} describing the elements of this
- * node
+ * @implSpec the default implementation invokes the generator to create
+ * an instance of a boxed primitive array with a length of
+ * {@link #count()} and then invokes {@link #copyInto(T[], int)} with
+ * that array at an offset of 0.
*/
@Override
- Spliterator.OfInt spliterator();
+ default T[] asArray(IntFunction<T[]> generator) {
+ T[] boxed = generator.apply((int) count());
+ copyInto(boxed, 0);
+ return boxed;
+ }
+
+ /**
+ * Views this node as a primitive array.
+ *
+ * <p>Depending on the underlying implementation this may return a
+ * reference to an internal array rather than a copy. It is the callers
+ * responsibility to decide if either this node or the array is utilized
+ * as the primary reference for the data.</p>
+ *
+ * @return an array containing the contents of this {@code Node}
+ */
+ T_ARR asPrimitiveArray();
+
+ /**
+ * Creates a new primitive array.
+ *
+ * @param count the length of the primitive array.
+ * @return the new primitive array.
+ */
+ T_ARR newArray(int count);
+
+ /**
+ * Copies the content of this {@code Node} into a primitive array,
+ * starting at a given offset into the array. It is the caller's
+ * responsibility to ensure there is sufficient room in the array.
+ *
+ * @param array the array into which to copy the contents of this
+ * {@code Node}
+ * @param offset the starting offset within the array
+ * @throws IndexOutOfBoundsException if copying would cause access of
+ * data outside array bounds
+ * @throws NullPointerException if {@code array} is {@code null}
+ */
+ void copyInto(T_ARR array, int offset);
+ }
+
+ /**
+ * Specialized {@code Node} for int elements
+ */
+ interface OfInt extends OfPrimitive<Integer, IntConsumer, int[], Spliterator.OfInt, OfInt> {
/**
* {@inheritDoc}
@@ -227,37 +324,12 @@
}
/**
- * Traverses the elements of this node, and invoke the provided
- * {@code IntConsumer} with each element.
- *
- * @param consumer a {@code IntConsumer} that is to be invoked with each
- * element in this {@code Node}
- */
- void forEach(IntConsumer consumer);
-
- /**
- * {@inheritDoc}
- *
- * @implSpec the default implementation invokes the generator to create
- * an instance of an Integer[] array with a length of {@link #count()}
- * and then invokes {@link #copyInto(Integer[], int)} with that
- * Integer[] array at an offset of 0. This is not efficient and it is
- * recommended to invoke {@link #asPrimitiveArray()}.
- */
- @Override
- default Integer[] asArray(IntFunction<Integer[]> generator) {
- Integer[] boxed = generator.apply((int) count());
- copyInto(boxed, 0);
- return boxed;
- }
-
- /**
* {@inheritDoc}
*
* @implSpec the default implementation invokes {@link #asPrimitiveArray()} to
* obtain an int[] array then and copies the elements from that int[]
* array into the boxed Integer[] array. This is not efficient and it
- * is recommended to invoke {@link #copyInto(int[], int)}.
+ * is recommended to invoke {@link #copyInto(Object, int)}.
*/
@Override
default void copyInto(Integer[] boxed, int offset) {
@@ -271,35 +343,23 @@
}
@Override
- default Node.OfInt getChild(int i) {
- throw new IndexOutOfBoundsException();
+ default Node.OfInt truncate(long from, long to, IntFunction<Integer[]> generator) {
+ if (from == 0 && to == count())
+ return this;
+ long size = to - from;
+ Spliterator.OfInt spliterator = spliterator();
+ Node.Builder.OfInt nodeBuilder = Nodes.intBuilder(size);
+ nodeBuilder.begin(size);
+ for (int i = 0; i < from && spliterator.tryAdvance((IntConsumer) e -> { }); i++) { }
+ for (int i = 0; (i < size) && spliterator.tryAdvance((IntConsumer) nodeBuilder); i++) { }
+ nodeBuilder.end();
+ return nodeBuilder.build();
}
- /**
- * Views this node as an int[] array.
- *
- * <p>Depending on the underlying implementation this may return a
- * reference to an internal array rather than a copy. It is the callers
- * responsibility to decide if either this node or the array is utilized
- * as the primary reference for the data.</p>
- *
- * @return an array containing the contents of this {@code Node}
- */
- int[] asPrimitiveArray();
-
- /**
- * Copies the content of this {@code Node} into an int[] array, starting
- * at a given offset into the array. It is the caller's responsibility
- * to ensure there is sufficient room in the array.
- *
- * @param array the array into which to copy the contents of this
- * {@code Node}
- * @param offset the starting offset within the array
- * @throws IndexOutOfBoundsException if copying would cause access of
- * data outside array bounds
- * @throws NullPointerException if {@code array} is {@code null}
- */
- void copyInto(int[] array, int offset);
+ @Override
+ default int[] newArray(int count) {
+ return new int[count];
+ }
/**
* {@inheritDoc}
@@ -309,22 +369,12 @@
default StreamShape getShape() {
return StreamShape.INT_VALUE;
}
-
}
/**
* Specialized {@code Node} for long elements
*/
- interface OfLong extends Node<Long> {
-
- /**
- * {@inheritDoc}
- *
- * @return a {@link Spliterator.OfLong} describing the elements of this
- * node
- */
- @Override
- Spliterator.OfLong spliterator();
+ interface OfLong extends OfPrimitive<Long, LongConsumer, long[], Spliterator.OfLong, OfLong> {
/**
* {@inheritDoc}
@@ -347,37 +397,12 @@
}
/**
- * Traverses the elements of this node, and invoke the provided
- * {@code LongConsumer} with each element.
- *
- * @param consumer a {@code LongConsumer} that is to be invoked with
- * each element in this {@code Node}
- */
- void forEach(LongConsumer consumer);
-
- /**
- * {@inheritDoc}
- *
- * @implSpec the default implementation invokes the generator to create
- * an instance of a Long[] array with a length of {@link #count()} and
- * then invokes {@link #copyInto(Long[], int)} with that Long[] array at
- * an offset of 0. This is not efficient and it is recommended to
- * invoke {@link #asPrimitiveArray()}.
- */
- @Override
- default Long[] asArray(IntFunction<Long[]> generator) {
- Long[] boxed = generator.apply((int) count());
- copyInto(boxed, 0);
- return boxed;
- }
-
- /**
* {@inheritDoc}
*
* @implSpec the default implementation invokes {@link #asPrimitiveArray()}
* to obtain a long[] array then and copies the elements from that
* long[] array into the boxed Long[] array. This is not efficient and
- * it is recommended to invoke {@link #copyInto(long[], int)}.
+ * it is recommended to invoke {@link #copyInto(Object, int)}.
*/
@Override
default void copyInto(Long[] boxed, int offset) {
@@ -391,35 +416,23 @@
}
@Override
- default Node.OfLong getChild(int i) {
- throw new IndexOutOfBoundsException();
+ default Node.OfLong truncate(long from, long to, IntFunction<Long[]> generator) {
+ if (from == 0 && to == count())
+ return this;
+ long size = to - from;
+ Spliterator.OfLong spliterator = spliterator();
+ Node.Builder.OfLong nodeBuilder = Nodes.longBuilder(size);
+ nodeBuilder.begin(size);
+ for (int i = 0; i < from && spliterator.tryAdvance((LongConsumer) e -> { }); i++) { }
+ for (int i = 0; (i < size) && spliterator.tryAdvance((LongConsumer) nodeBuilder); i++) { }
+ nodeBuilder.end();
+ return nodeBuilder.build();
}
- /**
- * Views this node as a long[] array.
- *
- * <p/>Depending on the underlying implementation this may return a
- * reference to an internal array rather than a copy. It is the callers
- * responsibility to decide if either this node or the array is utilized
- * as the primary reference for the data.
- *
- * @return an array containing the contents of this {@code Node}
- */
- long[] asPrimitiveArray();
-
- /**
- * Copies the content of this {@code Node} into a long[] array, starting
- * at a given offset into the array. It is the caller's responsibility
- * to ensure there is sufficient room in the array.
- *
- * @param array the array into which to copy the contents of this
- * {@code Node}
- * @param offset the starting offset within the array
- * @throws IndexOutOfBoundsException if copying would cause access of
- * data outside array bounds
- * @throws NullPointerException if {@code array} is {@code null}
- */
- void copyInto(long[] array, int offset);
+ @Override
+ default long[] newArray(int count) {
+ return new long[count];
+ }
/**
* {@inheritDoc}
@@ -429,23 +442,12 @@
default StreamShape getShape() {
return StreamShape.LONG_VALUE;
}
-
-
}
/**
* Specialized {@code Node} for double elements
*/
- interface OfDouble extends Node<Double> {
-
- /**
- * {@inheritDoc}
- *
- * @return A {@link Spliterator.OfDouble} describing the elements of
- * this node
- */
- @Override
- Spliterator.OfDouble spliterator();
+ interface OfDouble extends OfPrimitive<Double, DoubleConsumer, double[], Spliterator.OfDouble, OfDouble> {
/**
* {@inheritDoc}
@@ -467,40 +469,15 @@
}
}
- /**
- * Traverses the elements of this node, and invoke the provided
- * {@code DoubleConsumer} with each element.
- *
- * @param consumer A {@code DoubleConsumer} that is to be invoked with
- * each element in this {@code Node}
- */
- void forEach(DoubleConsumer consumer);
-
//
/**
* {@inheritDoc}
*
- * @implSpec the default implementation invokes the generator to create
- * an instance of a Double[] array with a length of {@link #count()} and
- * then invokes {@link #copyInto(Double[], int)} with that Double[]
- * array at an offset of 0. This is not efficient and it is recommended
- * to invoke {@link #asPrimitiveArray()}.
- */
- @Override
- default Double[] asArray(IntFunction<Double[]> generator) {
- Double[] boxed = generator.apply((int) count());
- copyInto(boxed, 0);
- return boxed;
- }
-
- /**
- * {@inheritDoc}
- *
* @implSpec the default implementation invokes {@link #asPrimitiveArray()}
* to obtain a double[] array then and copies the elements from that
* double[] array into the boxed Double[] array. This is not efficient
- * and it is recommended to invoke {@link #copyInto(double[], int)}.
+ * and it is recommended to invoke {@link #copyInto(Object, int)}.
*/
@Override
default void copyInto(Double[] boxed, int offset) {
@@ -514,35 +491,23 @@
}
@Override
- default Node.OfDouble getChild(int i) {
- throw new IndexOutOfBoundsException();
+ default Node.OfDouble truncate(long from, long to, IntFunction<Double[]> generator) {
+ if (from == 0 && to == count())
+ return this;
+ long size = to - from;
+ Spliterator.OfDouble spliterator = spliterator();
+ Node.Builder.OfDouble nodeBuilder = Nodes.doubleBuilder(size);
+ nodeBuilder.begin(size);
+ for (int i = 0; i < from && spliterator.tryAdvance((DoubleConsumer) e -> { }); i++) { }
+ for (int i = 0; (i < size) && spliterator.tryAdvance((DoubleConsumer) nodeBuilder); i++) { }
+ nodeBuilder.end();
+ return nodeBuilder.build();
}
- /**
- * Views this node as a double[] array.
- *
- * <p/>Depending on the underlying implementation this may return a
- * reference to an internal array rather than a copy. It is the callers
- * responsibility to decide if either this node or the array is utilized
- * as the primary reference for the data.
- *
- * @return an array containing the contents of this {@code Node}
- */
- double[] asPrimitiveArray();
-
- /**
- * Copies the content of this {@code Node} into a double[] array, starting
- * at a given offset into the array. It is the caller's responsibility
- * to ensure there is sufficient room in the array.
- *
- * @param array the array into which to copy the contents of this
- * {@code Node}
- * @param offset the starting offset within the array
- * @throws IndexOutOfBoundsException if copying would cause access of
- * data outside array bounds
- * @throws NullPointerException if {@code array} is {@code null}
- */
- void copyInto(double[] array, int offset);
+ @Override
+ default double[] newArray(int count) {
+ return new double[count];
+ }
/**
* {@inheritDoc}
--- a/jdk/src/share/classes/java/util/stream/Nodes.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/Nodes.java Tue Jul 02 15:23:23 2013 -0700
@@ -33,11 +33,13 @@
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.concurrent.CountedCompleter;
+import java.util.function.BinaryOperator;
import java.util.function.Consumer;
import java.util.function.DoubleConsumer;
import java.util.function.IntConsumer;
import java.util.function.IntFunction;
import java.util.function.LongConsumer;
+import java.util.function.LongFunction;
/**
* Factory methods for constructing implementations of {@link Node} and
@@ -97,131 +99,28 @@
*
* @param <T> the type of elements of the concatenated node
* @param shape the shape of the concatenated node to be created
- * @param nodes the input nodes
+ * @param left the left input node
+ * @param right the right input node
* @return a {@code Node} covering the elements of the input nodes
* @throws IllegalStateException if all {@link Node} elements of the list
* are an not instance of type supported by this factory.
*/
@SuppressWarnings("unchecked")
- static <T> Node<T> conc(StreamShape shape, List<? extends Node<T>> nodes) {
- int size = nodes.size();
- if (size == 0)
- return emptyNode(shape);
- else if (size == 1)
- return nodes.get(0);
- else {
- // Create a right-balanced tree when there are more that 2 nodes
- switch (shape) {
- case REFERENCE: {
- List<Node<T>> refNodes = (List<Node<T>>) nodes;
- ConcNode<T> c = new ConcNode<>(refNodes.get(size - 2), refNodes.get(size - 1));
- for (int i = size - 3; i >= 0; i--) {
- c = new ConcNode<>(refNodes.get(i), c);
- }
- return c;
- }
- case INT_VALUE: {
- List<? extends Node.OfInt> intNodes = (List<? extends Node.OfInt>) nodes;
- IntConcNode c = new IntConcNode(intNodes.get(size - 2), intNodes.get(size - 1));
- for (int i = size - 3; i >= 0; i--) {
- c = new IntConcNode(intNodes.get(i), c);
- }
- return (Node<T>) c;
- }
- case LONG_VALUE: {
- List<? extends Node.OfLong> longNodes = (List<? extends Node.OfLong>) nodes;
- LongConcNode c = new LongConcNode(longNodes.get(size - 2), longNodes.get(size - 1));
- for (int i = size - 3; i >= 0; i--) {
- c = new LongConcNode(longNodes.get(i), c);
- }
- return (Node<T>) c;
- }
- case DOUBLE_VALUE: {
- List<? extends Node.OfDouble> doubleNodes = (List<? extends Node.OfDouble>) nodes;
- DoubleConcNode c = new DoubleConcNode(doubleNodes.get(size - 2), doubleNodes.get(size - 1));
- for (int i = size - 3; i >= 0; i--) {
- c = new DoubleConcNode(doubleNodes.get(i), c);
- }
- return (Node<T>) c;
- }
- default:
- throw new IllegalStateException("Unknown shape " + shape);
- }
- }
-
- }
-
- /**
- * Truncate a {@link Node}, returning a node describing a subsequence of
- * the contents of the input node.
- *
- * @param <T> the type of elements of the input node and truncated node
- * @param input the input node
- * @param from the starting offset to include in the truncated node (inclusive)
- * @param to the ending offset ot include in the truncated node (exclusive)
- * @param generator the array factory (only used for reference nodes)
- * @return the truncated node
- */
- @SuppressWarnings("unchecked")
- static <T> Node<T> truncateNode(Node<T> input, long from, long to, IntFunction<T[]> generator) {
- StreamShape shape = input.getShape();
- long size = truncatedSize(input.count(), from, to);
- if (size == 0)
- return emptyNode(shape);
- else if (from == 0 && to >= input.count())
- return input;
-
+ static <T> Node<T> conc(StreamShape shape, Node<T> left, Node<T> right) {
switch (shape) {
- case REFERENCE: {
- Spliterator<T> spliterator = input.spliterator();
- Node.Builder<T> nodeBuilder = Nodes.builder(size, generator);
- nodeBuilder.begin(size);
- for (int i = 0; i < from && spliterator.tryAdvance(e -> { }); i++) { }
- for (int i = 0; (i < size) && spliterator.tryAdvance(nodeBuilder); i++) { }
- nodeBuilder.end();
- return nodeBuilder.build();
- }
- case INT_VALUE: {
- Spliterator.OfInt spliterator = ((Node.OfInt) input).spliterator();
- Node.Builder.OfInt nodeBuilder = Nodes.intBuilder(size);
- nodeBuilder.begin(size);
- for (int i = 0; i < from && spliterator.tryAdvance((IntConsumer) e -> { }); i++) { }
- for (int i = 0; (i < size) && spliterator.tryAdvance((IntConsumer) nodeBuilder); i++) { }
- nodeBuilder.end();
- return (Node<T>) nodeBuilder.build();
- }
- case LONG_VALUE: {
- Spliterator.OfLong spliterator = ((Node.OfLong) input).spliterator();
- Node.Builder.OfLong nodeBuilder = Nodes.longBuilder(size);
- nodeBuilder.begin(size);
- for (int i = 0; i < from && spliterator.tryAdvance((LongConsumer) e -> { }); i++) { }
- for (int i = 0; (i < size) && spliterator.tryAdvance((LongConsumer) nodeBuilder); i++) { }
- nodeBuilder.end();
- return (Node<T>) nodeBuilder.build();
- }
- case DOUBLE_VALUE: {
- Spliterator.OfDouble spliterator = ((Node.OfDouble) input).spliterator();
- Node.Builder.OfDouble nodeBuilder = Nodes.doubleBuilder(size);
- nodeBuilder.begin(size);
- for (int i = 0; i < from && spliterator.tryAdvance((DoubleConsumer) e -> { }); i++) { }
- for (int i = 0; (i < size) && spliterator.tryAdvance((DoubleConsumer) nodeBuilder); i++) { }
- nodeBuilder.end();
- return (Node<T>) nodeBuilder.build();
- }
+ case REFERENCE:
+ return new ConcNode<>(left, right);
+ case INT_VALUE:
+ return (Node<T>) new ConcNode.OfInt((Node.OfInt) left, (Node.OfInt) right);
+ case LONG_VALUE:
+ return (Node<T>) new ConcNode.OfLong((Node.OfLong) left, (Node.OfLong) right);
+ case DOUBLE_VALUE:
+ return (Node<T>) new ConcNode.OfDouble((Node.OfDouble) left, (Node.OfDouble) right);
default:
throw new IllegalStateException("Unknown shape " + shape);
}
}
- private static long truncatedSize(long size, long from, long to) {
- if (from >= 0)
- size = Math.max(0, size - from);
- long limit = to - from;
- if (limit >= 0)
- size = Math.min(size, limit);
- return size;
- }
-
// Reference-based node methods
/**
@@ -422,7 +321,7 @@
new SizedCollectorTask.OfRef<>(spliterator, helper, array).invoke();
return node(array);
} else {
- Node<P_OUT> node = new CollectorTask<>(helper, generator, spliterator).invoke();
+ Node<P_OUT> node = new CollectorTask.OfRef<>(helper, generator, spliterator).invoke();
return flattenTree ? flatten(node, generator) : node;
}
}
@@ -460,7 +359,7 @@
return node(array);
}
else {
- Node.OfInt node = new IntCollectorTask<>(helper, spliterator).invoke();
+ Node.OfInt node = new CollectorTask.OfInt<>(helper, spliterator).invoke();
return flattenTree ? flattenInt(node) : node;
}
}
@@ -498,7 +397,7 @@
return node(array);
}
else {
- Node.OfLong node = new LongCollectorTask<>(helper, spliterator).invoke();
+ Node.OfLong node = new CollectorTask.OfLong<>(helper, spliterator).invoke();
return flattenTree ? flattenLong(node) : node;
}
}
@@ -536,7 +435,7 @@
return node(array);
}
else {
- Node.OfDouble node = new DoubleCollectorTask<>(helper, spliterator).invoke();
+ Node.OfDouble node = new CollectorTask.OfDouble<>(helper, spliterator).invoke();
return flattenTree ? flattenDouble(node) : node;
}
}
@@ -763,8 +662,6 @@
return curSize;
}
- // Traversable
-
@Override
public void forEach(Consumer<? super T> consumer) {
for (int i = 0; i < curSize; i++) {
@@ -829,13 +726,12 @@
/**
* Node class for an internal node with two or more children
*/
- static final class ConcNode<T> implements Node<T> {
- private final Node<T> left;
- private final Node<T> right;
-
+ private static abstract class AbstractConcNode<T, T_NODE extends Node<T>> implements Node<T> {
+ protected final T_NODE left;
+ protected final T_NODE right;
private final long size;
- ConcNode(Node<T> left, Node<T> right) {
+ AbstractConcNode(T_NODE left, T_NODE right) {
this.left = left;
this.right = right;
// The Node count will be required when the Node spliterator is
@@ -845,26 +741,38 @@
this.size = left.count() + right.count();
}
- // Node
-
- @Override
- public Spliterator<T> spliterator() {
- return new Nodes.InternalNodeSpliterator.OfRef<>(this);
- }
-
@Override
public int getChildCount() {
return 2;
}
@Override
- public Node<T> getChild(int i) {
+ public T_NODE getChild(int i) {
if (i == 0) return left;
if (i == 1) return right;
throw new IndexOutOfBoundsException();
}
@Override
+ public long count() {
+ return size;
+ }
+ }
+
+ static final class ConcNode<T>
+ extends AbstractConcNode<T, Node<T>>
+ implements Node<T> {
+
+ ConcNode(Node<T> left, Node<T> right) {
+ super(left, right);
+ }
+
+ @Override
+ public Spliterator<T> spliterator() {
+ return new Nodes.InternalNodeSpliterator.OfRef<>(this);
+ }
+
+ @Override
public void copyInto(T[] array, int offset) {
Objects.requireNonNull(array);
left.copyInto(array, offset);
@@ -879,14 +787,24 @@
}
@Override
- public long count() {
- return size;
+ public void forEach(Consumer<? super T> consumer) {
+ left.forEach(consumer);
+ right.forEach(consumer);
}
@Override
- public void forEach(Consumer<? super T> consumer) {
- left.forEach(consumer);
- right.forEach(consumer);
+ public Node<T> truncate(long from, long to, IntFunction<T[]> generator) {
+ if (from == 0 && to == count())
+ return this;
+ long leftCount = left.count();
+ if (from >= leftCount)
+ return right.truncate(from - leftCount, to - leftCount, generator);
+ else if (to <= leftCount)
+ return left.truncate(from, to, generator);
+ else {
+ return Nodes.conc(getShape(), left.truncate(from, leftCount, generator),
+ right.truncate(0, to - leftCount, generator));
+ }
}
@Override
@@ -897,12 +815,92 @@
return String.format("ConcNode[size=%d]", count());
}
}
+
+ private abstract static class OfPrimitive<E, T_CONS, T_ARR,
+ T_SPLITR extends Spliterator.OfPrimitive<E, T_CONS, T_SPLITR>,
+ T_NODE extends Node.OfPrimitive<E, T_CONS, T_ARR, T_SPLITR, T_NODE>>
+ extends AbstractConcNode<E, T_NODE>
+ implements Node.OfPrimitive<E, T_CONS, T_ARR, T_SPLITR, T_NODE> {
+
+ OfPrimitive(T_NODE left, T_NODE right) {
+ super(left, right);
+ }
+
+ @Override
+ public void forEach(T_CONS consumer) {
+ left.forEach(consumer);
+ right.forEach(consumer);
+ }
+
+ @Override
+ public void copyInto(T_ARR array, int offset) {
+ left.copyInto(array, offset);
+ right.copyInto(array, offset + (int) left.count());
+ }
+
+ @Override
+ public T_ARR asPrimitiveArray() {
+ T_ARR array = newArray((int) count());
+ copyInto(array, 0);
+ return array;
+ }
+
+ @Override
+ public String toString() {
+ if (count() < 32)
+ return String.format("%s[%s.%s]", this.getClass().getName(), left, right);
+ else
+ return String.format("%s[size=%d]", this.getClass().getName(), count());
+ }
+ }
+
+ static final class OfInt
+ extends ConcNode.OfPrimitive<Integer, IntConsumer, int[], Spliterator.OfInt, Node.OfInt>
+ implements Node.OfInt {
+
+ OfInt(Node.OfInt left, Node.OfInt right) {
+ super(left, right);
+ }
+
+ @Override
+ public Spliterator.OfInt spliterator() {
+ return new InternalNodeSpliterator.OfInt(this);
+ }
+ }
+
+ static final class OfLong
+ extends ConcNode.OfPrimitive<Long, LongConsumer, long[], Spliterator.OfLong, Node.OfLong>
+ implements Node.OfLong {
+
+ OfLong(Node.OfLong left, Node.OfLong right) {
+ super(left, right);
+ }
+
+ @Override
+ public Spliterator.OfLong spliterator() {
+ return new InternalNodeSpliterator.OfLong(this);
+ }
+ }
+
+ static final class OfDouble
+ extends ConcNode.OfPrimitive<Double, DoubleConsumer, double[], Spliterator.OfDouble, Node.OfDouble>
+ implements Node.OfDouble {
+
+ OfDouble(Node.OfDouble left, Node.OfDouble right) {
+ super(left, right);
+ }
+
+ @Override
+ public Spliterator.OfDouble spliterator() {
+ return new InternalNodeSpliterator.OfDouble(this);
+ }
+ }
}
/** Abstract class for spliterator for all internal node classes */
private static abstract class InternalNodeSpliterator<T,
S extends Spliterator<T>,
- N extends Node<T>, C>
+ N extends Node<T>>
implements Spliterator<T> {
// Node we are pointing to
// null if full traversal has occurred
@@ -960,7 +958,7 @@
return null;
}
- protected final boolean internalTryAdvance(C consumer) {
+ protected final boolean initTryAdvance() {
if (curNode == null)
return false;
@@ -981,29 +979,12 @@
else
tryAdvanceSpliterator = lastNodeSpliterator;
}
-
- boolean hasNext = tryAdvance(tryAdvanceSpliterator, consumer);
- if (!hasNext) {
- if (lastNodeSpliterator == null) {
- // Advance to the spliterator of the next non-empty leaf node
- Node<T> leaf = findNextLeafNode(tryAdvanceStack);
- if (leaf != null) {
- tryAdvanceSpliterator = (S) leaf.spliterator();
- // Since the node is not-empty the spliterator can be advanced
- return tryAdvance(tryAdvanceSpliterator, consumer);
- }
- }
- // No more elements to traverse
- curNode = null;
- }
- return hasNext;
+ return true;
}
- protected abstract boolean tryAdvance(S spliterator, C consumer);
-
@Override
@SuppressWarnings("unchecked")
- public S trySplit() {
+ public final S trySplit() {
if (curNode == null || tryAdvanceSpliterator != null)
return null; // Cannot split if fully or partially traversed
else if (lastNodeSpliterator != null)
@@ -1024,7 +1005,7 @@
}
@Override
- public long estimateSize() {
+ public final long estimateSize() {
if (curNode == null)
return 0;
@@ -1041,12 +1022,12 @@
}
@Override
- public int characteristics() {
+ public final int characteristics() {
return Spliterator.SIZED;
}
private static final class OfRef<T>
- extends InternalNodeSpliterator<T, Spliterator<T>, Node<T>, Consumer<? super T>> {
+ extends InternalNodeSpliterator<T, Spliterator<T>, Node<T>> {
OfRef(Node<T> curNode) {
super(curNode);
@@ -1054,13 +1035,24 @@
@Override
public boolean tryAdvance(Consumer<? super T> consumer) {
- return internalTryAdvance(consumer);
- }
+ if (!initTryAdvance())
+ return false;
- @Override
- protected boolean tryAdvance(Spliterator<T> spliterator,
- Consumer<? super T> consumer) {
- return spliterator.tryAdvance(consumer);
+ boolean hasNext = tryAdvanceSpliterator.tryAdvance(consumer);
+ if (!hasNext) {
+ if (lastNodeSpliterator == null) {
+ // Advance to the spliterator of the next non-empty leaf node
+ Node<T> leaf = findNextLeafNode(tryAdvanceStack);
+ if (leaf != null) {
+ tryAdvanceSpliterator = leaf.spliterator();
+ // Since the node is not-empty the spliterator can be advanced
+ return tryAdvanceSpliterator.tryAdvance(consumer);
+ }
+ }
+ // No more elements to traverse
+ curNode = null;
+ }
+ return hasNext;
}
@Override
@@ -1085,34 +1077,47 @@
}
}
- private static final class OfInt
- extends InternalNodeSpliterator<Integer, Spliterator.OfInt, Node.OfInt, IntConsumer>
- implements Spliterator.OfInt {
+ private static abstract class OfPrimitive<T, T_CONS, T_ARR,
+ T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>,
+ N extends Node.OfPrimitive<T, T_CONS, T_ARR, T_SPLITR, N>>
+ extends InternalNodeSpliterator<T, T_SPLITR, N>
+ implements Spliterator.OfPrimitive<T, T_CONS, T_SPLITR> {
- OfInt(Node.OfInt cur) {
+ OfPrimitive(N cur) {
super(cur);
}
@Override
- public boolean tryAdvance(IntConsumer consumer) {
- return internalTryAdvance(consumer);
+ public boolean tryAdvance(T_CONS consumer) {
+ if (!initTryAdvance())
+ return false;
+
+ boolean hasNext = tryAdvanceSpliterator.tryAdvance(consumer);
+ if (!hasNext) {
+ if (lastNodeSpliterator == null) {
+ // Advance to the spliterator of the next non-empty leaf node
+ N leaf = findNextLeafNode(tryAdvanceStack);
+ if (leaf != null) {
+ tryAdvanceSpliterator = leaf.spliterator();
+ // Since the node is not-empty the spliterator can be advanced
+ return tryAdvanceSpliterator.tryAdvance(consumer);
+ }
+ }
+ // No more elements to traverse
+ curNode = null;
+ }
+ return hasNext;
}
@Override
- protected boolean tryAdvance(Spliterator.OfInt spliterator,
- IntConsumer consumer) {
- return spliterator.tryAdvance(consumer);
- }
-
- @Override
- public void forEachRemaining(IntConsumer consumer) {
+ public void forEachRemaining(T_CONS consumer) {
if (curNode == null)
return;
if (tryAdvanceSpliterator == null) {
if (lastNodeSpliterator == null) {
- Deque<Node.OfInt> stack = initStack();
- Node.OfInt leaf;
+ Deque<N> stack = initStack();
+ N leaf;
while ((leaf = findNextLeafNode(stack)) != null) {
leaf.forEach(consumer);
}
@@ -1126,86 +1131,31 @@
}
}
+ private static final class OfInt
+ extends OfPrimitive<Integer, IntConsumer, int[], Spliterator.OfInt, Node.OfInt>
+ implements Spliterator.OfInt {
+
+ OfInt(Node.OfInt cur) {
+ super(cur);
+ }
+ }
+
private static final class OfLong
- extends InternalNodeSpliterator<Long, Spliterator.OfLong, Node.OfLong, LongConsumer>
+ extends OfPrimitive<Long, LongConsumer, long[], Spliterator.OfLong, Node.OfLong>
implements Spliterator.OfLong {
OfLong(Node.OfLong cur) {
super(cur);
}
-
- @Override
- public boolean tryAdvance(LongConsumer consumer) {
- return internalTryAdvance(consumer);
- }
-
- @Override
- protected boolean tryAdvance(Spliterator.OfLong spliterator,
- LongConsumer consumer) {
- return spliterator.tryAdvance(consumer);
- }
-
- @Override
- public void forEachRemaining(LongConsumer consumer) {
- if (curNode == null)
- return;
-
- if (tryAdvanceSpliterator == null) {
- if (lastNodeSpliterator == null) {
- Deque<Node.OfLong> stack = initStack();
- Node.OfLong leaf;
- while ((leaf = findNextLeafNode(stack)) != null) {
- leaf.forEach(consumer);
- }
- curNode = null;
- }
- else
- lastNodeSpliterator.forEachRemaining(consumer);
- }
- else
- while(tryAdvance(consumer)) { }
- }
}
private static final class OfDouble
- extends InternalNodeSpliterator<Double, Spliterator.OfDouble, Node.OfDouble, DoubleConsumer>
+ extends OfPrimitive<Double, DoubleConsumer, double[], Spliterator.OfDouble, Node.OfDouble>
implements Spliterator.OfDouble {
OfDouble(Node.OfDouble cur) {
super(cur);
}
-
- @Override
- public boolean tryAdvance(DoubleConsumer consumer) {
- return internalTryAdvance(consumer);
- }
-
- @Override
- protected boolean tryAdvance(Spliterator.OfDouble spliterator,
- DoubleConsumer consumer) {
- return spliterator.tryAdvance(consumer);
- }
-
- @Override
- public void forEachRemaining(DoubleConsumer consumer) {
- if (curNode == null)
- return;
-
- if (tryAdvanceSpliterator == null) {
- if (lastNodeSpliterator == null) {
- Deque<Node.OfDouble> stack = initStack();
- Node.OfDouble leaf;
- while ((leaf = findNextLeafNode(stack)) != null) {
- leaf.forEach(consumer);
- }
- curNode = null;
- }
- else
- lastNodeSpliterator.forEachRemaining(consumer);
- }
- else
- while(tryAdvance(consumer)) { }
- }
}
}
@@ -1330,47 +1280,6 @@
private static final long[] EMPTY_LONG_ARRAY = new long[0];
private static final double[] EMPTY_DOUBLE_ARRAY = new double[0];
- private abstract static class AbstractPrimitiveConcNode<E, N extends Node<E>>
- implements Node<E> {
- final N left;
- final N right;
- final long size;
-
- AbstractPrimitiveConcNode(N left, N right) {
- this.left = left;
- this.right = right;
- // The Node count will be required when the Node spliterator is
- // obtained and it is cheaper to aggressively calculate bottom up as
- // the tree is built rather than later on by traversing the tree
- this.size = left.count() + right.count();
- }
-
- @Override
- public int getChildCount() {
- return 2;
- }
-
- @Override
- public N getChild(int i) {
- if (i == 0) return left;
- if (i == 1) return right;
- throw new IndexOutOfBoundsException();
- }
-
- @Override
- public long count() {
- return size;
- }
-
- @Override
- public String toString() {
- if (count() < 32)
- return String.format("%s[%s.%s]", this.getClass().getName(), left, right);
- else
- return String.format("%s[size=%d]", this.getClass().getName(), count());
- }
- }
-
private static class IntArrayNode implements Node.OfInt {
final int[] array;
int curSize;
@@ -1535,105 +1444,6 @@
}
}
- static final class IntConcNode
- extends AbstractPrimitiveConcNode<Integer, Node.OfInt>
- implements Node.OfInt {
-
- IntConcNode(Node.OfInt left, Node.OfInt right) {
- super(left, right);
- }
-
- @Override
- public void forEach(IntConsumer consumer) {
- left.forEach(consumer);
- right.forEach(consumer);
- }
-
- @Override
- public Spliterator.OfInt spliterator() {
- return new InternalNodeSpliterator.OfInt(this);
- }
-
- @Override
- public void copyInto(int[] array, int offset) {
- left.copyInto(array, offset);
- right.copyInto(array, offset + (int) left.count());
- }
-
- @Override
- public int[] asPrimitiveArray() {
- int[] array = new int[(int) count()];
- copyInto(array, 0);
- return array;
- }
- }
-
- static final class LongConcNode
- extends AbstractPrimitiveConcNode<Long, Node.OfLong>
- implements Node.OfLong {
-
- LongConcNode(Node.OfLong left, Node.OfLong right) {
- super(left, right);
- }
-
- @Override
- public void forEach(LongConsumer consumer) {
- left.forEach(consumer);
- right.forEach(consumer);
- }
-
- @Override
- public Spliterator.OfLong spliterator() {
- return new InternalNodeSpliterator.OfLong(this);
- }
-
- @Override
- public void copyInto(long[] array, int offset) {
- left.copyInto(array, offset);
- right.copyInto(array, offset + (int) left.count());
- }
-
- @Override
- public long[] asPrimitiveArray() {
- long[] array = new long[(int) count()];
- copyInto(array, 0);
- return array;
- }
- }
-
- static final class DoubleConcNode
- extends AbstractPrimitiveConcNode<Double, Node.OfDouble>
- implements Node.OfDouble {
-
- DoubleConcNode(Node.OfDouble left, Node.OfDouble right) {
- super(left, right);
- }
-
- @Override
- public void forEach(DoubleConsumer consumer) {
- left.forEach(consumer);
- right.forEach(consumer);
- }
-
- @Override
- public Spliterator.OfDouble spliterator() {
- return new InternalNodeSpliterator.OfDouble(this);
- }
-
- @Override
- public void copyInto(double[] array, int offset) {
- left.copyInto(array, offset);
- right.copyInto(array, offset + (int) left.count());
- }
-
- @Override
- public double[] asPrimitiveArray() {
- double[] array = new double[(int) count()];
- copyInto(array, 0);
- return array;
- }
- }
-
private static final class IntFixedNodeBuilder
extends IntArrayNode
implements Node.Builder.OfInt {
@@ -2245,48 +2055,25 @@
}
}
- private static final class OfInt
- extends ToArrayTask<Integer, Node.OfInt, OfInt> {
- private final int[] array;
+ private static class OfPrimitive<T, T_CONS, T_ARR,
+ T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>,
+ T_NODE extends Node.OfPrimitive<T, T_CONS, T_ARR, T_SPLITR, T_NODE>>
+ extends ToArrayTask<T, T_NODE, OfPrimitive<T, T_CONS, T_ARR, T_SPLITR, T_NODE>> {
+ private final T_ARR array;
- private OfInt(Node.OfInt node, int[] array, int offset) {
+ private OfPrimitive(T_NODE node, T_ARR array, int offset) {
super(node, offset);
this.array = array;
}
- private OfInt(OfInt parent, Node.OfInt node, int offset) {
+ private OfPrimitive(OfPrimitive<T, T_CONS, T_ARR, T_SPLITR, T_NODE> parent, T_NODE node, int offset) {
super(parent, node, offset);
this.array = parent.array;
}
@Override
- OfInt makeChild(int childIndex, int offset) {
- return new OfInt(this, node.getChild(childIndex), offset);
- }
-
- @Override
- void copyNodeToArray() {
- node.copyInto(array, offset);
- }
- }
-
- private static final class OfLong
- extends ToArrayTask<Long, Node.OfLong, OfLong> {
- private final long[] array;
-
- private OfLong(Node.OfLong node, long[] array, int offset) {
- super(node, offset);
- this.array = array;
- }
-
- private OfLong(OfLong parent, Node.OfLong node, int offset) {
- super(parent, node, offset);
- this.array = parent.array;
- }
-
- @Override
- OfLong makeChild(int childIndex, int offset) {
- return new OfLong(this, node.getChild(childIndex), offset);
+ OfPrimitive<T, T_CONS, T_ARR, T_SPLITR, T_NODE> makeChild(int childIndex, int offset) {
+ return new OfPrimitive<>(this, node.getChild(childIndex), offset);
}
@Override
@@ -2295,173 +2082,98 @@
}
}
- private static final class OfDouble
- extends ToArrayTask<Double, Node.OfDouble, OfDouble> {
- private final double[] array;
-
- private OfDouble(Node.OfDouble node, double[] array, int offset) {
- super(node, offset);
- this.array = array;
+ private static final class OfInt
+ extends OfPrimitive<Integer, IntConsumer, int[], Spliterator.OfInt, Node.OfInt> {
+ private OfInt(Node.OfInt node, int[] array, int offset) {
+ super(node, array, offset);
}
+ }
- private OfDouble(OfDouble parent, Node.OfDouble node, int offset) {
- super(parent, node, offset);
- this.array = parent.array;
+ private static final class OfLong
+ extends OfPrimitive<Long, LongConsumer, long[], Spliterator.OfLong, Node.OfLong> {
+ private OfLong(Node.OfLong node, long[] array, int offset) {
+ super(node, array, offset);
}
+ }
- @Override
- OfDouble makeChild(int childIndex, int offset) {
- return new OfDouble(this, node.getChild(childIndex), offset);
- }
-
- @Override
- void copyNodeToArray() {
- node.copyInto(array, offset);
+ private static final class OfDouble
+ extends OfPrimitive<Double, DoubleConsumer, double[], Spliterator.OfDouble, Node.OfDouble> {
+ private OfDouble(Node.OfDouble node, double[] array, int offset) {
+ super(node, array, offset);
}
}
}
- private static final class CollectorTask<P_IN, P_OUT>
- extends AbstractTask<P_IN, P_OUT, Node<P_OUT>, CollectorTask<P_IN, P_OUT>> {
- private final PipelineHelper<P_OUT> helper;
- private final IntFunction<P_OUT[]> generator;
+ private static class CollectorTask<P_IN, P_OUT, T_NODE extends Node<P_OUT>, T_BUILDER extends Node.Builder<P_OUT>>
+ extends AbstractTask<P_IN, P_OUT, T_NODE, CollectorTask<P_IN, P_OUT, T_NODE, T_BUILDER>> {
+ protected final PipelineHelper<P_OUT> helper;
+ protected final LongFunction<T_BUILDER> builderFactory;
+ protected final BinaryOperator<T_NODE> concFactory;
CollectorTask(PipelineHelper<P_OUT> helper,
- IntFunction<P_OUT[]> generator,
- Spliterator<P_IN> spliterator) {
+ Spliterator<P_IN> spliterator,
+ LongFunction<T_BUILDER> builderFactory,
+ BinaryOperator<T_NODE> concFactory) {
super(helper, spliterator);
this.helper = helper;
- this.generator = generator;
+ this.builderFactory = builderFactory;
+ this.concFactory = concFactory;
}
- CollectorTask(CollectorTask<P_IN, P_OUT> parent, Spliterator<P_IN> spliterator) {
+ CollectorTask(CollectorTask<P_IN, P_OUT, T_NODE, T_BUILDER> parent,
+ Spliterator<P_IN> spliterator) {
super(parent, spliterator);
helper = parent.helper;
- generator = parent.generator;
+ builderFactory = parent.builderFactory;
+ concFactory = parent.concFactory;
}
@Override
- protected CollectorTask<P_IN, P_OUT> makeChild(Spliterator<P_IN> spliterator) {
+ protected CollectorTask<P_IN, P_OUT, T_NODE, T_BUILDER> makeChild(Spliterator<P_IN> spliterator) {
return new CollectorTask<>(this, spliterator);
}
@Override
- protected Node<P_OUT> doLeaf() {
- Node.Builder<P_OUT> builder
- = builder(helper.exactOutputSizeIfKnown(spliterator),
- generator);
- return helper.wrapAndCopyInto(builder, spliterator).build();
+ protected T_NODE doLeaf() {
+ T_BUILDER builder = builderFactory.apply(helper.exactOutputSizeIfKnown(spliterator));
+ return (T_NODE) helper.wrapAndCopyInto(builder, spliterator).build();
}
@Override
public void onCompletion(CountedCompleter caller) {
- if (!isLeaf()) {
- setLocalResult(new ConcNode<>(leftChild.getLocalResult(), rightChild.getLocalResult()));
- }
+ if (!isLeaf())
+ setLocalResult(concFactory.apply(leftChild.getLocalResult(), rightChild.getLocalResult()));
super.onCompletion(caller);
}
- }
-
- private static final class IntCollectorTask<P_IN>
- extends AbstractTask<P_IN, Integer, Node.OfInt, IntCollectorTask<P_IN>> {
- private final PipelineHelper<Integer> helper;
-
- IntCollectorTask(PipelineHelper<Integer> helper, Spliterator<P_IN> spliterator) {
- super(helper, spliterator);
- this.helper = helper;
- }
-
- IntCollectorTask(IntCollectorTask<P_IN> parent, Spliterator<P_IN> spliterator) {
- super(parent, spliterator);
- helper = parent.helper;
- }
- @Override
- protected IntCollectorTask<P_IN> makeChild(Spliterator<P_IN> spliterator) {
- return new IntCollectorTask<>(this, spliterator);
- }
-
- @Override
- protected Node.OfInt doLeaf() {
- Node.Builder.OfInt builder = intBuilder(helper.exactOutputSizeIfKnown(spliterator));
- return helper.wrapAndCopyInto(builder, spliterator).build();
- }
-
- @Override
- public void onCompletion(CountedCompleter caller) {
- if (!isLeaf()) {
- setLocalResult(new IntConcNode(leftChild.getLocalResult(), rightChild.getLocalResult()));
+ private static final class OfRef<P_IN, P_OUT>
+ extends CollectorTask<P_IN, P_OUT, Node<P_OUT>, Node.Builder<P_OUT>> {
+ OfRef(PipelineHelper<P_OUT> helper,
+ IntFunction<P_OUT[]> generator,
+ Spliterator<P_IN> spliterator) {
+ super(helper, spliterator, s -> builder(s, generator), ConcNode::new);
}
- super.onCompletion(caller);
- }
- }
-
- private static final class LongCollectorTask<P_IN>
- extends AbstractTask<P_IN, Long, Node.OfLong, LongCollectorTask<P_IN>> {
- private final PipelineHelper<Long> helper;
-
- LongCollectorTask(PipelineHelper<Long> helper, Spliterator<P_IN> spliterator) {
- super(helper, spliterator);
- this.helper = helper;
}
- LongCollectorTask(LongCollectorTask<P_IN> parent, Spliterator<P_IN> spliterator) {
- super(parent, spliterator);
- helper = parent.helper;
- }
-
- @Override
- protected LongCollectorTask<P_IN> makeChild(Spliterator<P_IN> spliterator) {
- return new LongCollectorTask<>(this, spliterator);
- }
-
- @Override
- protected Node.OfLong doLeaf() {
- Node.Builder.OfLong builder = longBuilder(helper.exactOutputSizeIfKnown(spliterator));
- return helper.wrapAndCopyInto(builder, spliterator).build();
+ private static final class OfInt<P_IN>
+ extends CollectorTask<P_IN, Integer, Node.OfInt, Node.Builder.OfInt> {
+ OfInt(PipelineHelper<Integer> helper, Spliterator<P_IN> spliterator) {
+ super(helper, spliterator, Nodes::intBuilder, ConcNode.OfInt::new);
+ }
}
- @Override
- public void onCompletion(CountedCompleter caller) {
- if (!isLeaf()) {
- setLocalResult(new LongConcNode(leftChild.getLocalResult(), rightChild.getLocalResult()));
+ private static final class OfLong<P_IN>
+ extends CollectorTask<P_IN, Long, Node.OfLong, Node.Builder.OfLong> {
+ OfLong(PipelineHelper<Long> helper, Spliterator<P_IN> spliterator) {
+ super(helper, spliterator, Nodes::longBuilder, ConcNode.OfLong::new);
}
- super.onCompletion(caller);
- }
- }
-
- private static final class DoubleCollectorTask<P_IN>
- extends AbstractTask<P_IN, Double, Node.OfDouble, DoubleCollectorTask<P_IN>> {
- private final PipelineHelper<Double> helper;
-
- DoubleCollectorTask(PipelineHelper<Double> helper, Spliterator<P_IN> spliterator) {
- super(helper, spliterator);
- this.helper = helper;
}
- DoubleCollectorTask(DoubleCollectorTask<P_IN> parent, Spliterator<P_IN> spliterator) {
- super(parent, spliterator);
- helper = parent.helper;
- }
-
- @Override
- protected DoubleCollectorTask<P_IN> makeChild(Spliterator<P_IN> spliterator) {
- return new DoubleCollectorTask<>(this, spliterator);
- }
-
- @Override
- protected Node.OfDouble doLeaf() {
- Node.Builder.OfDouble builder
- = doubleBuilder(helper.exactOutputSizeIfKnown(spliterator));
- return helper.wrapAndCopyInto(builder, spliterator).build();
- }
-
- @Override
- public void onCompletion(CountedCompleter caller) {
- if (!isLeaf()) {
- setLocalResult(new DoubleConcNode(leftChild.getLocalResult(), rightChild.getLocalResult()));
+ private static final class OfDouble<P_IN>
+ extends CollectorTask<P_IN, Double, Node.OfDouble, Node.Builder.OfDouble> {
+ OfDouble(PipelineHelper<Double> helper, Spliterator<P_IN> spliterator) {
+ super(helper, spliterator, Nodes::doubleBuilder, ConcNode.OfDouble::new);
}
- super.onCompletion(caller);
}
}
}
--- a/jdk/src/share/classes/java/util/stream/PipelineHelper.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/PipelineHelper.java Tue Jul 02 15:23:23 2013 -0700
@@ -44,7 +44,7 @@
* and {@link AbstractPipeline#opEvaluateParallel(PipelineHelper, java.util.Spliterator,
* java.util.function.IntFunction)}, methods, which can use the
* {@code PipelineHelper} to access information about the pipeline such as
- * input shape, output shape, stream flags, and size, and use the helper methods
+ * head shape, stream flags, and size, and use the helper methods
* such as {@link #wrapAndCopyInto(Sink, Spliterator)},
* {@link #copyInto(Sink, Spliterator)}, and {@link #wrapSink(Sink)} to execute
* pipeline operations.
@@ -55,6 +55,13 @@
abstract class PipelineHelper<P_OUT> {
/**
+ * Gets the stream shape for the source of the pipeline segment.
+ *
+ * @return the stream shape for the source of the pipeline segment.
+ */
+ abstract StreamShape getSourceShape();
+
+ /**
* Gets the combined stream and operation flags for the output of the described
* pipeline. This will incorporate stream flags from the stream source, all
* the intermediate operations and the terminal operation.
@@ -146,6 +153,14 @@
abstract<P_IN> Sink<P_IN> wrapSink(Sink<P_OUT> sink);
/**
+ *
+ * @param spliterator
+ * @param <P_IN>
+ * @return
+ */
+ abstract<P_IN> Spliterator<P_OUT> wrapSpliterator(Spliterator<P_IN> spliterator);
+
+ /**
* Constructs a @{link Node.Builder} compatible with the output shape of
* this {@code PipelineHelper}.
*
--- a/jdk/src/share/classes/java/util/stream/ReferencePipeline.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/ReferencePipeline.java Tue Jul 02 15:23:23 2013 -0700
@@ -25,7 +25,6 @@
package java.util.stream;
import java.util.Comparator;
-import java.util.Comparators;
import java.util.Iterator;
import java.util.Objects;
import java.util.Optional;
@@ -166,6 +165,11 @@
Sink<P_OUT> opWrapSink(int flags, Sink<P_OUT> sink) {
return new Sink.ChainedReference<P_OUT>(sink) {
@Override
+ public void begin(long size) {
+ downstream.begin(-1);
+ }
+
+ @Override
public void accept(P_OUT u) {
if (predicate.test(u))
downstream.accept(u);
@@ -252,6 +256,12 @@
@Override
Sink<P_OUT> opWrapSink(int flags, Sink<R> sink) {
return new Sink.ChainedReference<P_OUT>(sink) {
+ @Override
+ public void begin(long size) {
+ downstream.begin(-1);
+ }
+
+ @Override
public void accept(P_OUT u) {
// We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
Stream<? extends R> result = mapper.apply(u);
@@ -273,6 +283,12 @@
Sink<P_OUT> opWrapSink(int flags, Sink<Integer> sink) {
return new Sink.ChainedReference<P_OUT>(sink) {
IntConsumer downstreamAsInt = downstream::accept;
+ @Override
+ public void begin(long size) {
+ downstream.begin(-1);
+ }
+
+ @Override
public void accept(P_OUT u) {
// We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
IntStream result = mapper.apply(u);
@@ -294,6 +310,12 @@
Sink<P_OUT> opWrapSink(int flags, Sink<Double> sink) {
return new Sink.ChainedReference<P_OUT>(sink) {
DoubleConsumer downstreamAsDouble = downstream::accept;
+ @Override
+ public void begin(long size) {
+ downstream.begin(-1);
+ }
+
+ @Override
public void accept(P_OUT u) {
// We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
DoubleStream result = mapper.apply(u);
@@ -315,6 +337,12 @@
Sink<P_OUT> opWrapSink(int flags, Sink<Long> sink) {
return new Sink.ChainedReference<P_OUT>(sink) {
LongConsumer downstreamAsLong = downstream::accept;
+ @Override
+ public void begin(long size) {
+ downstream.begin(-1);
+ }
+
+ @Override
public void accept(P_OUT u) {
// We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
LongStream result = mapper.apply(u);
@@ -483,12 +511,12 @@
@Override
public final Optional<P_OUT> max(Comparator<? super P_OUT> comparator) {
- return reduce(Comparators.greaterOf(comparator));
+ return reduce(BinaryOperator.maxBy(comparator));
}
@Override
public final Optional<P_OUT> min(Comparator<? super P_OUT> comparator) {
- return reduce(Comparators.lesserOf(comparator));
+ return reduce(BinaryOperator.minBy(comparator));
}
--- a/jdk/src/share/classes/java/util/stream/SliceOps.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/SliceOps.java Tue Jul 02 15:23:23 2013 -0700
@@ -24,8 +24,6 @@
*/
package java.util.stream;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Spliterator;
import java.util.concurrent.CountedCompleter;
import java.util.function.IntFunction;
@@ -42,6 +40,63 @@
private SliceOps() { }
/**
+ * Calculates the sliced size given the current size, number of elements
+ * skip, and the number of elements to limit.
+ *
+ * @param size the current size
+ * @param skip the number of elements to skip, assumed to be >= 0
+ * @param limit the number of elements to limit, assumed to be >= 0, with
+ * a value of {@code Long.MAX_VALUE} if there is no limit
+ * @return the sliced size
+ */
+ private static long calcSize(long size, long skip, long limit) {
+ return size >= 0 ? Math.max(-1, Math.min(size - skip, limit)) : -1;
+ }
+
+ /**
+ * Calculates the slice fence, which is one past the index of the slice
+ * range
+ * @param skip the number of elements to skip, assumed to be >= 0
+ * @param limit the number of elements to limit, assumed to be >= 0, with
+ * a value of {@code Long.MAX_VALUE} if there is no limit
+ * @return the slice fence.
+ */
+ private static long calcSliceFence(long skip, long limit) {
+ long sliceFence = limit >= 0 ? skip + limit : Long.MAX_VALUE;
+ // Check for overflow
+ return (sliceFence >= 0) ? sliceFence : Long.MAX_VALUE;
+ }
+
+ /**
+ * Creates a slice spliterator given a stream shape governing the
+ * spliterator type. Requires that the underlying Spliterator
+ * be SUBSIZED.
+ */
+ @SuppressWarnings("unchecked")
+ private static <P_IN> Spliterator<P_IN> sliceSpliterator(StreamShape shape,
+ Spliterator<P_IN> s,
+ long skip, long limit) {
+ assert s.hasCharacteristics(Spliterator.SUBSIZED);
+ long sliceFence = calcSliceFence(skip, limit);
+ switch (shape) {
+ case REFERENCE:
+ return new StreamSpliterators
+ .SliceSpliterator.OfRef<>(s, skip, sliceFence);
+ case INT_VALUE:
+ return (Spliterator<P_IN>) new StreamSpliterators
+ .SliceSpliterator.OfInt((Spliterator.OfInt) s, skip, sliceFence);
+ case LONG_VALUE:
+ return (Spliterator<P_IN>) new StreamSpliterators
+ .SliceSpliterator.OfLong((Spliterator.OfLong) s, skip, sliceFence);
+ case DOUBLE_VALUE:
+ return (Spliterator<P_IN>) new StreamSpliterators
+ .SliceSpliterator.OfDouble((Spliterator.OfDouble) s, skip, sliceFence);
+ default:
+ throw new IllegalStateException("Unknown shape " + shape);
+ }
+ }
+
+ /**
* Appends a "slice" operation to the provided stream. The slice operation
* may be may be skip-only, limit-only, or skip-and-limit.
*
@@ -58,11 +113,71 @@
return new ReferencePipeline.StatefulOp<T,T>(upstream, StreamShape.REFERENCE,
flags(limit)) {
+ Spliterator<T> unorderedSkipLimitSpliterator(Spliterator<T> s,
+ long skip, long limit, long sizeIfKnown) {
+ if (skip <= sizeIfKnown) {
+ // Use just the limit if the number of elements
+ // to skip is <= the known pipeline size
+ limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip;
+ skip = 0;
+ }
+ return new StreamSpliterators.UnorderedSliceSpliterator.OfRef<>(s, skip, limit);
+ }
+
+ @Override
+ <P_IN> Spliterator<T> opEvaluateParallelLazy(PipelineHelper<T> helper, Spliterator<P_IN> spliterator) {
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ return new StreamSpliterators.SliceSpliterator.OfRef<>(
+ helper.wrapSpliterator(spliterator),
+ skip,
+ calcSliceFence(skip, limit));
+ } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+ return unorderedSkipLimitSpliterator(
+ helper.wrapSpliterator(spliterator),
+ skip, limit, size);
+ }
+ else {
+ // @@@ OOMEs will occur for LongStream.longs().filter(i -> true).limit(n)
+ // regardless of the value of n
+ // Need to adjust the target size of splitting for the
+ // SliceTask from say (size / k) to say min(size / k, 1 << 14)
+ // This will limit the size of the buffers created at the leaf nodes
+ // cancellation will be more aggressive cancelling later tasks
+ // if the target slice size has been reached from a given task,
+ // cancellation should also clear local results if any
+ return new SliceTask<>(this, helper, spliterator, i -> (T[]) new Object[i], skip, limit).
+ invoke().spliterator();
+ }
+ }
+
@Override
<P_IN> Node<T> opEvaluateParallel(PipelineHelper<T> helper,
Spliterator<P_IN> spliterator,
IntFunction<T[]> generator) {
- return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ // Because the pipeline is SIZED the slice spliterator
+ // can be created from the source, this requires matching
+ // to shape of the source, and is potentially more efficient
+ // than creating the slice spliterator from the pipeline
+ // wrapping spliterator
+ Spliterator<P_IN> s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit);
+ return Nodes.collect(helper, s, true, generator);
+ } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+ Spliterator<T> s = unorderedSkipLimitSpliterator(
+ helper.wrapSpliterator(spliterator),
+ skip, limit, size);
+ // Collect using this pipeline, which is empty and therefore
+ // can be used with the pipeline wrapping spliterator
+ // Note that we cannot create a slice spliterator from
+ // the source spliterator if the pipeline is not SIZED
+ return Nodes.collect(this, s, true, generator);
+ }
+ else {
+ return new SliceTask<>(this, helper, spliterator, generator, skip, limit).
+ invoke();
+ }
}
@Override
@@ -72,6 +187,11 @@
long m = limit >= 0 ? limit : Long.MAX_VALUE;
@Override
+ public void begin(long size) {
+ downstream.begin(calcSize(size, skip, m));
+ }
+
+ @Override
public void accept(T t) {
if (n == 0) {
if (m > 0) {
@@ -109,11 +229,64 @@
return new IntPipeline.StatefulOp<Integer>(upstream, StreamShape.INT_VALUE,
flags(limit)) {
+ Spliterator.OfInt unorderedSkipLimitSpliterator(
+ Spliterator.OfInt s, long skip, long limit, long sizeIfKnown) {
+ if (skip <= sizeIfKnown) {
+ // Use just the limit if the number of elements
+ // to skip is <= the known pipeline size
+ limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip;
+ skip = 0;
+ }
+ return new StreamSpliterators.UnorderedSliceSpliterator.OfInt(s, skip, limit);
+ }
+
+ @Override
+ <P_IN> Spliterator<Integer> opEvaluateParallelLazy(PipelineHelper<Integer> helper,
+ Spliterator<P_IN> spliterator) {
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ return new StreamSpliterators.SliceSpliterator.OfInt(
+ (Spliterator.OfInt) helper.wrapSpliterator(spliterator),
+ skip,
+ calcSliceFence(skip, limit));
+ } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+ return unorderedSkipLimitSpliterator(
+ (Spliterator.OfInt) helper.wrapSpliterator(spliterator),
+ skip, limit, size);
+ }
+ else {
+ return new SliceTask<>(this, helper, spliterator, Integer[]::new, skip, limit).
+ invoke().spliterator();
+ }
+ }
+
@Override
<P_IN> Node<Integer> opEvaluateParallel(PipelineHelper<Integer> helper,
Spliterator<P_IN> spliterator,
IntFunction<Integer[]> generator) {
- return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ // Because the pipeline is SIZED the slice spliterator
+ // can be created from the source, this requires matching
+ // to shape of the source, and is potentially more efficient
+ // than creating the slice spliterator from the pipeline
+ // wrapping spliterator
+ Spliterator<P_IN> s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit);
+ return Nodes.collectInt(helper, s, true);
+ } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+ Spliterator.OfInt s = unorderedSkipLimitSpliterator(
+ (Spliterator.OfInt) helper.wrapSpliterator(spliterator),
+ skip, limit, size);
+ // Collect using this pipeline, which is empty and therefore
+ // can be used with the pipeline wrapping spliterator
+ // Note that we cannot create a slice spliterator from
+ // the source spliterator if the pipeline is not SIZED
+ return Nodes.collectInt(this, s, true);
+ }
+ else {
+ return new SliceTask<>(this, helper, spliterator, generator, skip, limit).
+ invoke();
+ }
}
@Override
@@ -123,6 +296,11 @@
long m = limit >= 0 ? limit : Long.MAX_VALUE;
@Override
+ public void begin(long size) {
+ downstream.begin(calcSize(size, skip, m));
+ }
+
+ @Override
public void accept(int t) {
if (n == 0) {
if (m > 0) {
@@ -160,11 +338,64 @@
return new LongPipeline.StatefulOp<Long>(upstream, StreamShape.LONG_VALUE,
flags(limit)) {
+ Spliterator.OfLong unorderedSkipLimitSpliterator(
+ Spliterator.OfLong s, long skip, long limit, long sizeIfKnown) {
+ if (skip <= sizeIfKnown) {
+ // Use just the limit if the number of elements
+ // to skip is <= the known pipeline size
+ limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip;
+ skip = 0;
+ }
+ return new StreamSpliterators.UnorderedSliceSpliterator.OfLong(s, skip, limit);
+ }
+
+ @Override
+ <P_IN> Spliterator<Long> opEvaluateParallelLazy(PipelineHelper<Long> helper,
+ Spliterator<P_IN> spliterator) {
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ return new StreamSpliterators.SliceSpliterator.OfLong(
+ (Spliterator.OfLong) helper.wrapSpliterator(spliterator),
+ skip,
+ calcSliceFence(skip, limit));
+ } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+ return unorderedSkipLimitSpliterator(
+ (Spliterator.OfLong) helper.wrapSpliterator(spliterator),
+ skip, limit, size);
+ }
+ else {
+ return new SliceTask<>(this, helper, spliterator, Long[]::new, skip, limit).
+ invoke().spliterator();
+ }
+ }
+
@Override
<P_IN> Node<Long> opEvaluateParallel(PipelineHelper<Long> helper,
Spliterator<P_IN> spliterator,
IntFunction<Long[]> generator) {
- return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ // Because the pipeline is SIZED the slice spliterator
+ // can be created from the source, this requires matching
+ // to shape of the source, and is potentially more efficient
+ // than creating the slice spliterator from the pipeline
+ // wrapping spliterator
+ Spliterator<P_IN> s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit);
+ return Nodes.collectLong(helper, s, true);
+ } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+ Spliterator.OfLong s = unorderedSkipLimitSpliterator(
+ (Spliterator.OfLong) helper.wrapSpliterator(spliterator),
+ skip, limit, size);
+ // Collect using this pipeline, which is empty and therefore
+ // can be used with the pipeline wrapping spliterator
+ // Note that we cannot create a slice spliterator from
+ // the source spliterator if the pipeline is not SIZED
+ return Nodes.collectLong(this, s, true);
+ }
+ else {
+ return new SliceTask<>(this, helper, spliterator, generator, skip, limit).
+ invoke();
+ }
}
@Override
@@ -174,6 +405,11 @@
long m = limit >= 0 ? limit : Long.MAX_VALUE;
@Override
+ public void begin(long size) {
+ downstream.begin(calcSize(size, skip, m));
+ }
+
+ @Override
public void accept(long t) {
if (n == 0) {
if (m > 0) {
@@ -211,11 +447,64 @@
return new DoublePipeline.StatefulOp<Double>(upstream, StreamShape.DOUBLE_VALUE,
flags(limit)) {
+ Spliterator.OfDouble unorderedSkipLimitSpliterator(
+ Spliterator.OfDouble s, long skip, long limit, long sizeIfKnown) {
+ if (skip <= sizeIfKnown) {
+ // Use just the limit if the number of elements
+ // to skip is <= the known pipeline size
+ limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip;
+ skip = 0;
+ }
+ return new StreamSpliterators.UnorderedSliceSpliterator.OfDouble(s, skip, limit);
+ }
+
+ @Override
+ <P_IN> Spliterator<Double> opEvaluateParallelLazy(PipelineHelper<Double> helper,
+ Spliterator<P_IN> spliterator) {
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ return new StreamSpliterators.SliceSpliterator.OfDouble(
+ (Spliterator.OfDouble) helper.wrapSpliterator(spliterator),
+ skip,
+ calcSliceFence(skip, limit));
+ } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+ return unorderedSkipLimitSpliterator(
+ (Spliterator.OfDouble) helper.wrapSpliterator(spliterator),
+ skip, limit, size);
+ }
+ else {
+ return new SliceTask<>(this, helper, spliterator, Double[]::new, skip, limit).
+ invoke().spliterator();
+ }
+ }
+
@Override
<P_IN> Node<Double> opEvaluateParallel(PipelineHelper<Double> helper,
Spliterator<P_IN> spliterator,
IntFunction<Double[]> generator) {
- return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+ long size = helper.exactOutputSizeIfKnown(spliterator);
+ if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+ // Because the pipeline is SIZED the slice spliterator
+ // can be created from the source, this requires matching
+ // to shape of the source, and is potentially more efficient
+ // than creating the slice spliterator from the pipeline
+ // wrapping spliterator
+ Spliterator<P_IN> s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit);
+ return Nodes.collectDouble(helper, s, true);
+ } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+ Spliterator.OfDouble s = unorderedSkipLimitSpliterator(
+ (Spliterator.OfDouble) helper.wrapSpliterator(spliterator),
+ skip, limit, size);
+ // Collect using this pipeline, which is empty and therefore
+ // can be used with the pipeline wrapping spliterator
+ // Note that we cannot create a slice spliterator from
+ // the source spliterator if the pipeline is not SIZED
+ return Nodes.collectDouble(this, s, true);
+ }
+ else {
+ return new SliceTask<>(this, helper, spliterator, generator, skip, limit).
+ invoke();
+ }
}
@Override
@@ -225,6 +514,11 @@
long m = limit >= 0 ? limit : Long.MAX_VALUE;
@Override
+ public void begin(long size) {
+ downstream.begin(calcSize(size, skip, m));
+ }
+
+ @Override
public void accept(double t) {
if (n == 0) {
if (m > 0) {
@@ -250,20 +544,6 @@
return StreamOpFlag.NOT_SIZED | ((limit != -1) ? StreamOpFlag.IS_SHORT_CIRCUIT : 0);
}
- // Parallel strategy -- two cases
- // IF we have full size information
- // - decompose, keeping track of each leaf's (offset, size)
- // - calculate leaf only if intersection between (offset, size) and desired slice
- // - Construct a Node containing the appropriate sections of the appropriate leaves
- // IF we don't
- // - decompose, and calculate size of each leaf
- // - on complete of any node, compute completed initial size from the root, and if big enough, cancel later nodes
- // - @@@ this can be significantly improved
-
- // @@@ Currently we don't do the sized version at all
-
- // @@@ Should take into account ORDERED flag; if not ORDERED, we can limit in temporal order instead
-
/**
* {@code ForkJoinTask} implementing slice computation.
*
@@ -316,19 +596,18 @@
? op.exactOutputSizeIfKnown(spliterator)
: -1;
final Node.Builder<P_OUT> nb = op.makeNodeBuilder(sizeIfKnown, generator);
- Sink<P_OUT> opSink = op.opWrapSink(op.sourceOrOpFlags, nb);
-
- if (!StreamOpFlag.SHORT_CIRCUIT.isKnown(op.sourceOrOpFlags))
- helper.wrapAndCopyInto(opSink, spliterator);
- else
- helper.copyIntoWithCancel(helper.wrapSink(opSink), spliterator);
- return nb.build();
+ Sink<P_OUT> opSink = op.opWrapSink(helper.getStreamAndOpFlags(), nb);
+ helper.copyIntoWithCancel(helper.wrapSink(opSink), spliterator);
+ // It is necessary to truncate here since the result at the root
+ // can only be set once
+ return doTruncate(nb.build());
}
else {
Node<P_OUT> node = helper.wrapAndCopyInto(helper.makeNodeBuilder(-1, generator),
- spliterator).build();
+ spliterator).build();
thisNodeSize = node.count();
completed = true;
+ spliterator = null;
return node;
}
}
@@ -336,176 +615,95 @@
@Override
public final void onCompletion(CountedCompleter<?> caller) {
if (!isLeaf()) {
+ Node<P_OUT> result;
thisNodeSize = leftChild.thisNodeSize + rightChild.thisNodeSize;
+ if (canceled) {
+ thisNodeSize = 0;
+ result = getEmptyResult();
+ }
+ else if (thisNodeSize == 0)
+ result = getEmptyResult();
+ else if (leftChild.thisNodeSize == 0)
+ result = rightChild.getLocalResult();
+ else {
+ result = Nodes.conc(op.getOutputShape(),
+ leftChild.getLocalResult(), rightChild.getLocalResult());
+ }
+ setLocalResult(isRoot() ? doTruncate(result) : result);
completed = true;
-
- if (isRoot()) {
- // Only collect nodes once absolute size information is known
+ }
+ if (targetSize >= 0
+ && !isRoot()
+ && isLeftCompleted(targetOffset + targetSize))
+ cancelLaterNodes();
- ArrayList<Node<P_OUT>> nodes = new ArrayList<>();
- visit(nodes, 0);
- Node<P_OUT> result;
- if (nodes.size() == 0)
- result = Nodes.emptyNode(op.getOutputShape());
- else if (nodes.size() == 1)
- result = nodes.get(0);
- else
- // This will create a tree of depth 1 and will not be a sub-tree
- // for leaf nodes within the require range
- result = Nodes.conc(op.getOutputShape(), nodes);
- setLocalResult(result);
- }
- }
- if (targetSize >= 0) {
- if (((SliceTask<P_IN, P_OUT>) getRoot()).leftSize() >= targetOffset + targetSize)
- cancelLaterNodes();
- }
- // Don't call super.onCompletion(), we don't look at the child nodes until farther up the tree
+ super.onCompletion(caller);
}
- /** Compute the cumulative size of the longest leading prefix of completed children */
- private long leftSize() {
+ @Override
+ protected void cancel() {
+ super.cancel();
if (completed)
- return thisNodeSize;
- else if (isLeaf())
- return 0;
- else {
- long leftSize = 0;
- for (SliceTask<P_IN, P_OUT> child = leftChild, p = null; child != p;
- p = child, child = rightChild) {
- if (child.completed)
- leftSize += child.thisNodeSize;
- else {
- leftSize += child.leftSize();
- break;
- }
- }
- return leftSize;
- }
+ setLocalResult(getEmptyResult());
+ }
+
+ private Node<P_OUT> doTruncate(Node<P_OUT> input) {
+ long to = targetSize >= 0 ? Math.min(input.count(), targetOffset + targetSize) : thisNodeSize;
+ return input.truncate(targetOffset, to, generator);
}
- private void visit(List<Node<P_OUT>> results, int offset) {
- if (!isLeaf()) {
- for (SliceTask<P_IN, P_OUT> child = leftChild, p = null; child != p;
- p = child, child = rightChild) {
- child.visit(results, offset);
- offset += child.thisNodeSize;
- }
- }
- else {
- if (results.size() == 0) {
- if (offset + thisNodeSize >= targetOffset)
- results.add(truncateNode(getLocalResult(),
- Math.max(0, targetOffset - offset),
- targetSize >= 0 ? Math.max(0, offset + thisNodeSize - (targetOffset + targetSize)) : 0));
- }
- else {
- if (targetSize == -1 || offset < targetOffset + targetSize) {
- results.add(truncateNode(getLocalResult(),
- 0,
- targetSize >= 0 ? Math.max(0, offset + thisNodeSize - (targetOffset + targetSize)) : 0));
+ /**
+ * Determine if the number of completed elements in this node and nodes
+ * to the left of this node is greater than or equal to the target size.
+ *
+ * @param target the target size
+ * @return true if the number of elements is greater than or equal to
+ * the target size, otherwise false.
+ */
+ private boolean isLeftCompleted(long target) {
+ long size = completed ? thisNodeSize : completedSize(target);
+ if (size >= target)
+ return true;
+ for (SliceTask<P_IN, P_OUT> parent = getParent(), node = this;
+ parent != null;
+ node = parent, parent = parent.getParent()) {
+ if (node == parent.rightChild) {
+ SliceTask<P_IN, P_OUT> left = parent.leftChild;
+ if (left != null) {
+ size += left.completedSize(target);
+ if (size >= target)
+ return true;
}
}
}
+ return size >= target;
}
/**
- * Return a new node describing the result of truncating an existing Node
- * at the left and/or right.
+ * Compute the number of completed elements in this node.
+ * <p>
+ * Computation terminates if all nodes have been processed or the
+ * number of completed elements is greater than or equal to the target
+ * size.
+ *
+ * @param target the target size
+ * @return return the number of completed elements
*/
- private Node<P_OUT> truncateNode(Node<P_OUT> input,
- long skipLeft, long skipRight) {
- if (skipLeft == 0 && skipRight == 0)
- return input;
+ private long completedSize(long target) {
+ if (completed)
+ return thisNodeSize;
else {
- return Nodes.truncateNode(input, skipLeft, thisNodeSize - skipRight, generator);
+ SliceTask<P_IN, P_OUT> left = leftChild;
+ SliceTask<P_IN, P_OUT> right = rightChild;
+ if (left == null || right == null) {
+ // must be completed
+ return thisNodeSize;
+ }
+ else {
+ long leftSize = left.completedSize(target);
+ return (leftSize >= target) ? leftSize : leftSize + right.completedSize(target);
+ }
}
}
}
-
- // @@@ Currently unused -- optimization for when all sizes are known
-// private static class SizedSliceTask<S, T> extends AbstractShortCircuitTask<S, T, Node<T>, SizedSliceTask<S, T>> {
-// private final int targetOffset, targetSize;
-// private final int offset, size;
-//
-// private SizedSliceTask(ParallelPipelineHelper<S, T> helper, int offset, int size) {
-// super(helper);
-// targetOffset = offset;
-// targetSize = size;
-// this.offset = 0;
-// this.size = spliterator.getSizeIfKnown();
-// }
-//
-// private SizedSliceTask(SizedSliceTask<S, T> parent, Spliterator<S> spliterator) {
-// // Makes assumptions about order in which siblings are created and linked into parent!
-// super(parent, spliterator);
-// targetOffset = parent.targetOffset;
-// targetSize = parent.targetSize;
-// int siblingSizes = 0;
-// for (SizedSliceTask<S, T> sibling = parent.children; sibling != null; sibling = sibling.nextSibling)
-// siblingSizes += sibling.size;
-// size = spliterator.getSizeIfKnown();
-// offset = parent.offset + siblingSizes;
-// }
-//
-// @Override
-// protected SizedSliceTask<S, T> makeChild(Spliterator<S> spliterator) {
-// return new SizedSliceTask<>(this, spliterator);
-// }
-//
-// @Override
-// protected Node<T> getEmptyResult() {
-// return Nodes.emptyNode();
-// }
-//
-// @Override
-// public boolean taskCanceled() {
-// if (offset > targetOffset+targetSize || offset+size < targetOffset)
-// return true;
-// else
-// return super.taskCanceled();
-// }
-//
-// @Override
-// protected Node<T> doLeaf() {
-// int skipLeft = Math.max(0, targetOffset - offset);
-// int skipRight = Math.max(0, offset + size - (targetOffset + targetSize));
-// if (skipLeft == 0 && skipRight == 0)
-// return helper.into(Nodes.<T>makeBuilder(spliterator.getSizeIfKnown())).build();
-// else {
-// // If we're the first or last node that intersects the target range, peel off irrelevant elements
-// int truncatedSize = size - skipLeft - skipRight;
-// NodeBuilder<T> builder = Nodes.<T>makeBuilder(truncatedSize);
-// Sink<S> wrappedSink = helper.wrapSink(builder);
-// wrappedSink.begin(truncatedSize);
-// Iterator<S> iterator = spliterator.iterator();
-// for (int i=0; i<skipLeft; i++)
-// iterator.next();
-// for (int i=0; i<truncatedSize; i++)
-// wrappedSink.apply(iterator.next());
-// wrappedSink.end();
-// return builder.build();
-// }
-// }
-//
-// @Override
-// public void onCompletion(CountedCompleter<?> caller) {
-// if (!isLeaf()) {
-// Node<T> result = null;
-// for (SizedSliceTask<S, T> child = children.nextSibling; child != null; child = child.nextSibling) {
-// Node<T> childResult = child.getRawResult();
-// if (childResult == null)
-// continue;
-// else if (result == null)
-// result = childResult;
-// else
-// result = Nodes.node(result, childResult);
-// }
-// setRawResult(result);
-// if (offset <= targetOffset && offset+size >= targetOffset+targetSize)
-// shortCircuit(result);
-// }
-// }
-// }
-
}
--- a/jdk/src/share/classes/java/util/stream/SortedOps.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/SortedOps.java Tue Jul 02 15:23:23 2013 -0700
@@ -27,7 +27,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
-import java.util.Comparators;
import java.util.Objects;
import java.util.Spliterator;
import java.util.concurrent.ForkJoinTask;
@@ -114,7 +113,7 @@
StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED);
this.isNaturalSort = true;
// Will throw CCE when we try to sort if T is not Comparable
- this.comparator = (Comparator<? super T>) Comparators.naturalOrder();
+ this.comparator = (Comparator<? super T>) Comparator.naturalOrder();
}
/**
--- a/jdk/src/share/classes/java/util/stream/Stream.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/Stream.java Tue Jul 02 15:23:23 2013 -0700
@@ -880,14 +880,7 @@
*/
public static<T> Stream<T> generate(Supplier<T> s) {
Objects.requireNonNull(s);
- return StreamSupport.stream(Spliterators.spliteratorUnknownSize(
- new Iterator<T>() {
- @Override
- public boolean hasNext() { return true; }
-
- @Override
- public T next() { return s.get(); }
- },
- Spliterator.ORDERED | Spliterator.IMMUTABLE));
+ return StreamSupport.stream(
+ new StreamSpliterators.InfiniteSupplyingSpliterator.OfRef<>(Long.MAX_VALUE, s));
}
}
--- a/jdk/src/share/classes/java/util/stream/StreamSpliterators.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/StreamSpliterators.java Tue Jul 02 15:23:23 2013 -0700
@@ -26,11 +26,15 @@
import java.util.Comparator;
import java.util.Spliterator;
+import java.util.concurrent.atomic.AtomicLong;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.DoubleConsumer;
+import java.util.function.DoubleSupplier;
import java.util.function.IntConsumer;
+import java.util.function.IntSupplier;
import java.util.function.LongConsumer;
+import java.util.function.LongSupplier;
import java.util.function.Supplier;
/**
@@ -212,9 +216,10 @@
@Override
public final long estimateSize() {
init();
- return StreamOpFlag.SIZED.isKnown(ph.getStreamAndOpFlags())
- ? spliterator.estimateSize()
- : Long.MAX_VALUE;
+ // Use the estimate of the wrapped spliterator
+ // Note this may not be accurate if there are filter/flatMap
+ // operations filtering or adding elements to the stream
+ return spliterator.estimateSize();
}
@Override
@@ -240,7 +245,7 @@
// but for sub-splits only an estimate is known
if ((c & Spliterator.SIZED) != 0) {
c &= ~(Spliterator.SIZED | Spliterator.SUBSIZED);
- c |= (spliterator.characteristics() & Spliterator.SIZED & Spliterator.SUBSIZED);
+ c |= (spliterator.characteristics() & (Spliterator.SIZED | Spliterator.SUBSIZED));
}
return c;
@@ -304,7 +309,7 @@
finished = true;
}
else {
- while (tryAdvance(consumer)) { }
+ do { } while (tryAdvance(consumer));
}
}
}
@@ -360,7 +365,7 @@
finished = true;
}
else {
- while (tryAdvance(consumer)) { }
+ do { } while (tryAdvance(consumer));
}
}
}
@@ -416,7 +421,7 @@
finished = true;
}
else {
- while (tryAdvance(consumer)) { }
+ do { } while (tryAdvance(consumer));
}
}
}
@@ -472,7 +477,7 @@
finished = true;
}
else {
- while (tryAdvance(consumer)) { }
+ do { } while (tryAdvance(consumer));
}
}
}
@@ -483,17 +488,17 @@
* first call to any spliterator method.
* @param <T>
*/
- static class DelegatingSpliterator<T> implements Spliterator<T> {
- private final Supplier<Spliterator<T>> supplier;
+ static class DelegatingSpliterator<T, T_SPLITR extends Spliterator<T>>
+ implements Spliterator<T> {
+ private final Supplier<? extends T_SPLITR> supplier;
- private Spliterator<T> s;
+ private T_SPLITR s;
- @SuppressWarnings("unchecked")
- DelegatingSpliterator(Supplier<? extends Spliterator<T>> supplier) {
- this.supplier = (Supplier<Spliterator<T>>) supplier;
+ DelegatingSpliterator(Supplier<? extends T_SPLITR> supplier) {
+ this.supplier = supplier;
}
- Spliterator<T> get() {
+ T_SPLITR get() {
if (s == null) {
s = supplier.get();
}
@@ -501,8 +506,8 @@
}
@Override
- public Spliterator<T> trySplit() {
- return get().trySplit();
+ public T_SPLITR trySplit() {
+ return (T_SPLITR) get().trySplit();
}
@Override
@@ -540,97 +545,881 @@
return getClass().getName() + "[" + get() + "]";
}
- static final class OfInt extends DelegatingSpliterator<Integer> implements Spliterator.OfInt {
- private Spliterator.OfInt s;
-
- OfInt(Supplier<Spliterator.OfInt> supplier) {
- super(supplier);
- }
-
- @Override
- Spliterator.OfInt get() {
- if (s == null) {
- s = (Spliterator.OfInt) super.get();
- }
- return s;
- }
-
- @Override
- public Spliterator.OfInt trySplit() {
- return get().trySplit();
- }
-
- @Override
- public boolean tryAdvance(IntConsumer consumer) {
- return get().tryAdvance(consumer);
- }
-
- @Override
- public void forEachRemaining(IntConsumer consumer) {
- get().forEachRemaining(consumer);
- }
- }
-
- static final class OfLong extends DelegatingSpliterator<Long> implements Spliterator.OfLong {
- private Spliterator.OfLong s;
-
- OfLong(Supplier<Spliterator.OfLong> supplier) {
+ static class OfPrimitive<T, T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>>
+ extends DelegatingSpliterator<T, T_SPLITR>
+ implements Spliterator.OfPrimitive<T, T_CONS, T_SPLITR> {
+ OfPrimitive(Supplier<? extends T_SPLITR> supplier) {
super(supplier);
}
@Override
- Spliterator.OfLong get() {
- if (s == null) {
- s = (Spliterator.OfLong) super.get();
- }
- return s;
- }
-
- @Override
- public Spliterator.OfLong trySplit() {
- return get().trySplit();
- }
-
- @Override
- public boolean tryAdvance(LongConsumer consumer) {
+ public boolean tryAdvance(T_CONS consumer) {
return get().tryAdvance(consumer);
}
@Override
- public void forEachRemaining(LongConsumer consumer) {
+ public void forEachRemaining(T_CONS consumer) {
get().forEachRemaining(consumer);
}
}
- static final class OfDouble extends DelegatingSpliterator<Double> implements Spliterator.OfDouble {
- private Spliterator.OfDouble s;
+ static final class OfInt
+ extends OfPrimitive<Integer, IntConsumer, Spliterator.OfInt>
+ implements Spliterator.OfInt {
+
+ OfInt(Supplier<Spliterator.OfInt> supplier) {
+ super(supplier);
+ }
+ }
+
+ static final class OfLong
+ extends OfPrimitive<Long, LongConsumer, Spliterator.OfLong>
+ implements Spliterator.OfLong {
+
+ OfLong(Supplier<Spliterator.OfLong> supplier) {
+ super(supplier);
+ }
+ }
+
+ static final class OfDouble
+ extends OfPrimitive<Double, DoubleConsumer, Spliterator.OfDouble>
+ implements Spliterator.OfDouble {
OfDouble(Supplier<Spliterator.OfDouble> supplier) {
super(supplier);
}
+ }
+ }
+
+ /**
+ * A slice Spliterator from a source Spliterator that reports
+ * {@code SUBSIZED}.
+ *
+ */
+ static abstract class SliceSpliterator<T, T_SPLITR extends Spliterator<T>> {
+ // The start index of the slice
+ final long sliceOrigin;
+ // One past the last index of the slice
+ final long sliceFence;
+
+ // The spliterator to slice
+ T_SPLITR s;
+ // current (absolute) index, modified on advance/split
+ long index;
+ // one past last (absolute) index or sliceFence, which ever is smaller
+ long fence;
+
+ SliceSpliterator(T_SPLITR s, long sliceOrigin, long sliceFence, long origin, long fence) {
+ assert s.hasCharacteristics(Spliterator.SUBSIZED);
+ this.s = s;
+ this.sliceOrigin = sliceOrigin;
+ this.sliceFence = sliceFence;
+ this.index = origin;
+ this.fence = fence;
+ }
+
+ protected abstract T_SPLITR makeSpliterator(T_SPLITR s, long sliceOrigin, long sliceFence, long origin, long fence);
+
+ public T_SPLITR trySplit() {
+ if (sliceOrigin >= fence)
+ return null;
+
+ if (index >= fence)
+ return null;
+
+ // Keep splitting until the left and right splits intersect with the slice
+ // thereby ensuring the size estimate decreases.
+ // This also avoids creating empty spliterators which can result in
+ // existing and additionally created F/J tasks that perform
+ // redundant work on no elements.
+ while (true) {
+ T_SPLITR leftSplit = (T_SPLITR) s.trySplit();
+ if (leftSplit == null)
+ return null;
+
+ long leftSplitFenceUnbounded = index + leftSplit.estimateSize();
+ long leftSplitFence = Math.min(leftSplitFenceUnbounded, sliceFence);
+ if (sliceOrigin >= leftSplitFence) {
+ // The left split does not intersect with, and is to the left of, the slice
+ // The right split does intersect
+ // Discard the left split and split further with the right split
+ index = leftSplitFence;
+ }
+ else if (leftSplitFence >= sliceFence) {
+ // The right split does not intersect with, and is to the right of, the slice
+ // The left split does intersect
+ // Discard the right split and split further with the left split
+ s = leftSplit;
+ fence = leftSplitFence;
+ }
+ else if (index >= sliceOrigin && leftSplitFenceUnbounded <= sliceFence) {
+ // The left split is contained within the slice, return the underlying left split
+ // Right split is contained within or intersects with the slice
+ index = leftSplitFence;
+ return leftSplit;
+ } else {
+ // The left split intersects with the slice
+ // Right split is contained within or intersects with the slice
+ return makeSpliterator(leftSplit, sliceOrigin, sliceFence, index, index = leftSplitFence);
+ }
+ }
+ }
+
+ public long estimateSize() {
+ return (sliceOrigin < fence)
+ ? fence - Math.max(sliceOrigin, index) : 0;
+ }
+
+ public int characteristics() {
+ return s.characteristics();
+ }
+
+ static final class OfRef<T>
+ extends SliceSpliterator<T, Spliterator<T>>
+ implements Spliterator<T> {
+
+ OfRef(Spliterator<T> s, long sliceOrigin, long sliceFence) {
+ this(s, sliceOrigin, sliceFence, 0, Math.min(s.estimateSize(), sliceFence));
+ }
+
+ private OfRef(Spliterator<T> s,
+ long sliceOrigin, long sliceFence, long origin, long fence) {
+ super(s, sliceOrigin, sliceFence, origin, fence);
+ }
+
+ @Override
+ protected Spliterator<T> makeSpliterator(Spliterator<T> s,
+ long sliceOrigin, long sliceFence,
+ long origin, long fence) {
+ return new OfRef<>(s, sliceOrigin, sliceFence, origin, fence);
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer<? super T> action) {
+ if (sliceOrigin >= fence)
+ return false;
+
+ while (sliceOrigin > index) {
+ s.tryAdvance(e -> {});
+ index++;
+ }
+
+ if (index >= fence)
+ return false;
+
+ index++;
+ return s.tryAdvance(action);
+ }
+
+ @Override
+ public void forEachRemaining(Consumer<? super T> action) {
+ if (sliceOrigin >= fence)
+ return;
+
+ if (index >= fence)
+ return;
+
+ if (index >= sliceOrigin && (index + s.estimateSize()) <= sliceFence) {
+ // The spliterator is contained within the slice
+ s.forEachRemaining(action);
+ index = fence;
+ } else {
+ // The spliterator intersects with the slice
+ while (sliceOrigin > index) {
+ s.tryAdvance(e -> {});
+ index++;
+ }
+ // Traverse elements up to the fence
+ for (;index < fence; index++) {
+ s.tryAdvance(action);
+ }
+ }
+ }
+ }
+
+ static abstract class OfPrimitive<T,
+ T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>,
+ T_CONS>
+ extends SliceSpliterator<T, T_SPLITR>
+ implements Spliterator.OfPrimitive<T, T_CONS, T_SPLITR> {
+
+ OfPrimitive(T_SPLITR s, long sliceOrigin, long sliceFence) {
+ this(s, sliceOrigin, sliceFence, 0, Math.min(s.estimateSize(), sliceFence));
+ }
+
+ private OfPrimitive(T_SPLITR s,
+ long sliceOrigin, long sliceFence, long origin, long fence) {
+ super(s, sliceOrigin, sliceFence, origin, fence);
+ }
+
+ @Override
+ public boolean tryAdvance(T_CONS action) {
+ if (sliceOrigin >= fence)
+ return false;
+
+ while (sliceOrigin > index) {
+ s.tryAdvance(emptyConsumer());
+ index++;
+ }
+
+ if (index >= fence)
+ return false;
+
+ index++;
+ return s.tryAdvance(action);
+ }
+
+ @Override
+ public void forEachRemaining(T_CONS action) {
+ if (sliceOrigin >= fence)
+ return;
+
+ if (index >= fence)
+ return;
+
+ if (index >= sliceOrigin && (index + s.estimateSize()) <= sliceFence) {
+ // The spliterator is contained within the slice
+ s.forEachRemaining(action);
+ index = fence;
+ } else {
+ // The spliterator intersects with the slice
+ while (sliceOrigin > index) {
+ s.tryAdvance(emptyConsumer());
+ index++;
+ }
+ // Traverse elements up to the fence
+ for (;index < fence; index++) {
+ s.tryAdvance(action);
+ }
+ }
+ }
+
+ protected abstract T_CONS emptyConsumer();
+ }
+
+ static final class OfInt extends OfPrimitive<Integer, Spliterator.OfInt, IntConsumer>
+ implements Spliterator.OfInt {
+ OfInt(Spliterator.OfInt s, long sliceOrigin, long sliceFence) {
+ super(s, sliceOrigin, sliceFence);
+ }
+
+ OfInt(Spliterator.OfInt s,
+ long sliceOrigin, long sliceFence, long origin, long fence) {
+ super(s, sliceOrigin, sliceFence, origin, fence);
+ }
+
+ @Override
+ protected Spliterator.OfInt makeSpliterator(Spliterator.OfInt s,
+ long sliceOrigin, long sliceFence,
+ long origin, long fence) {
+ return new SliceSpliterator.OfInt(s, sliceOrigin, sliceFence, origin, fence);
+ }
+
+ @Override
+ protected IntConsumer emptyConsumer() {
+ return e -> {};
+ }
+ }
+
+ static final class OfLong extends OfPrimitive<Long, Spliterator.OfLong, LongConsumer>
+ implements Spliterator.OfLong {
+ OfLong(Spliterator.OfLong s, long sliceOrigin, long sliceFence) {
+ super(s, sliceOrigin, sliceFence);
+ }
+
+ OfLong(Spliterator.OfLong s,
+ long sliceOrigin, long sliceFence, long origin, long fence) {
+ super(s, sliceOrigin, sliceFence, origin, fence);
+ }
+
+ @Override
+ protected Spliterator.OfLong makeSpliterator(Spliterator.OfLong s,
+ long sliceOrigin, long sliceFence,
+ long origin, long fence) {
+ return new SliceSpliterator.OfLong(s, sliceOrigin, sliceFence, origin, fence);
+ }
+
+ @Override
+ protected LongConsumer emptyConsumer() {
+ return e -> {};
+ }
+ }
+
+ static final class OfDouble extends OfPrimitive<Double, Spliterator.OfDouble, DoubleConsumer>
+ implements Spliterator.OfDouble {
+ OfDouble(Spliterator.OfDouble s, long sliceOrigin, long sliceFence) {
+ super(s, sliceOrigin, sliceFence);
+ }
+
+ OfDouble(Spliterator.OfDouble s,
+ long sliceOrigin, long sliceFence, long origin, long fence) {
+ super(s, sliceOrigin, sliceFence, origin, fence);
+ }
+
+ @Override
+ protected Spliterator.OfDouble makeSpliterator(Spliterator.OfDouble s,
+ long sliceOrigin, long sliceFence,
+ long origin, long fence) {
+ return new SliceSpliterator.OfDouble(s, sliceOrigin, sliceFence, origin, fence);
+ }
@Override
- Spliterator.OfDouble get() {
- if (s == null) {
- s = (Spliterator.OfDouble) super.get();
+ protected DoubleConsumer emptyConsumer() {
+ return e -> {};
+ }
+ }
+ }
+
+ /**
+ * A slice Spliterator that does not preserve order, if any, of a source
+ * Spliterator.
+ *
+ * Note: The source spliterator may report {@code ORDERED} since that
+ * spliterator be the result of a previous pipeline stage that was
+ * collected to a {@code Node}. It is the order of the pipeline stage
+ * that governs whether the this slice spliterator is to be used or not.
+ */
+ static abstract class UnorderedSliceSpliterator<T, T_SPLITR extends Spliterator<T>> {
+ static final int CHUNK_SIZE = 1 << 7;
+
+ // The spliterator to slice
+ protected final T_SPLITR s;
+ protected final boolean unlimited;
+ private final long skipThreshold;
+ private final AtomicLong permits;
+
+ UnorderedSliceSpliterator(T_SPLITR s, long skip, long limit) {
+ this.s = s;
+ this.unlimited = limit < 0;
+ this.skipThreshold = limit >= 0 ? limit : 0;
+ this.permits = new AtomicLong(limit >= 0 ? skip + limit : skip);
+ }
+
+ UnorderedSliceSpliterator(T_SPLITR s, UnorderedSliceSpliterator parent) {
+ this.s = s;
+ this.unlimited = parent.unlimited;
+ this.permits = parent.permits;
+ this.skipThreshold = parent.skipThreshold;
+ }
+
+ /**
+ * Acquire permission to skip or process elements. The caller must
+ * first acquire the elements, then consult this method for guidance
+ * as to what to do with the data.
+ *
+ * <p>We use an {@code AtomicLong} to atomically maintain a counter,
+ * which is initialized as skip+limit if we are limiting, or skip only
+ * if we are not limiting. The user should consult the method
+ * {@code checkPermits()} before acquiring data elements.
+ *
+ * @param numElements the number of elements the caller has in hand
+ * @return the number of elements that should be processed; any
+ * remaining elements should be discarded.
+ */
+ protected final long acquirePermits(long numElements) {
+ long remainingPermits;
+ long grabbing;
+ // permits never increase, and don't decrease below zero
+ assert numElements > 0;
+ do {
+ remainingPermits = permits.get();
+ if (remainingPermits == 0)
+ return unlimited ? numElements : 0;
+ grabbing = Math.min(remainingPermits, numElements);
+ } while (grabbing > 0 &&
+ !permits.compareAndSet(remainingPermits, remainingPermits - grabbing));
+
+ if (unlimited)
+ return Math.max(numElements - grabbing, 0);
+ else if (remainingPermits > skipThreshold)
+ return Math.max(grabbing - (remainingPermits - skipThreshold), 0);
+ else
+ return grabbing;
+ }
+
+ enum PermitStatus { NO_MORE, MAYBE_MORE, UNLIMITED }
+
+ /** Call to check if permits might be available before acquiring data */
+ protected final PermitStatus permitStatus() {
+ if (permits.get() > 0)
+ return PermitStatus.MAYBE_MORE;
+ else
+ return unlimited ? PermitStatus.UNLIMITED : PermitStatus.NO_MORE;
+ }
+
+ public final T_SPLITR trySplit() {
+ // Stop splitting when there are no more limit permits
+ if (permits.get() == 0)
+ return null;
+ T_SPLITR split = (T_SPLITR) s.trySplit();
+ return split == null ? null : makeSpliterator(split);
+ }
+
+ protected abstract T_SPLITR makeSpliterator(T_SPLITR s);
+
+ public final long estimateSize() {
+ return s.estimateSize();
+ }
+
+ public final int characteristics() {
+ return s.characteristics() &
+ ~(Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.ORDERED);
+ }
+
+ static final class OfRef<T> extends UnorderedSliceSpliterator<T, Spliterator<T>>
+ implements Spliterator<T>, Consumer<T> {
+ T tmpSlot;
+
+ OfRef(Spliterator<T> s, long skip, long limit) {
+ super(s, skip, limit);
+ }
+
+ OfRef(Spliterator<T> s, OfRef parent) {
+ super(s, parent);
+ }
+
+ @Override
+ public final void accept(T t) {
+ tmpSlot = t;
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer<? super T> action) {
+ while (permitStatus() != PermitStatus.NO_MORE) {
+ if (!s.tryAdvance(this))
+ return false;
+ else if (acquirePermits(1) == 1) {
+ action.accept(tmpSlot);
+ tmpSlot = null;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void forEachRemaining(Consumer<? super T> action) {
+ ArrayBuffer.OfRef<T> sb = null;
+ PermitStatus permitStatus;
+ while ((permitStatus = permitStatus()) != PermitStatus.NO_MORE) {
+ if (permitStatus == PermitStatus.MAYBE_MORE) {
+ // Optimistically traverse elements up to a threshold of CHUNK_SIZE
+ if (sb == null)
+ sb = new ArrayBuffer.OfRef<>(CHUNK_SIZE);
+ else
+ sb.reset();
+ long permitsRequested = 0;
+ do { } while (s.tryAdvance(sb) && ++permitsRequested < CHUNK_SIZE);
+ if (permitsRequested == 0)
+ return;
+ sb.forEach(action, acquirePermits(permitsRequested));
+ }
+ else {
+ // Must be UNLIMITED; let 'er rip
+ s.forEachRemaining(action);
+ return;
+ }
+ }
+ }
+
+ @Override
+ protected Spliterator<T> makeSpliterator(Spliterator<T> s) {
+ return new UnorderedSliceSpliterator.OfRef<>(s, this);
+ }
+ }
+
+ /**
+ * Concrete sub-types must also be an instance of type {@code T_CONS}.
+ *
+ * @param <T_BUFF> the type of the spined buffer. Must also be a type of
+ * {@code T_CONS}.
+ */
+ static abstract class OfPrimitive<
+ T,
+ T_CONS,
+ T_BUFF extends ArrayBuffer.OfPrimitive<T_CONS>,
+ T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>>
+ extends UnorderedSliceSpliterator<T, T_SPLITR>
+ implements Spliterator.OfPrimitive<T, T_CONS, T_SPLITR> {
+ OfPrimitive(T_SPLITR s, long skip, long limit) {
+ super(s, skip, limit);
+ }
+
+ OfPrimitive(T_SPLITR s, UnorderedSliceSpliterator.OfPrimitive parent) {
+ super(s, parent);
+ }
+
+ @Override
+ public boolean tryAdvance(T_CONS action) {
+ while (permitStatus() != PermitStatus.NO_MORE) {
+ if (!s.tryAdvance((T_CONS) this))
+ return false;
+ else if (acquirePermits(1) == 1) {
+ acceptConsumed(action);
+ return true;
+ }
}
- return s;
+ return false;
+ }
+
+ protected abstract void acceptConsumed(T_CONS action);
+
+ @Override
+ public void forEachRemaining(T_CONS action) {
+ T_BUFF sb = null;
+ PermitStatus permitStatus;
+ while ((permitStatus = permitStatus()) != PermitStatus.NO_MORE) {
+ if (permitStatus == PermitStatus.MAYBE_MORE) {
+ // Optimistically traverse elements up to a threshold of CHUNK_SIZE
+ if (sb == null)
+ sb = bufferCreate(CHUNK_SIZE);
+ else
+ sb.reset();
+ @SuppressWarnings("unchecked")
+ T_CONS sbc = (T_CONS) sb;
+ long permitsRequested = 0;
+ do { } while (s.tryAdvance(sbc) && ++permitsRequested < CHUNK_SIZE);
+ if (permitsRequested == 0)
+ return;
+ sb.forEach(action, acquirePermits(permitsRequested));
+ }
+ else {
+ // Must be UNLIMITED; let 'er rip
+ s.forEachRemaining(action);
+ return;
+ }
+ }
+ }
+
+ protected abstract T_BUFF bufferCreate(int initialCapacity);
+ }
+
+ static final class OfInt
+ extends OfPrimitive<Integer, IntConsumer, ArrayBuffer.OfInt, Spliterator.OfInt>
+ implements Spliterator.OfInt, IntConsumer {
+
+ int tmpValue;
+
+ OfInt(Spliterator.OfInt s, long skip, long limit) {
+ super(s, skip, limit);
+ }
+
+ OfInt(Spliterator.OfInt s, UnorderedSliceSpliterator.OfInt parent) {
+ super(s, parent);
+ }
+
+ @Override
+ public void accept(int value) {
+ tmpValue = value;
+ }
+
+ @Override
+ protected void acceptConsumed(IntConsumer action) {
+ action.accept(tmpValue);
+ }
+
+ @Override
+ protected ArrayBuffer.OfInt bufferCreate(int initialCapacity) {
+ return new ArrayBuffer.OfInt(initialCapacity);
+ }
+
+ @Override
+ protected Spliterator.OfInt makeSpliterator(Spliterator.OfInt s) {
+ return new UnorderedSliceSpliterator.OfInt(s, this);
+ }
+ }
+
+ static final class OfLong
+ extends OfPrimitive<Long, LongConsumer, ArrayBuffer.OfLong, Spliterator.OfLong>
+ implements Spliterator.OfLong, LongConsumer {
+
+ long tmpValue;
+
+ OfLong(Spliterator.OfLong s, long skip, long limit) {
+ super(s, skip, limit);
+ }
+
+ OfLong(Spliterator.OfLong s, UnorderedSliceSpliterator.OfLong parent) {
+ super(s, parent);
+ }
+
+ @Override
+ public void accept(long value) {
+ tmpValue = value;
+ }
+
+ @Override
+ protected void acceptConsumed(LongConsumer action) {
+ action.accept(tmpValue);
+ }
+
+ @Override
+ protected ArrayBuffer.OfLong bufferCreate(int initialCapacity) {
+ return new ArrayBuffer.OfLong(initialCapacity);
+ }
+
+ @Override
+ protected Spliterator.OfLong makeSpliterator(Spliterator.OfLong s) {
+ return new UnorderedSliceSpliterator.OfLong(s, this);
+ }
+ }
+
+ static final class OfDouble
+ extends OfPrimitive<Double, DoubleConsumer, ArrayBuffer.OfDouble, Spliterator.OfDouble>
+ implements Spliterator.OfDouble, DoubleConsumer {
+
+ double tmpValue;
+
+ OfDouble(Spliterator.OfDouble s, long skip, long limit) {
+ super(s, skip, limit);
+ }
+
+ OfDouble(Spliterator.OfDouble s, UnorderedSliceSpliterator.OfDouble parent) {
+ super(s, parent);
+ }
+
+ @Override
+ public void accept(double value) {
+ tmpValue = value;
+ }
+
+ @Override
+ protected void acceptConsumed(DoubleConsumer action) {
+ action.accept(tmpValue);
+ }
+
+ @Override
+ protected ArrayBuffer.OfDouble bufferCreate(int initialCapacity) {
+ return new ArrayBuffer.OfDouble(initialCapacity);
+ }
+
+ @Override
+ protected Spliterator.OfDouble makeSpliterator(Spliterator.OfDouble s) {
+ return new UnorderedSliceSpliterator.OfDouble(s, this);
+ }
+ }
+ }
+
+ /**
+ * A Spliterator that infinitely supplies elements in no particular order.
+ *
+ * <p>Splitting divides the estimated size in two and stops when the
+ * estimate size is 0.
+ *
+ * <p>The {@code forEachRemaining} method if invoked will never terminate.
+ * The {@coe tryAdvance} method always returns true.
+ *
+ */
+ static abstract class InfiniteSupplyingSpliterator<T> implements Spliterator<T> {
+ long estimate;
+
+ protected InfiniteSupplyingSpliterator(long estimate) {
+ this.estimate = estimate;
+ }
+
+ @Override
+ public long estimateSize() {
+ return estimate;
+ }
+
+ @Override
+ public int characteristics() {
+ return IMMUTABLE;
+ }
+
+ static final class OfRef<T> extends InfiniteSupplyingSpliterator<T> {
+ final Supplier<T> s;
+
+ OfRef(long size, Supplier<T> s) {
+ super(size);
+ this.s = s;
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer<? super T> action) {
+ action.accept(s.get());
+ return true;
+ }
+
+ @Override
+ public Spliterator<T> trySplit() {
+ if (estimate == 0)
+ return null;
+ return new InfiniteSupplyingSpliterator.OfRef<>(estimate >>>= 1, s);
+ }
+ }
+
+ static final class OfInt extends InfiniteSupplyingSpliterator<Integer>
+ implements Spliterator.OfInt {
+ final IntSupplier s;
+
+ OfInt(long size, IntSupplier s) {
+ super(size);
+ this.s = s;
+ }
+
+ @Override
+ public boolean tryAdvance(IntConsumer action) {
+ action.accept(s.getAsInt());
+ return true;
+ }
+
+ @Override
+ public Spliterator.OfInt trySplit() {
+ if (estimate == 0)
+ return null;
+ return new InfiniteSupplyingSpliterator.OfInt(estimate = estimate >>> 1, s);
+ }
+ }
+
+ static final class OfLong extends InfiniteSupplyingSpliterator<Long>
+ implements Spliterator.OfLong {
+ final LongSupplier s;
+
+ OfLong(long size, LongSupplier s) {
+ super(size);
+ this.s = s;
+ }
+
+ @Override
+ public boolean tryAdvance(LongConsumer action) {
+ action.accept(s.getAsLong());
+ return true;
+ }
+
+ @Override
+ public Spliterator.OfLong trySplit() {
+ if (estimate == 0)
+ return null;
+ return new InfiniteSupplyingSpliterator.OfLong(estimate = estimate >>> 1, s);
+ }
+ }
+
+ static final class OfDouble extends InfiniteSupplyingSpliterator<Double>
+ implements Spliterator.OfDouble {
+ final DoubleSupplier s;
+
+ OfDouble(long size, DoubleSupplier s) {
+ super(size);
+ this.s = s;
+ }
+
+ @Override
+ public boolean tryAdvance(DoubleConsumer action) {
+ action.accept(s.getAsDouble());
+ return true;
}
@Override
public Spliterator.OfDouble trySplit() {
- return get().trySplit();
+ if (estimate == 0)
+ return null;
+ return new InfiniteSupplyingSpliterator.OfDouble(estimate = estimate >>> 1, s);
+ }
+ }
+ }
+
+ // @@@ Consolidate with Node.Builder
+ static abstract class ArrayBuffer {
+ int index;
+
+ void reset() {
+ index = 0;
+ }
+
+ static final class OfRef<T> extends ArrayBuffer implements Consumer<T> {
+ final Object[] array;
+
+ OfRef(int size) {
+ this.array = new Object[size];
+ }
+
+ @Override
+ public void accept(T t) {
+ array[index++] = t;
+ }
+
+ public void forEach(Consumer<? super T> action, long fence) {
+ for (int i = 0; i < fence; i++) {
+ @SuppressWarnings("unchecked")
+ T t = (T) array[i];
+ action.accept(t);
+ }
+ }
+ }
+
+ static abstract class OfPrimitive<T_CONS> extends ArrayBuffer {
+ int index;
+
+ @Override
+ void reset() {
+ index = 0;
+ }
+
+ abstract void forEach(T_CONS action, long fence);
+ }
+
+ static final class OfInt extends OfPrimitive<IntConsumer>
+ implements IntConsumer {
+ final int[] array;
+
+ OfInt(int size) {
+ this.array = new int[size];
}
@Override
- public boolean tryAdvance(DoubleConsumer consumer) {
- return get().tryAdvance(consumer);
+ public void accept(int t) {
+ array[index++] = t;
+ }
+
+ @Override
+ public void forEach(IntConsumer action, long fence) {
+ for (int i = 0; i < fence; i++) {
+ action.accept(array[i]);
+ }
+ }
+ }
+
+ static final class OfLong extends OfPrimitive<LongConsumer>
+ implements LongConsumer {
+ final long[] array;
+
+ OfLong(int size) {
+ this.array = new long[size];
+ }
+
+ @Override
+ public void accept(long t) {
+ array[index++] = t;
}
@Override
- public void forEachRemaining(DoubleConsumer consumer) {
- get().forEachRemaining(consumer);
+ public void forEach(LongConsumer action, long fence) {
+ for (int i = 0; i < fence; i++) {
+ action.accept(array[i]);
+ }
+ }
+ }
+
+ static final class OfDouble extends OfPrimitive<DoubleConsumer>
+ implements DoubleConsumer {
+ final double[] array;
+
+ OfDouble(int size) {
+ this.array = new double[size];
+ }
+
+ @Override
+ public void accept(double t) {
+ array[index++] = t;
+ }
+
+ @Override
+ void forEach(DoubleConsumer action, long fence) {
+ for (int i = 0; i < fence; i++) {
+ action.accept(array[i]);
+ }
}
}
}
-}
+}
\ No newline at end of file
--- a/jdk/src/share/classes/java/util/zip/Deflater.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/zip/Deflater.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -461,7 +461,7 @@
}
/**
- * Returns the total number of uncompressed bytes input so far.</p>
+ * Returns the total number of uncompressed bytes input so far.
*
* @return the total (non-negative) number of uncompressed bytes input so far
* @since 1.5
@@ -487,7 +487,7 @@
}
/**
- * Returns the total number of compressed bytes output so far.</p>
+ * Returns the total number of compressed bytes output so far.
*
* @return the total (non-negative) number of compressed bytes output so far
* @since 1.5
--- a/jdk/src/share/classes/java/util/zip/Inflater.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/java/util/zip/Inflater.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -305,7 +305,7 @@
}
/**
- * Returns the total number of compressed bytes input so far.</p>
+ * Returns the total number of compressed bytes input so far.
*
* @return the total (non-negative) number of compressed bytes input so far
* @since 1.5
@@ -331,7 +331,7 @@
}
/**
- * Returns the total number of uncompressed bytes output so far.</p>
+ * Returns the total number of uncompressed bytes output so far.
*
* @return the total (non-negative) number of uncompressed bytes output so far
* @since 1.5
--- a/jdk/src/share/classes/javax/naming/CompositeName.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/CompositeName.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -42,7 +42,7 @@
* The most significant component is at index 0.
* An empty composite name has no components.
*<p>
- * <h4>JNDI Composite Name Syntax</h4>
+ * <h1>JNDI Composite Name Syntax</h1>
* JNDI defines a standard string representation for composite names. This
* representation is the concatenation of the components of a composite name
* from left to right using the component separator (a forward
@@ -73,12 +73,12 @@
* a separator) denotes a trailing empty component.
* Adjacent component separators denote an empty component.
*<p>
- *<h4>Composite Name Examples</h4>
+ *<h1>Composite Name Examples</h1>
*This table shows examples of some composite names. Each row shows
*the string form of a composite name and its corresponding structural form
*(<tt>CompositeName</tt>).
*<p>
-<table border="1" cellpadding=3 width="70%" summary="examples showing string form of composite name and its corresponding structural form (CompositeName)">
+<table border="1" cellpadding=3 summary="examples showing string form of composite name and its corresponding structural form (CompositeName)">
<tr>
<th>String Name</th>
@@ -137,14 +137,14 @@
</tr>
</table>
* <p>
- *<h4>Composition Examples</h4>
+ *<h1>Composition Examples</h1>
* Here are some composition examples. The right column shows composing
* string composite names while the left column shows composing the
* corresponding <tt>CompositeName</tt>s. Notice that composing the
* string forms of two composite names simply involves concatenating
* their string forms together.
-<p> <table border="1" cellpadding=3 width="70%" summary="composition examples showing string names and composite names">
+<p> <table border="1" cellpadding=3 summary="composition examples showing string names and composite names">
<tr>
<th>String Names</th>
@@ -189,7 +189,7 @@
</table>
*<p>
- *<h4>Multithreaded Access</h4>
+ *<h1>Multithreaded Access</h1>
* A <tt>CompositeName</tt> instance is not synchronized against concurrent
* multithreaded access. Multiple threads trying to access and modify a
* <tt>CompositeName</tt> should lock the object.
--- a/jdk/src/share/classes/javax/naming/CompoundName.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/CompoundName.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -39,7 +39,7 @@
* The most significant component is at index 0.
* An empty compound name has no components.
*<p>
- * <h4>Compound Name Syntax</h4>
+ * <h1>Compound Name Syntax</h1>
* The syntax of a compound name is specified using a set of properties:
*<dl>
* <dt>jndi.syntax.direction
@@ -136,7 +136,7 @@
* so that when the same string is parsed, it will yield the same components
* of the original compound name.
*<p>
- *<h4>Multithreaded Access</h4>
+ *<h1>Multithreaded Access</h1>
* A <tt>CompoundName</tt> instance is not synchronized against concurrent
* multithreaded access. Multiple threads trying to access and modify a
* <tt>CompoundName</tt> should lock the object.
--- a/jdk/src/share/classes/javax/naming/Context.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/Context.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -32,7 +32,7 @@
* consists of a set of name-to-object bindings.
* It contains methods for examining and updating these bindings.
* <p>
- * <h4>Names</h4>
+ * <h1>Names</h1>
* Each name passed as an argument to a <tt>Context</tt> method is relative
* to that context. The empty name is used to name the context itself.
* A name parameter may never be null.
@@ -69,12 +69,12 @@
* names in a composite namespace, at the discretion of the service
* provider.
*<p>
- *<h4>Exceptions</h4>
+ *<h1>Exceptions</h1>
* All the methods in this interface can throw a <tt>NamingException</tt> or
* any of its subclasses. See <tt>NamingException</tt> and their subclasses
* for details on each exception.
*<p>
- *<h4>Concurrent Access</h4>
+ *<h1>Concurrent Access</h1>
* A Context instance is not guaranteed to be synchronized against
* concurrent access by multiple threads. Threads that need to access
* a single Context instance concurrently should synchronize amongst
@@ -91,7 +91,7 @@
* being followed.
*
*<p>
- *<h4>Parameters</h4>
+ *<h1>Parameters</h1>
* A <tt>Name</tt> parameter passed to any method of the
* <tt>Context</tt> interface or one of its subinterfaces
* will not be modified by the service provider.
@@ -103,7 +103,7 @@
* The caller may subsequently modify it; the service provider may not.
*
*<p>
- *<h4>Environment Properties</h4>
+ *<h1>Environment Properties</h1>
*<p>
* JNDI applications need a way to communicate various preferences
* and properties that define the environment in which naming and
@@ -138,7 +138,7 @@
*
*<p>
*<a name=RESOURCEFILES></a>
- *<h4>Resource Files</h4>
+ *<h1>Resource Files</h1>
*<p>
* To simplify the task of setting up the environment
* required by a JNDI application,
@@ -151,11 +151,11 @@
* and the value is a string in the format defined
* for that property. Here is an example of a JNDI resource file:
*
- * <blockquote><tt><pre>
+ * <blockquote>{@code
* java.naming.factory.object=com.sun.jndi.ldap.AttrsToCorba:com.wiz.from.Person
* java.naming.factory.state=com.sun.jndi.ldap.CorbaToAttrs:com.wiz.from.Person
* java.naming.factory.control=com.sun.jndi.ldap.ResponseControlFactory
- * </pre></tt></blockquote>
+ * }</blockquote>
*
* The JNDI class library reads the resource files and makes the property
* values freely available. Thus JNDI resource files should be considered
@@ -165,7 +165,7 @@
* There are two kinds of JNDI resource files:
* <em>provider</em> and <em>application</em>.
*
- * <h5>Provider Resource Files</h5>
+ * <h2>Provider Resource Files</h2>
*
* Each service provider has an optional resource that lists properties
* specific to that provider. The name of this resource is:
@@ -200,7 +200,7 @@
* The service provider's documentation should clearly state which
* properties are allowed; other properties in the file will be ignored.
*
- * <h5>Application Resource Files</h5>
+ * <h2>Application Resource Files</h2>
*
* When an application is deployed, it will generally have several
* codebase directories and JARs in its classpath. Similarly, when an
@@ -232,7 +232,7 @@
* collects and uses all of these export lists when searching for factory
* classes.
*
- * <h5>Search Algorithm for Properties</h5>
+ * <h2>Search Algorithm for Properties</h2>
*
* When JNDI constructs an initial context, the context's environment
* is initialized with properties defined in the environment parameter
--- a/jdk/src/share/classes/javax/naming/InitialContext.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/InitialContext.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -258,6 +258,7 @@
* environment may be modified independently and it may be accessed
* concurrently).
*
+ * @param <T> the type of the returned object
* @param name
* the name of the object to look up
* @return the object bound to <tt>name</tt>
@@ -276,11 +277,12 @@
/**
* A static method to retrieve the named object.
* See {@link #doLookup(Name)} for details.
+ * @param <T> the type of the returned object
* @param name
* the name of the object to look up
* @return the object bound to <tt>name</tt>
* @throws NamingException if a naming exception is encountered
- * @since 1.6
+ * @since 1.6
*/
@SuppressWarnings("unchecked")
public static <T> T doLookup(String name)
--- a/jdk/src/share/classes/javax/naming/RefAddr.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/RefAddr.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -91,7 +91,8 @@
* Determines whether obj is equal to this RefAddr.
*<p>
* obj is equal to this RefAddr all of these conditions are true
- *<ul> non-null
+ *<ul>
+ *<li> non-null
*<li> instance of RefAddr
*<li> obj has the same address type as this RefAddr (using String.compareTo())
*<li> both obj and this RefAddr's contents are null or they are equal
--- a/jdk/src/share/classes/javax/naming/ReferralException.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/ReferralException.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -38,7 +38,7 @@
* constructors and/or corresponding "set" methods).
* <p>
* The following code sample shows how <tt>ReferralException</tt> can be used.
- * <p><blockquote><pre>
+ * <blockquote>{@code
* while (true) {
* try {
* bindings = ctx.listBindings(name);
@@ -51,7 +51,7 @@
* ctx = e.getReferralContext();
* }
* }
- * </pre></blockquote></p>
+ * }</blockquote>
*<p>
* <tt>ReferralException</tt> is an abstract class. Concrete implementations
* determine its synchronization and serialization properties.
--- a/jdk/src/share/classes/javax/naming/directory/DirContext.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/directory/DirContext.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -32,7 +32,7 @@
* methods for examining and updating attributes
* associated with objects, and for searching the directory.
* <p>
- * <h4>Names</h4>
+ * <h1>Names</h1>
* Each name passed as an argument to a <tt>DirContext</tt> method is relative
* to that context. The empty name is used to name the context itself.
* The name parameter may never be null.
@@ -51,7 +51,7 @@
* name argument to the <tt>Context</tt> methods. These same rules
* apply to the name argument to the <tt>DirContext</tt> methods.
* <p>
- * <h4>Attribute Models</h4>
+ * <h1>Attribute Models</h1>
* There are two basic models of what attributes should be
* associated with. First, attributes may be directly associated with a
* DirContext object.
@@ -81,7 +81,7 @@
* whether an object's attributes are stored as part of the object, or stored
* within the parent object and associated with the object's name.
* <p>
- * <h4>Attribute Type Names</h4>
+ * <h1>Attribute Type Names</h1>
* In the <tt>getAttributes()</tt> and <tt>search()</tt> methods,
* you can supply the attributes to return by supplying a list of
* attribute names (strings).
@@ -113,7 +113,7 @@
* </ul>
*
* <p>
- *<h4>Operational Attributes</h4>
+ *<h1>Operational Attributes</h1>
*<p>
* Some directories have the notion of "operational attributes" which are
* attributes associated with a directory object for administrative
@@ -127,7 +127,7 @@
* In order to retrieve operational attributes, you must name them explicitly.
*
* <p>
- * <h4>Named Context</h4>
+ * <h1>Named Context</h1>
* <p>
* There are certain methods in which the name must resolve to a context
* (for example, when searching a single level context). The documentation
@@ -138,7 +138,7 @@
* Aside from these methods, there is no requirement that the
* <em>named object</em> be a DirContext.
*<p>
- *<h4>Parameters</h4>
+ *<h1>Parameters</h1>
*<p>
* An <tt>Attributes</tt>, <tt>SearchControls</tt>, or array object
* passed as a parameter to any method will not be modified by the
@@ -150,7 +150,7 @@
* the caller. The caller may subsequently modify it; the service
* provider will not.
*<p>
- *<h4>Exceptions</h4>
+ *<h1>Exceptions</h1>
*<p>
* All the methods in this interface can throw a NamingException or
* any of its subclasses. See NamingException and their subclasses
--- a/jdk/src/share/classes/javax/naming/event/EventContext.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/event/EventContext.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -34,7 +34,7 @@
* Contains methods for registering/deregistering listeners to be notified of
* events fired when objects named in a context changes.
*<p>
- *<h4>Target</h4>
+ *<h1>Target</h1>
* The name parameter in the <tt>addNamingListener()</tt> methods is referred
* to as the <em>target</em>. The target, along with the scope, identify
* the object(s) that the listener is interested in.
@@ -59,7 +59,7 @@
* whether a <tt>EventContext</tt> supports registration
* of nonexistent targets.
*<p>
- *<h4>Event Source</h4>
+ *<h1>Event Source</h1>
* The <tt>EventContext</tt> instance on which you invoke the
* registration methods is the <em>event source</em> of the events that are
* (potentially) generated.
@@ -93,7 +93,7 @@
* it needs to keep a reference to the listener in order to remove it
* later). It cannot expect to do a <tt>lookup()</tt> and get another instance of
* a <tt>EventContext</tt> on which to perform the deregistration.
- *<h4>Lifetime of Registration</h4>
+ *<h1>Lifetime of Registration</h1>
* A registered listener becomes deregistered when:
*<ul>
*<li>It is removed using <tt>removeNamingListener()</tt>.
@@ -105,7 +105,7 @@
* Until that point, a <tt>EventContext</tt> instance that has outstanding
* listeners will continue to exist and be maintained by the service provider.
*
- *<h4>Listener Implementations</h4>
+ *<h1>Listener Implementations</h1>
* The registration/deregistration methods accept an instance of
* <tt>NamingListener</tt>. There are subinterfaces of <tt>NamingListener</tt>
* for different of event types of <tt>NamingEvent</tt>.
@@ -118,7 +118,7 @@
* of the listeners, this allows some service providers to optimize the
* registration.
*
- *<h4>Threading Issues</h4>
+ *<h1>Threading Issues</h1>
*
* Like <tt>Context</tt> instances in general, instances of
* <tt>EventContext</tt> are not guaranteed to be thread-safe.
--- a/jdk/src/share/classes/javax/naming/ldap/ControlFactory.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/ldap/ControlFactory.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -51,7 +51,7 @@
*/
public abstract class ControlFactory {
- /*
+ /**
* Creates a new instance of a control factory.
*/
protected ControlFactory() {
--- a/jdk/src/share/classes/javax/naming/ldap/InitialLdapContext.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/ldap/InitialLdapContext.java Tue Jul 02 15:23:23 2013 -0700
@@ -38,7 +38,7 @@
* <tt>javax.naming.InitialDirContext</tt> for details on synchronization,
* and the policy for how an initial context is created.
*
- * <h4>Request Controls</h4>
+ * <h1>Request Controls</h1>
* When you create an initial context (<tt>InitialLdapContext</tt>),
* you can specify a list of request controls.
* These controls will be used as the request controls for any
--- a/jdk/src/share/classes/javax/naming/ldap/LdapContext.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/ldap/LdapContext.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -78,10 +78,8 @@
* <h4>Context Request Controls</h4>
* There are two ways in which a context instance gets its request controls:
* <ol>
- * <tt>
- * <li>ldapContext.newInstance(<strong>reqCtls</strong>)
- * <li>ldapContext.setRequestControls(<strong>reqCtls</strong>)
- * </tt>
+ * <li><tt>ldapContext.newInstance(<strong>reqCtls</strong>)</tt>
+ * <li><tt>ldapContext.setRequestControls(<strong>reqCtls</strong>)</tt>
* </ol>
* where <tt>ldapContext</tt> is an instance of <tt>LdapContext</tt>.
* Specifying <tt>null</tt> or an empty array for <tt>reqCtls</tt>
@@ -102,12 +100,10 @@
* <h4>Connection Request Controls</h4>
* There are three ways in which connection request controls are set:
* <ol>
- * <tt>
- * <li>
- * new InitialLdapContext(env, <strong>connCtls</strong>)
- * <li>refException.getReferralContext(env, <strong>connCtls</strong>)
- * <li>ldapContext.reconnect(<strong>connCtls</strong>);
- * </tt>
+ * <li><tt>
+ * new InitialLdapContext(env, <strong>connCtls</strong>)</tt>
+ * <li><tt>refException.getReferralContext(env, <strong>connCtls</strong>)</tt>
+ * <li><tt>ldapContext.reconnect(<strong>connCtls</strong>);</tt>
* </ol>
* where <tt>refException</tt> is an instance of
* <tt>LdapReferralException</tt>, and <tt>ldapContext</tt> is an
--- a/jdk/src/share/classes/javax/script/Invocable.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/script/Invocable.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -63,6 +63,7 @@
/**
* Used to call top-level procedures and functions defined in scripts.
*
+ * @param name of the procedure or function to call
* @param args Arguments to pass to the procedure or function
* @return The value returned by the procedure or function
*
@@ -79,6 +80,7 @@
* the interpreter. The methods of the interface
* may be implemented using the <code>invokeFunction</code> method.
*
+ * @param <T> the type of the interface to return
* @param clasz The <code>Class</code> object of the interface to return.
*
* @return An instance of requested interface - null if the requested interface is unavailable,
@@ -95,6 +97,7 @@
* a scripting object compiled in the interpreter. The methods of the
* interface may be implemented using the <code>invokeMethod</code> method.
*
+ * @param <T> the type of the interface to return
* @param thiz The scripting object whose member functions are used to implement the methods of the interface.
* @param clasz The <code>Class</code> object of the interface to return.
*
--- a/jdk/src/share/classes/javax/script/ScriptContext.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/script/ScriptContext.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -78,6 +78,7 @@
* @return The associated <code>Bindings</code>. Returns <code>null</code> if it has not
* been set.
*
+ * @param scope The scope
* @throws IllegalArgumentException If no <code>Bindings</code> is defined for the
* specified scope value in <code>ScriptContext</code> of this type.
*/
--- a/jdk/src/share/classes/javax/script/ScriptEngineFactory.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/script/ScriptEngineFactory.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -80,6 +80,7 @@
* identify the <code>ScriptEngine</code> by the <code>ScriptEngineManager</code>.
* For instance, an implementation based on the Mozilla Rhino Javascript engine might
* return list containing {"javascript", "rhino"}.
+ * @return an immutable list of short names
*/
public List<String> getNames();
--- a/jdk/src/share/classes/javax/script/SimpleScriptContext.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/script/SimpleScriptContext.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -82,7 +82,9 @@
*/
protected Bindings globalScope;
-
+ /**
+ * Create a {@code SimpleScriptContext}.
+ */
public SimpleScriptContext() {
engineScope = new SimpleBindings();
globalScope = null;
--- a/jdk/src/share/classes/javax/sql/CommonDataSource.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/CommonDataSource.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -122,7 +122,8 @@
* In the worst case, this may be the root Logger.
*
* @return the parent Logger for this data source
- * @throws SQLFeatureNotSupportedException if the data source does not use <code>java.util.logging<code>.
+ * @throws SQLFeatureNotSupportedException if the data source does not use
+ * {@code java.util.logging}
* @since 1.7
*/
public Logger getParentLogger() throws SQLFeatureNotSupportedException;
--- a/jdk/src/share/classes/javax/sql/ConnectionPoolDataSource.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/ConnectionPoolDataSource.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -32,7 +32,7 @@
* A factory for <code>PooledConnection</code>
* objects. An object that implements this interface will typically be
* registered with a naming service that is based on the
- * Java<sup><font size=-2>TM</font></sup> Naming and Directory Interface
+ * Java™ Naming and Directory Interface
* (JNDI).
*
* @since 1.4
--- a/jdk/src/share/classes/javax/sql/DataSource.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/DataSource.java Tue Jul 02 15:23:23 2013 -0700
@@ -36,7 +36,7 @@
* is the preferred means of getting a connection. An object that implements
* the {@code DataSource} interface will typically be
* registered with a naming service based on the
- * Java<sup><font size=-2>TM</font></sup> Naming and Directory (JNDI) API.
+ * Java™ Naming and Directory (JNDI) API.
* <P>
* The {@code DataSource} interface is implemented by a driver vendor.
* There are three types of implementations:
--- a/jdk/src/share/classes/javax/sql/RowSet.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/RowSet.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -32,7 +32,7 @@
/**
* The interface that adds support to the JDBC API for the
- * JavaBeans<sup><font size=-2>TM</font></sup> component model.
+ * JavaBeans™ component model.
* A rowset, which can be used as a JavaBeans component in
* a visual Bean development environment, can be created and
* configured at design time and executed at run time.
--- a/jdk/src/share/classes/javax/sql/XADataSource.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/XADataSource.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -31,7 +31,7 @@
* A factory for {@code XAConnection} objects that is used internally.
* An object that implements the {@code XADataSource} interface is
* typically registered with a naming service that uses the
- * Java Naming and Directory Interface<sup><font size=-3>TM</font></sup>
+ * Java Naming and Directory Interface™
* (JNDI).
* <p>
* An implementation of {@code XADataSource} must include a public no-arg
--- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -37,7 +37,7 @@
/**
* An abstract class providing a <code>RowSet</code> object with its basic functionality.
* The basic functions include having properties and sending event notifications,
- * which all JavaBeans<sup><font size=-2>TM</font></sup> components must implement.
+ * which all JavaBeans™ components must implement.
* <P>
* <h3>1.0 Overview</h3>
* The <code>BaseRowSet</code> class provides the core functionality
@@ -93,7 +93,7 @@
* NOTE: In order to use a <code>DataSource</code> object for making a
* connection, the <code>DataSource</code> object must have been registered
* with a naming service that uses the Java Naming and Directory
- * Interface<sup><font size=-2>TM</font></sup> (JNDI) API. This registration
+ * Interface™ (JNDI) API. This registration
* is usually done by a person acting in the capacity of a system administrator.
* <P>
* <h3>3.0 Setting the Command and Its Parameters</h3>
@@ -106,7 +106,7 @@
* to <code>null</code> if required.
* <P>
* The following code fragment illustrates how the
- * <code>CachedRowSet</code><sup><font size=-2>TM</font></sup>
+ * <code>CachedRowSet</code>™
* object <code>crs</code> might have its command property set. Note that if a
* tool is used to set properties, this is the code that the tool would use.
* <PRE>{@code
--- a/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -46,7 +46,7 @@
* A <code>CachedRowSet</code> object is a container for rows of data
* that caches its rows in memory, which makes it possible to operate without always being
* connected to its data source. Further, it is a
- * JavaBeans<sup><font size=-2>TM</font></sup> component and is scrollable,
+ * JavaBeans™ component and is scrollable,
* updatable, and serializable. A <code>CachedRowSet</code> object typically
* contains rows from a result set, but it can also contain rows from any file
* with a tabular format, such as a spread sheet. The reference implementation
@@ -410,7 +410,7 @@
* NOTE: In order to use a <code>DataSource</code> object for making a
* connection, the <code>DataSource</code> object must have been registered
* with a naming service that uses the Java Naming and Directory
- * Interface<sup><font size=-2>TM</font></sup> (JNDI) API. This registration
+ * Interface™ (JNDI) API. This registration
* is usually done by a person acting in the capacity of a system
* administrator.
* <P>
@@ -734,7 +734,6 @@
* source. Otherwise, the application <b>must</b> explicity call the
* <code>commit()</code> or <code>rollback()</code> methods as appropriate.
*
- * @throws SQLException if the cursor is on the insert row
* @throws SyncProviderException if the underlying
* synchronization provider's writer fails to write the updates
* back to the data source
@@ -805,7 +804,6 @@
* <code>commit</code> or <code>rollback</code> methods as appropriate.
*
* @param con a standard JDBC <code>Connection</code> object
- * @throws SQLException if the cursor is on the insert row
* @throws SyncProviderException if the underlying
* synchronization provider's writer fails to write the updates
* back to the data source
@@ -1371,7 +1369,7 @@
* Applications can form a <code>WebRowSet</code> object from the <code>CachedRowSet</code>
* object returned by this method in order
* to export the <code>RowSet</code> schema definition to XML for future use.
- *
+ * @return An empty copy of this {@code CachedRowSet} object
* @throws SQLException if an error occurs in cloning the structure of this
* <code>CachedRowSet</code> object
* @see #createShared
@@ -1543,6 +1541,7 @@
* @param numRows when populating, the number of rows interval on which the
* <code>CachedRowSet</code> populated should fire; the default value
* is zero; cannot be less than <code>fetchSize</code> or zero
+ * @throws SQLException {@code numRows < 0 or numRows < getFetchSize() }
*/
public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException;
--- a/jdk/src/share/classes/javax/sql/rowset/FilteredRowSet.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/FilteredRowSet.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -51,7 +51,7 @@
* <p>
* A JDBC <code>FilteredRowSet</code> standard implementation implements the
* <code>RowSet</code> interfaces and extends the
- * <code>CachedRowSet</code><sup><font size=-2>TM</font></sup> class. The
+ * <code>CachedRowSet</code>™ class. The
* <code>CachedRowSet</code> class provides a set of protected cursor manipulation
* methods, which a <code>FilteredRowSet</code> implementation can override
* to supply filtering support.
@@ -69,8 +69,8 @@
* class JavaDoc), a <code>FilteredRowSet</code> could then be used as described
* below.
* <P>
- * <code>
* <pre>
+ * {@code
* FilteredRowSet frs = new FilteredRowSetImpl();
* frs.populate(rs);
*
@@ -78,8 +78,8 @@
* frs.setFilter(name);
*
* frs.next() // only names from "Alpha" to "Bravo" will be returned
+ * }
* </pre>
- * </code>
* In the example above, we initialize a <code>Range</code> object which
* implements the <code>Predicate</code> interface. This object expresses
* the following constraints: All rows outputted or modified from this
--- a/jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -38,7 +38,7 @@
*
* <h3>1.0 Overview</h3>
* A wrapper around a <code>ResultSet</code> object that makes it possible
- * to use the result set as a JavaBeans<sup><font size=-2>TM</font></sup>
+ * to use the result set as a JavaBeans™
* component. Thus, a <code>JdbcRowSet</code> object can be one of the Beans that
* a tool makes available for composing an application. Because
* a <code>JdbcRowSet</code> is a connected rowset, that is, it continually
@@ -113,7 +113,7 @@
* <P>
* The implementation of the <code>RowSet</code> method <code>execute</code> in the
* <code>JdbcRowSet</code> reference implementation differs from that in the
- * <code>CachedRowSet</code><sup><font size=-2>TM</font></sup>
+ * <code>CachedRowSet</code>™
* reference implementation to account for the different
* requirements of connected and disconnected <code>RowSet</code> objects.
* <p>
@@ -238,6 +238,7 @@
* call to either the method commit or the method rollback. By default,
* new connections are in auto-commit mode.
*
+ * @return {@code true} if auto-commit is enabled; {@code false} otherwise
* @throws SQLException if a database access error occurs
* @see java.sql.Connection#getAutoCommit()
*/
@@ -251,7 +252,8 @@
* to allow an application to set the <code>JdbcRowSet</code> transaction behavior.
* <p>
* Sets the current auto-commit mode for this <code>Connection</code> object.
- *
+ * @param autoCommit {@code true} to enable auto-commit; {@code false} to
+ * disable auto-commit
* @throws SQLException if a database access error occurs
* @see java.sql.Connection#setAutoCommit(boolean)
*/
@@ -277,7 +279,7 @@
* Undoes all changes made in the current transaction to the last set savepoint
* and releases any database locks currently held by this <code>Connection</code>
* object. This method should be used only when auto-commit mode has been disabled.
- *
+ * @param s The {@code Savepoint} to rollback to
* @throws SQLException if a database access error occurs or this <code>Connection</code>
* object within this <code>JdbcRowSet</code> is in auto-commit mode.
* @see #rollback
--- a/jdk/src/share/classes/javax/sql/rowset/Joinable.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/Joinable.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -137,7 +137,7 @@
* object. A <code>JoinRowSet</code> object can now add this <code>RowSet</code>
* object based on the match column.
* <p>
- * Sub-interfaces such as the <code>CachedRowSet</code><sup><font size=-2>TM</font></sup>
+ * Sub-interfaces such as the <code>CachedRowSet</code>™
* interface define the method <code>CachedRowSet.setKeyColumns</code>, which allows
* primary key semantics to be enforced on specific columns.
* Implementations of the <code>setMatchColumn(int columnIdx)</code> method
--- a/jdk/src/share/classes/javax/sql/rowset/Predicate.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/Predicate.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -111,7 +111,7 @@
* cursor moving from row to the next. In addition, if this internal method
* moves the cursor onto a row that has been deleted, the internal method will
* continue to ove the cursor until a valid row is found.
- *
+ * @param rs The {@code RowSet} to be evaluated
* @return <code>true</code> if there are more rows in the filter;
* <code>false</code> otherwise
*/
--- a/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -71,7 +71,9 @@
debug = val != null && !"false".equals(val);
}
-
+ /**
+ * RowSetProvider constructor
+ */
protected RowSetProvider () {
}
--- a/jdk/src/share/classes/javax/sql/rowset/RowSetWarning.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/RowSetWarning.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -35,7 +35,7 @@
* This class complements the <code>SQLWarning</code> class.
* <P>
* Rowset warnings may be retrieved from <code>JdbcRowSet</code>,
- * <code>CachedRowSet</code><sup><font size=-2>TM</font></sup>,
+ * <code>CachedRowSet</code>™,
* <code>WebRowSet</code>, <code>FilteredRowSet</code>, or <code>JoinRowSet</code>
* implementations. To retrieve the first warning reported on any
* <code>RowSet</code>
--- a/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -33,306 +33,310 @@
import org.xml.sax.*;
/**
- * The standard interface that all implementations of a <code>WebRowSet</code>
+ * The standard interface that all implementations of a {@code WebRowSet}
* must implement.
* <P>
* <h3>1.0 Overview</h3>
- * The <code>WebRowSetImpl</code> provides the standard
+ * The {@code WebRowSetImpl} provides the standard
* reference implementation, which may be extended if required.
* <P>
* The standard WebRowSet XML Schema definition is available at the following
* URI:
* <ul>
- * <pre>
+ * <li>
* <a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">http://java.sun.com/xml/ns/jdbc/webrowset.xsd</a>
- * </pre>
+ * </li>
* </ul>
* It describes the standard XML document format required when describing a
- * <code>RowSet</code> object in XML and must be used be all standard implementations
- * of the <code>WebRowSet</code> interface to ensure interoperability. In addition,
- * the <code>WebRowSet</code> schema uses specific SQL/XML Schema annotations,
+ * {@code RowSet} object in XML and must be used be all standard implementations
+ * of the {@code WebRowSet} interface to ensure interoperability. In addition,
+ * the {@code WebRowSet} schema uses specific SQL/XML Schema annotations,
* thus ensuring greater cross
* platform inter-operability. This is an effort currently under way at the ISO
* organization. The SQL/XML definition is available at the following URI:
* <ul>
- * <pre>
+ * <li>
* <a href="http://standards.iso.org/iso/9075/2002/12/sqlxml">http://standards.iso.org/iso/9075/2002/12/sqlxml</a>
- * </pre>
+ * </li>
* </ul>
- * The schema definition describes the internal data of a <code>RowSet</code> object
+ * The schema definition describes the internal data of a {@code RowSet} object
* in three distinct areas:
* <UL>
- * <li><b>properties</b></li>
- * These properties describe the standard synchronization provider properties in
- * addition to the more general <code>RowSet</code> properties.
- * <p>
- * <li><b>metadata</b></li>
- * This describes the metadata associated with the tabular structure governed by a
- * <code>WebRowSet</code> object. The metadata described is closely aligned with the
- * metadata accessible in the underlying <code>java.sql.ResultSet</code> interface.
- * <p>
- * <li><b>data</b></li>
- * This describes the original data (the state of data since the last population
- * or last synchronization of the <code>WebRowSet</code> object) and the current
+ * <li>properties - These properties describe the standard synchronization
+ * provider properties in addition to the more general {@code RowSet} properties.
+ * </li>
+ * <li>metadata - This describes the metadata associated with the tabular structure governed by a
+ * {@code WebRowSet} object. The metadata described is closely aligned with the
+ * metadata accessible in the underlying {@code java.sql.ResultSet} interface.
+ * </li>
+ * <li>data - This describes the original data (the state of data since the
+ * last population
+ * or last synchronization of the {@code WebRowSet} object) and the current
* data. By keeping track of the delta between the original data and the current data,
- * a <code>WebRowSet</code> maintains
- * the ability to synchronize changes in its data back to the originating data source.
+ * a {@code WebRowSet} maintains the ability to synchronize changes
+ * in its data back to the originating data source.
+ * </li>
* </ul>
* <P>
* <h3>2.0 WebRowSet States</h3>
- * The following sections demonstrates how a <code>WebRowSet</code> implementation
+ * The following sections demonstrates how a {@code WebRowSet} implementation
* should use the XML Schema to describe update, insert, and delete operations
- * and to describe the state of a <code>WebRowSet</code> object in XML.
+ * and to describe the state of a {@code WebRowSet} object in XML.
* <p>
- * <h4>2.1 State 1 - Outputting a <code>WebRowSet</code> Object to XML</h3>
- * In this example, a <code>WebRowSet</code> object is created and populated with a simple 2 column,
- * 5 row table from a data source. Having the 5 rows in a <code>WebRowSet</code> object
+ * <h4>2.1 State 1 - Outputting a {@code WebRowSet} Object to XML</h4>
+ * In this example, a {@code WebRowSet} object is created and populated with a simple 2 column,
+ * 5 row table from a data source. Having the 5 rows in a {@code WebRowSet} object
* makes it possible to describe them in XML. The
* metadata describing the various standard JavaBeans properties as defined
* in the RowSet interface plus the standard properties defined in
- * the <code>CachedRowSet</code><sup><font size=-2>TM</font></sup> interface
+ * the {@code CachedRowSet}™ interface
* provide key details that describe WebRowSet
* properties. Outputting the WebRowSet object to XML using the standard
- * <code>writeXml</code> methods describes the internal properties as follows:
+ * {@code writeXml} methods describes the internal properties as follows:
* <PRE>
- * <<font color=red>properties</font>>
- * <<font color=red>command</font>>select co1, col2 from test_table<<font color=red>/command</font>>
- * <<font color=red>concurrency</font>>1<<font color=red>/concurrency</font>>
- * <<font color=red>datasource/</font>>
- * <<font color=red>escape-processing</font>>true<<font color=red>/escape-processing</font>>
- * <<font color=red>fetch-direction</font>>0<<font color=red>/fetch-direction</font>>
- * <<font color=red>fetch-size</font>>0<<font color=red>/fetch-size</font>>
- * <<font color=red>isolation-level</font>>1<<font color=red>/isolation-level</font>>
- * <<font color=red>key-columns/</font>>
- * <<font color=red>map/</font>>
- * <<font color=red>max-field-size</font>>0<<font color=red>/max-field-size</font>>
- * <<font color=red>max-rows</font>>0<<font color=red>/max-rows</font>>
- * <<font color=red>query-timeout</font>>0<<font color=red>/query-timeout</font>>
- * <<font color=red>read-only</font>>false<<font color=red>/read-only</font>>
- * <<font color=red>rowset-type</font>>TRANSACTION_READ_UNCOMMITED<<font color=red>/rowset-type</font>>
- * <<font color=red>show-deleted</font>>false<<font color=red>/show-deleted</font>>
- * <<font color=red>table-name/</font>>
- * <<font color=red>url</font>>jdbc:thin:oracle<<font color=red>/url</font>>
- * <<font color=red>sync-provider</font>>
- * <<font color=red>sync-provider-name</font>>.com.rowset.provider.RIOptimisticProvider<<font color=red>/sync-provider-name</font>>
- * <<font color=red>sync-provider-vendor</font>>Oracle Corporation<<font color=red>/sync-provider-vendor</font>>
- * <<font color=red>sync-provider-version</font>>1.0<<font color=red>/sync-provider-name</font>>
- * <<font color=red>sync-provider-grade</font>>LOW<<font color=red>/sync-provider-grade</font>>
- * <<font color=red>data-source-lock</font>>NONE<<font color=red>/data-source-lock</font>>
- * <<font color=red>/sync-provider</font>>
- * <<font color=red>/properties</font>>
- * </PRE>
+ * {@code
+ * <properties>
+ * <command>select co1, col2 from test_table</command>
+ * <concurrency>1</concurrency>
+ * <datasource/>
+ * <escape-processing>true</escape-processing>
+ * <fetch-direction>0</fetch-direction>
+ * <fetch-size>0</fetch-size>
+ * <isolation-level>1</isolation-level>
+ * <key-columns/>
+ * <map/>
+ * <max-field-size>0</max-field-size>
+ * <max-rows>0</max-rows>
+ * <query-timeout>0</query-timeout>
+ * <read-only>false</read-only>
+ * <rowset-type>TRANSACTION_READ_UNCOMMITED</rowset-type>
+ * <show-deleted>false</show-deleted>
+ * <table-name/>
+ * <url>jdbc:thin:oracle</url>
+ * <sync-provider>
+ * <sync-provider-name>.com.rowset.provider.RIOptimisticProvider</sync-provider-name>
+ * <sync-provider-vendor>Oracle Corporation</sync-provider-vendor>
+ * <sync-provider-version>1.0</sync-provider-name>
+ * <sync-provider-grade>LOW</sync-provider-grade>
+ * <data-source-lock>NONE</data-source-lock>
+ * </sync-provider>
+ * </properties>
+ * } </PRE>
* The meta-data describing the make up of the WebRowSet is described
* in XML as detailed below. Note both columns are described between the
- * <code>column-definition</code> tags.
+ * {@code column-definition} tags.
* <PRE>
- * <<font color=red>metadata</font>>
- * <<font color=red>column-count</font>>2<<font color=red>/column-count</font>>
- * <<font color=red>column-definition</font>>
- * <<font color=red>column-index</font>>1<<font color=red>/column-index</font>>
- * <<font color=red>auto-increment</font>>false<<font color=red>/auto-increment</font>>
- * <<font color=red>case-sensitive</font>>true<<font color=red>/case-sensitive</font>>
- * <<font color=red>currency</font>>false<<font color=red>/currency</font>>
- * <<font color=red>nullable</font>>1<<font color=red>/nullable</font>>
- * <<font color=red>signed</font>>false<<font color=red>/signed</font>>
- * <<font color=red>searchable</font>>true<<font color=red>/searchable</font>>
- * <<font color=red>column-display-size</font>>10<<font color=red>/column-display-size</font>>
- * <<font color=red>column-label</font>>COL1<<font color=red>/column-label</font>>
- * <<font color=red>column-name</font>>COL1<<font color=red>/column-name</font>>
- * <<font color=red>schema-name/</font>>
- * <<font color=red>column-precision</font>>10<<font color=red>/column-precision</font>>
- * <<font color=red>column-scale</font>>0<<font color=red>/column-scale</font>>
- * <<font color=red>table-name/</font>>
- * <<font color=red>catalog-name/</font>>
- * <<font color=red>column-type</font>>1<<font color=red>/column-type</font>>
- * <<font color=red>column-type-name</font>>CHAR<<font color=red>/column-type-name</font>>
- * <<font color=red>/column-definition</font>>
- * <<font color=red>column-definition</font>>
- * <<font color=red>column-index</font>>2<<font color=red>/column-index</font>>
- * <<font color=red>auto-increment</font>>false<<font color=red>/auto-increment</font>>
- * <<font color=red>case-sensitive</font>>false<<font color=red>/case-sensitive</font>>
- * <<font color=red>currency</font>>false<<font color=red>/currency</font>>
- * <<font color=red>nullable</font>>1<<font color=red>/nullable</font>>
- * <<font color=red>signed</font>>true<<font color=red>/signed</font>>
- * <<font color=red>searchable</font>>true<<font color=red>/searchable</font>>
- * <<font color=red>column-display-size</font>>39<<font color=red>/column-display-size</font>>
- * <<font color=red>column-label</font>>COL2<<font color=red>/column-label</font>>
- * <<font color=red>column-name</font>>COL2<<font color=red>/column-name</font>>
- * <<font color=red>schema-name/</font>>
- * <<font color=red>column-precision</font>>38<<font color=red>/column-precision</font>>
- * <<font color=red>column-scale</font>>0<<font color=red>/column-scale</font>>
- * <<font color=red>table-name/</font>>
- * <<font color=red>catalog-name/</font>>
- * <<font color=red>column-type</font>>3<<font color=red>/column-type</font>>
- * <<font color=red>column-type-name</font>>NUMBER<<font color=red>/column-type-name</font>>
- * <<font color=red>/column-definition</font>>
- * <<font color=red>/metadata</font>>
- * </PRE>
+ * {@code
+ * <metadata>
+ * <column-count>2</column-count>
+ * <column-definition>
+ * <column-index>1</column-index>
+ * <auto-increment>false</auto-increment>
+ * <case-sensitive>true</case-sensitive>
+ * <currency>false</currency>
+ * <nullable>1</nullable>
+ * <signed>false</signed>
+ * <searchable>true</searchable>
+ * <column-display-size>10</column-display-size>
+ * <column-label>COL1</column-label>
+ * <column-name>COL1</column-name>
+ * <schema-name/>
+ * <column-precision>10</column-precision>
+ * <column-scale>0</column-scale>
+ * <table-name/>
+ * <catalog-name/>
+ * <column-type>1</column-type>
+ * <column-type-name>CHAR</column-type-name>
+ * </column-definition>
+ * <column-definition>
+ * <column-index>2</column-index>
+ * <auto-increment>false</auto-increment>
+ * <case-sensitive>false</case-sensitive>
+ * <currency>false</currency>
+ * <nullable>1</nullable>
+ * <signed>true</signed>
+ * <searchable>true</searchable>
+ * <column-display-size>39</column-display-size>
+ * <column-label>COL2</column-label>
+ * <column-name>COL2</column-name>
+ * <schema-name/>
+ * <column-precision>38</column-precision>
+ * <column-scale>0</column-scale>
+ * <table-name/>
+ * <catalog-name/>
+ * <column-type>3</column-type>
+ * <column-type-name>NUMBER</column-type-name>
+ * </column-definition>
+ * </metadata>
+ * }</PRE>
* Having detailed how the properties and metadata are described, the following details
- * how the contents of a <code>WebRowSet</code> object is described in XML. Note, that
- * this describes a <code>WebRowSet</code> object that has not undergone any
+ * how the contents of a {@code WebRowSet} object is described in XML. Note, that
+ * this describes a {@code WebRowSet} object that has not undergone any
* modifications since its instantiation.
- * A <code>currentRow</code> tag is mapped to each row of the table structure that the
- * <code>WebRowSet</code> object provides. A <code>columnValue</code> tag may contain
- * either the <code>stringData</code> or <code>binaryData</code> tag, according to
+ * A {@code currentRow} tag is mapped to each row of the table structure that the
+ * {@code WebRowSet} object provides. A {@code columnValue} tag may contain
+ * either the {@code stringData} or {@code binaryData} tag, according to
* the SQL type that
- * the XML value is mapping back to. The <code>binaryData</code> tag contains data in the
- * Base64 encoding and is typically used for <code>BLOB</code> and <code>CLOB</code> type data.
+ * the XML value is mapping back to. The {@code binaryData} tag contains data in the
+ * Base64 encoding and is typically used for {@code BLOB} and {@code CLOB} type data.
* <PRE>
- * <<font color=red>data</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * {@code
+ * <data>
+ * <currentRow>
+ * <columnValue>
* firstrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 1
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <currentRow>
+ * <columnValue>
* secondrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 2
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <currentRow>
+ * <columnValue>
* thirdrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 3
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <currentRow>
+ * <columnValue>
* fourthrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 4
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>/data</font>>
- * </PRE>
+ * </columnValue>
+ * </currentRow>
+ * </data>
+ * }</PRE>
* <h4>2.2 State 2 - Deleting a Row</h4>
- * Deleting a row in a <code>WebRowSet</code> object involves simply moving to the row
- * to be deleted and then calling the method <code>deleteRow</code>, as in any other
- * <code>RowSet</code> object. The following
- * two lines of code, in which <i>wrs</i> is a <code>WebRowSet</code> object, delete
+ * Deleting a row in a {@code WebRowSet} object involves simply moving to the row
+ * to be deleted and then calling the method {@code deleteRow}, as in any other
+ * {@code RowSet} object. The following
+ * two lines of code, in which <i>wrs</i> is a {@code WebRowSet} object, delete
* the third row.
* <PRE>
* wrs.absolute(3);
* wrs.deleteRow();
* </PRE>
- * The XML description shows the third row is marked as a <code>deleteRow</code>,
- * which eliminates the third row in the <code>WebRowSet</code> object.
+ * The XML description shows the third row is marked as a {@code deleteRow},
+ * which eliminates the third row in the {@code WebRowSet} object.
* <PRE>
- * <<font color=red>data</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * {@code
+ * <data>
+ * <currentRow>
+ * <columnValue>
* firstrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 1
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <currentRow>
+ * <columnValue>
* secondrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 2
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>deleteRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <deleteRow>
+ * <columnValue>
* thirdrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 3
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/deleteRow</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </deleteRow>
+ * <currentRow>
+ * <columnValue>
* fourthrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 4
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>/data</font>>
- * </PRE>
+ * </columnValue>
+ * </currentRow>
+ * </data>
+ *} </PRE>
* <h4>2.3 State 3 - Inserting a Row</h4>
- * A <code>WebRowSet</code> object can insert a new row by moving to the insert row,
+ * A {@code WebRowSet} object can insert a new row by moving to the insert row,
* calling the appropriate updater methods for each column in the row, and then
- * calling the method <code>insertRow</code>.
+ * calling the method {@code insertRow}.
* <PRE>
+ * {@code
* wrs.moveToInsertRow();
* wrs.updateString(1, "fifththrow");
* wrs.updateString(2, "5");
* wrs.insertRow();
- * </PRE>
+ * }</PRE>
* The following code fragment changes the second column value in the row just inserted.
* Note that this code applies when new rows are inserted right after the current row,
- * which is why the method <code>next</code> moves the cursor to the correct row.
- * Calling the method <code>acceptChanges</code> writes the change to the data source.
+ * which is why the method {@code next} moves the cursor to the correct row.
+ * Calling the method {@code acceptChanges} writes the change to the data source.
*
* <PRE>
- * wrs.moveToCurrentRow();
+ * {@code wrs.moveToCurrentRow();
* wrs.next();
* wrs.updateString(2, "V");
* wrs.acceptChanges();
- * :
- * </PRE>
+ * }</PRE>
* Describing this in XML demonstrates where the Java code inserts a new row and then
* performs an update on the newly inserted row on an individual field.
* <PRE>
- * <<font color=red>data</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * {@code
+ * <data>
+ * <currentRow>
+ * <columnValue>
* firstrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 1
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <currentRow>
+ * <columnValue>
* secondrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 2
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <currentRow>
+ * <columnValue>
* newthirdrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* III
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>insertRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <insertRow>
+ * <columnValue>
* fifthrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 5
- * <<font color=red>/columnValue</font>>
- * <<font color=red>updateValue</font>>
+ * </columnValue>
+ * <updateValue>
* V
- * <<font color=red>/updateValue</font>>
- * <<font color=red>/insertRow</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * </updateValue>
+ * </insertRow>
+ * <currentRow>
+ * <columnValue>
* fourthrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 4
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>/date</font>>
- * </PRE>
+ * </columnValue>
+ * </currentRow>
+ * </date>
+ *} </PRE>
* <h4>2.4 State 4 - Modifying a Row</h4>
* Modifying a row produces specific XML that records both the new value and the
* value that was replaced. The value that was replaced becomes the original value,
@@ -340,63 +344,65 @@
* code moves the cursor to a specific row, performs some modifications, and updates
* the row when complete.
* <PRE>
+ *{@code
* wrs.absolute(5);
* wrs.updateString(1, "new4thRow");
* wrs.updateString(2, "IV");
* wrs.updateRow();
- * </PRE>
- * In XML, this is described by the <code>modifyRow</code> tag. Both the original and new
+ * }</PRE>
+ * In XML, this is described by the {@code modifyRow} tag. Both the original and new
* values are contained within the tag for original row tracking purposes.
* <PRE>
- * <<font color=red>data</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * {@code
+ * <data>
+ * <currentRow>
+ * <columnValue>
* firstrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 1
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <currentRow>
+ * <columnValue>
* secondrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 2
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <currentRow>
+ * <columnValue>
* newthirdrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* III
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>currentRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <currentRow>
+ * <columnValue>
* fifthrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * <columnValue>
* 5
- * <<font color=red>/columnValue</font>>
- * <<font color=red>/currentRow</font>>
- * <<font color=red>modifyRow</font>>
- * <<font color=red>columnValue</font>>
+ * </columnValue>
+ * </currentRow>
+ * <modifyRow>
+ * <columnValue>
* fourthrow
- * <<font color=red>/columnValue</font>>
- * <<font color=red>updateValue</font>>
+ * </columnValue>
+ * <updateValue>
* new4thRow
- * <<font color=red>/updateValue</font>>
- * <<font color=red>columnValue</font>>
+ * </updateValue>
+ * <columnValue>
* 4
- * <<font color=red>/columnValue</font>>
- * <<font color=red>updateValue</font>>
+ * </columnValue>
+ * <updateValue>
* IV
- * <<font color=red>/updateValue</font>>
- * <<font color=red>/modifyRow</font>>
- * <<font color=red>/data</font>>
- * </PRE>
+ * </updateValue>
+ * </modifyRow>
+ * </data>
+ * }</PRE>
*
* @see javax.sql.rowset.JdbcRowSet
* @see javax.sql.rowset.CachedRowSet
@@ -407,78 +413,78 @@
public interface WebRowSet extends CachedRowSet {
/**
- * Reads a <code>WebRowSet</code> object in its XML format from the given
- * <code>Reader</code> object.
+ * Reads a {@code WebRowSet} object in its XML format from the given
+ * {@code Reader} object.
*
- * @param reader the <code>java.io.Reader</code> stream from which this
- * <code>WebRowSet</code> object will be populated
+ * @param reader the {@code java.io.Reader} stream from which this
+ * {@code WebRowSet} object will be populated
* @throws SQLException if a database access error occurs
*/
public void readXml(java.io.Reader reader) throws SQLException;
/**
- * Reads a stream based XML input to populate this <code>WebRowSet</code>
+ * Reads a stream based XML input to populate this {@code WebRowSet}
* object.
*
- * @param iStream the <code>java.io.InputStream</code> from which this
- * <code>WebRowSet</code> object will be populated
+ * @param iStream the {@code java.io.InputStream} from which this
+ * {@code WebRowSet} object will be populated
* @throws SQLException if a data source access error occurs
* @throws IOException if an IO exception occurs
*/
public void readXml(java.io.InputStream iStream) throws SQLException, IOException;
/**
- * Populates this <code>WebRowSet</code> object with
- * the contents of the given <code>ResultSet</code> object and writes its
+ * Populates this {@code WebRowSet} object with
+ * the contents of the given {@code ResultSet} object and writes its
* data, properties, and metadata
- * to the given <code>Writer</code> object in XML format.
+ * to the given {@code Writer} object in XML format.
* <p>
- * NOTE: The <code>WebRowSet</code> cursor may be moved to write out the
+ * NOTE: The {@code WebRowSet} cursor may be moved to write out the
* contents to the XML data source. If implemented in this way, the cursor <b>must</b>
- * be returned to its position just prior to the <code>writeXml()</code> call.
+ * be returned to its position just prior to the {@code writeXml()} call.
*
- * @param rs the <code>ResultSet</code> object with which to populate this
- * <code>WebRowSet</code> object
- * @param writer the <code>java.io.Writer</code> object to write to.
+ * @param rs the {@code ResultSet} object with which to populate this
+ * {@code WebRowSet} object
+ * @param writer the {@code java.io.Writer} object to write to.
* @throws SQLException if an error occurs writing out the rowset
* contents in XML format
*/
public void writeXml(ResultSet rs, java.io.Writer writer) throws SQLException;
/**
- * Populates this <code>WebRowSet</code> object with
- * the contents of the given <code>ResultSet</code> object and writes its
+ * Populates this {@code WebRowSet} object with
+ * the contents of the given {@code ResultSet} object and writes its
* data, properties, and metadata
- * to the given <code>OutputStream</code> object in XML format.
+ * to the given {@code OutputStream} object in XML format.
* <p>
- * NOTE: The <code>WebRowSet</code> cursor may be moved to write out the
+ * NOTE: The {@code WebRowSet} cursor may be moved to write out the
* contents to the XML data source. If implemented in this way, the cursor <b>must</b>
- * be returned to its position just prior to the <code>writeXml()</code> call.
+ * be returned to its position just prior to the {@code writeXml()} call.
*
- * @param rs the <code>ResultSet</code> object with which to populate this
- * <code>WebRowSet</code> object
- * @param oStream the <code>java.io.OutputStream</code> to write to
+ * @param rs the {@code ResultSet} object with which to populate this
+ * {@code WebRowSet} object
+ * @param oStream the {@code java.io.OutputStream} to write to
* @throws SQLException if a data source access error occurs
* @throws IOException if a IO exception occurs
*/
public void writeXml(ResultSet rs, java.io.OutputStream oStream) throws SQLException, IOException;
/**
- * Writes the data, properties, and metadata for this <code>WebRowSet</code> object
- * to the given <code>Writer</code> object in XML format.
+ * Writes the data, properties, and metadata for this {@code WebRowSet} object
+ * to the given {@code Writer} object in XML format.
*
- * @param writer the <code>java.io.Writer</code> stream to write to
+ * @param writer the {@code java.io.Writer} stream to write to
* @throws SQLException if an error occurs writing out the rowset
* contents to XML
*/
public void writeXml(java.io.Writer writer) throws SQLException;
/**
- * Writes the data, properties, and metadata for this <code>WebRowSet</code> object
- * to the given <code>OutputStream</code> object in XML format.
+ * Writes the data, properties, and metadata for this {@code WebRowSet} object
+ * to the given {@code OutputStream} object in XML format.
*
- * @param oStream the <code>java.io.OutputStream</code> stream to write to
+ * @param oStream the {@code java.io.OutputStream} stream to write to
* @throws SQLException if a data source access error occurs
* @throws IOException if a IO exception occurs
*/
@@ -486,14 +492,14 @@
/**
* The public identifier for the XML Schema definition that defines the XML
- * tags and their valid values for a <code>WebRowSet</code> implementation.
+ * tags and their valid values for a {@code WebRowSet} implementation.
*/
public static String PUBLIC_XML_SCHEMA =
"--//Oracle Corporation//XSD Schema//EN";
/**
* The URL for the XML Schema definition file that defines the XML tags and
- * their valid values for a <code>WebRowSet</code> implementation.
+ * their valid values for a {@code WebRowSet} implementation.
*/
public static String SCHEMA_SYSTEM_ID = "http://java.sun.com/xml/ns/jdbc/webrowset.xsd";
}
--- a/jdk/src/share/classes/javax/sql/rowset/package.html Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/package.html Tue Jul 02 15:23:23 2013 -0700
@@ -67,7 +67,7 @@
<ul>
<li><a href="JdbcRowSet.html"><b><code>JdbcRowSet</code></b></a> - A wrapper around
a <tt>ResultSet</tt> object that makes it possible to use the result set as a
-JavaBeans<sup><font size=-2>TM</font></sup> component. Thus,
+JavaBeans™ component. Thus,
a <tt>JdbcRowSet</tt> object can be a Bean that any tool
makes available for assembling an application as part of a component based
architecture . A <tt>JdbcRowSet</tt> object is a connected <code>RowSet</code>
@@ -79,7 +79,7 @@
<p>
<li><a href="CachedRowSet.html">
<b><code>CachedRowSet</code>™</b></a>
- - A <tt>CachedRowSet</tt> object is a JavaBeans<sup><font size=-2>TM</font></sup>
+ - A <tt>CachedRowSet</tt> object is a JavaBeans™
component that is scrollable, updatable, serializable, and generally disconnected from
the source of its data. A <tt>CachedRowSet</tt> object
typically contains rows from a result set, but it can also contain rows from any
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -50,7 +50,7 @@
* if necessary. At this time, logical pointers to the data in the data source,
* such as locators, are not currently supported.
*
- * <h4> Thread safety </h4>
+ * <h3> Thread safety </h3>
*
* A SerialArray is not safe for use by multiple concurrent threads. If a
* SerialArray is to be used by more than one thread then access to the
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -51,7 +51,7 @@
* <code>Blob</code> object within a <code>SerialBlob</code> object
* and to update or truncate a <code>Blob</code> object.
*
- * <h4> Thread safety </h4>
+ * <h3> Thread safety </h3>
*
* <p> A SerialBlob is not safe for use by multiple concurrent threads. If a
* SerialBlob is to be used by more than one thread then access to the SerialBlob
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -44,7 +44,7 @@
* from a <code>SerialClob</code> object or to locate the start of
* a pattern of characters.
*
- * <h4> Thread safety </h4>
+ * <h3> Thread safety </h3>
*
* <p> A SerialClob is not safe for use by multiple concurrent threads. If a
* SerialClob is to be used by more than one thread then access to the SerialClob
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -43,7 +43,7 @@
* java.net.URL url = rowset.getURL(1);
* </pre>
*
- * <h4> Thread safety </h4>
+ * <h3> Thread safety </h3>
*
* A SerialDatalink is not safe for use by multiple concurrent threads. If a
* SerialDatalink is to be used by more than one thread then access to the
@@ -77,6 +77,7 @@
* Constructs a new <code>SerialDatalink</code> object from the given
* <code>java.net.URL</code> object.
* <P>
+ * @param url the {@code URL} to create the {@code SerialDataLink} from
* @throws SerialException if url parameter is a null
*/
public SerialDatalink(URL url) throws SerialException {
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java Tue Jul 02 15:23:23 2013 -0700
@@ -47,7 +47,7 @@
* Static or transient fields cannot be serialized; an attempt to serialize
* them will result in a <code>SerialException</code> object being thrown.
*
- * <h4> Thread safety </h4>
+ * <h3> Thread safety </h3>
*
* A SerialJavaObject is not safe for use by multiple concurrent threads. If a
* SerialJavaObject is to be used by more than one thread then access to the
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -37,7 +37,7 @@
* creating a <code>SerialRef</code> instance from a <code>Ref</code>
* object and provides methods for getting and setting the <code>Ref</code> object.
*
- * <h4> Thread safety </h4>
+ * <h3> Thread safety </h3>
*
* A SerialRef is not safe for use by multiple concurrent threads. If a
* SerialRef is to be used by more than one thread then access to the SerialRef
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -51,7 +51,7 @@
* the SQL type name of the SQL structured type in the database, and methods
* for retrieving its attribute values.
*
- * <h4> Thread safety </h4>
+ * <h3> Thread safety </h3>
*
* A SerialStruct is not safe for use by multiple concurrent threads. If a
* SerialStruct is to be used by more than one thread then access to the
--- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -260,13 +260,14 @@
* <p>
* Synchronization providers bound to a JNDI context can be
* registered by binding a SyncProvider instance to a JNDI namespace.
- * <ul>
+ *
* <pre>
+ * {@code
* SyncProvider p = new MySyncProvider();
* InitialContext ic = new InitialContext();
* ic.bind ("jdbc/rowset/MySyncProvider", p);
- * </pre>
- * </ul>
+ * } </pre>
+ *
* Furthermore, an initial JNDI context should be set with the
* <code>SyncFactory</code> using the <code>setJNDIContext</code> method.
* The <code>SyncFactory</code> leverages this context to search for
@@ -564,6 +565,8 @@
*
* @return Enumeration A enumeration of available synchronization
* providers that are registered with this Factory
+ * @throws SyncFactoryException If an error occurs obtaining the registered
+ * providers
*/
public static Enumeration<SyncProvider> getRegisteredProviders()
throws SyncFactoryException {
@@ -648,7 +651,8 @@
/**
* Returns the logging object for applications to retrieve
* synchronization events posted by SyncProvider implementations.
- *
+ * @return The {@code Logger} that has been specified for use by
+ * {@code SyncProvider} implementations
* @throws SyncFactoryException if no logging object has been set.
*/
public static Logger getLogger() throws SyncFactoryException {
--- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -81,10 +81,13 @@
* <code>SyncProviderException</code> method <code>getSyncResolver</code> to get
* the <code>SyncResolver</code> object <i>resolver</i>.
* <PRE>
+ * {@code
* } catch (SyncProviderException spe) {
* SyncResolver resolver = spe.getSyncResolver();
* ...
* }
+ *
+ * }
* </PRE>
* <P>
* With <i>resolver</i> in hand, an application can use it to get the information
@@ -97,7 +100,7 @@
* The following kinds of information can be obtained from a <code>SyncResolver</code>
* object:
* <P>
- * <LI>What operation was being attempted when a conflict occurred<BR>
+ * <h3>What operation was being attempted when a conflict occurred</h3>
* The <code>SyncProvider</code> interface defines four constants
* describing states that may occur. Three
* constants describe the type of operation (update, delete, or insert) that a
@@ -106,10 +109,10 @@
* These constants are the possible return values when a <code>SyncResolver</code> object
* calls the method <code>getStatus</code>.
* <PRE>
- * int operation = resolver.getStatus();
+ * {@code int operation = resolver.getStatus(); }
* </PRE>
* <P>
- * <LI>The value in the data source that caused a conflict<BR>
+ * <h3>The value in the data source that caused a conflict</h3>
* A conflict exists when a value that a <code>RowSet</code> object has changed
* and is attempting to write to the data source
* has also been changed in the data source since the last synchronization. An
@@ -122,7 +125,6 @@
* </PRE>
* Note that the column in <i>resolver</i> can be designated by the column number,
* as is done in the preceding line of code, or by the column name.
- * </UL>
* <P>
* With the information retrieved from the methods <code>getStatus</code> and
* <code>getConflictValue</code>, the application may make a determination as to
@@ -193,7 +195,8 @@
* code fragment, the value in <i>crs</i> is the one set as the resolved value, which means
* that it will be used to overwrite the conflict value in the data source.
*
- * <PRE>{@code
+ * <PRE>
+ * {@code
* try {
*
* crs.acceptChanges(con);
--- a/jdk/src/share/classes/sun/misc/FDBigInteger.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/FDBigInteger.java Tue Jul 02 15:23:23 2013 -0700
@@ -782,7 +782,7 @@
assert this.size() >= subtrahend.size() : "result should be positive";
FDBigInteger minuend;
if (this.isImmutable) {
- minuend = new FDBigInteger(this.data, this.offset);
+ minuend = new FDBigInteger(this.data.clone(), this.offset);
} else {
minuend = this;
}
@@ -851,7 +851,7 @@
assert this.size() >= subtrahend.size() : "result should be positive";
FDBigInteger minuend = this;
if (subtrahend.isImmutable) {
- subtrahend = new FDBigInteger(subtrahend.data, subtrahend.offset);
+ subtrahend = new FDBigInteger(subtrahend.data.clone(), subtrahend.offset);
}
int offsetDiff = minuend.offset - subtrahend.offset;
int[] sData = subtrahend.data;
--- a/jdk/src/share/classes/sun/misc/FloatingDecimal.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/FloatingDecimal.java Tue Jul 02 15:23:23 2013 -0700
@@ -49,12 +49,14 @@
static final int MAX_DECIMAL_EXPONENT = 308;
static final int MIN_DECIMAL_EXPONENT = -324;
static final int BIG_DECIMAL_EXPONENT = 324; // i.e. abs(MIN_DECIMAL_EXPONENT)
+ static final int MAX_NDIGITS = 1100;
static final int SINGLE_EXP_SHIFT = FloatConsts.SIGNIFICAND_WIDTH - 1;
static final int SINGLE_FRACT_HOB = 1<<SINGLE_EXP_SHIFT;
static final int SINGLE_MAX_DECIMAL_DIGITS = 7;
static final int SINGLE_MAX_DECIMAL_EXPONENT = 38;
static final int SINGLE_MIN_DECIMAL_EXPONENT = -45;
+ static final int SINGLE_MAX_NDIGITS = 200;
static final int INT_DECIMAL_DIGITS = 9;
@@ -1002,15 +1004,11 @@
*/
static class PreparedASCIIToBinaryBuffer implements ASCIIToBinaryConverter {
final private double doubleVal;
- private int roundDir = 0;
+ final private float floatVal;
- public PreparedASCIIToBinaryBuffer(double doubleVal) {
+ public PreparedASCIIToBinaryBuffer(double doubleVal, float floatVal) {
this.doubleVal = doubleVal;
- }
-
- public PreparedASCIIToBinaryBuffer(double doubleVal, int roundDir) {
- this.doubleVal = doubleVal;
- this.roundDir = roundDir;
+ this.floatVal = floatVal;
}
@Override
@@ -1020,15 +1018,15 @@
@Override
public float floatValue() {
- return stickyRound(doubleVal,roundDir);
+ return floatVal;
}
}
- static final ASCIIToBinaryConverter A2BC_POSITIVE_INFINITY = new PreparedASCIIToBinaryBuffer(Double.POSITIVE_INFINITY);
- static final ASCIIToBinaryConverter A2BC_NEGATIVE_INFINITY = new PreparedASCIIToBinaryBuffer(Double.NEGATIVE_INFINITY);
- static final ASCIIToBinaryConverter A2BC_NOT_A_NUMBER = new PreparedASCIIToBinaryBuffer(Double.NaN);
- static final ASCIIToBinaryConverter A2BC_POSITIVE_ZERO = new PreparedASCIIToBinaryBuffer(0.0d);
- static final ASCIIToBinaryConverter A2BC_NEGATIVE_ZERO = new PreparedASCIIToBinaryBuffer(-0.0d);
+ static final ASCIIToBinaryConverter A2BC_POSITIVE_INFINITY = new PreparedASCIIToBinaryBuffer(Double.POSITIVE_INFINITY, Float.POSITIVE_INFINITY);
+ static final ASCIIToBinaryConverter A2BC_NEGATIVE_INFINITY = new PreparedASCIIToBinaryBuffer(Double.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY);
+ static final ASCIIToBinaryConverter A2BC_NOT_A_NUMBER = new PreparedASCIIToBinaryBuffer(Double.NaN, Float.NaN);
+ static final ASCIIToBinaryConverter A2BC_POSITIVE_ZERO = new PreparedASCIIToBinaryBuffer(0.0d, 0.0f);
+ static final ASCIIToBinaryConverter A2BC_NEGATIVE_ZERO = new PreparedASCIIToBinaryBuffer(-0.0d, -0.0f);
/**
* A buffered implementation of <code>ASCIIToBinaryConverter</code>.
@@ -1038,7 +1036,6 @@
int decExponent;
char digits[];
int nDigits;
- int roundDir = 0; // set by doubleValue
ASCIIToBinaryBuffer( boolean negSign, int decExponent, char[] digits, int n)
{
@@ -1048,40 +1045,6 @@
this.nDigits = n;
}
- @Override
- public double doubleValue() {
- return doubleValue(false);
- }
-
- /**
- * Computes a number that is the ULP of the given value,
- * for purposes of addition/subtraction. Generally easy.
- * More difficult if subtracting and the argument
- * is a normalized a power of 2, as the ULP changes at these points.
- */
- private static double ulp(double dval, boolean subtracting) {
- long lbits = Double.doubleToLongBits(dval) & ~DoubleConsts.SIGN_BIT_MASK;
- int binexp = (int) (lbits >>> EXP_SHIFT);
- double ulpval;
- if (subtracting && (binexp >= EXP_SHIFT) && ((lbits & DoubleConsts.SIGNIF_BIT_MASK) == 0L)) {
- // for subtraction from normalized, powers of 2,
- // use next-smaller exponent
- binexp -= 1;
- }
- if (binexp > EXP_SHIFT) {
- ulpval = Double.longBitsToDouble(((long) (binexp - EXP_SHIFT)) << EXP_SHIFT);
- } else if (binexp == 0) {
- ulpval = Double.MIN_VALUE;
- } else {
- ulpval = Double.longBitsToDouble(1L << (binexp - 1));
- }
- if (subtracting) {
- ulpval = -ulpval;
- }
-
- return ulpval;
- }
-
/**
* Takes a FloatingDecimal, which we presumably just scanned in,
* and finds out what its value is, as a double.
@@ -1090,15 +1053,9 @@
* ROUNDING DIRECTION in case the result is really destined
* for a single-precision float.
*/
- private strictfp double doubleValue(boolean mustSetRoundDir) {
+ @Override
+ public double doubleValue() {
int kDigits = Math.min(nDigits, MAX_DECIMAL_DIGITS + 1);
- long lValue;
- double dValue;
- double rValue;
-
- if (mustSetRoundDir) {
- roundDir = 0;
- }
//
// convert the lead kDigits to a long integer.
//
@@ -1108,11 +1065,11 @@
for (int i = 1; i < iDigits; i++) {
iValue = iValue * 10 + (int) digits[i] - (int) '0';
}
- lValue = (long) iValue;
+ long lValue = (long) iValue;
for (int i = iDigits; i < kDigits; i++) {
lValue = lValue * 10L + (long) ((int) digits[i] - (int) '0');
}
- dValue = (double) lValue;
+ double dValue = (double) lValue;
int exp = decExponent - kDigits;
//
// lValue now contains a long integer with the value of
@@ -1140,13 +1097,7 @@
// Can get the answer with one operation,
// thus one roundoff.
//
- rValue = dValue * SMALL_10_POW[exp];
- if (mustSetRoundDir) {
- double tValue = rValue / SMALL_10_POW[exp];
- roundDir = (tValue == dValue) ? 0
- : (tValue < dValue) ? 1
- : -1;
- }
+ double rValue = dValue * SMALL_10_POW[exp];
return (isNegative) ? -rValue : rValue;
}
int slop = MAX_DECIMAL_DIGITS - kDigits;
@@ -1158,14 +1109,7 @@
// with one rounding.
//
dValue *= SMALL_10_POW[slop];
- rValue = dValue * SMALL_10_POW[exp - slop];
-
- if (mustSetRoundDir) {
- double tValue = rValue / SMALL_10_POW[exp - slop];
- roundDir = (tValue == dValue) ? 0
- : (tValue < dValue) ? 1
- : -1;
- }
+ double rValue = dValue * SMALL_10_POW[exp - slop];
return (isNegative) ? -rValue : rValue;
}
//
@@ -1176,13 +1120,7 @@
//
// Can get the answer in one division.
//
- rValue = dValue / SMALL_10_POW[-exp];
- if (mustSetRoundDir) {
- double tValue = rValue * SMALL_10_POW[-exp];
- roundDir = (tValue == dValue) ? 0
- : (tValue < dValue) ? 1
- : -1;
- }
+ double rValue = dValue / SMALL_10_POW[-exp];
return (isNegative) ? -rValue : rValue;
}
//
@@ -1303,9 +1241,14 @@
// Formulate the EXACT big-number result as
// bigD0 * 10^exp
//
+ if (nDigits > MAX_NDIGITS) {
+ nDigits = MAX_NDIGITS + 1;
+ digits[MAX_NDIGITS] = '1';
+ }
FDBigInteger bigD0 = new FDBigInteger(lValue, digits, kDigits, nDigits);
exp = decExponent - nDigits;
+ long ieeeBits = Double.doubleToRawLongBits(dValue); // IEEE-754 bits of double candidate
final int B5 = Math.max(0, -exp); // powers of 5 in bigB, value is not modified inside correctionLoop
final int D5 = Math.max(0, exp); // powers of 5 in bigD, value is not modified inside correctionLoop
bigD0 = bigD0.multByPow52(D5, 0);
@@ -1315,10 +1258,9 @@
correctionLoop:
while (true) {
- // here dValue can't be NaN, Infinity or zero
- long bigBbits = Double.doubleToRawLongBits(dValue) & ~DoubleConsts.SIGN_BIT_MASK;
- int binexp = (int) (bigBbits >>> EXP_SHIFT);
- bigBbits &= DoubleConsts.SIGNIF_BIT_MASK;
+ // here ieeeBits can't be NaN, Infinity or zero
+ int binexp = (int) (ieeeBits >>> EXP_SHIFT);
+ long bigBbits = ieeeBits & DoubleConsts.SIGNIF_BIT_MASK;
if (binexp > 0) {
bigBbits |= FRACT_HOB;
} else { // Normalize denormalized numbers.
@@ -1358,7 +1300,7 @@
if (binexp <= -DoubleConsts.EXP_BIAS) {
// This is going to be a denormalized number
// (if not actually zero).
- // half an ULP is at 2^-(expBias+EXP_SHIFT+1)
+ // half an ULP is at 2^-(DoubleConsts.EXP_BIAS+EXP_SHIFT+1)
hulpbias = binexp + lowOrderZeros + DoubleConsts.EXP_BIAS;
} else {
hulpbias = 1 + lowOrderZeros;
@@ -1422,17 +1364,12 @@
if ((cmpResult) < 0) {
// difference is small.
// this is close enough
- if (mustSetRoundDir) {
- roundDir = overvalue ? -1 : 1;
- }
break correctionLoop;
} else if (cmpResult == 0) {
// difference is exactly half an ULP
// round to some other value maybe, then finish
- dValue += 0.5 * ulp(dValue, overvalue);
- // should check for bigIntNBits == 1 here??
- if (mustSetRoundDir) {
- roundDir = overvalue ? -1 : 1;
+ if ((ieeeBits & 1) != 0) { // half ties to even
+ ieeeBits += overvalue ? -1 : 1; // nextDown or nextUp
}
break correctionLoop;
} else {
@@ -1440,15 +1377,18 @@
// could scale addend by ratio of difference to
// halfUlp here, if we bothered to compute that difference.
// Most of the time ( I hope ) it is about 1 anyway.
- dValue += ulp(dValue, overvalue);
- if (dValue == 0.0 || dValue == Double.POSITIVE_INFINITY) {
+ ieeeBits += overvalue ? -1 : 1; // nextDown or nextUp
+ if (ieeeBits == 0 || ieeeBits == DoubleConsts.EXP_BIT_MASK) { // 0.0 or Double.POSITIVE_INFINITY
break correctionLoop; // oops. Fell off end of range.
}
continue; // try again.
}
}
- return (isNegative) ? -dValue : dValue;
+ if (isNegative) {
+ ieeeBits |= DoubleConsts.SIGN_BIT_MASK;
+ }
+ return Double.longBitsToDouble(ieeeBits);
}
/**
@@ -1461,18 +1401,16 @@
* ( because of the preference to a zero low-order bit ).
*/
@Override
- public strictfp float floatValue() {
+ public float floatValue() {
int kDigits = Math.min(nDigits, SINGLE_MAX_DECIMAL_DIGITS + 1);
- int iValue;
- float fValue;
//
// convert the lead kDigits to an integer.
//
- iValue = (int) digits[0] - (int) '0';
+ int iValue = (int) digits[0] - (int) '0';
for (int i = 1; i < kDigits; i++) {
iValue = iValue * 10 + (int) digits[i] - (int) '0';
}
- fValue = (float) iValue;
+ float fValue = (float) iValue;
int exp = decExponent - kDigits;
//
// iValue now contains an integer with the value of
@@ -1505,7 +1443,7 @@
int slop = SINGLE_MAX_DECIMAL_DIGITS - kDigits;
if (exp <= SINGLE_MAX_SMALL_TEN + slop) {
//
- // We can multiply dValue by 10^(slop)
+ // We can multiply fValue by 10^(slop)
// and it is still "small" and exact.
// Then we can multiply by 10^(exp-slop)
// with one rounding.
@@ -1555,38 +1493,208 @@
// The sum of digits plus exponent is greater than
// what we think we can do with one error.
//
- // Start by weeding out obviously out-of-range
- // results, then convert to double and go to
- // common hard-case code.
+ // Start by approximating the right answer by,
+ // naively, scaling by powers of 10.
+ // Scaling uses doubles to avoid overflow/underflow.
//
- if (decExponent > SINGLE_MAX_DECIMAL_EXPONENT + 1) {
- //
- // Lets face it. This is going to be
- // Infinity. Cut to the chase.
- //
- return (isNegative) ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY;
- } else if (decExponent < SINGLE_MIN_DECIMAL_EXPONENT - 1) {
- //
- // Lets face it. This is going to be
- // zero. Cut to the chase.
- //
- return (isNegative) ? -0.0f : 0.0f;
+ double dValue = fValue;
+ if (exp > 0) {
+ if (decExponent > SINGLE_MAX_DECIMAL_EXPONENT + 1) {
+ //
+ // Lets face it. This is going to be
+ // Infinity. Cut to the chase.
+ //
+ return (isNegative) ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY;
+ }
+ if ((exp & 15) != 0) {
+ dValue *= SMALL_10_POW[exp & 15];
+ }
+ if ((exp >>= 4) != 0) {
+ int j;
+ for (j = 0; exp > 0; j++, exp >>= 1) {
+ if ((exp & 1) != 0) {
+ dValue *= BIG_10_POW[j];
+ }
+ }
+ }
+ } else if (exp < 0) {
+ exp = -exp;
+ if (decExponent < SINGLE_MIN_DECIMAL_EXPONENT - 1) {
+ //
+ // Lets face it. This is going to be
+ // zero. Cut to the chase.
+ //
+ return (isNegative) ? -0.0f : 0.0f;
+ }
+ if ((exp & 15) != 0) {
+ dValue /= SMALL_10_POW[exp & 15];
+ }
+ if ((exp >>= 4) != 0) {
+ int j;
+ for (j = 0; exp > 0; j++, exp >>= 1) {
+ if ((exp & 1) != 0) {
+ dValue *= TINY_10_POW[j];
+ }
+ }
+ }
}
+ fValue = Math.max(Float.MIN_VALUE, Math.min(Float.MAX_VALUE, (float) dValue));
//
- // Here, we do 'way too much work, but throwing away
- // our partial results, and going and doing the whole
- // thing as double, then throwing away half the bits that computes
- // when we convert back to float.
+ // fValue is now approximately the result.
+ // The hard part is adjusting it, by comparison
+ // with FDBigInteger arithmetic.
+ // Formulate the EXACT big-number result as
+ // bigD0 * 10^exp
//
- // The alternative is to reproduce the whole multiple-precision
- // algorithm for float precision, or to try to parameterize it
- // for common usage. The former will take about 400 lines of code,
- // and the latter I tried without success. Thus the semi-hack
- // answer here.
- //
- double dValue = doubleValue(true);
- return stickyRound(dValue, roundDir);
+ if (nDigits > SINGLE_MAX_NDIGITS) {
+ nDigits = SINGLE_MAX_NDIGITS + 1;
+ digits[SINGLE_MAX_NDIGITS] = '1';
+ }
+ FDBigInteger bigD0 = new FDBigInteger(iValue, digits, kDigits, nDigits);
+ exp = decExponent - nDigits;
+
+ int ieeeBits = Float.floatToRawIntBits(fValue); // IEEE-754 bits of float candidate
+ final int B5 = Math.max(0, -exp); // powers of 5 in bigB, value is not modified inside correctionLoop
+ final int D5 = Math.max(0, exp); // powers of 5 in bigD, value is not modified inside correctionLoop
+ bigD0 = bigD0.multByPow52(D5, 0);
+ bigD0.makeImmutable(); // prevent bigD0 modification inside correctionLoop
+ FDBigInteger bigD = null;
+ int prevD2 = 0;
+
+ correctionLoop:
+ while (true) {
+ // here ieeeBits can't be NaN, Infinity or zero
+ int binexp = ieeeBits >>> SINGLE_EXP_SHIFT;
+ int bigBbits = ieeeBits & FloatConsts.SIGNIF_BIT_MASK;
+ if (binexp > 0) {
+ bigBbits |= SINGLE_FRACT_HOB;
+ } else { // Normalize denormalized numbers.
+ assert bigBbits != 0 : bigBbits; // floatToBigInt(0.0)
+ int leadingZeros = Integer.numberOfLeadingZeros(bigBbits);
+ int shift = leadingZeros - (31 - SINGLE_EXP_SHIFT);
+ bigBbits <<= shift;
+ binexp = 1 - shift;
+ }
+ binexp -= FloatConsts.EXP_BIAS;
+ int lowOrderZeros = Integer.numberOfTrailingZeros(bigBbits);
+ bigBbits >>>= lowOrderZeros;
+ final int bigIntExp = binexp - SINGLE_EXP_SHIFT + lowOrderZeros;
+ final int bigIntNBits = SINGLE_EXP_SHIFT + 1 - lowOrderZeros;
+
+ //
+ // Scale bigD, bigB appropriately for
+ // big-integer operations.
+ // Naively, we multiply by powers of ten
+ // and powers of two. What we actually do
+ // is keep track of the powers of 5 and
+ // powers of 2 we would use, then factor out
+ // common divisors before doing the work.
+ //
+ int B2 = B5; // powers of 2 in bigB
+ int D2 = D5; // powers of 2 in bigD
+ int Ulp2; // powers of 2 in halfUlp.
+ if (bigIntExp >= 0) {
+ B2 += bigIntExp;
+ } else {
+ D2 -= bigIntExp;
+ }
+ Ulp2 = B2;
+ // shift bigB and bigD left by a number s. t.
+ // halfUlp is still an integer.
+ int hulpbias;
+ if (binexp <= -FloatConsts.EXP_BIAS) {
+ // This is going to be a denormalized number
+ // (if not actually zero).
+ // half an ULP is at 2^-(FloatConsts.EXP_BIAS+SINGLE_EXP_SHIFT+1)
+ hulpbias = binexp + lowOrderZeros + FloatConsts.EXP_BIAS;
+ } else {
+ hulpbias = 1 + lowOrderZeros;
+ }
+ B2 += hulpbias;
+ D2 += hulpbias;
+ // if there are common factors of 2, we might just as well
+ // factor them out, as they add nothing useful.
+ int common2 = Math.min(B2, Math.min(D2, Ulp2));
+ B2 -= common2;
+ D2 -= common2;
+ Ulp2 -= common2;
+ // do multiplications by powers of 5 and 2
+ FDBigInteger bigB = FDBigInteger.valueOfMulPow52(bigBbits, B5, B2);
+ if (bigD == null || prevD2 != D2) {
+ bigD = bigD0.leftShift(D2);
+ prevD2 = D2;
+ }
+ //
+ // to recap:
+ // bigB is the scaled-big-int version of our floating-point
+ // candidate.
+ // bigD is the scaled-big-int version of the exact value
+ // as we understand it.
+ // halfUlp is 1/2 an ulp of bigB, except for special cases
+ // of exact powers of 2
+ //
+ // the plan is to compare bigB with bigD, and if the difference
+ // is less than halfUlp, then we're satisfied. Otherwise,
+ // use the ratio of difference to halfUlp to calculate a fudge
+ // factor to add to the floating value, then go 'round again.
+ //
+ FDBigInteger diff;
+ int cmpResult;
+ boolean overvalue;
+ if ((cmpResult = bigB.cmp(bigD)) > 0) {
+ overvalue = true; // our candidate is too big.
+ diff = bigB.leftInplaceSub(bigD); // bigB is not user further - reuse
+ if ((bigIntNBits == 1) && (bigIntExp > -FloatConsts.EXP_BIAS + 1)) {
+ // candidate is a normalized exact power of 2 and
+ // is too big (larger than Float.MIN_NORMAL). We will be subtracting.
+ // For our purposes, ulp is the ulp of the
+ // next smaller range.
+ Ulp2 -= 1;
+ if (Ulp2 < 0) {
+ // rats. Cannot de-scale ulp this far.
+ // must scale diff in other direction.
+ Ulp2 = 0;
+ diff = diff.leftShift(1);
+ }
+ }
+ } else if (cmpResult < 0) {
+ overvalue = false; // our candidate is too small.
+ diff = bigD.rightInplaceSub(bigB); // bigB is not user further - reuse
+ } else {
+ // the candidate is exactly right!
+ // this happens with surprising frequency
+ break correctionLoop;
+ }
+ cmpResult = diff.cmpPow52(B5, Ulp2);
+ if ((cmpResult) < 0) {
+ // difference is small.
+ // this is close enough
+ break correctionLoop;
+ } else if (cmpResult == 0) {
+ // difference is exactly half an ULP
+ // round to some other value maybe, then finish
+ if ((ieeeBits & 1) != 0) { // half ties to even
+ ieeeBits += overvalue ? -1 : 1; // nextDown or nextUp
+ }
+ break correctionLoop;
+ } else {
+ // difference is non-trivial.
+ // could scale addend by ratio of difference to
+ // halfUlp here, if we bothered to compute that difference.
+ // Most of the time ( I hope ) it is about 1 anyway.
+ ieeeBits += overvalue ? -1 : 1; // nextDown or nextUp
+ if (ieeeBits == 0 || ieeeBits == FloatConsts.EXP_BIT_MASK) { // 0.0 or Float.POSITIVE_INFINITY
+ break correctionLoop; // oops. Fell off end of range.
+ }
+ continue; // try again.
+ }
+
+ }
+ if (isNegative) {
+ ieeeBits |= FloatConsts.SIGN_BIT_MASK;
+ }
+ return Float.intBitsToFloat(ieeeBits);
}
@@ -1935,32 +2043,6 @@
throw new NumberFormatException("For input string: \"" + in + "\"");
}
- /**
- * Rounds a double to a float.
- * In addition to the fraction bits of the double,
- * look at the class instance variable roundDir,
- * which should help us avoid double-rounding error.
- * roundDir was set in hardValueOf if the estimate was
- * close enough, but not exact. It tells us which direction
- * of rounding is preferred.
- */
- static float stickyRound( double dval, int roundDirection ){
- if(roundDirection!=0) {
- long lbits = Double.doubleToRawLongBits( dval );
- long binexp = lbits & DoubleConsts.EXP_BIT_MASK;
- if ( binexp == 0L || binexp == DoubleConsts.EXP_BIT_MASK ){
- // what we have here is special.
- // don't worry, the right thing will happen.
- return (float) dval;
- }
- lbits += (long)roundDirection; // hack-o-matic.
- return (float)Double.longBitsToDouble( lbits );
- } else {
- return (float)dval;
- }
- }
-
-
private static class HexFloatPattern {
/**
* Grammar is compatible with hexadecimal floating-point constants
@@ -2282,6 +2364,39 @@
// else all of string was seen, round and sticky are
// correct as false.
+ // Float calculations
+ int floatBits = isNegative ? FloatConsts.SIGN_BIT_MASK : 0;
+ if (exponent >= FloatConsts.MIN_EXPONENT) {
+ if (exponent > FloatConsts.MAX_EXPONENT) {
+ // Float.POSITIVE_INFINITY
+ floatBits |= FloatConsts.EXP_BIT_MASK;
+ } else {
+ int threshShift = DoubleConsts.SIGNIFICAND_WIDTH - FloatConsts.SIGNIFICAND_WIDTH - 1;
+ boolean floatSticky = (significand & ((1L << threshShift) - 1)) != 0 || round || sticky;
+ int iValue = (int) (significand >>> threshShift);
+ if ((iValue & 3) != 1 || floatSticky) {
+ iValue++;
+ }
+ floatBits |= (((((int) exponent) + (FloatConsts.EXP_BIAS - 1))) << SINGLE_EXP_SHIFT) + (iValue >> 1);
+ }
+ } else {
+ if (exponent < FloatConsts.MIN_SUB_EXPONENT - 1) {
+ // 0
+ } else {
+ // exponent == -127 ==> threshShift = 53 - 2 + (-149) - (-127) = 53 - 24
+ int threshShift = (int) ((DoubleConsts.SIGNIFICAND_WIDTH - 2 + FloatConsts.MIN_SUB_EXPONENT) - exponent);
+ assert threshShift >= DoubleConsts.SIGNIFICAND_WIDTH - FloatConsts.SIGNIFICAND_WIDTH;
+ assert threshShift < DoubleConsts.SIGNIFICAND_WIDTH;
+ boolean floatSticky = (significand & ((1L << threshShift) - 1)) != 0 || round || sticky;
+ int iValue = (int) (significand >>> threshShift);
+ if ((iValue & 3) != 1 || floatSticky) {
+ iValue++;
+ }
+ floatBits |= iValue >> 1;
+ }
+ }
+ float fValue = Float.intBitsToFloat(floatBits);
+
// Check for overflow and update exponent accordingly.
if (exponent > DoubleConsts.MAX_EXPONENT) { // Infinite result
// overflow to properly signed infinity
@@ -2390,87 +2505,7 @@
Double.longBitsToDouble(significand | DoubleConsts.SIGN_BIT_MASK) :
Double.longBitsToDouble(significand );
- int roundDir = 0;
- //
- // Set roundingDir variable field of fd properly so
- // that the input string can be properly rounded to a
- // float value. There are two cases to consider:
- //
- // 1. rounding to double discards sticky bit
- // information that would change the result of a float
- // rounding (near halfway case between two floats)
- //
- // 2. rounding to double rounds up when rounding up
- // would not occur when rounding to float.
- //
- // For former case only needs to be considered when
- // the bits rounded away when casting to float are all
- // zero; otherwise, float round bit is properly set
- // and sticky will already be true.
- //
- // The lower exponent bound for the code below is the
- // minimum (normalized) subnormal exponent - 1 since a
- // value with that exponent can round up to the
- // minimum subnormal value and the sticky bit
- // information must be preserved (i.e. case 1).
- //
- if ((exponent >= FloatConsts.MIN_SUB_EXPONENT - 1) &&
- (exponent <= FloatConsts.MAX_EXPONENT)) {
- // Outside above exponent range, the float value
- // will be zero or infinity.
-
- //
- // If the low-order 28 bits of a rounded double
- // significand are 0, the double could be a
- // half-way case for a rounding to float. If the
- // double value is a half-way case, the double
- // significand may have to be modified to round
- // the the right float value (see the stickyRound
- // method). If the rounding to double has lost
- // what would be float sticky bit information, the
- // double significand must be incremented. If the
- // double value's significand was itself
- // incremented, the float value may end up too
- // large so the increment should be undone.
- //
- if ((significand & 0xfffffffL) == 0x0L) {
- // For negative values, the sign of the
- // roundDir is the same as for positive values
- // since adding 1 increasing the significand's
- // magnitude and subtracting 1 decreases the
- // significand's magnitude. If neither round
- // nor sticky is true, the double value is
- // exact and no adjustment is required for a
- // proper float rounding.
- if (round || sticky) {
- if (leastZero) { // prerounding lsb is 0
- // If round and sticky were both true,
- // and the least significant
- // significand bit were 0, the rounded
- // significand would not have its
- // low-order bits be zero. Therefore,
- // we only need to adjust the
- // significand if round XOR sticky is
- // true.
- if (round ^ sticky) {
- roundDir = 1;
- }
- } else { // prerounding lsb is 1
- // If the prerounding lsb is 1 and the
- // resulting significand has its
- // low-order bits zero, the significand
- // was incremented. Here, we undo the
- // increment, which will ensure the
- // right guard and sticky bits for the
- // float rounding.
- if (round) {
- roundDir = -1;
- }
- }
- }
- }
- }
- return new PreparedASCIIToBinaryBuffer(value,roundDir);
+ return new PreparedASCIIToBinaryBuffer(value, fValue);
}
}
}
--- a/jdk/src/share/classes/sun/net/www/http/PosterOutputStream.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/net/www/http/PosterOutputStream.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -30,7 +30,7 @@
/**
* Instances of this class are returned to applications for the purpose of
- * sending user data for a HTTP POST or PUT request. This class is used
+ * sending user data for a HTTP request (excluding TRACE). This class is used
* when the content-length will be specified in the header of the request.
* The semantics of ByteArrayOutputStream are extended so that
* when close() is called, it is no longer possible to write
--- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Tue Jul 02 15:23:23 2013 -0700
@@ -1167,7 +1167,7 @@
/*
* Allowable input/output sequences:
- * [interpreted as POST/PUT]
+ * [interpreted as request entity]
* - get output, [write output,] get input, [read input]
* - get output, [write output]
* [interpreted as GET]
@@ -1209,9 +1209,8 @@
if (method.equals("GET")) {
method = "POST"; // Backward compatibility
}
- if (!"POST".equals(method) && !"PUT".equals(method) &&
- "http".equals(url.getProtocol())) {
- throw new ProtocolException("HTTP method " + method +
+ if ("TRACE".equals(method) && "http".equals(url.getProtocol())) {
+ throw new ProtocolException("HTTP method TRACE" +
" doesn't support output");
}
@@ -2807,9 +2806,10 @@
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
+
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
- if (cookieHandler == null)
+ if (cookieHandler == null || value.length() == 0)
return value;
sun.misc.JavaNetHttpCookieAccess access =
--- a/jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java Tue Jul 02 15:23:23 2013 -0700
@@ -38,6 +38,10 @@
public CGIClientException(String s) {
super(s);
}
+
+ public CGIClientException(String s, Throwable cause) {
+ super(s, cause);
+ }
}
/**
@@ -50,6 +54,10 @@
public CGIServerException(String s) {
super(s);
}
+
+ public CGIServerException(String s, Throwable cause) {
+ super(s, cause);
+ }
}
/**
@@ -148,13 +156,16 @@
try {
handler.execute(param);
} catch (CGIClientException e) {
+ e.printStackTrace();
returnClientError(e.getMessage());
} catch (CGIServerException e) {
+ e.printStackTrace();
returnServerError(e.getMessage());
}
else
returnClientError("invalid command.");
} catch (Exception e) {
+ e.printStackTrace();
returnServerError("internal error: " + e.getMessage());
}
System.exit(0);
@@ -225,7 +236,7 @@
try {
port = Integer.parseInt(param);
} catch (NumberFormatException e) {
- throw new CGIClientException("invalid port number.");
+ throw new CGIClientException("invalid port number.", e);
}
if (port <= 0 || port > 0xFFFF)
throw new CGIClientException("invalid port: " + port);
@@ -238,7 +249,7 @@
try {
socket = new Socket(InetAddress.getLocalHost(), port);
} catch (IOException e) {
- throw new CGIServerException("could not connect to local port");
+ throw new CGIServerException("could not connect to local port", e);
}
/*
@@ -249,9 +260,9 @@
try {
clientIn.readFully(buffer);
} catch (EOFException e) {
- throw new CGIClientException("unexpected EOF reading request body");
+ throw new CGIClientException("unexpected EOF reading request body", e);
} catch (IOException e) {
- throw new CGIClientException("error reading request body");
+ throw new CGIClientException("error reading request body", e);
}
/*
@@ -266,7 +277,7 @@
socketOut.write(buffer);
socketOut.flush();
} catch (IOException e) {
- throw new CGIServerException("error writing to server");
+ throw new CGIServerException("error writing to server", e);
}
/*
@@ -276,7 +287,7 @@
try {
socketIn = new DataInputStream(socket.getInputStream());
} catch (IOException e) {
- throw new CGIServerException("error reading from server");
+ throw new CGIServerException("error reading from server", e);
}
String key = "Content-length:".toLowerCase();
boolean contentLengthFound = false;
@@ -286,7 +297,7 @@
try {
line = getLine(socketIn);
} catch (IOException e) {
- throw new CGIServerException("error reading from server");
+ throw new CGIServerException("error reading from server", e);
}
if (line == null)
throw new CGIServerException(
@@ -313,9 +324,9 @@
socketIn.readFully(buffer);
} catch (EOFException e) {
throw new CGIServerException(
- "unexpected EOF reading server response");
+ "unexpected EOF reading server response", e);
} catch (IOException e) {
- throw new CGIServerException("error reading from server");
+ throw new CGIServerException("error reading from server", e);
}
/*
@@ -327,7 +338,7 @@
try {
System.out.write(buffer);
} catch (IOException e) {
- throw new CGIServerException("error writing response");
+ throw new CGIServerException("error writing response", e);
}
System.out.flush();
}
--- a/jdk/src/share/classes/sun/security/jgss/krb5/AcceptSecContextToken.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/AcceptSecContextToken.java Tue Jul 02 15:23:23 2013 -0700
@@ -27,9 +27,10 @@
import org.ietf.jgss.*;
import java.io.InputStream;
-import java.io.OutputStream;
import java.io.IOException;
-import java.io.ByteArrayInputStream;
+import java.security.AccessController;
+
+import sun.security.action.GetBooleanAction;
import sun.security.krb5.*;
class AcceptSecContextToken extends InitialToken {
@@ -42,23 +43,19 @@
*/
public AcceptSecContextToken(Krb5Context context,
KrbApReq apReq)
- throws KrbException, IOException {
+ throws KrbException, IOException, GSSException {
- /*
- * RFC 1964, section 1.2 states:
- * (1) context key: uses Kerberos session key (or subkey, if
- * present in authenticator emitted by context initiator) directly
- *
- * This does not mention context acceptor. Hence we will not
- * generate a subkey on the acceptor side. Note: Our initiator will
- * still allow another acceptor to generate a subkey, even though
- * our acceptor does not do so.
- */
- boolean useSubkey = false;
+ boolean useSubkey = AccessController.doPrivileged(
+ new GetBooleanAction("sun.security.krb5.acceptor.subkey"));
boolean useSequenceNumber = true;
- apRep = new KrbApRep(apReq, useSequenceNumber, useSubkey);
+ EncryptionKey subKey = null;
+ if (useSubkey) {
+ subKey = new EncryptionKey(apReq.getCreds().getSessionKey());
+ context.setKey(Krb5Context.ACCEPTOR_SUBKEY, subKey);
+ }
+ apRep = new KrbApRep(apReq, useSequenceNumber, subKey);
context.resetMySequenceNumber(apRep.getSeqNumber().intValue());
--- a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java Tue Jul 02 15:23:23 2013 -0700
@@ -297,9 +297,11 @@
/**
* Generates a sub-sessionkey from a given session key.
+ *
+ * Used in AcceptSecContextToken and KrbApReq by acceptor- and initiator-
+ * side respectively.
*/
- // Used in KrbApRep, KrbApReq
- EncryptionKey(EncryptionKey key) throws KrbCryptoException {
+ public EncryptionKey(EncryptionKey key) throws KrbCryptoException {
// generate random sub-session key
keyValue = Confounder.bytes(key.keyValue.length);
for (int i = 0; i < keyValue.length; i++) {
--- a/jdk/src/share/classes/sun/security/krb5/KdcComm.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/KdcComm.java Tue Jul 02 15:23:23 2013 -0700
@@ -46,6 +46,7 @@
import java.util.List;
import java.util.Set;
import java.util.HashSet;
+import java.util.Iterator;
import sun.security.krb5.internal.KRBError;
/**
@@ -203,7 +204,6 @@
if (obuf == null)
return null;
- Exception savedException = null;
Config cfg = Config.getInstance();
if (realm == null) {
@@ -218,42 +218,51 @@
if (kdcList == null) {
throw new KrbException("Cannot get kdc for realm " + realm);
}
- String tempKdc = null; // may include the port number also
- byte[] ibuf = null;
- for (String tmp: KdcAccessibility.list(kdcList)) {
- tempKdc = tmp;
- try {
- ibuf = send(obuf,tempKdc,useTCP);
- KRBError ke = null;
+ // tempKdc may include the port number also
+ Iterator<String> tempKdc = KdcAccessibility.list(kdcList).iterator();
+ if (!tempKdc.hasNext()) {
+ throw new KrbException("Cannot get kdc for realm " + realm);
+ }
+ try {
+ return sendIfPossible(obuf, tempKdc.next(), useTCP);
+ } catch(Exception first) {
+ while(tempKdc.hasNext()) {
try {
- ke = new KRBError(ibuf);
- } catch (Exception e) {
- // OK
- }
- if (ke != null && ke.getErrorCode() ==
- Krb5.KRB_ERR_RESPONSE_TOO_BIG) {
- ibuf = send(obuf, tempKdc, true);
- }
- KdcAccessibility.removeBad(tempKdc);
- break;
+ return sendIfPossible(obuf, tempKdc.next(), useTCP);
+ } catch(Exception ignore) {}
+ }
+ throw first;
+ }
+ }
+
+ // send the AS Request to the specified KDC
+ // failover to using TCP if useTCP is not set and response is too big
+ private byte[] sendIfPossible(byte[] obuf, String tempKdc, boolean useTCP)
+ throws IOException, KrbException {
+
+ try {
+ byte[] ibuf = send(obuf, tempKdc, useTCP);
+ KRBError ke = null;
+ try {
+ ke = new KRBError(ibuf);
} catch (Exception e) {
- if (DEBUG) {
- System.out.println(">>> KrbKdcReq send: error trying " +
- tempKdc);
- e.printStackTrace(System.out);
- }
- KdcAccessibility.addBad(tempKdc);
- savedException = e;
+ // OK
+ }
+ if (ke != null && ke.getErrorCode() ==
+ Krb5.KRB_ERR_RESPONSE_TOO_BIG) {
+ ibuf = send(obuf, tempKdc, true);
}
+ KdcAccessibility.removeBad(tempKdc);
+ return ibuf;
+ } catch(Exception e) {
+ if (DEBUG) {
+ System.out.println(">>> KrbKdcReq send: error trying " +
+ tempKdc);
+ e.printStackTrace(System.out);
+ }
+ KdcAccessibility.addBad(tempKdc);
+ throw e;
}
- if (ibuf == null && savedException != null) {
- if (savedException instanceof IOException) {
- throw (IOException) savedException;
- } else {
- throw (KrbException) savedException;
- }
- }
- return ibuf;
}
// send the AS Request to the specified KDC
@@ -496,7 +505,7 @@
}
// Returns a preferred KDC list by putting the bad ones at the end
- private static synchronized String[] list(String kdcList) {
+ private static synchronized List<String> list(String kdcList) {
StringTokenizer st = new StringTokenizer(kdcList);
List<String> list = new ArrayList<>();
if (badPolicy == BpType.TRY_LAST) {
@@ -515,7 +524,7 @@
list.add(st.nextToken());
}
}
- return list.toArray(new String[list.size()]);
+ return list;
}
}
}
--- a/jdk/src/share/classes/sun/security/krb5/KrbApRep.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/KrbApRep.java Tue Jul 02 15:23:23 2013 -0700
@@ -53,12 +53,10 @@
*/
// Used in AcceptSecContextToken
public KrbApRep(KrbApReq incomingReq,
- boolean useSeqNumber,
- boolean useSubKey) throws KrbException, IOException {
+ boolean useSeqNumber,
+ EncryptionKey subKey)
+ throws KrbException, IOException {
- EncryptionKey subKey =
- (useSubKey?
- new EncryptionKey(incomingReq.getCreds().getSessionKey()):null);
SeqNumber seqNum = new LocalSeqNumber();
init(incomingReq, subKey, seqNum);
--- a/jdk/src/share/classes/sun/security/krb5/KrbApReq.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/KrbApReq.java Tue Jul 02 15:23:23 2013 -0700
@@ -33,12 +33,14 @@
import sun.security.krb5.internal.*;
import sun.security.krb5.internal.crypto.*;
-import sun.security.krb5.internal.rcache.*;
import sun.security.jgss.krb5.Krb5AcceptCredential;
import java.net.InetAddress;
import sun.security.util.*;
import java.io.IOException;
import java.util.Arrays;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import sun.security.krb5.internal.rcache.AuthTimeWithHash;
/**
* This class encapsulates a KRB-AP-REQ that a client sends to a
@@ -53,11 +55,23 @@
private Credentials creds;
private APReq apReqMessg;
- private static CacheTable table = new CacheTable();
+ // Used by acceptor side
+ private static ReplayCache rcache = ReplayCache.getInstance();
private static boolean DEBUG = Krb5.DEBUG;
+ private static final char[] hexConst = "0123456789ABCDEF".toCharArray();
+
+ private static final MessageDigest md;
+
+ static {
+ try {
+ md = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException ex) {
+ throw new RuntimeException("Impossible");
+ }
+ }
/**
- * Contructs a AP-REQ message to send to the peer.
+ * Constructs an AP-REQ message to send to the peer.
* @param tgsCred the <code>Credentials</code> to be used to construct the
* AP Request protocol message.
* @param mutualRequired Whether mutual authentication is required
@@ -81,7 +95,7 @@
*/
/**
- * Contructs a AP-REQ message to send to the peer.
+ * Constructs an AP-REQ message to send to the peer.
* @param tgsCred the <code>Credentials</code> to be used to construct the
* AP Request protocol message.
* @param mutualRequired Whether mutual authentication is required
@@ -125,7 +139,7 @@
}
/**
- * Contructs a AP-REQ message from the bytes received from the
+ * Constructs an AP-REQ message from the bytes received from the
* peer.
* @param message The message received from the peer
* @param keys <code>EncrtyptionKey</code>s to decrypt the message;
@@ -146,7 +160,7 @@
}
/**
- * Contructs a AP-REQ message from the bytes received from the
+ * Constructs an AP-REQ message from the bytes received from the
* peer.
* @param value The <code>DerValue</code> that contains the
* DER enoded AP-REQ protocol message
@@ -297,15 +311,19 @@
if (!authenticator.ctime.inClockSkew())
throw new KrbApErrException(Krb5.KRB_AP_ERR_SKEW);
- // start to check if it is a replay attack.
- AuthTime time =
- new AuthTime(authenticator.ctime.getTime(), authenticator.cusec);
- String client = authenticator.cname.toString();
- if (table.get(time, authenticator.cname.toString()) != null) {
- throw new KrbApErrException(Krb5.KRB_AP_ERR_REPEAT);
- } else {
- table.put(client, time, System.currentTimeMillis());
+ byte[] hash = md.digest(apReqMessg.authenticator.cipher);
+ char[] h = new char[hash.length * 2];
+ for (int i=0; i<hash.length; i++) {
+ h[2*i] = hexConst[(hash[i]&0xff)>>4];
+ h[2*i+1] = hexConst[hash[i]&0xf];
}
+ AuthTimeWithHash time = new AuthTimeWithHash(
+ authenticator.cname.toString(),
+ apReqMessg.ticket.sname.toString(),
+ authenticator.ctime.getSeconds(),
+ authenticator.cusec,
+ new String(h));
+ rcache.checkAndStore(KerberosTime.now(), time);
if (initiator != null) {
// sender host address
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ReplayCache.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 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. 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.krb5.internal;
+
+import sun.security.action.GetPropertyAction;
+import sun.security.krb5.internal.rcache.AuthTimeWithHash;
+import sun.security.krb5.internal.rcache.MemoryCache;
+import sun.security.krb5.internal.rcache.DflCache;
+
+import java.security.AccessController;
+
+/**
+ * Models the replay cache of an acceptor as described in
+ * RFC 4120 3.2.3.
+ * @since 1.8
+ */
+public abstract class ReplayCache {
+ public static ReplayCache getInstance(String type) {
+ if (type == null) {
+ return new MemoryCache();
+ } else if (type.equals("dfl") || type.startsWith("dfl:")) {
+ return new DflCache(type);
+ } else if (type.equals("none")) {
+ return new ReplayCache() {
+ @Override
+ public void checkAndStore(KerberosTime currTime, AuthTimeWithHash time)
+ throws KrbApErrException {
+ // no check at all
+ }
+ };
+ } else {
+ throw new IllegalArgumentException("Unknown type: " + type);
+ }
+ }
+ public static ReplayCache getInstance() {
+ String type = AccessController.doPrivileged(
+ new GetPropertyAction("sun.security.krb5.rcache"));
+ return getInstance(type);
+ }
+
+ /**
+ * Accepts or rejects an AuthTime.
+ * @param currTime the current time
+ * @param time AuthTimeWithHash object calculated from authenticator
+ * @throws KrbApErrException if the authenticator is a replay
+ */
+ public abstract void checkAndStore(KerberosTime currTime, AuthTimeWithHash time)
+ throws KrbApErrException;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthList.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/*
+ *
+ * (C) Copyright IBM Corp. 1999 All Rights Reserved.
+ * Copyright 1997 The Open Group Research Institute. All rights reserved.
+ */
+
+package sun.security.krb5.internal.rcache;
+
+import sun.security.krb5.internal.Krb5;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.ListIterator;
+import sun.security.krb5.internal.KerberosTime;
+import sun.security.krb5.internal.KrbApErrException;
+
+/**
+ * This class provides an efficient caching mechanism to store AuthTimeWithHash
+ * from client authenticators. The cache minimizes the memory usage by doing
+ * 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
+ * common case a newcomer should be newer than the first element.
+ *
+ * @author Yanni Zhang
+ */
+public class AuthList {
+
+ private final LinkedList<AuthTimeWithHash> entries;
+ private final int lifespan;
+
+ /**
+ * Constructs a AuthList.
+ */
+ public AuthList(int lifespan) {
+ this.lifespan = lifespan;
+ entries = new LinkedList<>();
+ }
+
+ /**
+ * Puts the authenticator timestamp into the cache in descending order,
+ * and throw an exception if it's already there.
+ */
+ public void put(AuthTimeWithHash t, KerberosTime currentTime)
+ throws KrbApErrException {
+
+ if (entries.isEmpty()) {
+ entries.addFirst(t);
+ } else {
+ AuthTimeWithHash temp = entries.getFirst();
+ int cmp = temp.compareTo(t);
+ if (cmp < 0) {
+ // This is the most common case, newly received authenticator
+ // has larger timestamp.
+ entries.addFirst(t);
+ } else if (cmp == 0) {
+ throw new KrbApErrException(Krb5.KRB_AP_ERR_REPEAT);
+ } else {
+ //unless client clock being re-adjusted.
+ ListIterator<AuthTimeWithHash> it = entries.listIterator(1);
+ boolean found = false;
+ while (it.hasNext()) {
+ temp = it.next();
+ cmp = temp.compareTo(t);
+ if (cmp < 0) {
+ // Find an older one, put in front of it
+ entries.add(entries.indexOf(temp), t);
+ found = true;
+ break;
+ } else if (cmp == 0) {
+ throw new KrbApErrException(Krb5.KRB_AP_ERR_REPEAT);
+ }
+ }
+ if (!found) {
+ // All is newer than the newcomer. Sigh.
+ entries.addLast(t);
+ }
+ }
+ }
+
+ // let us cleanup while we are here
+ long timeLimit = currentTime.getSeconds() - lifespan;
+ ListIterator<AuthTimeWithHash> it = entries.listIterator(0);
+ AuthTimeWithHash temp = null;
+ int index = -1;
+ while (it.hasNext()) {
+ // search expired timestamps.
+ temp = it.next();
+ if (temp.ctime < timeLimit) {
+ index = entries.indexOf(temp);
+ break;
+ }
+ }
+ // It would be nice if LinkedList has a method called truncate(index).
+ if (index > -1) {
+ do {
+ // remove expired timestamps from the list.
+ entries.removeLast();
+ } while(entries.size() > index);
+ }
+ }
+
+ public boolean isEmpty() {
+ return entries.isEmpty();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ Iterator<AuthTimeWithHash> iter = entries.descendingIterator();
+ int pos = entries.size();
+ while (iter.hasNext()) {
+ AuthTimeWithHash at = iter.next();
+ sb.append('#').append(pos--).append(": ")
+ .append(at.toString()).append('\n');
+ }
+ return sb.toString();
+ }
+}
--- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthTime.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthTime.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 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
@@ -30,54 +31,126 @@
package sun.security.krb5.internal.rcache;
-import sun.security.krb5.internal.KerberosTime;
+import java.io.IOException;
+import java.nio.BufferUnderflowException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.charset.StandardCharsets;
+import java.util.StringTokenizer;
/**
- * The class represents the timestamp in authenticator.
+ * The class represents an old style replay cache entry. It is only used in
+ * a dfl file.
*
+ * @author Sun/Oracle
* @author Yanni Zhang
*/
public class AuthTime {
- long kerberosTime;
- int cusec;
+ final int ctime;
+ final int cusec;
+ final String client;
+ final String server;
+
+ /**
+ * Constructs an <code>AuthTime</code>.
+ */
+ public AuthTime(String client, String server,
+ int ctime, int cusec) {
+ this.ctime = ctime;
+ this.cusec = cusec;
+ this.client = client;
+ this.server = server;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%d/%06d/----/%s", ctime, cusec, client);
+ }
+
+ // Methods used when saved in a dfl file. See DflCache.java
/**
- * Constructs a new <code>AuthTime</code>.
- * @param time time from the <code>Authenticator</code>.
- * @param cusec microsecond field from the <code>Authenticator</code>.
+ * Reads an LC style string from a channel, which is a int32 length
+ * plus a UTF-8 encoded string possibly ends with \0.
+ * @throws IOException if there is a format error
+ * @throws BufferUnderflowException if goes beyond the end
*/
- public AuthTime(long time, int c) {
- kerberosTime = time;
- cusec = c;
+ private static String readStringWithLength(SeekableByteChannel chan)
+ throws IOException {
+ ByteBuffer bb = ByteBuffer.allocate(4);
+ bb.order(ByteOrder.nativeOrder());
+ chan.read(bb);
+ bb.flip();
+ int len = bb.getInt();
+ if (len > 1024) {
+ // Memory attack? The string should be fairly short.
+ throw new IOException("Invalid string length");
+ }
+ bb = ByteBuffer.allocate(len);
+ if (chan.read(bb) != len) {
+ throw new IOException("Not enough string");
+ }
+ byte[] data = bb.array();
+ return (data[len-1] == 0)?
+ new String(data, 0, len-1, StandardCharsets.UTF_8):
+ new String(data, StandardCharsets.UTF_8);
}
/**
- * Compares if an object equals to an <code>AuthTime</code> object.
- * @param o an object.
- * @return true if two objects are equivalent, otherwise, return false.
+ * Reads an AuthTime or AuthTimeWithHash object from a channel.
+ * @throws IOException if there is a format error
+ * @throws BufferUnderflowException if goes beyond the end
*/
- public boolean equals(Object o) {
- if (o instanceof AuthTime) {
- if ((((AuthTime)o).kerberosTime == kerberosTime)
- && (((AuthTime)o).cusec == cusec)) {
- return true;
+ public static AuthTime readFrom(SeekableByteChannel chan)
+ throws IOException {
+ String client = readStringWithLength(chan);
+ String server = readStringWithLength(chan);
+ ByteBuffer bb = ByteBuffer.allocate(8);
+ chan.read(bb);
+ bb.order(ByteOrder.nativeOrder());
+ int cusec = bb.getInt(0);
+ int ctime = bb.getInt(4);
+ if (client.isEmpty()) {
+ StringTokenizer st = new StringTokenizer(server, " :");
+ if (st.countTokens() != 6) {
+ throw new IOException("Incorrect rcache style");
}
+ st.nextToken();
+ String hash = st.nextToken();
+ st.nextToken();
+ client = st.nextToken();
+ st.nextToken();
+ server = st.nextToken();
+ return new AuthTimeWithHash(
+ client, server, ctime, cusec, hash);
+ } else {
+ return new AuthTime(
+ client, server, ctime, cusec);
}
- return false;
}
/**
- * Returns a hash code for this <code>AuthTime</code> object.
- *
- * @return a <code>hash code</code> value for this object.
+ * Encodes to be used in a dfl file
*/
- public int hashCode() {
- int result = 17;
-
- result = 37 * result + (int)(kerberosTime ^ (kerberosTime >>> 32));
- result = 37 * result + cusec;
-
- return result;
+ protected byte[] encode0(String cstring, String sstring) {
+ byte[] c = cstring.getBytes(StandardCharsets.UTF_8);;
+ byte[] s = sstring.getBytes(StandardCharsets.UTF_8);;
+ byte[] zero = new byte[1];
+ int len = 4 + c.length + 1 + 4 + s.length + 1 + 4 + 4;
+ ByteBuffer bb = ByteBuffer.allocate(len)
+ .order(ByteOrder.nativeOrder());
+ bb.putInt(c.length+1).put(c).put(zero)
+ .putInt(s.length+1).put(s).put(zero)
+ .putInt(cusec).putInt(ctime);
+ return bb.array();
}
+ /**
+ * Encodes to be used in a dfl file
+ * @param withHash useless here
+ */
+ public byte[] encode(boolean withHash) {
+ return encode0(client, server);
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthTimeWithHash.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 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. 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.krb5.internal.rcache;
+
+import java.util.Objects;
+
+/**
+ * The class represents a new style replay cache entry. It can be either used
+ * inside memory or in a dfl file.
+ */
+public class AuthTimeWithHash extends AuthTime
+ implements Comparable<AuthTimeWithHash> {
+
+ final String hash;
+
+ /**
+ * Constructs a new <code>AuthTimeWithHash</code>.
+ */
+ public AuthTimeWithHash(String client, String server,
+ int ctime, int cusec, String hash) {
+ super(client, server, ctime, cusec);
+ this.hash = hash;
+ }
+
+ /**
+ * Compares if an object equals to an <code>AuthTimeWithHash</code> object.
+ * @param o an object.
+ * @return true if two objects are equivalent, otherwise, return false.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof AuthTimeWithHash)) return false;
+ AuthTimeWithHash that = (AuthTimeWithHash)o;
+ return Objects.equals(hash, that.hash)
+ && Objects.equals(client, that.client)
+ && Objects.equals(server, that.server)
+ && ctime == that.ctime
+ && cusec == that.cusec;
+ }
+
+ /**
+ * Returns a hash code for this <code>AuthTimeWithHash</code> object.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(hash);
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%d/%06d/%s/%s", ctime, cusec, hash, client);
+ }
+
+ @Override
+ public int compareTo(AuthTimeWithHash other) {
+ int cmp = 0;
+ if (ctime != other.ctime) {
+ cmp = Integer.compare(ctime, other.ctime);
+ } else if (cusec != other.cusec) {
+ cmp = Integer.compare(cusec, other.cusec);
+ } else {
+ cmp = hash.compareTo(other.hash);
+ }
+ return cmp;
+ }
+
+ /**
+ * Compares with a possibly old style object. Used
+ * in DflCache$Storage#loadAndCheck.
+ * @return true if all AuthTime fields are the same
+ */
+ public boolean isSameIgnoresHash(AuthTime old) {
+ return client.equals(old.client) &&
+ server.equals(old.server) &&
+ ctime == old.ctime &&
+ cusec == old.cusec;
+ }
+
+ // Methods used when saved in a dfl file. See DflCache.java
+
+ /**
+ * Encodes to be used in a dfl file
+ * @param withHash write new style if true
+ */
+ @Override
+ public byte[] encode(boolean withHash) {
+ String cstring;
+ String sstring;
+ if (withHash) {
+ cstring = "";
+ sstring = String.format("HASH:%s %d:%s %d:%s", hash,
+ client.length(), client,
+ server.length(), server);
+ } else {
+ cstring = client;
+ sstring = server;
+ }
+ return encode0(cstring, sstring);
+ }
+}
--- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/CacheTable.java Tue Jul 02 15:20:55 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * 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.
- */
-
-/*
- *
- * (C) Copyright IBM Corp. 1999 All Rights Reserved.
- * Copyright 1997 The Open Group Research Institute. All rights reserved.
- */
-
-package sun.security.krb5.internal.rcache;
-
-import java.util.Hashtable;
-
-/**
- * This class implements Hashtable to store the replay caches.
- *
- * @author Yanni Zhang
- */
-public class CacheTable extends Hashtable<String,ReplayCache> {
-
- private static final long serialVersionUID = -4695501354546664910L;
-
- private boolean DEBUG = sun.security.krb5.internal.Krb5.DEBUG;
- public CacheTable () {
- }
-
- /**
- * Puts the client timestamp in replay cache.
- * @params principal the client's principal name.
- * @params time authenticator timestamp.
- */
- public synchronized void put(String principal, AuthTime time, long currTime) {
- ReplayCache rc = super.get(principal);
- if (rc == null) {
- if (DEBUG) {
- System.out.println("replay cache for " + principal + " is null.");
- }
- rc = new ReplayCache(principal, this);
- rc.put(time, currTime);
- if (!rc.isEmpty()) {
- super.put(principal, rc);
- }
- }
- else {
- rc.put(time, currTime);
- if (rc.isEmpty()) {
- super.remove(rc);
- }
- if (DEBUG) {
- System.out.println("replay cache found.");
- }
- }
-
- }
-
- /**
- * This method tests if replay cache keeps a record of the authenticator's time stamp.
- * If there is a record (replay attack detected), the server should reject the client request.
- * @params principal the client's principal name.
- * @params time authenticator timestamp.
- * @return null if no record found, else return an <code>AuthTime</code> object.
- */
- public Object get(AuthTime time, String principal) {
- ReplayCache rc = super.get(principal);
- if ((rc != null) && (rc.contains(time))) {
- return time;
- }
- return null;
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/DflCache.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 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. 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.krb5.internal.rcache;
+
+import java.io.*;
+import java.nio.BufferUnderflowException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.StandardOpenOption;
+import java.nio.file.attribute.PosixFilePermission;
+import java.security.AccessController;
+import java.util.*;
+
+import sun.security.action.GetPropertyAction;
+import sun.security.krb5.internal.KerberosTime;
+import sun.security.krb5.internal.Krb5;
+import sun.security.krb5.internal.KrbApErrException;
+import sun.security.krb5.internal.ReplayCache;
+
+
+/**
+ * A dfl file is used to sustores AuthTime entries when the system property
+ * sun.security.krb5.rcache is set to
+ *
+ * dfl(|:path/|:path/name|:name)
+ *
+ * The file will be path/name. If path is not given, it will be
+ *
+ * System.getProperty("java.io.tmpdir")
+ *
+ * If name is not given, it will be
+ *
+ * service_euid
+ *
+ * Java does not have a method to get euid, so uid is used instead. This
+ * should normally to be since a Java program is seldom used as a setuid app.
+ *
+ * The file has a header:
+ *
+ * i16 0x0501 (KRB5_RC_VNO) in network order
+ * i32 number of seconds for lifespan (in native order, same below)
+ *
+ * followed by cache entries concatenated, which can be encoded in
+ * 2 styles:
+ *
+ * The traditional style is:
+ *
+ * LC of client principal
+ * LC of server principal
+ * i32 cusec of Authenticator
+ * i32 ctime of Authenticator
+ *
+ * The new style has a hash:
+ *
+ * LC of ""
+ * LC of "HASH:%s %lu:%s %lu:%s" of (hash, clientlen, client, serverlen,
+ * server) where msghash is 32 char (lower case) text mode md5sum
+ * of the ciphertext of authenticator.
+ * i32 cusec of Authenticator
+ * i32 ctime of Authenticator
+ *
+ * where LC of a string means
+ *
+ * i32 strlen(string) + 1
+ * octets of string, with the \0x00 ending
+ *
+ * The old style block is always created by MIT krb5 used even if a new style
+ * is available, which means there can be 2 entries for a single Authenticator.
+ * Java also does this way.
+ *
+ * See src/lib/krb5/rcache/rc_io.c and src/lib/krb5/rcache/rc_dfl.c.
+ */
+public class DflCache extends ReplayCache {
+
+ private static final int KRB5_RV_VNO = 0x501;
+ private static final int EXCESSREPS = 30; // if missed-hit>this, recreate
+
+ private final String source;
+
+ private static int uid;
+ static {
+ try {
+ // Available on Solaris, Linux and Mac. Otherwise, no _euid suffix
+ Class<?> clazz = Class.forName("com.sun.security.auth.module.UnixSystem");
+ uid = (int)(long)(Long)
+ clazz.getMethod("getUid").invoke(clazz.newInstance());
+ } catch (Exception e) {
+ uid = -1;
+ }
+ }
+
+ public DflCache (String source) {
+ this.source = source;
+ }
+
+ private static String defaultPath() {
+ return AccessController.doPrivileged(
+ new GetPropertyAction("java.io.tmpdir"));
+ }
+
+ private static String defaultFile(String server) {
+ // service/host@REALM -> service
+ int slash = server.indexOf('/');
+ if (slash == -1) {
+ // A normal principal? say, dummy@REALM
+ slash = server.indexOf('@');
+ }
+ if (slash != -1) {
+ // Should not happen, but be careful
+ server= server.substring(0, slash);
+ }
+ if (uid != -1) {
+ server += "_" + uid;
+ }
+ return server;
+ }
+
+ private static Path getFileName(String source, String server) {
+ String path, file;
+ if (source.equals("dfl")) {
+ path = defaultPath();
+ file = defaultFile(server);
+ } else if (source.startsWith("dfl:")) {
+ source = source.substring(4);
+ int pos = source.lastIndexOf('/');
+ int pos1 = source.lastIndexOf('\\');
+ if (pos1 > pos) pos = pos1;
+ if (pos == -1) {
+ // Only file name
+ path = defaultPath();
+ file = source;
+ } else if (new File(source).isDirectory()) {
+ // Only path
+ path = source;
+ file = defaultFile(server);
+ } else {
+ // Full pathname
+ path = null;
+ file = source;
+ }
+ } else {
+ throw new IllegalArgumentException();
+ }
+ return new File(path, file).toPath();
+ }
+
+ @Override
+ public void checkAndStore(KerberosTime currTime, AuthTimeWithHash time)
+ throws KrbApErrException {
+ try {
+ checkAndStore0(currTime, time);
+ } catch (IOException ioe) {
+ KrbApErrException ke = new KrbApErrException(Krb5.KRB_ERR_GENERIC);
+ ke.initCause(ioe);
+ throw ke;
+ }
+ }
+
+ private synchronized void checkAndStore0(KerberosTime currTime, AuthTimeWithHash time)
+ throws IOException, KrbApErrException {
+ Path p = getFileName(source, time.server);
+ int missed = 0;
+ try (Storage s = new Storage()) {
+ try {
+ missed = s.loadAndCheck(p, time, currTime);
+ } catch (IOException ioe) {
+ // Non-existing or invalid file
+ Storage.create(p);
+ missed = s.loadAndCheck(p, time, currTime);
+ }
+ s.append(time);
+ }
+ if (missed > EXCESSREPS) {
+ Storage.expunge(p, currTime);
+ }
+ }
+
+
+ private static class Storage implements Closeable {
+ // Static methods
+ @SuppressWarnings("try")
+ private static void create(Path p) throws IOException {
+ try (SeekableByteChannel newChan = createNoClose(p)) {
+ // Do nothing, wait for close
+ }
+ makeMine(p);
+ }
+
+ private static void makeMine(Path p) throws IOException {
+ // chmod to owner-rw only, otherwise MIT krb5 rejects
+ try {
+ Set<PosixFilePermission> attrs = new HashSet<>();
+ attrs.add(PosixFilePermission.OWNER_READ);
+ attrs.add(PosixFilePermission.OWNER_WRITE);
+ Files.setPosixFilePermissions(p, attrs);
+ } catch (UnsupportedOperationException uoe) {
+ // No POSIX permission. That's OK.
+ }
+ }
+
+ private static SeekableByteChannel createNoClose(Path p)
+ throws IOException {
+ SeekableByteChannel newChan = Files.newByteChannel(
+ p, StandardOpenOption.CREATE,
+ StandardOpenOption.TRUNCATE_EXISTING,
+ StandardOpenOption.WRITE);
+ ByteBuffer buffer = ByteBuffer.allocate(6);
+ buffer.putShort((short)KRB5_RV_VNO);
+ buffer.order(ByteOrder.nativeOrder());
+ buffer.putInt(KerberosTime.getDefaultSkew());
+ buffer.flip();
+ newChan.write(buffer);
+ return newChan;
+ }
+
+ private static void expunge(Path p, KerberosTime currTime)
+ throws IOException {
+ Path p2 = Files.createTempFile(p.getParent(), "rcache", null);
+ try (SeekableByteChannel oldChan = Files.newByteChannel(p);
+ SeekableByteChannel newChan = createNoClose(p2)) {
+ long timeLimit = currTime.getSeconds() - readHeader(oldChan);
+ while (true) {
+ try {
+ AuthTime at = AuthTime.readFrom(oldChan);
+ if (at.ctime > timeLimit) {
+ ByteBuffer bb = ByteBuffer.wrap(at.encode(true));
+ newChan.write(bb);
+ }
+ } catch (BufferUnderflowException e) {
+ break;
+ }
+ }
+ }
+ makeMine(p2);
+ Files.move(p2, p,
+ StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.ATOMIC_MOVE);
+ }
+
+ // Instance methods
+ SeekableByteChannel chan;
+ private int loadAndCheck(Path p, AuthTimeWithHash time,
+ KerberosTime currTime)
+ throws IOException, KrbApErrException {
+ int missed = 0;
+ if (Files.isSymbolicLink(p)) {
+ throw new IOException("Symlink not accepted");
+ }
+ try {
+ Set<PosixFilePermission> perms =
+ Files.getPosixFilePermissions(p);
+ if (uid != -1 &&
+ (Integer)Files.getAttribute(p, "unix:uid") != uid) {
+ throw new IOException("Not mine");
+ }
+ if (perms.contains(PosixFilePermission.GROUP_READ) ||
+ perms.contains(PosixFilePermission.GROUP_WRITE) ||
+ perms.contains(PosixFilePermission.GROUP_EXECUTE) ||
+ perms.contains(PosixFilePermission.OTHERS_READ) ||
+ perms.contains(PosixFilePermission.OTHERS_WRITE) ||
+ perms.contains(PosixFilePermission.OTHERS_EXECUTE)) {
+ throw new IOException("Accessible by someone else");
+ }
+ } catch (UnsupportedOperationException uoe) {
+ // No POSIX permissions? Ignore it.
+ }
+ chan = Files.newByteChannel(p, StandardOpenOption.WRITE,
+ StandardOpenOption.READ);
+
+ long timeLimit = currTime.getSeconds() - readHeader(chan);
+
+ long pos = 0;
+ boolean seeNewButNotSame = false;
+ while (true) {
+ try {
+ pos = chan.position();
+ AuthTime a = AuthTime.readFrom(chan);
+ if (a instanceof AuthTimeWithHash) {
+ if (time.equals(a)) {
+ // Exact match, must be a replay
+ throw new KrbApErrException(Krb5.KRB_AP_ERR_REPEAT);
+ } else if (time.isSameIgnoresHash(a)) {
+ // Two different authenticators in the same second.
+ // Remember it
+ seeNewButNotSame = true;
+ }
+ } else {
+ if (time.isSameIgnoresHash(a)) {
+ // Two authenticators in the same second. Considered
+ // same if we haven't seen a new style version of it
+ if (!seeNewButNotSame) {
+ throw new KrbApErrException(Krb5.KRB_AP_ERR_REPEAT);
+ }
+ }
+ }
+ if (a.ctime < timeLimit) {
+ missed++;
+ } else {
+ missed--;
+ }
+ } catch (BufferUnderflowException e) {
+ // Half-written file?
+ chan.position(pos);
+ break;
+ }
+ }
+ return missed;
+ }
+
+ private static int readHeader(SeekableByteChannel chan)
+ throws IOException {
+ ByteBuffer bb = ByteBuffer.allocate(6);
+ chan.read(bb);
+ if (bb.getShort(0) != KRB5_RV_VNO) {
+ throw new IOException("Not correct rcache version");
+ }
+ bb.order(ByteOrder.nativeOrder());
+ return bb.getInt(2);
+ }
+
+ private void append(AuthTimeWithHash at) throws IOException {
+ // Write an entry with hash, to be followed by one without it,
+ // for the benefit of old implementations.
+ ByteBuffer bb;
+ bb = ByteBuffer.wrap(at.encode(true));
+ chan.write(bb);
+ bb = ByteBuffer.wrap(at.encode(false));
+ chan.write(bb);
+ }
+
+ @Override
+ public void close() throws IOException {
+ if (chan != null) chan.close();
+ chan = null;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/MemoryCache.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 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. 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.
+ */
+
+/*
+ *
+ * (C) Copyright IBM Corp. 1999 All Rights Reserved.
+ * Copyright 1997 The Open Group Research Institute. All rights reserved.
+ */
+
+package sun.security.krb5.internal.rcache;
+
+import java.util.*;
+import sun.security.krb5.internal.KerberosTime;
+import sun.security.krb5.internal.KrbApErrException;
+import sun.security.krb5.internal.ReplayCache;
+
+/**
+ * This class stores replay caches. AuthTimeWithHash objects are categorized
+ * into AuthLists keyed by the names of client and server.
+ *
+ * @author Yanni Zhang
+ */
+public class MemoryCache extends ReplayCache {
+
+ // TODO: One day we'll need to read dynamic krb5.conf.
+ private static final int lifespan = KerberosTime.getDefaultSkew();
+ private static final boolean DEBUG = sun.security.krb5.internal.Krb5.DEBUG;
+
+ private final Map<String,AuthList> content = new HashMap<>();
+
+ @Override
+ public synchronized void checkAndStore(KerberosTime currTime, AuthTimeWithHash time)
+ throws KrbApErrException {
+ String key = time.client + "|" + time.server;
+ AuthList rc = content.get(key);
+ if (DEBUG) {
+ System.out.println("MemoryCache: add " + time + " to " + key);
+ }
+ if (rc == null) {
+ rc = new AuthList(lifespan);
+ rc.put(time, currTime);
+ if (!rc.isEmpty()) {
+ content.put(key, rc);
+ }
+ } else {
+ if (DEBUG) {
+ System.out.println("MemoryCache: Existing AuthList:\n" + rc);
+ }
+ rc.put(time, currTime);
+ if (rc.isEmpty()) {
+ content.remove(key);
+ }
+ }
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ for (AuthList rc: content.values()) {
+ sb.append(rc.toString());
+ }
+ return sb.toString();
+ }
+}
--- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/ReplayCache.java Tue Jul 02 15:20:55 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- */
-
-/*
- *
- * (C) Copyright IBM Corp. 1999 All Rights Reserved.
- * Copyright 1997 The Open Group Research Institute. All rights reserved.
- */
-
-package sun.security.krb5.internal.rcache;
-
-import sun.security.krb5.internal.Krb5;
-import java.util.LinkedList;
-import java.util.ListIterator;
-import sun.security.krb5.internal.KerberosTime;
-
-/**
- * This class provides an efficient caching mechanism to store the timestamp of client authenticators.
- * The cache minimizes the memory usage by doing self-cleanup of expired items in the cache.
- *
- * @author Yanni Zhang
- */
-public class ReplayCache extends LinkedList<AuthTime> {
-
- private static final long serialVersionUID = 2997933194993803994L;
-
- // These 3 fields are now useless, keep for serialization compatibility
- private String principal;
- private CacheTable table;
- private int nap = 10 * 60 * 1000; //10 minutes break
-
- private boolean DEBUG = Krb5.DEBUG;
-
- /**
- * Constructs a ReplayCache for a client principal in specified <code>CacheTable</code>.
- * @param p client principal name.
- * @param ct CacheTable.
- */
- public ReplayCache (String p, CacheTable ct) {
- principal = p;
- table = ct;
- }
-
- /**
- * Puts the authenticator timestamp into the cache in descending order.
- * @param t <code>AuthTime</code>
- */
- public synchronized void put(AuthTime t, long currentTime) {
-
- if (this.size() == 0) {
- addFirst(t);
- }
- else {
- AuthTime temp = getFirst();
- if (temp.kerberosTime < t.kerberosTime) {
- // in most cases, newly received authenticator has
- // larger timestamp.
- addFirst(t);
- }
- else if (temp.kerberosTime == t.kerberosTime) {
- if (temp.cusec < t.cusec) {
- addFirst(t);
- }
- }
- else {
- //unless client clock being re-adjusted.
- ListIterator<AuthTime> it = listIterator(1);
- while (it.hasNext()) {
- temp = it.next();
- if (temp.kerberosTime < t.kerberosTime) {
- add(indexOf(temp), t);
- break;
- //we always put the bigger timestamp at the front.
- }
- else if (temp.kerberosTime == t.kerberosTime) {
- if (temp.cusec < t.cusec) {
- add(indexOf(temp), t);
- break;
- }
- }
- }
- }
- }
-
- // let us cleanup while we are here
- long timeLimit = currentTime - KerberosTime.getDefaultSkew() * 1000L;
- ListIterator<AuthTime> it = listIterator(0);
- AuthTime temp = null;
- int index = -1;
- while (it.hasNext()) {
- //search expired timestamps.
- temp = it.next();
- if (temp.kerberosTime < timeLimit) {
- index = indexOf(temp);
- break;
- }
- }
- if (index > -1) {
- do {
- //remove expired timestamps from the list.
- removeLast();
- } while(size() > index);
- }
- if (DEBUG) {
- printList();
- }
- }
-
-
- /**
- * Prints out the debug message.
- */
- private void printList() {
- Object[] total = toArray();
- for (int i = 0; i < total.length; i++) {
- System.out.println("object " + i + ": " + ((AuthTime)total[i]).kerberosTime + "/"
- + ((AuthTime)total[i]).cusec);
- }
- }
-
-}
--- a/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java Tue Jul 02 15:23:23 2013 -0700
@@ -675,8 +675,12 @@
responderURI, respCert, params.date(),
ocspExtensions);
}
- } catch (IOException e) {
- throw new CertPathValidatorException(e);
+ } catch (Exception e) {
+ if (e instanceof CertPathValidatorException) {
+ throw (CertPathValidatorException) e;
+ } else {
+ throw new CertPathValidatorException(e);
+ }
}
RevocationStatus rs =
--- a/jdk/src/share/classes/sun/security/ssl/Handshaker.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/Handshaker.java Tue Jul 02 15:23:23 2013 -0700
@@ -187,14 +187,14 @@
"sun.security.ssl.allowLegacyHelloMessages", true);
// To prevent the TLS renegotiation issues, by setting system property
- // "jdk.tls.rejectClientInitializedRenego" to true, applications in server
- // side can disable all client initiated SSL renegotiations regardless
- // of the support of TLS protocols.
+ // "jdk.tls.rejectClientInitiatedRenegotiation" to true, applications in
+ // server side can disable all client initiated SSL renegotiations
+ // regardless of the support of TLS protocols.
//
// By default, allow client initiated renegotiations.
static final boolean rejectClientInitiatedRenego =
Debug.getBooleanProperty(
- "jdk.tls.rejectClientInitializedRenego", false);
+ "jdk.tls.rejectClientInitiatedRenegotiation", false);
// need to dispose the object when it is invalidated
boolean invalidated;
--- a/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java Tue Jul 02 15:23:23 2013 -0700
@@ -281,7 +281,15 @@
// Reject client initiated renegotiation?
//
- // Should not have any impact on server initiated renegotiation.
+ // If server side should reject client-initiated renegotiation,
+ // send an alert_handshake_failure fatal alert, not a no_renegotiation
+ // warning alert (no_renegotiation must be a warning: RFC 2246).
+ // no_renegotiation might seem more natural at first, but warnings
+ // are not appropriate because the sending party does not know how
+ // the receiving party will behave. This state must be treated as
+ // a fatal server condition.
+ //
+ // This will not have any impact on server initiated renegotiation.
if (rejectClientInitiatedRenego && !isInitialHandshake &&
state != HandshakeMessage.ht_hello_request) {
fatalSE(Alerts.alert_handshake_failure,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/resources/pt/CalendarData_pt_BR.properties Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 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. 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.
+#
+
+# (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
+# (C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved
+#
+# The original version of this source code and documentation
+# is copyrighted and owned by Taligent, Inc., a wholly-owned
+# subsidiary of IBM. These materials are provided under terms
+# of a License Agreement between Taligent and Sun. This technology
+# is protected by multiple US and International patents.
+#
+# This notice and attribution to Taligent may not be removed.
+# Taligent is a registered trademark of Taligent, Inc.
+
+
+firstDayOfWeek=1
+minimalDaysInFirstWeek=1
--- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c Tue Jul 02 15:23:23 2013 -0700
@@ -43,7 +43,14 @@
#ifndef SO_BSDCOMPAT
#define SO_BSDCOMPAT 14
#endif
+/**
+ * IP_MULTICAST_ALL has been supported since kernel version 2.6.31
+ * but we may be building on a machine that is older than that.
+ */
+#ifndef IP_MULTICAST_ALL
+#define IP_MULTICAST_ALL 49
#endif
+#endif // __linux__
#ifndef IPTOS_TOS_MASK
#define IPTOS_TOS_MASK 0x1e
@@ -980,6 +987,18 @@
setsockopt(fd, SOL_SOCKET, SO_BROADCAST, (char*) &t, sizeof(int));
+#if defined(__linux__)
+ arg = 0;
+ int level = (domain == AF_INET6) ? IPPROTO_IPV6 : IPPROTO_IP;
+ if ((setsockopt(fd, level, IP_MULTICAST_ALL, (char*)&arg, sizeof(arg)) < 0) &&
+ (errno != ENOPROTOOPT)) {
+ JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
+ strerror(errno));
+ close(fd);
+ return;
+ }
+#endif
+
#if defined (__linux__) && defined (AF_INET6)
/*
* On Linux for IPv6 sockets we must set the hop limit
--- a/jdk/src/solaris/native/sun/nio/ch/Net.c Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/solaris/native/sun/nio/ch/Net.c Tue Jul 02 15:23:23 2013 -0700
@@ -40,6 +40,17 @@
#include "nio.h"
#include "sun_nio_ch_PollArrayWrapper.h"
+
+/**
+ * IP_MULTICAST_ALL supported since 2.6.31 but may not be available at
+ * build time.
+ */
+#ifdef __linux__
+ #ifndef IP_MULTICAST_ALL
+ #define IP_MULTICAST_ALL 49
+ #endif
+#endif
+
#ifdef _ALLBSD_SOURCE
#ifndef IP_BLOCK_SOURCE
@@ -175,7 +186,7 @@
sizeof(int)) < 0) {
JNU_ThrowByNameWithLastError(env,
JNU_JAVANETPKG "SocketException",
- "sun.nio.ch.Net.setIntOption");
+ "Unable to set IPV6_V6ONLY");
close(fd);
return -1;
}
@@ -188,11 +199,27 @@
sizeof(arg)) < 0) {
JNU_ThrowByNameWithLastError(env,
JNU_JAVANETPKG "SocketException",
- "sun.nio.ch.Net.setIntOption");
+ "Unable to set SO_REUSEADDR");
close(fd);
return -1;
}
}
+
+#if defined(__linux__)
+ if (type == SOCK_DGRAM) {
+ int arg = 0;
+ int level = (domain == AF_INET6) ? IPPROTO_IPV6 : IPPROTO_IP;
+ if ((setsockopt(fd, level, IP_MULTICAST_ALL, (char*)&arg, sizeof(arg)) < 0) &&
+ (errno != ENOPROTOOPT)) {
+ JNU_ThrowByNameWithLastError(env,
+ JNU_JAVANETPKG "SocketException",
+ "Unable to set IP_MULTICAST_ALL");
+ close(fd);
+ return -1;
+ }
+ }
+#endif
+
#if defined(__linux__) && defined(AF_INET6)
/* By default, Linux uses the route default */
if (domain == AF_INET6 && type == SOCK_DGRAM) {
@@ -201,7 +228,7 @@
sizeof(arg)) < 0) {
JNU_ThrowByNameWithLastError(env,
JNU_JAVANETPKG "SocketException",
- "sun.nio.ch.Net.setIntOption");
+ "Unable to set IPV6_MULTICAST_HOPS");
close(fd);
return -1;
}
@@ -646,7 +673,7 @@
return pfd.revents;
} else if (errno == EINTR) {
return IOS_INTERRUPTED;
- } else if (rv < 0) {
+ } else {
handleSocketError(env, errno);
return IOS_THROWN;
}
--- a/jdk/src/windows/native/java/net/DualStackPlainSocketImpl.c Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/src/windows/native/java/net/DualStackPlainSocketImpl.c Tue Jul 02 15:23:23 2013 -0700
@@ -43,6 +43,7 @@
(JNIEnv *env, jclass clazz) {
jclass cls = (*env)->FindClass(env, "java/net/InetSocketAddress");
+ CHECK_NULL(cls);
isa_class = (*env)->NewGlobalRef(env, cls);
isa_ctorID = (*env)->GetMethodID(env, cls, "<init>",
"(Ljava/net/InetAddress;I)V");
--- a/jdk/test/TEST.ROOT Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/TEST.ROOT Tue Jul 02 15:23:23 2013 -0700
@@ -1,6 +1,5 @@
# This file identifies the root of the test-suite hierarchy.
# It also contains test-suite configuration information.
-# DO NOT EDIT without first contacting jdk-regtest@sun.com.
# The list of keywords supported in the entire test suite
keys=2d dnd i18n
@@ -9,4 +8,4 @@
othervm.dirs=java/awt java/beans java/rmi javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces sun/rmi
# Tests that cannot run concurrently
-exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi
+exclusiveAccess.dirs=java/rmi/Naming java/util/Currency java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi
--- a/jdk/test/java/lang/Double/ParseDouble.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/lang/Double/ParseDouble.java Tue Jul 02 15:23:23 2013 -0700
@@ -23,20 +23,106 @@
/*
* @test
- * @bug 4160406 4705734 4707389 4826774 4895911 4421494 7021568 7039369
+ * @bug 4160406 4705734 4707389 4826774 4895911 4421494 6358355 7021568 7039369 4396272
* @summary Test for Double.parseDouble method and acceptance regex
*/
+import java.math.BigDecimal;
+import java.math.BigInteger;
import java.util.regex.*;
-import java.math.BigDecimal;
public class ParseDouble {
+ private static final BigDecimal HALF = BigDecimal.valueOf(0.5);
+
+ private static void fail(String val, double n) {
+ throw new RuntimeException("Double.parseDouble failed. String:" +
+ val + " Result:" + n);
+ }
+
+ private static void check(String val) {
+ double n = Double.parseDouble(val);
+ boolean isNegativeN = n < 0 || n == 0 && 1/n < 0;
+ double na = Math.abs(n);
+ String s = val.trim().toLowerCase();
+ switch (s.charAt(s.length() - 1)) {
+ case 'd':
+ case 'f':
+ s = s.substring(0, s.length() - 1);
+ break;
+ }
+ boolean isNegative = false;
+ if (s.charAt(0) == '+') {
+ s = s.substring(1);
+ } else if (s.charAt(0) == '-') {
+ s = s.substring(1);
+ isNegative = true;
+ }
+ if (s.equals("nan")) {
+ if (!Double.isNaN(n)) {
+ fail(val, n);
+ }
+ return;
+ }
+ if (Double.isNaN(n)) {
+ fail(val, n);
+ }
+ if (isNegativeN != isNegative)
+ fail(val, n);
+ if (s.equals("infinity")) {
+ if (na != Double.POSITIVE_INFINITY) {
+ fail(val, n);
+ }
+ return;
+ }
+ BigDecimal bd;
+ if (s.startsWith("0x")) {
+ s = s.substring(2);
+ int indP = s.indexOf('p');
+ long exp = Long.parseLong(s.substring(indP + 1));
+ int indD = s.indexOf('.');
+ String significand;
+ if (indD >= 0) {
+ significand = s.substring(0, indD) + s.substring(indD + 1, indP);
+ exp -= 4*(indP - indD - 1);
+ } else {
+ significand = s.substring(0, indP);
+ }
+ bd = new BigDecimal(new BigInteger(significand, 16));
+ if (exp >= 0) {
+ bd = bd.multiply(BigDecimal.valueOf(2).pow((int)exp));
+ } else {
+ bd = bd.divide(BigDecimal.valueOf(2).pow((int)-exp));
+ }
+ } else {
+ bd = new BigDecimal(s);
+ }
+ BigDecimal l, u;
+ if (Double.isInfinite(na)) {
+ l = new BigDecimal(Double.MAX_VALUE).add(new BigDecimal(Math.ulp(Double.MAX_VALUE)).multiply(HALF));
+ u = null;
+ } else {
+ l = new BigDecimal(na).subtract(new BigDecimal(Math.ulp(Math.nextUp(-na))).multiply(HALF));
+ u = new BigDecimal(na).add(new BigDecimal(Math.ulp(n)).multiply(HALF));
+ }
+ int cmpL = bd.compareTo(l);
+ int cmpU = u != null ? bd.compareTo(u) : -1;
+ if ((Double.doubleToLongBits(n) & 1) != 0) {
+ if (cmpL <= 0 || cmpU >= 0) {
+ fail(val, n);
+ }
+ } else {
+ if (cmpL < 0 || cmpU > 0) {
+ fail(val, n);
+ }
+ }
+ }
+
private static void check(String val, double expected) {
double n = Double.parseDouble(val);
if (n != expected)
- throw new RuntimeException("Double.parseDouble failed. String:" +
- val + " Result:" + n);
+ fail(val, n);
+ check(val);
}
private static void rudimentaryTest() {
@@ -460,6 +546,7 @@
try {
d = Double.parseDouble(input[i]);
+ check(input[i]);
}
catch (NumberFormatException e) {
if (! exceptionalInput) {
@@ -560,12 +647,13 @@
* region that should convert to that value.
*/
private static void testSubnormalPowers() {
+ boolean failed = false;
BigDecimal TWO = BigDecimal.valueOf(2);
// An ulp is the same for all subnormal values
BigDecimal ulp_BD = new BigDecimal(Double.MIN_VALUE);
- // Test subnormal powers of two
- for(int i = -1074; i <= -1022; i++) {
+ // Test subnormal powers of two (except Double.MIN_VALUE)
+ for(int i = -1073; i <= -1022; i++) {
double d = Math.scalb(1.0, i);
/*
@@ -578,17 +666,69 @@
double convertedLowerBound = Double.parseDouble(lowerBound.toString());
double convertedUpperBound = Double.parseDouble(upperBound.toString());
+ if (convertedLowerBound != d) {
+ failed = true;
+ System.out.printf("2^%d lowerBound converts as %a %s%n",
+ i, convertedLowerBound, lowerBound);
+ }
+ if (convertedUpperBound != d) {
+ failed = true;
+ System.out.printf("2^%d upperBound converts as %a %s%n",
+ i, convertedUpperBound, upperBound);
+ }
}
+ /*
+ * Double.MIN_VALUE
+ * The region ]0.5*Double.MIN_VALUE, 1.5*Double.MIN_VALUE[ should round to Double.MIN_VALUE .
+ */
+ BigDecimal minValue = new BigDecimal(Double.MIN_VALUE);
+ if (Double.parseDouble(minValue.multiply(new BigDecimal(0.5)).toString()) != 0.0) {
+ failed = true;
+ System.out.printf("0.5*MIN_VALUE doesn't convert 0%n");
+ }
+ if (Double.parseDouble(minValue.multiply(new BigDecimal(0.50000000001)).toString()) != Double.MIN_VALUE) {
+ failed = true;
+ System.out.printf("0.50000000001*MIN_VALUE doesn't convert to MIN_VALUE%n");
+ }
+ if (Double.parseDouble(minValue.multiply(new BigDecimal(1.49999999999)).toString()) != Double.MIN_VALUE) {
+ failed = true;
+ System.out.printf("1.49999999999*MIN_VALUE doesn't convert to MIN_VALUE%n");
+ }
+ if (Double.parseDouble(minValue.multiply(new BigDecimal(1.5)).toString()) != 2*Double.MIN_VALUE) {
+ failed = true;
+ System.out.printf("1.5*MIN_VALUE doesn't convert to 2*MIN_VALUE%n");
+ }
+
+ if (failed)
+ throw new RuntimeException("Inconsistent conversion");
}
+ /**
+ * For each power of two, test at boundaries of
+ * region that should convert to that value.
+ */
+ private static void testPowers() {
+ for(int i = -1074; i <= +1023; i++) {
+ double d = Math.scalb(1.0, i);
+ BigDecimal d_BD = new BigDecimal(d);
+
+ BigDecimal lowerBound = d_BD.subtract(new BigDecimal(Math.ulp(Math.nextUp(-d))).multiply(HALF));
+ BigDecimal upperBound = d_BD.add(new BigDecimal(Math.ulp(d)).multiply(HALF));
+
+ check(lowerBound.toString());
+ check(upperBound.toString());
+ }
+ check(new BigDecimal(Double.MAX_VALUE).add(new BigDecimal(Math.ulp(Double.MAX_VALUE)).multiply(HALF)).toString());
+ }
private static void testStrictness() {
- final double expected = 0x0.0000008000001p-1022;
+ final double expected = 0x0.0000008000000p-1022;
+// final double expected = 0x0.0000008000001p-1022;
boolean failed = false;
double conversion = 0.0;
double sum = 0.0; // Prevent conversion from being optimized away
- //2^-1047 + 2^-1075
+ //2^-1047 + 2^-1075 rounds to 2^-1047
String decimal = "6.631236871469758276785396630275967243399099947355303144249971758736286630139265439618068200788048744105960420552601852889715006376325666595539603330361800519107591783233358492337208057849499360899425128640718856616503093444922854759159988160304439909868291973931426625698663157749836252274523485312442358651207051292453083278116143932569727918709786004497872322193856150225415211997283078496319412124640111777216148110752815101775295719811974338451936095907419622417538473679495148632480391435931767981122396703443803335529756003353209830071832230689201383015598792184172909927924176339315507402234836120730914783168400715462440053817592702766213559042115986763819482654128770595766806872783349146967171293949598850675682115696218943412532098591327667236328125E-316";
for(int i = 0; i <= 12_000; i++) {
@@ -620,6 +760,7 @@
testRegex(paddedBadStrings, true);
testSubnormalPowers();
+ testPowers();
testStrictness();
}
}
--- a/jdk/test/java/lang/Float/ParseFloat.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/lang/Float/ParseFloat.java Tue Jul 02 15:23:23 2013 -0700
@@ -23,17 +23,105 @@
/*
* @test
- * @bug 4160406 4705734 4707389
+ * @bug 4160406 4705734 4707389 6358355 7032154
* @summary Tests for Float.parseFloat method
*/
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
public class ParseFloat {
+ private static final BigDecimal HALF = BigDecimal.valueOf(0.5);
+
+ private static void fail(String val, float n) {
+ throw new RuntimeException("Float.parseFloat failed. String:" +
+ val + " Result:" + n);
+ }
+
+ private static void check(String val) {
+ float n = Float.parseFloat(val);
+ boolean isNegativeN = n < 0 || n == 0 && 1/n < 0;
+ float na = Math.abs(n);
+ String s = val.trim().toLowerCase();
+ switch (s.charAt(s.length() - 1)) {
+ case 'd':
+ case 'f':
+ s = s.substring(0, s.length() - 1);
+ break;
+ }
+ boolean isNegative = false;
+ if (s.charAt(0) == '+') {
+ s = s.substring(1);
+ } else if (s.charAt(0) == '-') {
+ s = s.substring(1);
+ isNegative = true;
+ }
+ if (s.equals("nan")) {
+ if (!Float.isNaN(n)) {
+ fail(val, n);
+ }
+ return;
+ }
+ if (Float.isNaN(n)) {
+ fail(val, n);
+ }
+ if (isNegativeN != isNegative)
+ fail(val, n);
+ if (s.equals("infinity")) {
+ if (na != Float.POSITIVE_INFINITY) {
+ fail(val, n);
+ }
+ return;
+ }
+ BigDecimal bd;
+ if (s.startsWith("0x")) {
+ s = s.substring(2);
+ int indP = s.indexOf('p');
+ long exp = Long.parseLong(s.substring(indP + 1));
+ int indD = s.indexOf('.');
+ String significand;
+ if (indD >= 0) {
+ significand = s.substring(0, indD) + s.substring(indD + 1, indP);
+ exp -= 4*(indP - indD - 1);
+ } else {
+ significand = s.substring(0, indP);
+ }
+ bd = new BigDecimal(new BigInteger(significand, 16));
+ if (exp >= 0) {
+ bd = bd.multiply(BigDecimal.valueOf(2).pow((int)exp));
+ } else {
+ bd = bd.divide(BigDecimal.valueOf(2).pow((int)-exp));
+ }
+ } else {
+ bd = new BigDecimal(s);
+ }
+ BigDecimal l, u;
+ if (Float.isInfinite(na)) {
+ l = new BigDecimal(Float.MAX_VALUE).add(new BigDecimal(Math.ulp(Float.MAX_VALUE)).multiply(HALF));
+ u = null;
+ } else {
+ l = new BigDecimal(na).subtract(new BigDecimal(Math.ulp(-Math.nextUp(-na))).multiply(HALF));
+ u = new BigDecimal(na).add(new BigDecimal(Math.ulp(n)).multiply(HALF));
+ }
+ int cmpL = bd.compareTo(l);
+ int cmpU = u != null ? bd.compareTo(u) : -1;
+ if ((Float.floatToIntBits(n) & 1) != 0) {
+ if (cmpL <= 0 || cmpU >= 0) {
+ fail(val, n);
+ }
+ } else {
+ if (cmpL < 0 || cmpU > 0) {
+ fail(val, n);
+ }
+ }
+ }
+
private static void check(String val, float expected) {
float n = Float.parseFloat(val);
if (n != expected)
- throw new RuntimeException("Float.parseFloat failed. String:" +
- val + " Result:" + n);
+ fail(val, n);
+ check(val);
}
private static void rudimentaryTest() {
@@ -47,6 +135,17 @@
check("-10", (float) -10.0);
check("-10.00", (float) -10.0);
check("-10.01", (float) -10.01);
+
+ // bug 6358355
+ check("144115196665790480", 0x1.000002p57f);
+ check("144115196665790481", 0x1.000002p57f);
+ check("0.050000002607703203", 0.05f);
+ check("0.050000002607703204", 0.05f);
+ check("0.050000002607703205", 0.05f);
+ check("0.050000002607703206", 0.05f);
+ check("0.050000002607703207", 0.05f);
+ check("0.050000002607703208", 0.05f);
+ check("0.050000002607703209", 0.050000004f);
}
static String badStrings[] = {
@@ -182,6 +281,7 @@
try {
d = Float.parseFloat(input[i]);
+ check(input[i]);
}
catch (NumberFormatException e) {
if (! exceptionalInput) {
@@ -199,6 +299,24 @@
}
}
+ /**
+ * For each power of two, test at boundaries of
+ * region that should convert to that value.
+ */
+ private static void testPowers() {
+ for(int i = -149; i <= +127; i++) {
+ float f = Math.scalb(1.0f, i);
+ BigDecimal f_BD = new BigDecimal(f);
+
+ BigDecimal lowerBound = f_BD.subtract(new BigDecimal(Math.ulp(-Math.nextUp(-f))).multiply(HALF));
+ BigDecimal upperBound = f_BD.add(new BigDecimal(Math.ulp(f)).multiply(HALF));
+
+ check(lowerBound.toString());
+ check(upperBound.toString());
+ }
+ check(new BigDecimal(Float.MAX_VALUE).add(new BigDecimal(Math.ulp(Float.MAX_VALUE)).multiply(HALF)).toString());
+ }
+
public static void main(String[] args) throws Exception {
rudimentaryTest();
@@ -206,5 +324,7 @@
testParsing(paddedGoodStrings, false);
testParsing(badStrings, true);
testParsing(paddedBadStrings, true);
+
+ testPowers();
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/lambda/LambdaConstructorMethodHandleUnbox.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 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.
+ */
+
+/*
+ * @test
+ * @bug 8016761
+ * @summary Lambda metafactory: incorrect type conversion of constructor method handle
+ */
+
+public class LambdaConstructorMethodHandleUnbox {
+ interface IntFunction<X> {
+ int m(X x);
+ }
+
+ public static void main(String[] args) {
+ IntFunction<String> s = Integer::new;
+ if (s.m("2000") + s.m("13") != 2013) {
+ throw new RuntimeException("Lambda conversion failure");
+ }
+ }
+}
--- a/jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -36,12 +36,14 @@
import java.util.logging.*;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
public class LoggingMXBeanTest
{
- static String LOGGER_NAME_1 = "com.sun.management.Logger";
- static String LOGGER_NAME_2 = "com.sun.management.Logger.Logger2";
- static String UNKNOWN_LOGGER_NAME = "com.sun.management.Unknown";
+ static final String LOGGER_NAME_1 = "com.sun.management.Logger";
+ static final String LOGGER_NAME_2 = "com.sun.management.Logger.Logger2";
+ static final String UNKNOWN_LOGGER_NAME = "com.sun.management.Unknown";
// These instance variables prevent premature logger garbage collection
// See getLogger() weak reference warnings.
@@ -213,23 +215,35 @@
PlatformLoggingMXBean mxbean2) {
// verify logger names
List<String> loggers1 = mxbean1.getLoggerNames();
+ System.out.println("Loggers: " + loggers1);
+
+ // Retrieve the named loggers to prevent them from being
+ // spontaneously gc'ed.
+ Map<String, Logger> loggersMap = new HashMap<>();
+ for (String n : loggers1) {
+ loggersMap.put(n, Logger.getLogger(n));
+ }
+
List<String> loggers2 = mxbean2.getLoggerNames();
+ // loggers1 and loggers2 should be identical - no new logger should
+ // have been created in between (at least no new logger name)
+ //
if (loggers1.size() != loggers2.size())
throw new RuntimeException("LoggerNames: unmatched number of entries");
- List<String> loggers3 = new ArrayList<>(loggers1);
- loggers3.removeAll(loggers2);
- if (loggers3.size() != 0)
+ if (!loggers2.containsAll(loggersMap.keySet()))
throw new RuntimeException("LoggerNames: unmatched loggers");
+
// verify logger's level and parent
for (String logger : loggers1) {
- if (!mxbean1.getLoggerLevel(logger)
- .equals(mxbean2.getLoggerLevel(logger)))
+ String level1 = mxbean1.getLoggerLevel(logger);
+ String level2 = mxbean2.getLoggerLevel(logger);
+ if (!java.util.Objects.equals(level1, level2)) {
throw new RuntimeException(
- "LoggerLevel: unmatched level for " + logger
- + ", " + mxbean1.getLoggerLevel(logger)
- + ", " + mxbean2.getLoggerLevel(logger));
+ "LoggerLevel: unmatched level for " + logger
+ + ", " + level1 + ", " + level2);
+ }
if (!mxbean1.getParentLoggerName(logger)
.equals(mxbean2.getParentLoggerName(logger)))
--- a/jdk/test/java/math/BigInteger/BigIntegerTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/math/BigInteger/BigIntegerTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -61,10 +61,13 @@
// KARATSUBA_SQUARE_THRESHOLD = 90 ints = 2880 bits
// TOOM_COOK_SQUARE_THRESHOLD = 140 ints = 4480 bits
//
+ // SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 8 ints = 256 bits
+ //
static final int BITS_KARATSUBA = 1600;
static final int BITS_TOOM_COOK = 2400;
static final int BITS_KARATSUBA_SQUARE = 2880;
static final int BITS_TOOM_COOK_SQUARE = 4480;
+ static final int BITS_SCHOENHAGE_BASE = 256;
static final int ORDER_SMALL = 60;
static final int ORDER_MEDIUM = 100;
@@ -467,12 +470,13 @@
public static void stringConv() {
int failCount = 0;
+ // Generic string conversion.
for (int i=0; i<100; i++) {
byte xBytes[] = new byte[Math.abs(rnd.nextInt())%100+1];
rnd.nextBytes(xBytes);
BigInteger x = new BigInteger(xBytes);
- for (int radix=2; radix < 37; radix++) {
+ for (int radix=Character.MIN_RADIX; radix < Character.MAX_RADIX; radix++) {
String result = x.toString(radix);
BigInteger test = new BigInteger(result, radix);
if (!test.equals(x)) {
@@ -483,6 +487,32 @@
}
}
}
+
+ // String conversion straddling the Schoenhage algorithm crossover
+ // threshold, and at twice and four times the threshold.
+ for (int k = 0; k <= 2; k++) {
+ int factor = 1 << k;
+ int upper = factor * BITS_SCHOENHAGE_BASE + 33;
+ int lower = upper - 35;
+
+ for (int bits = upper; bits >= lower; bits--) {
+ for (int i = 0; i < 50; i++) {
+ BigInteger x = BigInteger.ONE.shiftLeft(bits - 1).or(new BigInteger(bits - 2, rnd));
+
+ for (int radix = Character.MIN_RADIX; radix < Character.MAX_RADIX; radix++) {
+ String result = x.toString(radix);
+ BigInteger test = new BigInteger(result, radix);
+ if (!test.equals(x)) {
+ failCount++;
+ System.err.println("BigInteger toString: " + x);
+ System.err.println("Test: " + test);
+ System.err.println(radix);
+ }
+ }
+ }
+ }
+ }
+
report("String Conversion", failCount);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigInteger/PrimitiveConversionTests.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 1998, 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.
+ */
+
+import static java.math.BigInteger.ONE;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * @test
+ * @bug 7131192
+ * @summary This test ensures that BigInteger.floatValue() and
+ * BigInteger.doubleValue() behave correctly.
+ * @author Louis Wasserman
+ */
+public class PrimitiveConversionTests {
+ static final List<BigInteger> ALL_BIGINTEGER_CANDIDATES;
+
+ static {
+ List<BigInteger> samples = new ArrayList<>();
+ // Now add values near 2^N for lots of values of N.
+ for (int exponent : Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 31, 32, 33,
+ 34, 62, 63, 64, 65, 71, 72, 73, 79, 80, 81, 255, 256, 257, 511,
+ 512, 513, Double.MAX_EXPONENT - 1, Double.MAX_EXPONENT,
+ Double.MAX_EXPONENT + 1, 2000, 2001, 2002)) {
+ BigInteger x = ONE.shiftLeft(exponent);
+ for (BigInteger y : Arrays.asList(x, x.add(ONE), x.subtract(ONE))) {
+ samples.add(y);
+ samples.add(y.negate());
+ }
+ }
+
+ Random rng = new Random(1234567);
+ for (int i = 0; i < 2000; i++) {
+ samples.add(new BigInteger(rng.nextInt(2000), rng));
+ }
+
+ ALL_BIGINTEGER_CANDIDATES = Collections.unmodifiableList(samples);
+ }
+
+ public static int testDoubleValue() {
+ int failures = 0;
+ for (BigInteger big : ALL_BIGINTEGER_CANDIDATES) {
+ double expected = Double.parseDouble(big.toString());
+ double actual = big.doubleValue();
+
+ // should be bitwise identical
+ if (Double.doubleToRawLongBits(expected) != Double
+ .doubleToRawLongBits(actual)) {
+ System.out.println(big);
+ failures++;
+ }
+ }
+ return failures;
+ }
+
+ public static int testFloatValue() {
+ int failures = 0;
+ for (BigInteger big : ALL_BIGINTEGER_CANDIDATES) {
+ float expected = Float.parseFloat(big.toString());
+ float actual = big.floatValue();
+
+ // should be bitwise identical
+ if (Float.floatToRawIntBits(expected) != Float
+ .floatToRawIntBits(actual)) {
+ System.out.println(big + " " + expected + " " + actual);
+ failures++;
+ }
+ }
+ return failures;
+ }
+
+ public static void main(String[] args) {
+ int failures = testDoubleValue();
+ failures += testFloatValue();
+ if (failures > 0) {
+ throw new RuntimeException("Incurred " + failures
+ + " failures while testing primitive conversions.");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/CookieHandler/EmptyCookieHeader.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 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.
+ */
+
+/*
+ * @test
+ * @bug 8015799
+ * @summary HttpURLConnection.getHeaderFields() throws IllegalArgumentException
+ */
+
+import com.sun.net.httpserver.*;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.*;
+import java.util.*;
+
+public class EmptyCookieHeader {
+
+ public static void main(String[] args) throws Exception {
+ new EmptyCookieHeader().runTest();
+ }
+
+ public void runTest() throws Exception {
+ final CookieHandler oldHandler = CookieHandler.getDefault();
+ CookieHandler.setDefault(new TestCookieHandler());
+ HttpServer s = HttpServer.create(new InetSocketAddress(0), 0);
+ try {
+ startServer(s);
+ URL url = new URL("http://localhost:" + s.getAddress().getPort() + "/");
+ HttpURLConnection c = (HttpURLConnection)url.openConnection();
+ c.getHeaderFields();
+ } finally {
+ CookieHandler.setDefault(oldHandler);
+ s.stop(0);
+ }
+ }
+
+ static void startServer(HttpServer server) throws IOException {
+ server.createContext("/", new EmptyCookieHandler());
+ server.start();
+ }
+
+ static class EmptyCookieHandler implements HttpHandler {
+
+ @Override
+ public void handle(HttpExchange exchange) throws IOException {
+ String requestMethod = exchange.getRequestMethod();
+ if (requestMethod.equalsIgnoreCase("GET")) {
+ Headers responseHeaders = exchange.getResponseHeaders();
+ responseHeaders.set("Content-Type", "text/plain");
+ responseHeaders.set("Date", "June 13th 2012");
+
+ // No domain value set
+ responseHeaders.set("Set-Cookie2", "name=value");
+ responseHeaders.set("Set-Cookie2", "");
+ exchange.sendResponseHeaders(200, 0);
+ try (OutputStream os = exchange.getResponseBody()) {
+ String str = "This is what the server sent!";
+ os.write(str.getBytes());
+ }
+ }
+ }
+ }
+
+ class TestCookieHandler extends CookieHandler {
+ @Override
+ public Map<String,List<String>> get(URI uri,
+ Map<String,List<String>> respH) {
+ return new HashMap<>();
+ }
+
+ @Override
+ public void put(URI uri, Map<String,List<String >> respH) { }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/MulticastSocket/Promiscuous.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 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.
+ *
+
+/* @test
+ * @bug 8014499
+ * @summary Test for interference when two sockets are bound to the same
+ * port but joined to different multicast groups
+ * @run main Promiscuous
+ * @run main/othervm -Djava.net.preferIPv4Stack=true Promiscuous
+ */
+
+import java.io.IOException;
+import static java.lang.System.out;
+import java.net.*;
+
+public class Promiscuous {
+
+ static final int TIMEOUT = 5 * 1000; // 5 secs
+ static int id = 1000;
+
+ static void receive(MulticastSocket mc, boolean datagramExpected, int id)
+ throws IOException
+ {
+ byte[] ba = new byte[100];
+ DatagramPacket p = new DatagramPacket(ba, ba.length);
+ try {
+ mc.receive(p);
+ int recvId = Integer.parseInt(
+ new String(p.getData(), 0, p.getLength(), "UTF-8"));
+ if (datagramExpected) {
+ if (recvId != id)
+ throw new RuntimeException("Unexpected id, got " + recvId
+ + ", expected: " + id);
+ out.printf("Received message as expected, %s\n", p.getAddress());
+ } else {
+ throw new RuntimeException("Unexpected message received, "
+ + p.getAddress());
+ }
+ } catch (SocketTimeoutException e) {
+ if (datagramExpected)
+ throw new RuntimeException("Expected message not received, "
+ + e.getMessage());
+ else
+ out.printf("Message not received, as expected\n");
+ }
+ }
+
+ static void test(InetAddress group1, InetAddress group2)
+ throws IOException
+ {
+ try (MulticastSocket mc1 = new MulticastSocket();
+ MulticastSocket mc2 = new MulticastSocket(mc1.getLocalPort());
+ DatagramSocket ds = new DatagramSocket()) {
+ final int port = mc1.getLocalPort();
+ out.printf("Using port: %d\n", port);
+
+ mc1.setSoTimeout(TIMEOUT);
+ mc2.setSoTimeout(TIMEOUT);
+ int nextId = id;
+ byte[] msg = Integer.toString(nextId).getBytes("UTF-8");
+ DatagramPacket p = new DatagramPacket(msg, msg.length);
+ p.setAddress(group1);
+ p.setPort(port);
+
+ mc1.joinGroup(group1);
+ out.printf("mc1 joined the MC group: %s\n", group1);
+ mc2.joinGroup(group2);
+ out.printf("mc2 joined the MC group: %s\n", group2);
+
+ out.printf("Sending datagram to: %s/%d\n", group1, port);
+ ds.send(p);
+
+ // the packet should be received by mc1 only
+ receive(mc1, true, nextId);
+ receive(mc2, false, 0);
+
+ nextId = ++id;
+ msg = Integer.toString(nextId).getBytes("UTF-8");
+ p = new DatagramPacket(msg, msg.length);
+ p.setAddress(group2);
+ p.setPort(port);
+
+ out.printf("Sending datagram to: %s/%d\n", group2, port);
+ ds.send(p);
+
+ // the packet should be received by mc2 only
+ receive(mc2, true, nextId);
+ receive(mc1, false, 0);
+
+ mc1.leaveGroup(group1);
+ mc2.leaveGroup(group2);
+ }
+ }
+
+ public static void main(String args[]) throws IOException {
+ String os = System.getProperty("os.name");
+
+ // Requires IP_MULTICAST_ALL on Linux (new since 2.6.31) so skip
+ // on older kernels. Note that we skip on <= version 3 to keep the
+ // parsing simple
+ if (os.equals("Linux")) {
+ String osversion = System.getProperty("os.version");
+ String[] vers = osversion.split("\\.", 0);
+ int major = Integer.parseInt(vers[0]);
+ if (major < 3) {
+ System.out.format("Kernel version is %s, test skipped%n", osversion);
+ return;
+ }
+ }
+
+ // multicast groups used for the test
+ InetAddress ip4Group1 = InetAddress.getByName("224.7.8.9");
+ InetAddress ip4Group2 = InetAddress.getByName("225.4.5.6");
+
+ test(ip4Group1, ip4Group2);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 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.
+ *
+
+/* @test
+ * @bug 8014377
+ * @summary Test for interference when two sockets are bound to the same
+ * port but joined to different multicast groups
+ * @build Promiscuous NetworkConfiguration
+ * @run main Promiscuous
+ * @run main/othervm -Djava.net.preferIPv4Stack=true Promiscuous
+ */
+
+import java.nio.ByteBuffer;
+import java.nio.channels.*;
+import java.net.*;
+import static java.net.StandardProtocolFamily.*;
+import java.util.*;
+import java.io.IOException;
+
+public class Promiscuous {
+
+ static final Random rand = new Random();
+
+ static final ProtocolFamily UNSPEC = new ProtocolFamily() {
+ public String name() {
+ return "UNSPEC";
+ }
+ };
+
+ /**
+ * Sends a datagram to the given multicast group
+ */
+ static int sendDatagram(NetworkInterface nif,
+ InetAddress group,
+ int port)
+ throws IOException
+ {
+ ProtocolFamily family = (group instanceof Inet6Address) ?
+ StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+ DatagramChannel dc = DatagramChannel.open(family)
+ .setOption(StandardSocketOptions.IP_MULTICAST_IF, nif);
+ int id = rand.nextInt();
+ byte[] msg = Integer.toString(id).getBytes("UTF-8");
+ ByteBuffer buf = ByteBuffer.wrap(msg);
+ System.out.format("Send message -> group %s (id=0x%x)\n",
+ group.getHostAddress(), id);
+ dc.send(buf, new InetSocketAddress(group, port));
+ dc.close();
+ return id;
+ }
+
+ /**
+ * Wait (with timeout) for datagram. The {@code datagramExepcted}
+ * parameter indicates whether a datagram is expected, and if
+ * {@true} then {@code id} is the identifier in the payload.
+ */
+ static void receiveDatagram(DatagramChannel dc,
+ String name,
+ boolean datagramExepcted,
+ int id)
+ throws IOException
+ {
+ System.out.println("Checking if received by " + name);
+
+ Selector sel = Selector.open();
+ dc.configureBlocking(false);
+ dc.register(sel, SelectionKey.OP_READ);
+ ByteBuffer buf = ByteBuffer.allocateDirect(100);
+
+ try {
+ for (;;) {
+ System.out.println("Waiting to receive message");
+ sel.select(5*1000);
+ SocketAddress sa = dc.receive(buf);
+
+ // no datagram received
+ if (sa == null) {
+ if (datagramExepcted) {
+ throw new RuntimeException("Expected message not recieved");
+ }
+ System.out.println("No message received (correct)");
+ return;
+ }
+
+ // datagram received
+
+ InetAddress sender = ((InetSocketAddress)sa).getAddress();
+ buf.flip();
+ byte[] bytes = new byte[buf.remaining()];
+ buf.get(bytes);
+ int receivedId = Integer.parseInt(new String(bytes));
+
+ System.out.format("Received message from %s (id=0x%x)\n",
+ sender, receivedId);
+
+ if (!datagramExepcted) {
+ if (receivedId == id)
+ throw new RuntimeException("Message not expected");
+ System.out.println("Message ignored (has wrong id)");
+ } else {
+ if (receivedId == id) {
+ System.out.println("Message expected");
+ return;
+ }
+ System.out.println("Message ignored (wrong sender)");
+ }
+
+ sel.selectedKeys().clear();
+ buf.rewind();
+ }
+ } finally {
+ sel.close();
+ }
+ }
+
+ static void test(ProtocolFamily family,
+ NetworkInterface nif,
+ InetAddress group1,
+ InetAddress group2)
+ throws IOException
+ {
+
+ System.out.format("%nTest family=%s%n", family.name());
+
+ DatagramChannel dc1 = (family == UNSPEC) ?
+ DatagramChannel.open() : DatagramChannel.open(family);
+ DatagramChannel dc2 = (family == UNSPEC) ?
+ DatagramChannel.open() : DatagramChannel.open(family);
+
+ try {
+ dc1.setOption(StandardSocketOptions.SO_REUSEADDR, true);
+ dc2.setOption(StandardSocketOptions.SO_REUSEADDR, true);
+
+ dc1.bind(new InetSocketAddress(0));
+ int port = dc1.socket().getLocalPort();
+ dc2.bind(new InetSocketAddress(port));
+
+ System.out.format("dc1 joining [%s]:%d @ %s\n",
+ group1.getHostAddress(), port, nif.getName());
+ System.out.format("dc2 joining [%s]:%d @ %s\n",
+ group2.getHostAddress(), port, nif.getName());
+
+ dc1.join(group1, nif);
+ dc2.join(group2, nif);
+
+ int id = sendDatagram(nif, group1, port);
+
+ receiveDatagram(dc1, "dc1", true, id);
+ receiveDatagram(dc2, "dc2", false, id);
+
+ id = sendDatagram(nif, group2, port);
+
+ receiveDatagram(dc1, "dc1", false, id);
+ receiveDatagram(dc2, "dc2", true, id);
+
+ } finally {
+ dc1.close();
+ dc2.close();
+ }
+ }
+
+ public static void main(String[] args) throws IOException {
+ String os = System.getProperty("os.name");
+
+ // Requires IP_MULTICAST_ALL on Linux (new since 2.6.31) so skip
+ // on older kernels. Note that we skip on <= version 3 to keep the
+ // parsing simple
+ if (os.equals("Linux")) {
+ String osversion = System.getProperty("os.version");
+ String[] vers = osversion.split("\\.", 0);
+ int major = Integer.parseInt(vers[0]);
+ if (major < 3) {
+ System.out.format("Kernel version is %s, test skipped%n", osversion);
+ return;
+ }
+ }
+
+ // get local network configuration to use
+ NetworkConfiguration config = NetworkConfiguration.probe();
+
+ // multicast groups used for the test
+ InetAddress ip4Group1 = InetAddress.getByName("225.4.5.6");
+ InetAddress ip4Group2 = InetAddress.getByName("225.4.6.6");
+
+ for (NetworkInterface nif: config.ip4Interfaces()) {
+ InetAddress source = config.ip4Addresses(nif).iterator().next();
+ test(INET, nif, ip4Group1, ip4Group2);
+
+ // Solaris and Linux allow IPv6 sockets join IPv4 multicast groups
+ if (os.equals("SunOS") || os.equals("Linux"))
+ test(UNSPEC, nif, ip4Group1, ip4Group2);
+ }
+ }
+}
--- a/jdk/test/java/nio/file/Files/StreamTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/nio/file/Files/StreamTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -43,7 +43,7 @@
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Arrays;
-import java.util.Comparators;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
@@ -139,7 +139,7 @@
public void testBasic() {
try (CloseableStream<Path> s = Files.list(testFolder)) {
- Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
+ Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
assertEquals(actual, level1);
} catch (IOException ioe) {
fail("Unexpected IOException");
@@ -155,7 +155,7 @@
public void testWalk() {
try (CloseableStream<Path> s = Files.walk(testFolder)) {
- Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
+ Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
assertEquals(actual, all);
} catch (IOException ioe) {
fail("Unexpected IOException");
@@ -165,7 +165,7 @@
public void testWalkOneLevel() {
try (CloseableStream<Path> s = Files.walk(testFolder, 1)) {
Object[] actual = s.filter(path -> ! path.equals(testFolder))
- .sorted(Comparators.naturalOrder())
+ .sorted(Comparator.naturalOrder())
.toArray();
assertEquals(actual, level1);
} catch (IOException ioe) {
@@ -177,7 +177,7 @@
// If link is not supported, the directory structure won't have link.
// We still want to test the behavior with FOLLOW_LINKS option.
try (CloseableStream<Path> s = Files.walk(testFolder, FileVisitOption.FOLLOW_LINKS)) {
- Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
+ Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
assertEquals(actual, all_folowLinks);
} catch (IOException ioe) {
fail("Unexpected IOException");
@@ -637,13 +637,13 @@
public void testClosedStream() throws IOException {
try (CloseableStream<Path> s = Files.list(testFolder)) {
s.close();
- Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
+ Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
assertTrue(actual.length <= level1.length);
}
try (CloseableStream<Path> s = Files.walk(testFolder)) {
s.close();
- Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
+ Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
fail("Operate on closed stream should throw IllegalStateException");
} catch (IllegalStateException ex) {
// expected
@@ -652,7 +652,7 @@
try (CloseableStream<Path> s = Files.find(testFolder, Integer.MAX_VALUE,
(p, attr) -> true)) {
s.close();
- Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
+ Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
fail("Operate on closed stream should throw IllegalStateException");
} catch (IllegalStateException ex) {
// expected
--- a/jdk/test/java/security/cert/CertPathValidator/OCSP/FailoverToCRL.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/security/cert/CertPathValidator/OCSP/FailoverToCRL.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 6383095
+ * @bug 6383095 8019259
* @summary CRL revoked certificate failures masked by OCSP failures
*
* Note that the certificate validity is from Mar 16 14:55:35 2009 GMT to
@@ -254,12 +254,32 @@
CertPathValidator validator = CertPathValidator.getInstance("PKIX");
try {
+ System.out.println("Validating cert via OCSP: no responder URL");
validator.validate(path, params);
} catch (CertPathValidatorException cpve) {
if (cpve.getReason() != BasicReason.REVOKED) {
throw new Exception(
- "unexpect exception, should be a REVOKED CPVE", cpve);
+ "unexpected exception, should be a REVOKED CPVE", cpve);
}
+ System.out.println(" successful failover to using CRLs");
+ }
+
+ java.security.cert.PKIXRevocationChecker revocationChecker =
+ (java.security.cert.PKIXRevocationChecker)
+ validator.getRevocationChecker();
+ revocationChecker.setOCSPResponder(
+ new java.net.URI("bad_ocsp_responder_url"));
+ params.addCertPathChecker(revocationChecker);
+
+ try {
+ System.out.println("Validating cert via OCSP: bad responder URL");
+ validator.validate(path, params);
+ } catch (CertPathValidatorException cpve) {
+ if (cpve.getReason() != BasicReason.REVOKED) {
+ throw new Exception(
+ "unexpected exception, should be a REVOKED CPVE", cpve);
+ }
+ System.out.println(" successful failover to using CRLs");
}
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/testlibrary/Proc.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 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.
+ */
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.security.Permission;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * This is a test library that makes writing a Java test that spawns multiple
+ * Java processes easily.
+ *
+ * Usage:
+ *
+ * Proc.create("Clazz") // The class to launch
+ * .args("x") // with args
+ * .env("env", "value") // and an environment variable
+ * .prop("key","value") // and a system property
+ * .perm(perm) // with granted permissions
+ * .start(); // and start
+ *
+ * create/start must be called, args/env/prop/perm can be called zero or
+ * multiple times between create and start.
+ *
+ * The controller can call inheritIO to share its I/O to the process.
+ * Otherwise, it can send data into a proc's stdin with write/println, and
+ * read its stdout with readLine. stderr is always redirected to DFILE
+ * unless nodump() is called. A protocol is designed to make
+ * data exchange among the controller and the processes super easy, in which
+ * useful data are always printed with a special prefix ("PROCISFUN:").
+ * If the data is binary, make it BASE64.
+ *
+ * For example:
+ *
+ * - A producer Proc calls Proc.binOut() or Proc.textOut() to send out data.
+ * This method would prints to the stdout something like
+ *
+ * PROCISFUN:[raw text or base64 binary]
+ *
+ * - The controller calls producer.readData() to get the content. This method
+ * ignores all other output and only reads lines starting with "PROCISFUN:".
+ *
+ * - The controller does not care if the context is text or base64, it simply
+ * feeds the data to a consumer Proc by calling consumer.println(data).
+ * This will be printed into System.in of the consumer process.
+ *
+ * - The consumer Proc calls Proc.binIn() or Proc.textIn() to read the data.
+ * The first method de-base64 the input and return a byte[] block.
+ *
+ * Please note only plain ASCII is supported in raw text at the moment.
+ *
+ * As the Proc objects are hidden so deeply, two static methods, d(String) and
+ * d(Throwable) are provided to output info into stderr, where they will
+ * normally be appended messages to DFILE (unless nodump() is called).
+ * Developers can view the messages in real time by calling
+ *
+ * tail -f proc.debug
+ *
+ * TODO:
+ *
+ * . launch java tools, say, keytool
+ * . launch another version of java
+ * . start in another directory
+ * . start and finish using one method
+ *
+ * This is not a test, but is the core of
+ * JDK-8009977: A test library to launch multiple Java processes
+ */
+public class Proc {
+ private Process p;
+ private BufferedReader br; // the stdout of a process
+ private String launcher; // Optional: the java program
+
+ private List<Permission> perms = new ArrayList<>();
+ private List<String> args = new ArrayList<>();
+ private Map<String,String> env = new HashMap<>();
+ private Map<String,String> prop = new HashMap();
+ private boolean inheritIO = false;
+ private boolean noDump = false;
+
+ private String clazz; // Class to launch
+ private String debug; // debug flag, controller will show data
+ // transfer between procs
+
+ final private static String PREFIX = "PROCISFUN:";
+ final private static String DFILE = "proc.debug";
+
+ // The following methods are called by controllers
+
+ // Creates a Proc by the Java class name, launcher is an optional
+ // argument to specify the java program
+ public static Proc create(String clazz, String... launcher) {
+ Proc pc = new Proc();
+ pc.clazz = clazz;
+ if (launcher.length > 0) {
+ pc.launcher = launcher[0];
+ }
+ return pc;
+ }
+ // Sets inheritIO flag to proc. If set, proc will same I/O channels as
+ // teh controller. Otherwise, its stdin/stdout is untouched, and its
+ // stderr is redirected to DFILE.
+ public Proc inheritIO() {
+ inheritIO = true;
+ return this;
+ }
+ // When called, stderr inherits parent stderr, otherwise, append to a file
+ public Proc nodump() {
+ noDump = true;
+ return this;
+ }
+ // Specifies some args. Can be called multiple times.
+ public Proc args(String... args) {
+ for (String c: args) {
+ this.args.add(c);
+ }
+ return this;
+ }
+ // Returns debug prefix
+ public String debug() {
+ return debug;
+ }
+ // Enables debug with prefix
+ public Proc debug(String title) {
+ debug = title;
+ return this;
+ }
+ // Specifies an env var. Can be called multiple times.
+ public Proc env(String a, String b) {
+ env.put(a, b);
+ return this;
+ }
+ // Specifies a Java system property. Can be called multiple times.
+ public Proc prop(String a, String b) {
+ prop.put(a, b);
+ return this;
+ }
+ // Adds a perm to policy. Can be called multiple times. In order to make it
+ // effective, please also call prop("java.security.manager", "").
+ public Proc perm(Permission p) {
+ perms.add(p);
+ return this;
+ }
+ // Starts the proc
+ public Proc start() throws IOException {
+ List<String> cmd = new ArrayList<>();
+ if (launcher != null) {
+ cmd.add(launcher);
+ } else {
+ cmd.add(new File(new File(System.getProperty("java.home"), "bin"),
+ "java").getPath());
+ }
+ cmd.add("-cp");
+ StringBuilder cp = new StringBuilder();
+ for (URL url: ((URLClassLoader)Proc.class.getClassLoader()).getURLs()) {
+ if (cp.length() != 0) {
+ cp.append(File.pathSeparatorChar);
+ }
+ cp.append(url.getFile());
+ }
+ cmd.add(cp.toString());
+ for (Entry<String,String> e: prop.entrySet()) {
+ cmd.add("-D" + e.getKey() + "=" + e.getValue());
+ }
+ if (!perms.isEmpty()) {
+ Path p = Files.createTempFile(
+ Paths.get(".").toAbsolutePath(), "policy", null);
+ StringBuilder sb = new StringBuilder();
+ sb.append("grant {\n");
+ for (Permission perm: perms) {
+ // Sometimes a permission has no name or actions.
+ // but it's safe to use an empty string.
+ String s = String.format("%s \"%s\", \"%s\"",
+ perm.getClass().getCanonicalName(),
+ perm.getName()
+ .replace("\\", "\\\\").replace("\"", "\\\""),
+ perm.getActions());
+ sb.append(" permission ").append(s).append(";\n");
+ }
+ sb.append("};\n");
+ Files.write(p, sb.toString().getBytes());
+ cmd.add("-Djava.security.policy=" + p.toString());
+ }
+ cmd.add(clazz);
+ for (String s: args) {
+ cmd.add(s);
+ }
+ if (debug != null) {
+ System.out.println("PROC: " + debug + " cmdline: " + cmd);
+ }
+ ProcessBuilder pb = new ProcessBuilder(cmd);
+ for (Entry<String,String> e: env.entrySet()) {
+ pb.environment().put(e.getKey(), e.getValue());
+ }
+ if (inheritIO) {
+ pb.inheritIO();
+ } else if (noDump) {
+ pb.redirectError(ProcessBuilder.Redirect.INHERIT);
+ } else {
+ pb.redirectError(ProcessBuilder.Redirect.appendTo(new File(DFILE)));
+ }
+ p = pb.start();
+ br = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ return this;
+ }
+ // Reads a line from stdout of proc
+ public String readLine() throws IOException {
+ String s = br.readLine();
+ if (debug != null) {
+ System.out.println("PROC: " + debug + " readline: " +
+ (s == null ? "<EOF>" : s));
+ }
+ return s;
+ }
+ // Reads a special line from stdout of proc
+ public String readData() throws Exception {
+ while (true) {
+ String s = readLine();
+ if (s == null) {
+ if (p.waitFor() != 0) {
+ throw new Exception("Proc abnormal end");
+ } else {
+ return s;
+ }
+ }
+ if (s.startsWith(PREFIX)) {
+ return s.substring(PREFIX.length());
+ }
+ }
+ }
+ // Writes text into stdin of proc
+ public void println(String s) throws IOException {
+ if (debug != null) {
+ System.out.println("PROC: " + debug + " println: " + s);
+ }
+ write((s + "\n").getBytes());
+ }
+ // Writes data into stdin of proc
+ public void write(byte[] b) throws IOException {
+ p.getOutputStream().write(b);
+ p.getOutputStream().flush();
+ }
+ // Reads all output and wait for process end
+ public int waitFor() throws Exception {
+ while (true) {
+ String s = readLine();
+ if (s == null) {
+ break;
+ }
+ }
+ return p.waitFor();
+ }
+
+ // The following methods are used inside a proc
+
+ // Writes out a BASE64 binary with a prefix
+ public static void binOut(byte[] data) {
+ System.out.println(PREFIX + Base64.getEncoder().encodeToString(data));
+ }
+ // Reads in a line of BASE64 binary
+ public static byte[] binIn() throws Exception {
+ return Base64.getDecoder().decode(textIn());
+ }
+ // Writes out a text with a prefix
+ public static void textOut(String data) {
+ System.out.println(PREFIX + data);
+ }
+ // Reads in a line of text
+ public static String textIn() throws Exception {
+ StringBuilder sb = new StringBuilder();
+ boolean isEmpty = true;
+ while (true) {
+ int i = System.in.read();
+ if (i == -1) break;
+ isEmpty = false;
+ if (i == '\n') break;
+ if (i != 13) {
+ // Force it to a char, so only simple ASCII works.
+ sb.append((char)i);
+ }
+ }
+ return isEmpty ? null : sb.toString();
+ }
+ // Sends string to stderr. If inheritIO is not called, they will
+ // be collected into DFILE
+ public static void d(String s) throws IOException {
+ System.err.println(s);
+ }
+ // Sends an exception to stderr
+ public static void d(Throwable e) throws IOException {
+ e.printStackTrace();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Arrays/ParallelPrefix.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 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.
+ */
+
+/**
+ * @test
+ * @summary unit test for Arrays.ParallelPrefix().
+ * @author Tristan Yan
+ * @run testng ParallelPrefix
+ */
+
+import java.util.Arrays;
+import java.util.function.BinaryOperator;
+import java.util.function.DoubleBinaryOperator;
+import java.util.function.Function;
+import java.util.function.IntBinaryOperator;
+import java.util.function.LongBinaryOperator;
+import java.util.stream.IntStream;
+import java.util.stream.LongStream;
+import static org.testng.Assert.*;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+public class ParallelPrefix {
+ //Array size less than MIN_PARTITION
+ private final static int SMALL_ARRAY_SIZE = 1 << 3;
+
+ //Array size equals MIN_PARTITION
+ private final static int THRESHOLD_ARRAY_SIZE = 1 << 4;
+
+ //Array size greater than MIN_PARTITION
+ private final static int MEDIUM_ARRAY_SIZE = 1 << 8;
+
+ //Array size much greater than MIN_PARTITION
+ private final static int LARGE_ARRAY_SIZE = 1 << 12;
+
+ private final static int[] ARRAY_SIZE_COLLECTION = new int[]{
+ SMALL_ARRAY_SIZE, THRESHOLD_ARRAY_SIZE,MEDIUM_ARRAY_SIZE, LARGE_ARRAY_SIZE};
+
+ @DataProvider
+ public static Object[][] intSet(){
+ return genericData(size -> IntStream.range(0, size).toArray(), new IntBinaryOperator[]{Integer::sum, Integer::min});
+ }
+
+ @DataProvider
+ public static Object[][] longSet(){
+ return genericData(size -> LongStream.range(0, size).toArray(), new LongBinaryOperator[]{Long::sum, Long::min});
+ }
+
+ @DataProvider
+ public static Object[][] doubleSet(){
+ return genericData(size -> IntStream.range(0, size).mapToDouble(i -> (double)i).toArray(),
+ new DoubleBinaryOperator[]{Double::sum, Double::min});
+ }
+
+ @DataProvider
+ public static Object[][] stringSet(){
+ Function<Integer, String[]> stringsFunc = size ->
+ IntStream.range(0, size).mapToObj(Integer::toString).toArray(String[]::new);
+ BinaryOperator<String> cancatBop = String::concat;
+ return genericData(stringsFunc, new BinaryOperator[]{cancatBop});
+ }
+
+ private static <T, OPS> Object[][] genericData(Function<Integer, T> generateFunc, OPS[] ops) {
+ //test arrays which size is equals n-1, n, n+1, test random data
+ Object[][] data = new Object[ARRAY_SIZE_COLLECTION.length * 3 * ops.length][4];
+ for(int n = 0; n < ARRAY_SIZE_COLLECTION.length; n++ ) {
+ for(int testValue = -1 ; testValue <= 1; testValue++) {
+ int array_size = ARRAY_SIZE_COLLECTION[n] + testValue;
+ for(int opsN = 0; opsN < ops.length; opsN++) {
+ int index = n * 3 * ops.length + (testValue + 1) * ops.length + opsN;
+ data[index][0] = generateFunc.apply(array_size);
+ data[index][1] = array_size / 3;
+ data[index][2] = 2 * array_size / 3;
+ data[index][3] = ops[opsN];
+ }
+ }
+ }
+ return data;
+ }
+
+ @Test(dataProvider="intSet")
+ public void testParallelPrefixForInt(int[] data, int fromIndex, int toIndex, IntBinaryOperator op) {
+ int[] sequentialResult = data.clone();
+ for (int index = fromIndex + 1; index < toIndex; index++) {
+ sequentialResult[index ] = op.applyAsInt(sequentialResult[index - 1], sequentialResult[index]);
+ }
+
+ int[] parallelResult = data.clone();
+ Arrays.parallelPrefix(parallelResult, fromIndex, toIndex, op);
+ assertEquals(parallelResult, sequentialResult);
+
+ int[] parallelRangeResult = Arrays.copyOfRange(data, fromIndex, toIndex);
+ Arrays.parallelPrefix(parallelRangeResult, op);
+ assertEquals(parallelRangeResult, Arrays.copyOfRange(sequentialResult, fromIndex, toIndex));
+ }
+
+ @Test(dataProvider="longSet")
+ public void testParallelPrefixForLong(long[] data, int fromIndex, int toIndex, LongBinaryOperator op) {
+ long[] sequentialResult = data.clone();
+ for (int index = fromIndex + 1; index < toIndex; index++) {
+ sequentialResult[index ] = op.applyAsLong(sequentialResult[index - 1], sequentialResult[index]);
+ }
+
+ long[] parallelResult = data.clone();
+ Arrays.parallelPrefix(parallelResult, fromIndex, toIndex, op);
+ assertEquals(parallelResult, sequentialResult);
+
+ long[] parallelRangeResult = Arrays.copyOfRange(data, fromIndex, toIndex);
+ Arrays.parallelPrefix(parallelRangeResult, op);
+ assertEquals(parallelRangeResult, Arrays.copyOfRange(sequentialResult, fromIndex, toIndex));
+ }
+
+ @Test(dataProvider="doubleSet")
+ public void testParallelPrefixForDouble(double[] data, int fromIndex, int toIndex, DoubleBinaryOperator op) {
+ double[] sequentialResult = data.clone();
+ for (int index = fromIndex + 1; index < toIndex; index++) {
+ sequentialResult[index ] = op.applyAsDouble(sequentialResult[index - 1], sequentialResult[index]);
+ }
+
+ double[] parallelResult = data.clone();
+ Arrays.parallelPrefix(parallelResult, fromIndex, toIndex, op);
+ assertEquals(parallelResult, sequentialResult);
+
+ double[] parallelRangeResult = Arrays.copyOfRange(data, fromIndex, toIndex);
+ Arrays.parallelPrefix(parallelRangeResult, op);
+ assertEquals(parallelRangeResult, Arrays.copyOfRange(sequentialResult, fromIndex, toIndex));
+ }
+
+ @Test(dataProvider="stringSet")
+ public void testParallelPrefixForStringr(String[] data , int fromIndex, int toIndex, BinaryOperator<String> op) {
+ String[] sequentialResult = data.clone();
+ for (int index = fromIndex + 1; index < toIndex; index++) {
+ sequentialResult[index ] = op.apply(sequentialResult[index - 1], sequentialResult[index]);
+ }
+
+ String[] parallelResult = data.clone();
+ Arrays.parallelPrefix(parallelResult, fromIndex, toIndex, op);
+ assertEquals(parallelResult, sequentialResult);
+
+ String[] parallelRangeResult = Arrays.copyOfRange(data, fromIndex, toIndex);
+ Arrays.parallelPrefix(parallelRangeResult, op);
+ assertEquals(parallelRangeResult, Arrays.copyOfRange(sequentialResult, fromIndex, toIndex));
+ }
+}
+
--- a/jdk/test/java/util/Collection/ListDefaults.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Collection/ListDefaults.java Tue Jul 02 15:23:23 2013 -0700
@@ -25,7 +25,6 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
-import java.util.Comparators;
import java.util.List;
import java.util.LinkedList;
import java.util.Stack;
@@ -337,23 +336,23 @@
CollectionSupplier.shuffle(list);
list.sort(null);
- CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+ CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
if (test.name.startsWith("reverse")) {
Collections.reverse(list);
}
CollectionAsserts.assertContents(list, original);
CollectionSupplier.shuffle(list);
- list.sort(Comparators.<Integer>naturalOrder());
- CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+ list.sort(Comparator.<Integer>naturalOrder());
+ CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
if (test.name.startsWith("reverse")) {
Collections.reverse(list);
}
CollectionAsserts.assertContents(list, original);
CollectionSupplier.shuffle(list);
- list.sort(Comparators.<Integer>reverseOrder());
- CollectionAsserts.assertSorted(list, Comparators.<Integer>reverseOrder());
+ list.sort(Comparator.<Integer>reverseOrder());
+ CollectionAsserts.assertSorted(list, Comparator.<Integer>reverseOrder());
if (!test.name.startsWith("reverse")) {
Collections.reverse(list);
}
@@ -390,8 +389,8 @@
final List<Integer> copy = new ArrayList<>(list);
final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
CollectionSupplier.shuffle(subList);
- subList.sort(Comparators.<Integer>naturalOrder());
- CollectionAsserts.assertSorted(subList, Comparators.<Integer>naturalOrder());
+ subList.sort(Comparator.<Integer>naturalOrder());
+ CollectionAsserts.assertSorted(subList, Comparator.<Integer>naturalOrder());
// verify that elements [0, from) remain unmodified
for (int i = 0; i < SUBLIST_FROM; i++) {
assertTrue(list.get(i) == copy.get(i),
@@ -412,8 +411,8 @@
public void call(final List<Integer> list) {
final List<Integer> copy = new ArrayList<>(list);
CollectionSupplier.shuffle(list);
- list.sort(Comparators.<Integer>naturalOrder());
- CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+ list.sort(Comparator.<Integer>naturalOrder());
+ CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
}
});
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Comparator/BasicTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 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.
+ */
+
+/**
+ * @test
+ * @summary Comparator default method tests
+ * @run testng BasicTest
+ */
+
+import java.util.TreeMap;
+import java.util.Comparator;
+import org.testng.annotations.Test;
+
+import java.util.function.Function;
+import java.util.function.ToIntFunction;
+import java.util.function.ToLongFunction;
+import java.util.function.ToDoubleFunction;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+@Test(groups = "unit")
+public class BasicTest {
+ private static class Thing {
+ public final int intField;
+ public final long longField;
+ public final double doubleField;
+ public final String stringField;
+
+ private Thing(int intField, long longField, double doubleField, String stringField) {
+ this.intField = intField;
+ this.longField = longField;
+ this.doubleField = doubleField;
+ this.stringField = stringField;
+ }
+
+ public int getIntField() {
+ return intField;
+ }
+
+ public long getLongField() {
+ return longField;
+ }
+
+ public double getDoubleField() {
+ return doubleField;
+ }
+
+ public String getStringField() {
+ return stringField;
+ }
+ }
+
+ private final int[] intValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
+ private final long[] longValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
+ private final double[] doubleValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
+ private final String[] stringValues = { "a", "a", "b", "b", "c", "c", "d", "d", "e", "e" };
+ private final int[] comparisons = { 0, -1, 0, -1, 0, -1, 0, -1, 0 };
+
+ private<T> void assertComparisons(T[] things, Comparator<T> comp, int[] comparisons) {
+ for (int i=0; i<comparisons.length; i++) {
+ assertEquals(comparisons.length + 1, things.length);
+ assertEquals(comparisons[i], comp.compare(things[i], things[i+1]));
+ assertEquals(-comparisons[i], comp.compare(things[i+1], things[i]));
+ }
+ }
+
+ public void testIntComparator() {
+ Thing[] things = new Thing[intValues.length];
+ for (int i=0; i<intValues.length; i++)
+ things[i] = new Thing(intValues[i], 0L, 0.0, null);
+ Comparator<Thing> comp = Comparator.comparing(new ToIntFunction<Thing>() {
+ @Override
+ public int applyAsInt(Thing thing) {
+ return thing.getIntField();
+ }
+ });
+
+ assertComparisons(things, comp, comparisons);
+ }
+
+ public void testLongComparator() {
+ Thing[] things = new Thing[longValues.length];
+ for (int i=0; i<longValues.length; i++)
+ things[i] = new Thing(0, longValues[i], 0.0, null);
+ Comparator<Thing> comp = Comparator.comparing(new ToLongFunction<Thing>() {
+ @Override
+ public long applyAsLong(Thing thing) {
+ return thing.getLongField();
+ }
+ });
+
+ assertComparisons(things, comp, comparisons);
+ }
+
+ public void testDoubleComparator() {
+ Thing[] things = new Thing[doubleValues.length];
+ for (int i=0; i<doubleValues.length; i++)
+ things[i] = new Thing(0, 0L, doubleValues[i], null);
+ Comparator<Thing> comp = Comparator.comparing(new ToDoubleFunction<Thing>() {
+ @Override
+ public double applyAsDouble(Thing thing) {
+ return thing.getDoubleField();
+ }
+ });
+
+ assertComparisons(things, comp, comparisons);
+ }
+
+ public void testComparing() {
+ Thing[] things = new Thing[doubleValues.length];
+ for (int i=0; i<doubleValues.length; i++)
+ things[i] = new Thing(0, 0L, 0.0, stringValues[i]);
+ Comparator<Thing> comp = Comparator.comparing(new Function<Thing, String>() {
+ @Override
+ public String apply(Thing thing) {
+ return thing.getStringField();
+ }
+ });
+
+ assertComparisons(things, comp, comparisons);
+ }
+
+ public void testNaturalOrderComparator() {
+ Comparator<String> comp = Comparator.naturalOrder();
+
+ assertComparisons(stringValues, comp, comparisons);
+ }
+
+ public void testReverseComparator() {
+ Comparator<String> cmpr = Comparator.reverseOrder();
+ Comparator<String> cmp = cmpr.reversed();
+
+ assertEquals(cmp.reversed(), cmpr);
+ assertEquals(0, cmp.compare("a", "a"));
+ assertEquals(0, cmpr.compare("a", "a"));
+ assertTrue(cmp.compare("a", "b") < 0);
+ assertTrue(cmpr.compare("a", "b") > 0);
+ assertTrue(cmp.compare("b", "a") > 0);
+ assertTrue(cmpr.compare("b", "a") < 0);
+ }
+
+ public void testReverseComparator2() {
+ Comparator<String> cmp = (s1, s2) -> s1.length() - s2.length();
+ Comparator<String> cmpr = cmp.reversed();
+
+ assertEquals(cmpr.reversed(), cmp);
+ assertEquals(0, cmp.compare("abc", "def"));
+ assertEquals(0, cmpr.compare("abc", "def"));
+ assertTrue(cmp.compare("abcd", "def") > 0);
+ assertTrue(cmpr.compare("abcd", "def") < 0);
+ assertTrue(cmp.compare("abc", "defg") < 0);
+ assertTrue(cmpr.compare("abc", "defg") > 0);
+ }
+
+ private <T> void assertComparison(Comparator<T> cmp, T less, T greater) {
+ assertTrue(cmp.compare(less, greater) < 0, "less");
+ assertTrue(cmp.compare(less, less) == 0, "equal");
+ assertTrue(cmp.compare(greater, greater) == 0, "equal");
+ assertTrue(cmp.compare(greater, less) > 0, "greater");
+ }
+
+ private static class People {
+ final String firstName;
+ final String lastName;
+ final int age;
+
+ People(String first, String last, int age) {
+ firstName = first;
+ lastName = last;
+ this.age = age;
+ }
+
+ String getFirstName() { return firstName; }
+ String getLastName() { return lastName; }
+ int getAge() { return age; }
+ long getAgeAsLong() { return (long) age; };
+ double getAgeAsDouble() { return (double) age; };
+ }
+
+ private final People people[] = {
+ new People("John", "Doe", 34),
+ new People("Mary", "Doe", 30),
+ new People("Maria", "Doe", 14),
+ new People("Jonah", "Doe", 10),
+ new People("John", "Cook", 54),
+ new People("Mary", "Cook", 50),
+ new People("Mary", null, 25),
+ new People("John", null, 27)
+ };
+
+ public void testComparatorDefaultMethods() {
+ Comparator<People> cmp = Comparator.comparing((Function<People, String>) People::getFirstName);
+ Comparator<People> cmp2 = Comparator.comparing((Function<People, String>) People::getLastName);
+ // reverseOrder
+ assertComparison(cmp.reversed(), people[1], people[0]);
+ // thenComparing(Comparator)
+ assertComparison(cmp.thenComparing(cmp2), people[0], people[1]);
+ assertComparison(cmp.thenComparing(cmp2), people[4], people[0]);
+ // thenComparing(Function)
+ assertComparison(cmp.thenComparing(People::getLastName), people[0], people[1]);
+ assertComparison(cmp.thenComparing(People::getLastName), people[4], people[0]);
+ // thenComparing(ToIntFunction)
+ assertComparison(cmp.thenComparing(People::getAge), people[0], people[1]);
+ assertComparison(cmp.thenComparing(People::getAge), people[1], people[5]);
+ // thenComparing(ToLongFunction)
+ assertComparison(cmp.thenComparing(People::getAgeAsLong), people[0], people[1]);
+ assertComparison(cmp.thenComparing(People::getAgeAsLong), people[1], people[5]);
+ // thenComparing(ToDoubleFunction)
+ assertComparison(cmp.thenComparing(People::getAgeAsDouble), people[0], people[1]);
+ assertComparison(cmp.thenComparing(People::getAgeAsDouble), people[1], people[5]);
+ }
+
+
+ public void testNullsFirst() {
+ Comparator<String> strcmp = Comparator.nullsFirst(Comparator.naturalOrder());
+ Comparator<People> cmp = Comparator.<People, String>comparing(People::getLastName, strcmp)
+ .thenComparing(People::getFirstName, strcmp);
+ // Mary.null vs Mary.Cook - solve by last name
+ assertComparison(cmp, people[6], people[5]);
+ // John.null vs Mary.null - solve by first name
+ assertComparison(cmp, people[7], people[6]);
+
+ // More than one thenComparing
+ strcmp = Comparator.nullsFirst(Comparator.comparing((ToIntFunction<String>) String::length)
+ .thenComparing(String.CASE_INSENSITIVE_ORDER));
+ assertComparison(strcmp, null, "abc");
+ assertComparison(strcmp, "ab", "abc");
+ assertComparison(strcmp, "abc", "def");
+ assertEquals(0, strcmp.compare("abc", "ABC"));
+
+ // Ensure reverse still handle null properly
+ Comparator<String> strcmp2 = strcmp.reversed().thenComparing(Comparator.naturalOrder());
+ assertComparison(strcmp2, "abc", null);
+ assertComparison(strcmp2, "abc", "ab");
+ assertComparison(strcmp2, "def", "abc");
+ assertComparison(strcmp2, "ABC", "abc");
+
+ // Considering non-null values to be equal
+ Comparator<String> blind = Comparator.nullsFirst(null);
+ assertComparison(blind, null, "abc");
+ assertEquals(0, blind.compare("abc", "def"));
+ // reverse still consider non-null values to be equal
+ strcmp = blind.reversed();
+ assertComparison(strcmp, "abc", null);
+ assertEquals(0, strcmp.compare("abc", "def"));
+ // chain with another comparator to compare non-nulls
+ strcmp = blind.thenComparing(Comparator.naturalOrder());
+ assertComparison(strcmp, null, "abc");
+ assertComparison(strcmp, "abc", "def");
+ }
+
+ public void testNullsLast() {
+ Comparator<String> strcmp = Comparator.nullsLast(Comparator.naturalOrder());
+ Comparator<People> cmp = Comparator.<People, String>comparing(People::getLastName, strcmp)
+ .thenComparing(People::getFirstName, strcmp);
+ // Mary.null vs Mary.Cook - solve by last name
+ assertComparison(cmp, people[5], people[6]);
+ // John.null vs Mary.null - solve by first name
+ assertComparison(cmp, people[7], people[6]);
+
+ // More than one thenComparing
+ strcmp = Comparator.nullsLast(Comparator.comparing((ToIntFunction<String>) String::length)
+ .thenComparing(String.CASE_INSENSITIVE_ORDER));
+ assertComparison(strcmp, "abc", null);
+ assertComparison(strcmp, "ab", "abc");
+ assertComparison(strcmp, "abc", "def");
+
+ // Ensure reverse still handle null properly
+ Comparator<String> strcmp2 = strcmp.reversed().thenComparing(Comparator.naturalOrder());
+ assertComparison(strcmp2, null, "abc");
+ assertComparison(strcmp2, "abc", "ab");
+ assertComparison(strcmp2, "def", "abc");
+ assertComparison(strcmp2, "ABC", "abc");
+
+ // Considering non-null values to be equal
+ Comparator<String> blind = Comparator.nullsLast(null);
+ assertComparison(blind, "abc", null);
+ assertEquals(0, blind.compare("abc", "def"));
+ // reverse still consider non-null values to be equal
+ strcmp = blind.reversed();
+ assertComparison(strcmp, null, "abc");
+ assertEquals(0, strcmp.compare("abc", "def"));
+ // chain with another comparator to compare non-nulls
+ strcmp = blind.thenComparing(Comparator.naturalOrder());
+ assertComparison(strcmp, "abc", null);
+ assertComparison(strcmp, "abc", "def");
+ }
+
+ public void testComposeComparator() {
+ // Longer string in front
+ Comparator<String> first = (s1, s2) -> s2.length() - s1.length();
+ Comparator<String> second = Comparator.naturalOrder();
+ Comparator<String> composed = first.thenComparing(second);
+
+ assertTrue(composed.compare("abcdefg", "abcdef") < 0);
+ assertTrue(composed.compare("abcdef", "abcdefg") > 0);
+ assertTrue(composed.compare("abcdef", "abcdef") == 0);
+ assertTrue(composed.compare("abcdef", "ghijkl") < 0);
+ assertTrue(composed.compare("ghijkl", "abcdefg") > 0);
+ }
+
+ public void testNulls() {
+ try {
+ Comparator.<String>naturalOrder().compare("abc", (String) null);
+ fail("expected NPE with naturalOrder");
+ } catch (NullPointerException npe) {}
+ try {
+ Comparator.<String>naturalOrder().compare((String) null, "abc");
+ fail("expected NPE with naturalOrder");
+ } catch (NullPointerException npe) {}
+
+ try {
+ Comparator.<String>reverseOrder().compare("abc", (String) null);
+ fail("expected NPE with naturalOrder");
+ } catch (NullPointerException npe) {}
+ try {
+ Comparator.<String>reverseOrder().compare((String) null, "abc");
+ fail("expected NPE with naturalOrder");
+ } catch (NullPointerException npe) {}
+
+ try {
+ Comparator<People> cmp = Comparator.comparing((Function<People, String>) null, Comparator.<String>naturalOrder());
+ fail("comparing(null, cmp) should throw NPE");
+ } catch (NullPointerException npe) {}
+ try {
+ Comparator<People> cmp = Comparator.comparing((Function<People, String>) People::getFirstName, null);
+ fail("comparing(f, null) should throw NPE");
+ } catch (NullPointerException npe) {}
+
+ try {
+ Comparator<People> cmp = Comparator.comparing((Function<People, String>) null);
+ fail("comparing(null) should throw NPE");
+ } catch (NullPointerException npe) {}
+ try {
+ Comparator<People> cmp = Comparator.comparing((ToIntFunction<People>) null);
+ fail("comparing(null) should throw NPE");
+ } catch (NullPointerException npe) {}
+ try {
+ Comparator<People> cmp = Comparator.comparing((ToLongFunction<People>) null);
+ fail("comparing(null) should throw NPE");
+ } catch (NullPointerException npe) {}
+ try {
+ Comparator<People> cmp = Comparator.comparing((ToDoubleFunction<People>) null);
+ fail("comparing(null) should throw NPE");
+ } catch (NullPointerException npe) {}
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Comparator/TypeTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 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.
+ */
+
+/**
+ * @test
+ * @summary Comparator API narrowing type test
+ * @run testng TypeTest
+ */
+
+import java.util.function.Function;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.Comparator;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit")
+public class TypeTest {
+ static class Person {
+ String name;
+ static Comparator<Person> C = (p1, p2) -> p1.name.compareTo(p2.name);
+
+ Person(String name) {
+ this.name = name;
+ }
+
+ String getName() { return name; }
+ }
+
+ static class Employee extends Person {
+ int id;
+ static Comparator<Employee> C = (e1, e2) -> e1.id - e2.id;
+
+ Employee(int id, String name) {
+ super(name);
+ this.id = id;
+ }
+ }
+
+ static class Manager extends Employee {
+ long reports;
+ static Comparator<Manager> C = (e1, e2) -> (int) (e1.reports - e2.reports);
+
+ Manager(String name, int id, long reports) {
+ super(id, name);
+ this.reports = reports;
+ }
+ }
+
+ static <T> void assertOrder(T o1, T o2, Comparator<? super T> cmp) {
+ if (cmp.compare(o1, o2) > 0) {
+ System.out.println("Fail!!");
+ }
+ if (cmp.compare(o1, o2) == 0) {
+ System.out.println("Equal!!");
+ }
+ }
+
+ public static void main(String[] args) {
+ Manager m1 = new Manager("Manager", 2, 2000);
+ Manager m2 = new Manager("Manager", 4, 1300);
+
+ // Comparator<Employee> tmp = Person.C;
+
+ // Comparator<Manager> cmp = Employee.C.thenComparing(Person.C);
+ Comparator<Employee> cmp = Employee.C.thenComparing(Person.C);
+ assertOrder(m1, m2, Employee.C.thenComparing(Person.C));
+ assertOrder(m1, m2, cmp);
+ assertOrder(m1, new Employee(1, "Z"), Person.C);
+ assertOrder(new Employee(1, "Z"), m2, Employee.C);
+
+ assertOrder(m1, m2, Comparator.comparing(Employee::getName, String.CASE_INSENSITIVE_ORDER));
+
+ Map<String, Integer> map = new TreeMap<>();
+ map.entrySet().stream().sorted(Map.Entry.comparingByKey(String.CASE_INSENSITIVE_ORDER));
+ }
+}
--- a/jdk/test/java/util/Comparators/BasicTest.java Tue Jul 02 15:20:55 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,412 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8001667 8010279
- * @run testng BasicTest
- */
-
-import java.util.Comparator;
-import java.util.Comparators;
-import java.util.AbstractMap;
-import java.util.Map;
-import org.testng.annotations.Test;
-
-import java.util.function.BinaryOperator;
-import java.util.function.Function;
-import java.util.function.ToIntFunction;
-import java.util.function.ToLongFunction;
-import java.util.function.ToDoubleFunction;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.assertSame;
-import static org.testng.Assert.fail;
-
-/**
- * Unit tests for helper methods in Comparators
- */
-@Test(groups = "unit")
-public class BasicTest {
- private static class Thing {
- public final int intField;
- public final long longField;
- public final double doubleField;
- public final String stringField;
-
- private Thing(int intField, long longField, double doubleField, String stringField) {
- this.intField = intField;
- this.longField = longField;
- this.doubleField = doubleField;
- this.stringField = stringField;
- }
-
- public int getIntField() {
- return intField;
- }
-
- public long getLongField() {
- return longField;
- }
-
- public double getDoubleField() {
- return doubleField;
- }
-
- public String getStringField() {
- return stringField;
- }
- }
-
- private final int[] intValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
- private final long[] longValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
- private final double[] doubleValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
- private final String[] stringValues = { "a", "a", "b", "b", "c", "c", "d", "d", "e", "e" };
- private final int[] comparisons = { 0, -1, 0, -1, 0, -1, 0, -1, 0 };
-
- private<T> void assertComparisons(T[] things, Comparator<T> comp, int[] comparisons) {
- for (int i=0; i<comparisons.length; i++) {
- assertEquals(comparisons.length + 1, things.length);
- assertEquals(comparisons[i], comp.compare(things[i], things[i+1]));
- assertEquals(-comparisons[i], comp.compare(things[i+1], things[i]));
- }
- }
-
- public void testIntComparator() {
- Thing[] things = new Thing[intValues.length];
- for (int i=0; i<intValues.length; i++)
- things[i] = new Thing(intValues[i], 0L, 0.0, null);
- Comparator<Thing> comp = Comparators.comparing(new ToIntFunction<BasicTest.Thing>() {
- @Override
- public int applyAsInt(Thing thing) {
- return thing.getIntField();
- }
- });
-
- assertComparisons(things, comp, comparisons);
- }
-
- public void testLongComparator() {
- Thing[] things = new Thing[longValues.length];
- for (int i=0; i<longValues.length; i++)
- things[i] = new Thing(0, longValues[i], 0.0, null);
- Comparator<Thing> comp = Comparators.comparing(new ToLongFunction<BasicTest.Thing>() {
- @Override
- public long applyAsLong(Thing thing) {
- return thing.getLongField();
- }
- });
-
- assertComparisons(things, comp, comparisons);
- }
-
- public void testDoubleComparator() {
- Thing[] things = new Thing[doubleValues.length];
- for (int i=0; i<doubleValues.length; i++)
- things[i] = new Thing(0, 0L, doubleValues[i], null);
- Comparator<Thing> comp = Comparators.comparing(new ToDoubleFunction<BasicTest.Thing>() {
- @Override
- public double applyAsDouble(Thing thing) {
- return thing.getDoubleField();
- }
- });
-
- assertComparisons(things, comp, comparisons);
- }
-
- public void testComparing() {
- Thing[] things = new Thing[doubleValues.length];
- for (int i=0; i<doubleValues.length; i++)
- things[i] = new Thing(0, 0L, 0.0, stringValues[i]);
- Comparator<Thing> comp = Comparators.comparing(new Function<Thing, String>() {
- @Override
- public String apply(Thing thing) {
- return thing.getStringField();
- }
- });
-
- assertComparisons(things, comp, comparisons);
- }
-
- public void testNaturalOrderComparator() {
- Comparator<String> comp = Comparators.naturalOrder();
-
- assertComparisons(stringValues, comp, comparisons);
- }
-
- public void testReverseComparator() {
- Comparator<String> cmpr = Comparators.reverseOrder();
- Comparator<String> cmp = cmpr.reverseOrder();
-
- assertEquals(cmp.reverseOrder(), cmpr);
- assertEquals(0, cmp.compare("a", "a"));
- assertEquals(0, cmpr.compare("a", "a"));
- assertTrue(cmp.compare("a", "b") < 0);
- assertTrue(cmpr.compare("a", "b") > 0);
- assertTrue(cmp.compare("b", "a") > 0);
- assertTrue(cmpr.compare("b", "a") < 0);
- }
-
- public void testReverseComparator2() {
- Comparator<String> cmp = (s1, s2) -> s1.length() - s2.length();
- Comparator<String> cmpr = cmp.reverseOrder();
-
- assertEquals(cmpr.reverseOrder(), cmp);
- assertEquals(0, cmp.compare("abc", "def"));
- assertEquals(0, cmpr.compare("abc", "def"));
- assertTrue(cmp.compare("abcd", "def") > 0);
- assertTrue(cmpr.compare("abcd", "def") < 0);
- assertTrue(cmp.compare("abc", "defg") < 0);
- assertTrue(cmpr.compare("abc", "defg") > 0);
- }
-
- @Test(expectedExceptions=NullPointerException.class)
- public void testReverseComparatorNPE() {
- Comparator<String> cmp = Comparators.reverseOrder(null);
- }
-
- public void testComposeComparator() {
- // Longer string in front
- Comparator<String> first = (s1, s2) -> s2.length() - s1.length();
- Comparator<String> second = Comparators.naturalOrder();
- Comparator<String> composed = Comparators.compose(first, second);
-
- assertTrue(composed.compare("abcdefg", "abcdef") < 0);
- assertTrue(composed.compare("abcdef", "abcdefg") > 0);
- assertTrue(composed.compare("abcdef", "abcdef") == 0);
- assertTrue(composed.compare("abcdef", "ghijkl") < 0);
- assertTrue(composed.compare("ghijkl", "abcdefg") > 0);
- }
-
- private <K, V> void assertPairComparison(K k1, V v1, K k2, V v2,
- Comparator<Map.Entry<K, V>> ck,
- Comparator<Map.Entry<K, V>> cv) {
- final Map.Entry<K, V> p11 = new AbstractMap.SimpleImmutableEntry<>(k1, v1);
- final Map.Entry<K, V> p12 = new AbstractMap.SimpleImmutableEntry<>(k1, v2);
- final Map.Entry<K, V> p21 = new AbstractMap.SimpleImmutableEntry<>(k2, v1);
- final Map.Entry<K, V> p22 = new AbstractMap.SimpleImmutableEntry<>(k2, v2);
-
- assertTrue(ck.compare(p11, p11) == 0);
- assertTrue(ck.compare(p12, p11) == 0);
- assertTrue(ck.compare(p11, p12) == 0);
- assertTrue(ck.compare(p12, p22) < 0);
- assertTrue(ck.compare(p12, p21) < 0);
- assertTrue(ck.compare(p21, p11) > 0);
- assertTrue(ck.compare(p21, p12) > 0);
-
- assertTrue(cv.compare(p11, p11) == 0);
- assertTrue(cv.compare(p12, p11) > 0);
- assertTrue(cv.compare(p11, p12) < 0);
- assertTrue(cv.compare(p12, p22) == 0);
- assertTrue(cv.compare(p12, p21) > 0);
- assertTrue(cv.compare(p21, p11) == 0);
- assertTrue(cv.compare(p21, p12) < 0);
-
- Comparator<Map.Entry<K, V>> cmp = Comparators.compose(ck, cv);
- assertTrue(cmp.compare(p11, p11) == 0);
- assertTrue(cmp.compare(p12, p11) > 0);
- assertTrue(cmp.compare(p11, p12) < 0);
- assertTrue(cmp.compare(p12, p22) < 0);
- assertTrue(cmp.compare(p12, p21) < 0);
- assertTrue(cmp.compare(p21, p11) > 0);
- assertTrue(cmp.compare(p21, p12) > 0);
-
- cmp = Comparators.compose(cv, ck);
- assertTrue(cmp.compare(p11, p11) == 0);
- assertTrue(cmp.compare(p12, p11) > 0);
- assertTrue(cmp.compare(p11, p12) < 0);
- assertTrue(cmp.compare(p12, p22) < 0);
- assertTrue(cmp.compare(p12, p21) > 0);
- assertTrue(cmp.compare(p21, p11) > 0);
- assertTrue(cmp.compare(p21, p12) < 0);
- }
-
- public void testKVComparatorable() {
- assertPairComparison(1, "ABC", 2, "XYZ",
- Comparators.<Integer, String>naturalOrderKeys(),
- Comparators.<Integer, String>naturalOrderValues());
- }
-
- private static class People {
- final String firstName;
- final String lastName;
- final int age;
-
- People(String first, String last, int age) {
- firstName = first;
- lastName = last;
- this.age = age;
- }
-
- String getFirstName() { return firstName; }
- String getLastName() { return lastName; }
- int getAge() { return age; }
- long getAgeAsLong() { return (long) age; };
- double getAgeAsDouble() { return (double) age; };
- }
-
- private final People people[] = {
- new People("John", "Doe", 34),
- new People("Mary", "Doe", 30),
- new People("Maria", "Doe", 14),
- new People("Jonah", "Doe", 10),
- new People("John", "Cook", 54),
- new People("Mary", "Cook", 50),
- };
-
- public void testKVComparators() {
- // Comparator<People> cmp = Comparators.naturalOrder(); // Should fail to compiler as People is not comparable
- // We can use simple comparator, but those have been tested above.
- // Thus choose to do compose for some level of interation.
- Comparator<People> cmp1 = Comparators.comparing((Function<People, String>) People::getFirstName);
- Comparator<People> cmp2 = Comparators.comparing((Function<People, String>) People::getLastName);
- Comparator<People> cmp = Comparators.compose(cmp1, cmp2);
-
- assertPairComparison(people[0], people[0], people[1], people[1],
- Comparators.<People, People>byKey(cmp),
- Comparators.<People, People>byValue(cmp));
-
- }
-
- private <T> void assertComparison(Comparator<T> cmp, T less, T greater) {
- assertTrue(cmp.compare(less, greater) < 0, "less");
- assertTrue(cmp.compare(less, less) == 0, "equal");
- assertTrue(cmp.compare(greater, less) > 0, "greater");
- }
-
- public void testComparatorDefaultMethods() {
- Comparator<People> cmp = Comparators.comparing((Function<People, String>) People::getFirstName);
- Comparator<People> cmp2 = Comparators.comparing((Function<People, String>) People::getLastName);
- // reverseOrder
- assertComparison(cmp.reverseOrder(), people[1], people[0]);
- // thenComparing(Comparator)
- assertComparison(cmp.thenComparing(cmp2), people[0], people[1]);
- assertComparison(cmp.thenComparing(cmp2), people[4], people[0]);
- // thenComparing(Function)
- assertComparison(cmp.thenComparing(People::getLastName), people[0], people[1]);
- assertComparison(cmp.thenComparing(People::getLastName), people[4], people[0]);
- // thenComparing(ToIntFunction)
- assertComparison(cmp.thenComparing(People::getAge), people[0], people[1]);
- assertComparison(cmp.thenComparing(People::getAge), people[1], people[5]);
- // thenComparing(ToLongFunction)
- assertComparison(cmp.thenComparing(People::getAgeAsLong), people[0], people[1]);
- assertComparison(cmp.thenComparing(People::getAgeAsLong), people[1], people[5]);
- // thenComparing(ToDoubleFunction)
- assertComparison(cmp.thenComparing(People::getAgeAsDouble), people[0], people[1]);
- assertComparison(cmp.thenComparing(People::getAgeAsDouble), people[1], people[5]);
- }
-
- public void testGreaterOf() {
- // lesser
- assertSame(Comparators.greaterOf(Comparators.comparing(
- (Function<People, String>) People::getFirstName))
- .apply(people[0], people[1]),
- people[1]);
- // euqal
- assertSame(Comparators.greaterOf(Comparators.comparing(
- (Function<People, String>) People::getLastName))
- .apply(people[0], people[1]),
- people[0]);
- // greater
- assertSame(Comparators.greaterOf(Comparators.comparing(
- (ToIntFunction<People>) People::getAge))
- .apply(people[0], people[1]),
- people[0]);
- }
-
- public void testLesserOf() {
- // lesser
- assertSame(Comparators.lesserOf(Comparators.comparing(
- (Function<People, String>) People::getFirstName))
- .apply(people[0], people[1]),
- people[0]);
- // euqal
- assertSame(Comparators.lesserOf(Comparators.comparing(
- (Function<People, String>) People::getLastName))
- .apply(people[0], people[1]),
- people[0]);
- // greater
- assertSame(Comparators.lesserOf(Comparators.comparing(
- (ToIntFunction<People>) People::getAge))
- .apply(people[0], people[1]),
- people[1]);
- }
-
- public void testNulls() {
- try {
- Comparators.<String>naturalOrder().compare("abc", (String) null);
- fail("expected NPE with naturalOrder");
- } catch (NullPointerException npe) {}
- try {
- Comparators.<String>naturalOrder().compare((String) null, "abc");
- fail("expected NPE with naturalOrder");
- } catch (NullPointerException npe) {}
-
- try {
- Comparators.<String>reverseOrder().compare("abc", (String) null);
- fail("expected NPE with naturalOrder");
- } catch (NullPointerException npe) {}
- try {
- Comparators.<String>reverseOrder().compare((String) null, "abc");
- fail("expected NPE with naturalOrder");
- } catch (NullPointerException npe) {}
-
- try {
- Comparator<Map.Entry<String, String>> cmp = Comparators.byKey(null);
- fail("byKey(null) should throw NPE");
- } catch (NullPointerException npe) {}
-
- try {
- Comparator<Map.Entry<String, String>> cmp = Comparators.byValue(null);
- fail("byValue(null) should throw NPE");
- } catch (NullPointerException npe) {}
-
- try {
- Comparator<People> cmp = Comparators.comparing((Function<People, String>) null);
- fail("comparing(null) should throw NPE");
- } catch (NullPointerException npe) {}
- try {
- Comparator<People> cmp = Comparators.comparing((ToIntFunction<People>) null);
- fail("comparing(null) should throw NPE");
- } catch (NullPointerException npe) {}
- try {
- Comparator<People> cmp = Comparators.comparing((ToLongFunction<People>) null);
- fail("comparing(null) should throw NPE");
- } catch (NullPointerException npe) {}
- try {
- Comparator<People> cmp = Comparators.comparing((ToDoubleFunction<People>) null);
- fail("comparing(null) should throw NPE");
- } catch (NullPointerException npe) {}
-
- try {
- BinaryOperator<String> op = Comparators.lesserOf(null);
- fail("lesserOf(null) should throw NPE");
- } catch (NullPointerException npe) {}
-
- try {
- BinaryOperator<String> op = Comparators.greaterOf(null);
- fail("lesserOf(null) should throw NPE");
- } catch (NullPointerException npe) {}
- }
-}
--- a/jdk/test/java/util/Currency/PropertiesTest.sh Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Currency/PropertiesTest.sh Tue Jul 02 15:23:23 2013 -0700
@@ -23,7 +23,7 @@
#
# @test
-# @bug 6332666 7180362 8003846
+# @bug 6332666 6863624 7180362 8003846
# @summary tests the capability of replacing the currency data with user
# specified currency properties file
# @build PropertiesTest
@@ -56,10 +56,15 @@
PS=":"
FS="/"
;;
- Windows* | CYGWIN* )
+ Windows* )
PS=";"
FS="/"
;;
+ CYGWIN* )
+ PS=";"
+ FS="/"
+ TESTJAVA=`cygpath -u ${TESTJAVA}`
+ ;;
* )
echo "Unrecognized system!"
exit 1;
@@ -92,24 +97,27 @@
# Dump built-in currency data + overrides in properties file copied into
# JRE image.
-# copy the test properties file
+# Copy the test properties file. If testjava is not a typical jdk-image
+# or testjava is not writable, make a private copy of it.
COPIED=0
-if [ -w $TESTJAVA ]
+if [ -w ${TESTJAVA}${FS}jre${FS}lib ]
then
WRITABLEJDK=$TESTJAVA
+ PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
else
WRITABLEJDK=.${FS}testjava
+ if [ -d ${TESTJAVA}${FS}jre ]
+ then
+ PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
+ else
+ PROPLOCATION=${WRITABLEJDK}${FS}lib
+ fi
cp -r $TESTJAVA $WRITABLEJDK
+ chmod -R +w $WRITABLEJDK
COPIED=1
fi
-
-if [ -d ${WRITABLEJDK}${FS}jre ]
-then
- PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
-else
- PROPLOCATION=${WRITABLEJDK}${FS}lib
-fi
cp ${PROPS} $PROPLOCATION
+echo "Properties location: ${PROPLOCATION}"
# run
echo ''
--- a/jdk/test/java/util/Formatter/Basic-X.java.template Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Formatter/Basic-X.java.template Tue Jul 02 15:23:23 2013 -0700
@@ -1177,6 +1177,13 @@
test("%.3G", "1.00E-05", recip(create(100000.0)));
test("%.3G", "-1.00E-05", recip(create(-100000.0)));
+ test("%.1g", "-0", -0.0);
+ test("%3.0g", " -0", -0.0);
+ test("%.1g", "0", 0.0);
+ test("%3.0g", " 0", 0.0);
+ test("%.1g", "0", +0.0);
+ test("%3.0g", " 0", +0.0);
+
test("%3.0g", "1e-06", 0.000001);
test("%3.0g", "1e-05", 0.00001);
test("%3.0g", "1e-05", 0.0000099);
--- a/jdk/test/java/util/Formatter/Basic.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Formatter/Basic.java Tue Jul 02 15:23:23 2013 -0700
@@ -25,7 +25,7 @@
* @summary Unit test for formatter
* @bug 4906370 4962433 4973103 4989961 5005818 5031150 4970931 4989491 5002937
* 5005104 5007745 5061412 5055180 5066788 5088703 6317248 6318369 6320122
- * 6344623 6369500 6534606 6282094 6286592 6476425 5063507
+ * 6344623 6369500 6534606 6282094 6286592 6476425 5063507 6469160
*
* @run shell/timeout=240 Basic.sh
*/
--- a/jdk/test/java/util/Formatter/BasicBigDecimal.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Formatter/BasicBigDecimal.java Tue Jul 02 15:23:23 2013 -0700
@@ -1177,6 +1177,13 @@
test("%.3G", "1.00E-05", recip(create(100000.0)));
test("%.3G", "-1.00E-05", recip(create(-100000.0)));
+ test("%.1g", "-0", -0.0);
+ test("%3.0g", " -0", -0.0);
+ test("%.1g", "0", 0.0);
+ test("%3.0g", " 0", 0.0);
+ test("%.1g", "0", +0.0);
+ test("%3.0g", " 0", +0.0);
+
test("%3.0g", "1e-06", 0.000001);
test("%3.0g", "1e-05", 0.00001);
test("%3.0g", "1e-05", 0.0000099);
--- a/jdk/test/java/util/Formatter/BasicDouble.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Formatter/BasicDouble.java Tue Jul 02 15:23:23 2013 -0700
@@ -1123,6 +1123,15 @@
+
+
+
+
+
+
+
+
+
//---------------------------------------------------------------------
// %f - float, double, Double, BigDecimal
//---------------------------------------------------------------------
@@ -1168,6 +1177,13 @@
test("%.3G", "1.00E-05", recip(create(100000.0)));
test("%.3G", "-1.00E-05", recip(create(-100000.0)));
+ test("%.1g", "-0", -0.0);
+ test("%3.0g", " -0", -0.0);
+ test("%.1g", "0", 0.0);
+ test("%3.0g", " 0", 0.0);
+ test("%.1g", "0", +0.0);
+ test("%3.0g", " 0", +0.0);
+
test("%3.0g", "1e-06", 0.000001);
test("%3.0g", "1e-05", 0.00001);
test("%3.0g", "1e-05", 0.0000099);
--- a/jdk/test/java/util/Formatter/BasicDoubleObject.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Formatter/BasicDoubleObject.java Tue Jul 02 15:23:23 2013 -0700
@@ -1123,6 +1123,15 @@
+
+
+
+
+
+
+
+
+
//---------------------------------------------------------------------
// %f - float, double, Double, BigDecimal
//---------------------------------------------------------------------
@@ -1168,6 +1177,13 @@
test("%.3G", "1.00E-05", recip(create(100000.0)));
test("%.3G", "-1.00E-05", recip(create(-100000.0)));
+ test("%.1g", "-0", -0.0);
+ test("%3.0g", " -0", -0.0);
+ test("%.1g", "0", 0.0);
+ test("%3.0g", " 0", 0.0);
+ test("%.1g", "0", +0.0);
+ test("%3.0g", " 0", +0.0);
+
test("%3.0g", "1e-06", 0.000001);
test("%3.0g", "1e-05", 0.00001);
test("%3.0g", "1e-05", 0.0000099);
--- a/jdk/test/java/util/Formatter/BasicFloat.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Formatter/BasicFloat.java Tue Jul 02 15:23:23 2013 -0700
@@ -1106,6 +1106,15 @@
+
+
+
+
+
+
+
+
+
//---------------------------------------------------------------------
// %f - float
//---------------------------------------------------------------------
@@ -1168,6 +1177,13 @@
test("%.3G", "1.00E-05", recip(create(100000.0)));
test("%.3G", "-1.00E-05", recip(create(-100000.0)));
+ test("%.1g", "-0", -0.0);
+ test("%3.0g", " -0", -0.0);
+ test("%.1g", "0", 0.0);
+ test("%3.0g", " 0", 0.0);
+ test("%.1g", "0", +0.0);
+ test("%3.0g", " 0", +0.0);
+
test("%3.0g", "1e-06", 0.000001);
test("%3.0g", "1e-05", 0.00001);
test("%3.0g", "1e-05", 0.0000099);
--- a/jdk/test/java/util/Formatter/BasicFloatObject.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Formatter/BasicFloatObject.java Tue Jul 02 15:23:23 2013 -0700
@@ -1139,6 +1139,15 @@
+
+
+
+
+
+
+
+
+
//---------------------------------------------------------------------
// %g
//
@@ -1168,6 +1177,13 @@
test("%.3G", "1.00E-05", recip(create(100000.0)));
test("%.3G", "-1.00E-05", recip(create(-100000.0)));
+ test("%.1g", "-0", -0.0);
+ test("%3.0g", " -0", -0.0);
+ test("%.1g", "0", 0.0);
+ test("%3.0g", " 0", 0.0);
+ test("%.1g", "0", +0.0);
+ test("%3.0g", " 0", +0.0);
+
test("%3.0g", "1e-06", 0.000001);
test("%3.0g", "1e-05", 0.00001);
test("%3.0g", "1e-05", 0.0000099);
--- a/jdk/test/java/util/Locale/LocaleProviders.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Locale/LocaleProviders.java Tue Jul 02 15:23:23 2013 -0700
@@ -207,7 +207,7 @@
String jreResult = "\u5e73\u6210 16.11.03 (\u6c34) \u5348\u524d 11:53:47";
Locale l = new Locale("ja", "JP", "JP");
SimpleDateFormat sdf = new SimpleDateFormat("GGGG yyyy.MMM.dd '('E')' a hh:mm:ss", l);
- sdf.setTimeZone(TimeZone.getTimeZone("PST"));
+ sdf.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));
String result = sdf.format(sampleDate);
System.out.println(result);
if (LocaleProviderAdapter.getAdapterPreference()
--- a/jdk/test/java/util/Locale/LocaleProviders.sh Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Locale/LocaleProviders.sh Tue Jul 02 15:23:23 2013 -0700
@@ -24,7 +24,7 @@
#
# @test
# @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8010666
-# 8013086 8013233 8013903
+# 8013086 8013233 8013903 8015960
# @summary tests for "java.locale.providers" system property
# @compile -XDignore.symbol.file LocaleProviders.java
# @run shell/timeout=600 LocaleProviders.sh
--- a/jdk/test/java/util/Map/Defaults.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/Map/Defaults.java Tue Jul 02 15:23:23 2013 -0700
@@ -271,14 +271,21 @@
@Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=withNull values=withNull")
public void testComputeIfPresentNulls(String description, Map<IntegerEnum, String> map) {
- assertTrue(map.containsKey(null));
- assertNull(map.get(null));
+ assertTrue(map.containsKey(null), description + ": null key absent");
+ assertNull(map.get(null), description + ": value not null");
assertSame(map.computeIfPresent(null, (k, v) -> {
- fail();
+ fail(description + ": null value is not deemed present");
return EXTRA_VALUE;
}), null, description);
assertTrue(map.containsKey(null));
- assertSame(map.get(null), null, description);
+ assertNull(map.get(null), description);
+ assertNull(map.remove(EXTRA_KEY), description + ": unexpected mapping");
+ assertNull(map.put(EXTRA_KEY, null), description + ": unexpected value");
+ assertSame(map.computeIfPresent(EXTRA_KEY, (k, v) -> {
+ fail(description + ": null value is not deemed present");
+ return EXTRA_VALUE;
+ }), null, description);
+ assertNull(map.get(EXTRA_KEY), description + ": null mapping gone");
}
@Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
@@ -307,19 +314,59 @@
assertTrue(map.containsKey(null), "null key absent");
assertNull(map.get(null), "value not null");
assertSame(map.compute(null, (k, v) -> {
+ assertNull(k);
+ assertNull(v);
+ return null;
+ }), null, description);
+ assertFalse(map.containsKey(null), description + ": null key present.");
+ assertSame(map.compute(null, (k, v) -> {
assertSame(k, null);
assertNull(v);
return EXTRA_VALUE;
}), EXTRA_VALUE, description);
assertTrue(map.containsKey(null));
assertSame(map.get(null), EXTRA_VALUE, description);
- assertSame(map.remove(null), EXTRA_VALUE, "removed value not expected");
- assertFalse(map.containsKey(null), "null key present");
+ assertSame(map.remove(null), EXTRA_VALUE, description + ": removed value not expected");
+ // no mapping before and after
+ assertFalse(map.containsKey(null), description + ": null key present");
assertSame(map.compute(null, (k, v) -> {
- assertSame(k, null);
+ assertNull(k);
+ assertNull(v);
+ return null;
+ }), null, description + ": expected null result" );
+ assertFalse(map.containsKey(null), description + ": null key present");
+ // compute with map not containing value
+ assertNull(map.remove(EXTRA_KEY), description + ": unexpected mapping");
+ assertFalse(map.containsKey(EXTRA_KEY), description + ": key present");
+ assertSame(map.compute(EXTRA_KEY, (k, v) -> {
+ assertSame(k, EXTRA_KEY);
assertNull(v);
return null;
}), null, description);
+ assertFalse(map.containsKey(EXTRA_KEY), description + ": null key present");
+ // ensure removal.
+ assertNull(map.put(EXTRA_KEY, EXTRA_VALUE));
+ assertSame(map.compute(EXTRA_KEY, (k, v) -> {
+ assertSame(k, EXTRA_KEY);
+ assertSame(v, EXTRA_VALUE);
+ return null;
+ }), null, description + ": null resulted expected");
+ assertFalse(map.containsKey(EXTRA_KEY), description + ": null key present");
+ // compute with map containing null value
+ assertNull(map.put(EXTRA_KEY, null), description + ": unexpected value");
+ assertSame(map.compute(EXTRA_KEY, (k, v) -> {
+ assertSame(k, EXTRA_KEY);
+ assertNull(v);
+ return null;
+ }), null, description);
+ assertFalse(map.containsKey(EXTRA_KEY), description + ": null key present");
+ assertNull(map.put(EXTRA_KEY, null), description + ": unexpected value");
+ assertSame(map.compute(EXTRA_KEY, (k, v) -> {
+ assertSame(k, EXTRA_KEY);
+ assertNull(v);
+ return EXTRA_VALUE;
+ }), EXTRA_VALUE, description);
+ assertTrue(map.containsKey(EXTRA_KEY), "null key present");
}
@Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Map/EntryComparators.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8009736 8010279
+ * @run testng EntryComparators
+ */
+import java.util.function.Function;
+import java.util.Comparator;
+import java.util.AbstractMap;
+import java.util.Map;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+/**
+ * Unit tests for Map.Entry.comparing
+ */
+@Test(groups = "unit")
+public class EntryComparators {
+
+ private <K, V> void assertPairComparison(K k1, V v1, K k2, V v2,
+ Comparator<Map.Entry<K, V>> ck,
+ Comparator<Map.Entry<K, V>> cv) {
+ final Map.Entry<K, V> p11 = new AbstractMap.SimpleImmutableEntry<>(k1, v1);
+ final Map.Entry<K, V> p12 = new AbstractMap.SimpleImmutableEntry<>(k1, v2);
+ final Map.Entry<K, V> p21 = new AbstractMap.SimpleImmutableEntry<>(k2, v1);
+ final Map.Entry<K, V> p22 = new AbstractMap.SimpleImmutableEntry<>(k2, v2);
+
+ assertTrue(ck.compare(p11, p11) == 0);
+ assertTrue(ck.compare(p12, p11) == 0);
+ assertTrue(ck.compare(p11, p12) == 0);
+ assertTrue(ck.compare(p12, p22) < 0);
+ assertTrue(ck.compare(p12, p21) < 0);
+ assertTrue(ck.compare(p21, p11) > 0);
+ assertTrue(ck.compare(p21, p12) > 0);
+
+ assertTrue(cv.compare(p11, p11) == 0);
+ assertTrue(cv.compare(p12, p11) > 0);
+ assertTrue(cv.compare(p11, p12) < 0);
+ assertTrue(cv.compare(p12, p22) == 0);
+ assertTrue(cv.compare(p12, p21) > 0);
+ assertTrue(cv.compare(p21, p11) == 0);
+ assertTrue(cv.compare(p21, p12) < 0);
+
+ Comparator<Map.Entry<K, V>> cmp = ck.thenComparing(cv);
+ assertTrue(cmp.compare(p11, p11) == 0);
+ assertTrue(cmp.compare(p12, p11) > 0);
+ assertTrue(cmp.compare(p11, p12) < 0);
+ assertTrue(cmp.compare(p12, p22) < 0);
+ assertTrue(cmp.compare(p12, p21) < 0);
+ assertTrue(cmp.compare(p21, p11) > 0);
+ assertTrue(cmp.compare(p21, p12) > 0);
+
+ cmp = cv.thenComparing(ck);
+ assertTrue(cmp.compare(p11, p11) == 0);
+ assertTrue(cmp.compare(p12, p11) > 0);
+ assertTrue(cmp.compare(p11, p12) < 0);
+ assertTrue(cmp.compare(p12, p22) < 0);
+ assertTrue(cmp.compare(p12, p21) > 0);
+ assertTrue(cmp.compare(p21, p11) > 0);
+ assertTrue(cmp.compare(p21, p12) < 0);
+ }
+
+ public void testKVComparables() {
+ assertPairComparison(1, "ABC", 2, "XYZ",
+ Map.Entry.<Integer, String>comparingByKey(),
+ Map.Entry.<Integer, String>comparingByValue());
+ }
+
+ private static class People {
+ final String firstName;
+ final String lastName;
+ final int age;
+
+ People(String first, String last, int age) {
+ firstName = first;
+ lastName = last;
+ this.age = age;
+ }
+
+ String getFirstName() { return firstName; }
+ String getLastName() { return lastName; }
+ int getAge() { return age; }
+ }
+
+ private final People people[] = {
+ new People("John", "Doe", 34),
+ new People("Mary", "Doe", 30),
+ };
+
+ public void testKVComparators() {
+ // Comparator<People> cmp = Comparator.naturalOrder(); // Should fail to compiler as People is not comparable
+ // We can use simple comparator, but those have been tested above.
+ // Thus choose to do compose for some level of interation.
+ Comparator<People> cmp1 = Comparator.comparing((Function<People, String>) People::getFirstName);
+ Comparator<People> cmp2 = Comparator.comparing((Function<People, String>) People::getLastName);
+ Comparator<People> cmp = cmp1.thenComparing(cmp2);
+
+ assertPairComparison(people[0], people[0], people[1], people[1],
+ Map.Entry.<People, People>comparingByKey(cmp),
+ Map.Entry.<People, People>comparingByValue(cmp));
+
+ }
+
+ public void testNulls() {
+ try {
+ Comparator<Map.Entry<String, String>> cmp = Map.Entry.comparingByKey(null);
+ fail("comparingByKey(null) should throw NPE");
+ } catch (NullPointerException npe) {}
+
+ try {
+ Comparator<Map.Entry<String, String>> cmp = Map.Entry.comparingByValue(null);
+ fail("comparingByValue(null) should throw NPE");
+ } catch (NullPointerException npe) {}
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Properties/Bug6609431.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 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.
+ */
+/*
+ * @test
+ * @bug 6609431
+ * @summary Test whether loading of a property value in a file ending with
+ * a backslash works fine.
+ */
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Properties;
+
+public class Bug6609431 {
+ private static final String expected = "backslash";
+
+ public static void main(String[] args) throws IOException {
+ try (FileReader fr =
+ new FileReader(new File(System.getProperty("test.src", "."),
+ "Bug6609431.properties"))) {
+ Properties p = new Properties();
+ p.load(fr);
+ p.getProperty("a");
+ String val = p.getProperty("b");
+ if (!val.equals(expected)) {
+ throw new RuntimeException("Value returned from the property" +
+ " list was incorrect. Returned: '" + val +
+ "', expected: '" + expected + "'");
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Properties/Bug6609431.properties Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 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.
+#
+a=backslashbackslash
+b=backslash\
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/function/BinaryOperator/BasicTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8009736 8010279
+ * @run testng BasicTest
+ */
+
+import java.util.Comparator;
+import java.util.function.BinaryOperator;
+import java.util.function.Function;
+import java.util.function.ToIntFunction;
+import org.testng.annotations.Test;
+
+
+import static java.util.function.BinaryOperator.minBy;
+import static java.util.function.BinaryOperator.maxBy;
+import static org.testng.Assert.assertSame;
+import static org.testng.Assert.fail;
+
+/**
+ * Unit tests for helper methods in Comparators
+ */
+@Test(groups = "unit")
+public class BasicTest {
+
+ private static class People {
+ final String firstName;
+ final String lastName;
+ final int age;
+
+ People(String first, String last, int age) {
+ firstName = first;
+ lastName = last;
+ this.age = age;
+ }
+
+ String getFirstName() { return firstName; }
+ String getLastName() { return lastName; }
+ int getAge() { return age; }
+ }
+
+ private final People people[] = {
+ new People("John", "Doe", 34),
+ new People("Mary", "Doe", 30),
+ };
+
+ public void testMaxBy() {
+ Comparator<People> cmp = Comparator.comparing((Function<People, String>) People::getFirstName);
+ // lesser
+ assertSame(maxBy(cmp).apply(people[0], people[1]), people[1]);
+ // euqal
+ cmp = Comparator.comparing((Function<People, String>) People::getLastName);
+ assertSame(maxBy(cmp).apply(people[0], people[1]), people[0]);
+ // greater
+ cmp = Comparator.comparing((ToIntFunction<People>) People::getAge);
+ assertSame(maxBy(cmp).apply(people[0], people[1]), people[0]);
+ }
+
+ public void testLesserOf() {
+ Comparator<People> cmp = Comparator.comparing((Function<People, String>) People::getFirstName);
+ // lesser
+ assertSame(minBy(cmp).apply(people[0], people[1]), people[0]);
+ // euqal
+ cmp = Comparator.comparing((Function<People, String>) People::getLastName);
+ assertSame(minBy(cmp).apply(people[0], people[1]), people[0]);
+ // greater
+ cmp = Comparator.comparing((ToIntFunction<People>) People::getAge);
+ assertSame(minBy(cmp).apply(people[0], people[1]), people[1]);
+ }
+
+ public void testNulls() {
+ try {
+ BinaryOperator<String> op = minBy(null);
+ fail("minBy(null) should throw NPE");
+ } catch (NullPointerException npe) {}
+
+ try {
+ BinaryOperator<String> op = maxBy(null);
+ fail("maxBy(null) should throw NPE");
+ } catch (NullPointerException npe) {}
+ }
+}
--- a/jdk/test/java/util/logging/LogManagerInstanceTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/logging/LogManagerInstanceTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -63,7 +63,7 @@
if (!super.addLogger(root))
throw new RuntimeException("Fail to addLogger " + root);
} else {
- System.out.println("Root logger already exists");
+ throw new RuntimeException("Root logger already exists");
}
this.base = root;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobal.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 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.
+ */
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Logger;
+
+/**
+ * @test
+ * @bug 7184195
+ * @summary checks that java.util.logging.Logger.getGlobal().info() logs without configuration
+ * @build TestGetGlobal testgetglobal.HandlerImpl testgetglobal.LogManagerImpl1 testgetglobal.LogManagerImpl2 testgetglobal.LogManagerImpl3 testgetglobal.BadLogManagerImpl testgetglobal.DummyLogManagerImpl
+ * @run main/othervm/timeout=10 TestGetGlobal
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager TestGetGlobal
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobal
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobal
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobal
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobal
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobal
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobal
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobal
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobal
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobal
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobal
+ * @author danielfuchs
+ */
+public class TestGetGlobal {
+
+ final static String[] messages = {
+ "1. This message should not appear on the console.",
+ "2. This message should appear on the console.",
+ "3. This message should now appear on the console too."
+ };
+
+ static {
+ System.setProperty("java.util.logging.config.file",
+ System.getProperty("test.src", ".") + java.io.File.separator + "logging.properties");
+ }
+
+ public static void main(String... args) {
+
+ Logger.global.info(messages[0]); // at this point LogManager is not
+ // initialized yet, so this message should not appear.
+ Logger.getGlobal().info(messages[1]); // calling getGlobal() will
+ // initialize the LogManager - and thus this message should appear.
+ Logger.global.info(messages[2]); // Now that the LogManager is
+ // initialized, this message should appear too.
+
+ final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, 1, messages.length));
+ if (!testgetglobal.HandlerImpl.received.equals(expected)) {
+ throw new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalByName.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 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.
+ */
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Logger;
+
+/**
+ * @test
+ * @bug 7184195
+ * @summary checks that java.util.logging.Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info() logs without configuration
+ * @build TestGetGlobalByName testgetglobal.HandlerImpl testgetglobal.LogManagerImpl1 testgetglobal.LogManagerImpl2 testgetglobal.LogManagerImpl3 testgetglobal.BadLogManagerImpl testgetglobal.DummyLogManagerImpl
+ * @run main/othervm/timeout=10 TestGetGlobalByName
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager TestGetGlobalByName
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobalByName
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl TestGetGlobalByName
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalByName
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalByName
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalByName
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalByName
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalByName
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalByName
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalByName
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalByName
+ * @author danielfuchs
+ */
+public class TestGetGlobalByName {
+
+ final static String[] messages = {
+ "1. This message should not appear on the console.",
+ "2. This message should appear on the console.",
+ "3. This message should now appear on the console too."
+ };
+
+ static {
+ System.setProperty("java.util.logging.config.file",
+ System.getProperty("test.src", ".") + java.io.File.separator + "logging.properties");
+ }
+
+ public static void main(String... args) {
+
+ Logger.global.info(messages[0]); // at this point LogManager is not
+ // initialized yet, so this message should not appear.
+ Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info(messages[1]); // calling getLogger() will
+ // initialize the LogManager - and thus this message should appear.
+ Logger.global.info(messages[2]); // Now that the LogManager is
+ // initialized, this message should appear too.
+
+ final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, 1, messages.length));
+ if (!testgetglobal.HandlerImpl.received.equals(expected)) {
+ throw new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalConcurrent.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 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.
+ */
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Logger;
+
+/**
+ * @test
+ * @bug 7184195
+ * @summary checks that java.util.logging.Logger.getGlobal().info() logs without configuration
+ * @build TestGetGlobalConcurrent testgetglobal.HandlerImpl testgetglobal.LogManagerImpl1 testgetglobal.LogManagerImpl2 testgetglobal.LogManagerImpl3 testgetglobal.BadLogManagerImpl testgetglobal.DummyLogManagerImpl
+ * @run main/othervm/timeout=10 TestGetGlobalConcurrent
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager TestGetGlobalConcurrent
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl TestGetGlobalConcurrent
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl TestGetGlobalConcurrent
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalConcurrent
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalConcurrent
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalConcurrent
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalConcurrent
+ * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalConcurrent
+ * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalConcurrent
+ * @author danielfuchs
+ */
+public class TestGetGlobalConcurrent {
+
+ final static String[] messages = {
+ "1. This message should not appear on the console.",
+ "2. This message should appear on the console.",
+ "3. This message should now appear on the console too.",
+ "4. This message should appear on the console.",
+ "5. This message should now appear on the console too.",
+ "6. This message should appear on the console.",
+ "7. This message should now appear on the console too.",
+ "8. This message should appear on the console.",
+ "9. This message should now appear on the console too."
+ };
+
+ static {
+ System.setProperty("java.util.logging.config.file",
+ System.getProperty("test.src", ".") + java.io.File.separator + "logging.properties");
+ }
+
+ public static void test1() {
+ final int nb = 1;
+ final int i = 2*nb + 1;
+ Logger.getGlobal().info(messages[i]); // calling getGlobal() will
+ // initialize the LogManager - and thus this message should appear.
+ Logger.global.info(messages[i+1]); // Now that the LogManager is
+ // initialized, this message should appear too.
+
+ final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2));
+ if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
+ fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected));
+ }
+ }
+ public static void test2() {
+ final int nb = 2;
+ final int i = 2*nb + 1;
+ Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info(messages[i]); // calling getGlobal() will
+ // initialize the LogManager - and thus this message should appear.
+ Logger.global.info(messages[i+1]); // Now that the LogManager is
+ // initialized, this message should appear too.
+
+ final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2));
+ if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
+ fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected));
+ }
+ }
+ public static void test3() {
+ final int nb = 3;
+ final int i = 2*nb + 1;
+ java.util.logging.LogManager.getLogManager();
+ Logger.getGlobal().info(messages[i]); // calling getGlobal() will
+ // initialize the LogManager - and thus this message should appear.
+ Logger.global.info(messages[i+1]); // Now that the LogManager is
+ // initialized, this message should appear too.
+
+ final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2));
+ if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
+ fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected));
+ }
+ }
+ public static void test4() {
+ log = new MyLogger("foo.bar");
+ java.util.logging.LogManager.getLogManager().addLogger(log);
+ }
+
+
+ private static volatile Throwable failed = null;
+ private static volatile Logger log = null;
+
+ public static class MyLogger extends Logger {
+ public MyLogger(String name) {
+ super(name, null);
+ }
+ }
+
+ public static void fail(Throwable failure) {
+ failure.printStackTrace();
+ if (failed == null) failed = failure;
+ }
+
+ public static class WaitAndRun implements Runnable {
+ private final Runnable run;
+ public WaitAndRun(Runnable run) {
+ this.run = run;
+ }
+ public void run() {
+ try {
+ Thread.sleep(10);
+ run.run();
+ } catch (Exception | Error x) {
+ fail(x);
+ }
+ }
+ }
+
+ final static class Run1 implements Runnable {
+ public void run() { test1(); }
+ }
+ final static class Run2 implements Runnable {
+ public void run() { test2(); }
+ }
+ final static class Run3 implements Runnable {
+ public void run() { test3(); }
+ }
+ final static class Run4 implements Runnable {
+ public void run() { test4(); }
+ }
+
+ public static void main(String... args) throws Exception {
+
+ final Thread t1 = new Thread(new WaitAndRun(new Run1()), "test1");
+ final Thread t2 = new Thread(new WaitAndRun(new Run2()), "test2");
+ final Thread t3 = new Thread(new WaitAndRun(new Run3()), "test3");
+ final Thread t4 = new Thread(new WaitAndRun(new Run4()), "test4");
+
+ t1.setDaemon(true); t2.setDaemon(true); t3.setDaemon(true); t4.setDaemon(true);
+ t1.start(); t2.start(); t3.start(); t4.start();
+
+ Thread.sleep(10);
+
+ Logger.getGlobal().info(messages[1]); // calling getGlobal() will
+ // initialize the LogManager - and thus this message should appear.
+ Logger.global.info(messages[2]); // Now that the LogManager is
+ // initialized, this message should appear too.
+
+ final List<String> expected = Arrays.asList(Arrays.copyOfRange(messages, 1, 3));
+ if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
+ throw new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected);
+ }
+
+
+ t1.join(); t2.join(); t3.join(); t4.join();
+
+ if (failed != null) {
+ throw new Error("Test failed.", failed);
+ }
+
+ System.out.println("Test passed");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Logger/getGlobal/logging.properties Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,2 @@
+.level=INFO
+handlers=testgetglobal.HandlerImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Logger/getGlobal/policy Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,7 @@
+grant {
+ permission java.util.PropertyPermission "java.util.logging.config.file", "write";
+ permission java.util.PropertyPermission "test.src", "read";
+ permission java.lang.RuntimePermission "setContextClassLoader";
+ permission java.lang.RuntimePermission "shutdownHooks";
+ permission java.util.logging.LoggingPermission "control";
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/BadLogManagerImpl.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 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.
+ */
+package testgetglobal;
+
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+/**
+ * This class is used to verify that calling Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)
+ * in the constructor of a LogManager subclass installed as default
+ * LogManager does not cause issues beyond throwing the expected NPE.
+ * In that case the default LogManager class will simply be used.
+ * @author danielfuchs
+ */
+public class BadLogManagerImpl extends LogManager {
+
+ final Logger globalLogger;
+ public BadLogManagerImpl() {
+ // The call below should generate an NPE, which will be
+ // catched in LogManager initializer.
+ globalLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ System.err.println("Global is: " + globalLogger);
+ throw new Error("Should not have reached here");
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/DummyLogManagerImpl.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 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.
+ */
+package testgetglobal;
+
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+/**
+ * A dummy LogManager subclass that does nothing beyond extending LogManager.
+ * @author danielfuchs
+ */
+public class DummyLogManagerImpl extends LogManager {
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/HandlerImpl.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 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.
+ */
+package testgetglobal;
+
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.List;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.LogRecord;
+
+/**
+ *
+ * @author danielfuchs
+ */
+public class HandlerImpl extends ConsoleHandler {
+
+ public final static List<String> received = new CopyOnWriteArrayList<>();
+
+ public HandlerImpl() {
+ }
+
+ @Override
+ public void publish(LogRecord record) {
+ received.add(record.getMessage());
+ super.publish(record);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/LogManagerImpl1.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 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.
+ */
+package testgetglobal;
+
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+/**
+ * This class is used to verify that calling Logger.getGlobal() in the static
+ * initializer of a LogManager subclass installed as default LogManager
+ * does not cause issues.
+ * @author danielfuchs
+ */
+public class LogManagerImpl1 extends LogManager {
+
+ static final Logger global;
+ static {
+ global = Logger.getGlobal();
+ System.err.println("Global is: " + global);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/LogManagerImpl2.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 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.
+ */
+package testgetglobal;
+
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+/**
+ * This class is used to verify that calling Logger.getGlobal() in the constructor
+ * initializer of a LogManager subclass installed as default LogManager
+ * does not cause issues.
+ * @author danielfuchs
+ */
+public class LogManagerImpl2 extends LogManager {
+
+ final Logger globalLogger;
+ public LogManagerImpl2() {
+ globalLogger = Logger.getGlobal();
+ System.err.println("Global is: " + globalLogger);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/LogManagerImpl3.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 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.
+ */
+package testgetglobal;
+
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+/**
+ * This class is used to verify that calling Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)
+ * in the static initializer of a LogManager subclass installed as default
+ * LogManager does not cause issues beyond throwing the expected NPE.
+ * @author danielfuchs
+ */
+public class LogManagerImpl3 extends LogManager {
+
+ static final Logger global;
+ static {
+ Logger g = null;
+ try {
+ g = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ throw new Error("Should not have reached here");
+ } catch (Exception x) {
+ // This is to be expected: Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)
+ // will call LogManager.getLogManager() which will return null, since
+ // we haven't manage to do new LogManagerImpl3() yet.
+ //
+ System.err.println("Got expected exception - you cannot call"
+ + " Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)"
+ + " in LogManager subclass static initializer: " + x);
+ x.printStackTrace();
+ }
+ if (g == null) {
+ g = Logger.getGlobal();
+ }
+ global = g;
+ System.err.println("Global is: " + global);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/TestAppletLoggerContext.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,610 @@
+/*
+ * Copyright (c) 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.
+ */
+
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+import java.util.logging.LoggingPermission;
+import sun.misc.JavaAWTAccess;
+import sun.misc.SharedSecrets;
+
+/*
+ * @test
+ * @bug 8017174 8010727
+ * @summary NPE when using Logger.getAnonymousLogger or
+ * LogManager.getLogManager().getLogger
+ *
+ * @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingApplet
+ * @run main/othervm -Dtest.security=on TestAppletLoggerContext LoadingApplet
+ * @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingMain
+ * @run main/othervm -Dtest.security=on TestAppletLoggerContext LoadingMain
+ * @run main/othervm -Dtest.security=off TestAppletLoggerContext One
+ * @run main/othervm -Dtest.security=on TestAppletLoggerContext One
+ * @run main/othervm -Dtest.security=off TestAppletLoggerContext Two
+ * @run main/othervm -Dtest.security=on TestAppletLoggerContext Two
+ * @run main/othervm -Dtest.security=off TestAppletLoggerContext Three
+ * @run main/othervm -Dtest.security=on TestAppletLoggerContext Three
+ * @run main/othervm -Dtest.security=off TestAppletLoggerContext Four
+ * @run main/othervm -Dtest.security=on TestAppletLoggerContext Four
+ * @run main/othervm -Dtest.security=off TestAppletLoggerContext Five
+ * @run main/othervm -Dtest.security=on TestAppletLoggerContext Five
+ * @run main/othervm -Dtest.security=off TestAppletLoggerContext Six
+ * @run main/othervm -Dtest.security=on TestAppletLoggerContext Six
+ * @run main/othervm -Dtest.security=off TestAppletLoggerContext Seven
+ * @run main/othervm -Dtest.security=on TestAppletLoggerContext Seven
+ * @run main/othervm -Dtest.security=off TestAppletLoggerContext
+ * @run main/othervm -Dtest.security=on TestAppletLoggerContext
+ */
+
+// NOTE: We run in other VM in order to 1. switch security manager and 2. cause
+// LogManager class to be loaded anew.
+public class TestAppletLoggerContext {
+
+ // Avoids the hassle of dealing with files and system props...
+ static class SimplePolicy extends Policy {
+ private final Permissions perms;
+ public SimplePolicy(Permission... permissions) {
+ perms = new Permissions();
+ for (Permission permission : permissions) {
+ perms.add(permission);
+ }
+ }
+ @Override
+ public PermissionCollection getPermissions(CodeSource cs) {
+ return perms;
+ }
+ @Override
+ public PermissionCollection getPermissions(ProtectionDomain pd) {
+ return perms;
+ }
+ @Override
+ public boolean implies(ProtectionDomain pd, Permission p) {
+ return perms.implies(p);
+ }
+ }
+
+ // The bridge class initializes the logging system.
+ // It stubs the applet context in order to simulate context changes.
+ //
+ public static class Bridge {
+
+ private static class JavaAWTAccessStub implements JavaAWTAccess {
+ boolean active = true;
+
+ private static class TestExc {
+ private final Map<Object, Object> map = new HashMap<>();
+ void put(Object key, Object v) { map.put(key, v); }
+ Object get(Object key) { return map.get(key); }
+ void remove(Object o) { map.remove(o); }
+ public static TestExc exc(Object o) {
+ return TestExc.class.cast(o);
+ }
+ }
+
+ TestExc exc;
+ TestExc global = new TestExc();
+
+ @Override
+ public Object getContext() { return active ? global : null; }
+ @Override
+ public Object getExecutionContext() { return active ? exc : null; }
+ @Override
+ public Object get(Object o, Object o1) { return TestExc.exc(o).get(o1); }
+ @Override
+ public void put(Object o, Object o1, Object o2) { TestExc.exc(o).put(o1, o2); }
+ @Override
+ public void remove(Object o, Object o1) { TestExc.exc(o).remove(o1); }
+ @Override
+ public Object get(Object o) { return global.get(o); }
+ @Override
+ public void put(Object o, Object o1) { global.put(o, o1); }
+ @Override
+ public void remove(Object o) { global.remove(o); }
+ @Override
+ public boolean isDisposed() { return false; }
+ @Override
+ public boolean isMainAppContext() { return exc == null; }
+ }
+
+ final static JavaAWTAccessStub javaAwtAccess = new JavaAWTAccessStub();
+ public static void init() {
+ SharedSecrets.setJavaAWTAccess(javaAwtAccess);
+ if (System.getProperty("test.security", "on").equals("on")) {
+ Policy p = new SimplePolicy(new LoggingPermission("control", null),
+ new RuntimePermission("setContextClassLoader"),
+ new RuntimePermission("shutdownHooks"));
+ Policy.setPolicy(p);
+ System.setSecurityManager(new SecurityManager());
+ }
+ }
+
+ public static void changeContext() {
+ System.out.println("... Switching to a new applet context ...");
+ javaAwtAccess.active = true;
+ javaAwtAccess.exc = new JavaAWTAccessStub.TestExc();
+ }
+
+ public static void desactivate() {
+ System.out.println("... Running with no applet context ...");
+ javaAwtAccess.exc = null;
+ javaAwtAccess.active = false;
+ }
+
+ public static class CustomAnonymousLogger extends Logger {
+ public CustomAnonymousLogger() {
+ this("");
+ }
+ public CustomAnonymousLogger(String name) {
+ super(null, null);
+ System.out.println( " LogManager: " +LogManager.getLogManager());
+ System.out.println( " getLogger: " +LogManager.getLogManager().getLogger(name));
+ setParent(LogManager.getLogManager().getLogger(name));
+ }
+ }
+
+ public static class CustomLogger extends Logger {
+ CustomLogger(String name) {
+ super(name, null);
+ }
+ }
+ }
+
+ public static enum TestCase {
+ LoadingApplet, LoadingMain, One, Two, Three, Four, Five, Six, Seven;
+ public void test() {
+ switch(this) {
+ // When run - each of these two tests must be
+ // run before any other tests and before each other.
+ case LoadingApplet: testLoadingApplet(); break;
+ case LoadingMain: testLoadingMain(); break;
+ case One: testOne(); break;
+ case Two: testTwo(); break;
+ case Three: testThree(); break;
+ case Four: testFour(); break;
+ case Five: testFive(); break;
+ case Six: testSix(); break;
+ case Seven: testSeven(); break;
+ }
+ }
+ public String describe() {
+ switch(this) {
+ case LoadingApplet:
+ return "Test that when the LogManager class is"
+ + " loaded in an applet thread first,"
+ + "\n all LoggerContexts are correctly initialized";
+ case LoadingMain:
+ return "Test that when the LogManager class is"
+ + " loaded in the main thread first,"
+ + "\n all LoggerContexts are correctly initialized";
+ case One:
+ return "Test that Logger.getAnonymousLogger()"
+ + " and new CustomAnonymousLogger() don't throw NPE";
+ case Two:
+ return "Test that Logger.getLogger(\"\")"
+ + " does not return null nor throws NPE";
+ case Three:
+ return "Test that LogManager.getLogManager().getLogger(\"\")"
+ + " does not return null nor throws NPE";
+ case Four:
+ return "Test that Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)"
+ + " does not return null,\n and that"
+ + " new CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME)"
+ + " does not throw NPE";
+ case Five:
+ return "Test that LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME)"
+ + "\n does not return null nor throws NPE";
+ case Six:
+ return "Test that manager.getLogger(Logger.GLOBAL_LOGGER_NAME)"
+ + " returns null\n when manager is not the default"
+ + " LogManager instance.\n"
+ + "Test adding a new logger named \"global\" in that"
+ + " non default instance.";
+ case Seven: return "Test that manager.getLogger(\"\")"
+ + " returns null\n when manager is not the default"
+ + " LogManager instance.\n"
+ + "Test adding a new logger named \"\" in that"
+ + " non default instance.";
+ default: return "Undefined";
+ }
+ }
+ };
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String[] args) {
+ Bridge.init();
+ EnumSet<TestCase> tests = EnumSet.noneOf(TestCase.class);
+ for (String arg : args) {
+ tests.add(TestCase.valueOf(arg));
+ }
+ if (args.length == 0) {
+ tests = EnumSet.complementOf(EnumSet.of(TestCase.LoadingMain));
+ }
+ final EnumSet<TestCase> loadingTests =
+ EnumSet.of(TestCase.LoadingApplet, TestCase.LoadingMain);
+ int testrun = 0;
+ for (TestCase test : tests) {
+ if (loadingTests.contains(test)) {
+ if (testrun > 0) {
+ throw new UnsupportedOperationException("Test case "
+ + test + " must be executed first!");
+ }
+ }
+ System.out.println("Testing "+ test+": ");
+ System.out.println(test.describe());
+ try {
+ test.test();
+ } catch (Exception x) {
+ throw new Error(String.valueOf(test)
+ + (System.getSecurityManager() == null ? " without " : " with ")
+ + "security failed: "+x+"\n "+"FAILED: "+test.describe()+"\n", x);
+ } finally {
+ testrun++;
+ }
+ Bridge.changeContext();
+ System.out.println("PASSED: "+ test);
+ }
+ }
+
+ public static void testLoadingApplet() {
+ Bridge.changeContext();
+
+ Logger bar = new Bridge.CustomLogger("com.foo.Bar");
+ LogManager.getLogManager().addLogger(bar);
+ assertNotNull(bar.getParent());
+ testParent(bar);
+ testParent(LogManager.getLogManager().getLogger("global"));
+ testParent(LogManager.getLogManager().getLogger(bar.getName()));
+
+ Bridge.desactivate();
+
+ Logger foo = new Bridge.CustomLogger("com.foo.Foo");
+ boolean b = LogManager.getLogManager().addLogger(foo);
+ assertEquals(Boolean.TRUE, Boolean.valueOf(b));
+ assertNotNull(foo.getParent());
+ testParent(foo);
+ testParent(LogManager.getLogManager().getLogger("global"));
+ testParent(LogManager.getLogManager().getLogger(foo.getName()));
+ }
+
+ public static void testLoadingMain() {
+ Bridge.desactivate();
+
+ Logger bar = new Bridge.CustomLogger("com.foo.Bar");
+ LogManager.getLogManager().addLogger(bar);
+ assertNotNull(bar.getParent());
+ testParent(bar);
+ testParent(LogManager.getLogManager().getLogger("global"));
+ testParent(LogManager.getLogManager().getLogger(bar.getName()));
+
+ Bridge.changeContext();
+
+ Logger foo = new Bridge.CustomLogger("com.foo.Foo");
+ boolean b = LogManager.getLogManager().addLogger(foo);
+ assertEquals(Boolean.TRUE, Boolean.valueOf(b));
+ assertNotNull(foo.getParent());
+ testParent(foo);
+ testParent(LogManager.getLogManager().getLogger("global"));
+ testParent(LogManager.getLogManager().getLogger(foo.getName()));
+
+ }
+
+ public static void testOne() {
+ for (int i=0; i<3 ; i++) {
+ Logger logger1 = Logger.getAnonymousLogger();
+ Logger logger1b = Logger.getAnonymousLogger();
+ Bridge.changeContext();
+ Logger logger2 = Logger.getAnonymousLogger();
+ Logger logger2b = Logger.getAnonymousLogger();
+ Bridge.changeContext();
+ Logger logger3 = new Bridge.CustomAnonymousLogger();
+ Logger logger3b = new Bridge.CustomAnonymousLogger();
+ Bridge.changeContext();
+ Logger logger4 = new Bridge.CustomAnonymousLogger();
+ Logger logger4b = new Bridge.CustomAnonymousLogger();
+ }
+ }
+
+
+ public static void testTwo() {
+ for (int i=0; i<3 ; i++) {
+ Logger logger1 = Logger.getLogger("");
+ Logger logger1b = Logger.getLogger("");
+ assertNotNull(logger1);
+ assertNotNull(logger1b);
+ assertEquals(logger1, logger1b);
+ Bridge.changeContext();
+ Logger logger2 = Logger.getLogger("");
+ Logger logger2b = Logger.getLogger("");
+ assertNotNull(logger2);
+ assertNotNull(logger2b);
+ assertEquals(logger2, logger2b);
+ assertEquals(logger1, logger2);
+ }
+ }
+
+ public static void testThree() {
+ for (int i=0; i<3 ; i++) {
+ Logger logger1 = LogManager.getLogManager().getLogger("");
+ Logger logger1b = LogManager.getLogManager().getLogger("");
+ assertNotNull(logger1);
+ assertNotNull(logger1b);
+ assertEquals(logger1, logger1b);
+ Bridge.changeContext();
+ Logger logger2 = LogManager.getLogManager().getLogger("");
+ Logger logger2b = LogManager.getLogManager().getLogger("");
+ assertNotNull(logger2);
+ assertNotNull(logger2b);
+ assertEquals(logger2, logger2b);
+ assertEquals(logger1, logger2);
+ }
+ }
+
+ public static void testFour() {
+ for (int i=0; i<3 ; i++) {
+ Logger logger1 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger1b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ assertNotNull(logger1);
+ assertNotNull(logger1b);
+ assertEquals(logger1, logger1b);
+ Bridge.changeContext();
+
+ Logger logger2 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger2b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ assertNotNull(logger2);
+ assertNotNull(logger2b);
+ assertEquals(logger2, logger2b);
+
+ assertEquals(logger1, logger2);
+
+ Bridge.changeContext();
+ Logger logger3 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger3b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
+ Bridge.changeContext();
+ Logger logger4 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger4b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
+ }
+ }
+
+ public static void testFive() {
+ for (int i=0; i<3 ; i++) {
+ Logger logger1 = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger1b = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME);
+ assertNotNull(logger1);
+ assertNotNull(logger1b);
+ assertEquals(logger1, logger1b);
+
+ Bridge.changeContext();
+
+ Logger logger2 = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger2b = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME);
+ assertNotNull(logger2);
+ assertNotNull(logger2b);
+ assertEquals(logger2, logger2b);
+
+ assertEquals(logger1, logger2);
+ }
+ }
+
+ /**
+ * This test is designed to test the behavior of additional LogManager instances.
+ * It must be noted that if the security manager is off, then calling
+ * Bridge.changeContext() has actually no effect - which explains why we have
+ * some differences between the cases security manager on & security manager
+ * off.
+ **/
+ public static void testSix() {
+ for (int i=0; i<3 ; i++) {
+ Bridge.desactivate();
+ LogManager manager = new LogManager() {};
+ Logger logger1 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger1b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ assertNull(logger1);
+ assertNull(logger1b);
+ Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
+ manager.addLogger(global);
+ Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ assertNotNull(logger2);
+ assertNotNull(logger2b);
+ assertEquals(logger2, global);
+ assertEquals(logger2b, global);
+ assertNull(manager.getLogger(""));
+ assertNull(manager.getLogger(""));
+
+ Bridge.changeContext();
+
+ // this is not a supported configuration:
+ // We are in an applet context with several log managers.
+ // We however need to check our assumptions...
+
+ // Applet context => root logger and global logger are not null.
+ // root == LogManager.getLogManager().rootLogger
+ // global == Logger.global
+
+ Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ assertNotNull(logger3);
+ assertNotNull(logger3b);
+ Logger expected = (System.getSecurityManager() != null
+ ? Logger.getGlobal()
+ : global);
+ assertEquals(logger3, expected); // in applet context, we will not see
+ // the LogManager's custom global logger added above...
+ assertEquals(logger3b, expected); // in applet context, we will not see
+ // the LogManager's custom global logger added above...
+ Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
+ manager.addLogger(global2); // adding a global logger will not work in applet context
+ // we will always get back the global logger.
+ // this could be considered as a bug...
+ Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ assertNotNull(logger4);
+ assertNotNull(logger4b);
+ assertEquals(logger4, expected); // adding a global logger will not work in applet context
+ assertEquals(logger4b, expected); // adding a global logger will not work in applet context
+
+ Logger logger5 = manager.getLogger("");
+ Logger logger5b = manager.getLogger("");
+ Logger expectedRoot = (System.getSecurityManager() != null
+ ? LogManager.getLogManager().getLogger("")
+ : null);
+ assertEquals(logger5, expectedRoot);
+ assertEquals(logger5b, expectedRoot);
+
+ }
+ }
+
+ /**
+ * This test is designed to test the behavior of additional LogManager instances.
+ * It must be noted that if the security manager is off, then calling
+ * Bridge.changeContext() has actually no effect - which explains why we have
+ * some differences between the cases security manager on & security manager
+ * off.
+ **/
+ public static void testSeven() {
+ for (int i=0; i<3 ; i++) {
+ Bridge.desactivate();
+ LogManager manager = new LogManager() {};
+ Logger logger1 = manager.getLogger("");
+ Logger logger1b = manager.getLogger("");
+ assertNull(logger1);
+ assertNull(logger1b);
+ Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
+ manager.addLogger(global);
+ Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ assertNotNull(logger2);
+ assertNotNull(logger2b);
+ assertEquals(logger2, global);
+ assertEquals(logger2b, global);
+ Logger logger3 = manager.getLogger("");
+ Logger logger3b = manager.getLogger("");
+ assertNull(logger3);
+ assertNull(logger3b);
+ Logger root = new Bridge.CustomLogger("");
+ manager.addLogger(root);
+ Logger logger4 = manager.getLogger("");
+ Logger logger4b = manager.getLogger("");
+ assertNotNull(logger4);
+ assertNotNull(logger4b);
+ assertEquals(logger4, root);
+ assertEquals(logger4b, root);
+
+ Bridge.changeContext();
+
+ // this is not a supported configuration:
+ // We are in an applet context with several log managers.
+ // We haowever need to check our assumptions...
+
+ // Applet context => root logger and global logger are not null.
+ // root == LogManager.getLogManager().rootLogger
+ // global == Logger.global
+
+ Logger logger5 = manager.getLogger("");
+ Logger logger5b = manager.getLogger("");
+ Logger expectedRoot = (System.getSecurityManager() != null
+ ? LogManager.getLogManager().getLogger("")
+ : root);
+
+ assertNotNull(logger5);
+ assertNotNull(logger5b);
+ assertEquals(logger5, expectedRoot);
+ assertEquals(logger5b, expectedRoot);
+ if (System.getSecurityManager() != null) {
+ assertNotEquals(logger5, root);
+ assertNotEquals(logger5b, root);
+ }
+
+ Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
+ manager.addLogger(global2); // adding a global logger will not work in applet context
+ // we will always get back the global logger.
+ // this could be considered as a bug...
+ Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ Logger expectedGlobal = (System.getSecurityManager() != null
+ ? Logger.getGlobal()
+ : global);
+ assertNotNull(logger6);
+ assertNotNull(logger6b);
+ assertEquals(logger6, expectedGlobal); // adding a global logger will not work in applet context
+ assertEquals(logger6b, expectedGlobal); // adding a global logger will not work in applet context
+
+ Logger root2 = new Bridge.CustomLogger("");
+ manager.addLogger(root2); // adding a root logger will not work in applet context
+ // we will always get back the default manager's root logger.
+ // this could be considered as a bug...
+ Logger logger7 = manager.getLogger("");
+ Logger logger7b = manager.getLogger("");
+ assertNotNull(logger7);
+ assertNotNull(logger7b);
+ assertEquals(logger7, expectedRoot); // adding a global logger will not work in applet context
+ assertEquals(logger7b, expectedRoot); // adding a global logger will not work in applet context
+ assertNotEquals(logger7, root2);
+ assertNotEquals(logger7b, root2);
+ }
+ }
+
+ public static void testParent(Logger logger) {
+ Logger l = logger;
+ while (l.getParent() != null) {
+ l = l.getParent();
+ }
+ assertEquals("", l.getName());
+ }
+
+ public static class TestError extends RuntimeException {
+ public TestError(String msg) {
+ super(msg);
+ }
+ }
+
+ public static void assertNotNull(Object obj) {
+ if (obj == null) throw new NullPointerException();
+ }
+
+ public static void assertNull(Object obj) {
+ if (obj != null) throw new TestError("Null expected, got "+obj);
+ }
+
+ public static void assertEquals(Object o1, Object o2) {
+ if (o1 != o2) {
+ throw new TestError(o1 + " != " + o2);
+ }
+ }
+
+ public static void assertNotEquals(Object o1, Object o2) {
+ if (o1 == o2) {
+ throw new TestError(o1 + " == " + o2);
+ }
+ }
+}
--- a/jdk/test/java/util/stream/bootlib/java/util/stream/IntStreamTestDataProvider.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/bootlib/java/util/stream/IntStreamTestDataProvider.java Tue Jul 02 15:23:23 2013 -0700
@@ -129,7 +129,6 @@
() -> IntStream.range(0, ints.length).spliterator()));
spliterators.add(splitDescr("IntStream.intRangeClosed(0,l):" + name,
() -> IntStream.rangeClosed(0, ints.length).spliterator()));
-
// Need more!
}
spliteratorTestData = spliterators.toArray(new Object[0][]);
--- a/jdk/test/java/util/stream/bootlib/java/util/stream/LambdaTestHelpers.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/bootlib/java/util/stream/LambdaTestHelpers.java Tue Jul 02 15:23:23 2013 -0700
@@ -269,7 +269,7 @@
Set<T> uniq = new HashSet<>();
while(iter.hasNext()) {
T each = iter.next();
- assertTrue(!uniq.contains(each));
+ assertTrue(!uniq.contains(each), "Not unique");
uniq.add(each);
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/stream/bootlib/java/util/stream/LoggingTestCase.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 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.
+ */
+package java.util.stream;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.testng.Assert;
+import org.testng.ITestResult;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * LoggingTestCase
+ *
+ */
+@Test
+public class LoggingTestCase extends Assert {
+ private Map<String, Object> context = new HashMap<>();
+
+ @BeforeMethod
+ public void before() {
+ context.clear();
+ }
+
+ @AfterMethod
+ public void after(ITestResult result) {
+ if (!result.isSuccess()) {
+ List<Object> list = new ArrayList<>();
+ Collections.addAll(list, result.getParameters());
+ list.add(context.toString());
+ result.setParameters(list.toArray(new Object[list.size()]));
+ }
+ }
+
+ protected void setContext(String key, Object value) {
+ context.put(key, value);
+ }
+
+ protected void clearContext(String key) {
+ context.remove(key);
+ }
+}
--- a/jdk/test/java/util/stream/bootlib/java/util/stream/OpTestCase.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/bootlib/java/util/stream/OpTestCase.java Tue Jul 02 15:23:23 2013 -0700
@@ -50,7 +50,7 @@
* ways and asserts that they produce equivalent results.
*/
@Test
-public abstract class OpTestCase extends Assert {
+public abstract class OpTestCase extends LoggingTestCase {
private final Map<StreamShape, Set<? extends BaseStreamTestScenario>> testScenarios;
@@ -67,6 +67,25 @@
return ((AbstractPipeline) s).getStreamFlags();
}
+ /**
+ * An asserter for results produced when exercising of stream or terminal
+ * tests.
+ *
+ * @param <R> the type of result to assert on
+ */
+ public interface ResultAsserter<R> {
+ /**
+ * Assert a result produced when exercising of stream or terminal
+ * test.
+ *
+ * @param actual the actual result
+ * @param expected the expected result
+ * @param isOrdered true if the pipeline is ordered
+ * @param isParallel true if the pipeline is parallel
+ */
+ void assertResult(R actual, R expected, boolean isOrdered, boolean isParallel);
+ }
+
// Exercise stream operations
public interface BaseStreamTestScenario {
@@ -190,14 +209,19 @@
Set<BaseStreamTestScenario> testSet = new HashSet<>();
Collection<U> refResult;
- boolean isOrdered;
Consumer<TestData<T, S_IN>> before = LambdaTestHelpers.bEmpty;
Consumer<TestData<T, S_IN>> after = LambdaTestHelpers.bEmpty;
- BiConsumer<Iterable<U>, Iterable<U>> sequentialEqualityAsserter = LambdaTestHelpers::assertContentsEqual;
- BiConsumer<Iterable<U>, Iterable<U>> parallelEqualityAsserter = LambdaTestHelpers::assertContentsEqual;
+ ResultAsserter<Iterable<U>> resultAsserter = (act, exp, ord, par) -> {
+ if (par & !ord) {
+ LambdaTestHelpers.assertContentsUnordered(act, exp);
+ }
+ else {
+ LambdaTestHelpers.assertContentsEqual(act, exp);
+ }
+ };
private ExerciseDataStreamBuilder(TestData<T, S_IN> data, Function<S_IN, S_OUT> m) {
this.data = data;
@@ -211,10 +235,6 @@
testSet.addAll(testScenarios.get(shape));
}
- public BiConsumer<Iterable<U>, Iterable<U>> getEqualityAsserter(BaseStreamTestScenario t) {
- return t.isParallel() ? parallelEqualityAsserter : sequentialEqualityAsserter;
- }
-
//
public <I extends Iterable<U>> ExerciseDataStreamBuilder<T, U, S_IN, S_OUT> expectedResult(I expectedResult) {
@@ -299,29 +319,15 @@
return this;
}
- public ExerciseDataStreamBuilder<T, U, S_IN, S_OUT> sequentialEqualityAsserter(BiConsumer<Iterable<U>, Iterable<U>> equalator) {
- this.sequentialEqualityAsserter = equalator;
- return this;
- }
-
- public ExerciseDataStreamBuilder<T, U, S_IN, S_OUT> parallelEqualityAsserter(BiConsumer<Iterable<U>, Iterable<U>> equalator) {
- this.parallelEqualityAsserter = equalator;
+ public ExerciseDataStreamBuilder<T, U, S_IN, S_OUT> resultAsserter(ResultAsserter<Iterable<U>> resultAsserter) {
+ this.resultAsserter = resultAsserter;
return this;
}
// Build method
- private long count(StreamShape shape, BaseStream s) {
- switch (shape) {
- case REFERENCE: return ((Stream) s).count();
- case INT_VALUE: return ((IntStream) s).count();
- case LONG_VALUE: return ((LongStream) s).count();
- case DOUBLE_VALUE: return ((DoubleStream) s).count();
- default: throw new IllegalStateException("Unknown shape: " + shape);
- }
- }
-
public Collection<U> exercise() {
+ final boolean isOrdered;
if (refResult == null) {
// Induce the reference result
before.accept(data);
@@ -330,9 +336,10 @@
Node<U> refNodeResult = ((AbstractPipeline<?, U, ?>) sOut).evaluateToArrayNode(size -> (U[]) new Object[size]);
refResult = LambdaTestHelpers.toBoxedList(refNodeResult.spliterator());
after.accept(data);
- S_OUT anotherCopy = m.apply(data.stream());
- long count = count(((AbstractPipeline) anotherCopy).getOutputShape(), anotherCopy);
- assertEquals(count, refNodeResult.count());
+ }
+ else {
+ S_OUT sOut = m.apply(data.stream());
+ isOrdered = StreamOpFlag.ORDERED.isKnown(((AbstractPipeline) sOut).getStreamFlags());
}
List<Error> errors = new ArrayList<>();
@@ -343,16 +350,20 @@
List<U> result = new ArrayList<>();
test.run(data, LambdaTestHelpers.<U>toBoxingConsumer(result::add), m);
- Runnable asserter = () -> getEqualityAsserter(test).accept(result, refResult);
- if (test.isParallel() && !isOrdered)
- asserter = () -> LambdaTestHelpers.assertContentsUnordered(result, refResult);
- LambdaTestHelpers.launderAssertion(
- asserter,
- () -> String.format("%n%s: %s != %s", test, refResult, result));
+ Runnable asserter = () -> resultAsserter.assertResult(result, refResult, isOrdered, test.isParallel());
+
+ if (refResult.size() > 1000) {
+ LambdaTestHelpers.launderAssertion(
+ asserter,
+ () -> String.format("%n%s: [actual size=%d] != [expected size=%d]", test, result.size(), refResult.size()));
+ }
+ else {
+ LambdaTestHelpers.launderAssertion(
+ asserter,
+ () -> String.format("%n%s: [actual] %s != [expected] %s", test, result, refResult));
+ }
after.accept(data);
-// } catch (AssertionError ae) {
-// errors.add(ae);
} catch (Throwable t) {
errors.add(new Error(String.format("%s: %s", test, t), t));
}
@@ -406,8 +417,7 @@
Set<TerminalTestScenario> testSet = EnumSet.allOf(TerminalTestScenario.class);
- Function<S_OUT, BiConsumer<R, R>> sequentialEqualityAsserter = s -> LambdaTestHelpers::assertContentsEqual;
- Function<S_OUT, BiConsumer<R, R>> parallelEqualityAsserter = s -> LambdaTestHelpers::assertContentsEqual;
+ ResultAsserter<R> resultAsserter = (act, exp, ord, par) -> LambdaTestHelpers.assertContentsEqual(act, exp);
private ExerciseDataTerminalBuilder(TestData<T, S_IN> data, Function<S_IN, S_OUT> streamF, Function<S_OUT, R> terminalF) {
this.data = data;
@@ -423,23 +433,12 @@
}
public ExerciseDataTerminalBuilder<T, U, R, S_IN, S_OUT> equalator(BiConsumer<R, R> equalityAsserter) {
- this.sequentialEqualityAsserter = s -> equalityAsserter;
- this.parallelEqualityAsserter = s -> equalityAsserter;
+ resultAsserter = (act, exp, ord, par) -> equalityAsserter.accept(act, exp);
return this;
}
- public ExerciseDataTerminalBuilder<T, U, R, S_IN, S_OUT> sequentialEqualityAsserter(BiConsumer<R, R> equalityAsserter) {
- this.sequentialEqualityAsserter = s -> equalityAsserter;
- return this;
- }
-
- public ExerciseDataTerminalBuilder<T, U, R, S_IN, S_OUT> parallelEqualityAsserter(BiConsumer<R, R> equalityAsserter) {
- this.parallelEqualityAsserter = s -> equalityAsserter;
- return this;
- }
-
- public ExerciseDataTerminalBuilder<T, U, R, S_IN, S_OUT> parallelEqualityAsserter(Function<S_OUT, BiConsumer<R, R>> equalatorProvider) {
- this.parallelEqualityAsserter = equalatorProvider;
+ public ExerciseDataTerminalBuilder<T, U, R, S_IN, S_OUT> resultAsserter(ResultAsserter<R> resultAsserter) {
+ this.resultAsserter = resultAsserter;
return this;
}
@@ -467,8 +466,9 @@
// Build method
public R exercise() {
- S_OUT out = streamF.apply(data.stream());
+ S_OUT out = streamF.apply(data.stream()).sequential();
AbstractPipeline ap = (AbstractPipeline) out;
+ boolean isOrdered = StreamOpFlag.ORDERED.isKnown(ap.getStreamFlags());
StreamShape shape = ap.getOutputShape();
Node<U> node = ap.evaluateToArrayNode(size -> (U[]) new Object[size]);
@@ -481,9 +481,8 @@
S_OUT source = (S_OUT) createPipeline(shape, node.spliterator(),
StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SIZED,
false);
- BiConsumer<R, R> asserter = sequentialEqualityAsserter.apply(source);
R result = terminalF.apply(source);
- LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
+ LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
() -> String.format("Single sequential: %s != %s", refResult, result));
}
@@ -491,11 +490,10 @@
S_OUT source = (S_OUT) createPipeline(shape, node.spliterator(),
StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SIZED,
false);
- // Force short-curcuit
+ // Force short-circuit
source = (S_OUT) chain(source, new ShortCircuitOp<U>(shape));
- BiConsumer<R, R> asserter = sequentialEqualityAsserter.apply(source);
R result = terminalF.apply(source);
- LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
+ LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
() -> String.format("Single sequential pull: %s != %s", refResult, result));
}
@@ -503,44 +501,39 @@
S_OUT source = (S_OUT) createPipeline(shape, node.spliterator(),
StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SIZED,
true);
- BiConsumer<R, R> asserter = parallelEqualityAsserter.apply(source);
R result = terminalF.apply(source);
- LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
+ LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, true),
() -> String.format("Single parallel: %s != %s", refResult, result));
}
if (testSet.contains(TerminalTestScenario.ALL_SEQUENTIAL)) {
// This may forEach or tryAdvance depending on the terminal op implementation
S_OUT source = streamF.apply(data.stream());
- BiConsumer<R, R> asserter = sequentialEqualityAsserter.apply(source);
R result = terminalF.apply(source);
- LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
+ LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
() -> String.format("All sequential: %s != %s", refResult, result));
}
if (testSet.contains(TerminalTestScenario.ALL_SEQUENTIAL_SHORT_CIRCUIT)) {
S_OUT source = streamF.apply(data.stream());
- // Force short-curcuit
+ // Force short-circuit
source = (S_OUT) chain(source, new ShortCircuitOp<U>(shape));
- BiConsumer<R, R> asserter = sequentialEqualityAsserter.apply(source);
R result = terminalF.apply(source);
- LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
+ LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
() -> String.format("All sequential pull: %s != %s", refResult, result));
}
if (testSet.contains(TerminalTestScenario.ALL_PARALLEL)) {
S_OUT source = streamF.apply(data.parallelStream());
- BiConsumer<R, R> asserter = parallelEqualityAsserter.apply(source);
R result = terminalF.apply(source);
- LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
+ LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, true),
() -> String.format("All parallel: %s != %s", refResult, result));
}
if (testSet.contains(TerminalTestScenario.ALL_PARALLEL_SEQUENTIAL)) {
S_OUT source = streamF.apply(data.parallelStream());
- BiConsumer<R, R> asserter = parallelEqualityAsserter.apply(source);
R result = terminalF.apply(source.sequential());
- LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
+ LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
() -> String.format("All parallel then sequential: %s != %s", refResult, result));
}
--- a/jdk/test/java/util/stream/bootlib/java/util/stream/SpliteratorTestHelper.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/bootlib/java/util/stream/SpliteratorTestHelper.java Tue Jul 02 15:23:23 2013 -0700
@@ -42,11 +42,33 @@
*/
public class SpliteratorTestHelper {
+ public interface ContentAsserter<T> {
+ void assertContents(Collection<T> actual, Collection<T> expected, boolean isOrdered);
+ }
+
+ private static ContentAsserter<Object> DEFAULT_CONTENT_ASSERTER
+ = SpliteratorTestHelper::assertContents;
+
+ @SuppressWarnings("unchecked")
+ private static <T> ContentAsserter<T> defaultContentAsserter() {
+ return (ContentAsserter<T>) DEFAULT_CONTENT_ASSERTER;
+ }
+
public static void testSpliterator(Supplier<Spliterator<Integer>> supplier) {
- testSpliterator(supplier, (Consumer<Integer> b) -> b);
+ testSpliterator(supplier, defaultContentAsserter());
+ }
+
+ public static void testSpliterator(Supplier<Spliterator<Integer>> supplier,
+ ContentAsserter<Integer> asserter) {
+ testSpliterator(supplier, (Consumer<Integer> b) -> b, asserter);
}
public static void testIntSpliterator(Supplier<Spliterator.OfInt> supplier) {
+ testIntSpliterator(supplier, defaultContentAsserter());
+ }
+
+ public static void testIntSpliterator(Supplier<Spliterator.OfInt> supplier,
+ ContentAsserter<Integer> asserter) {
class BoxingAdapter implements Consumer<Integer>, IntConsumer {
private final Consumer<Integer> b;
@@ -65,10 +87,15 @@
}
}
- testSpliterator(supplier, c -> new BoxingAdapter(c));
+ testSpliterator(supplier, BoxingAdapter::new, asserter);
}
public static void testLongSpliterator(Supplier<Spliterator.OfLong> supplier) {
+ testLongSpliterator(supplier, defaultContentAsserter());
+ }
+
+ public static void testLongSpliterator(Supplier<Spliterator.OfLong> supplier,
+ ContentAsserter<Long> asserter) {
class BoxingAdapter implements Consumer<Long>, LongConsumer {
private final Consumer<Long> b;
@@ -87,10 +114,15 @@
}
}
- testSpliterator(supplier, c -> new BoxingAdapter(c));
+ testSpliterator(supplier, BoxingAdapter::new, asserter);
}
public static void testDoubleSpliterator(Supplier<Spliterator.OfDouble> supplier) {
+ testDoubleSpliterator(supplier, defaultContentAsserter());
+ }
+
+ public static void testDoubleSpliterator(Supplier<Spliterator.OfDouble> supplier,
+ ContentAsserter<Double> asserter) {
class BoxingAdapter implements Consumer<Double>, DoubleConsumer {
private final Consumer<Double> b;
@@ -109,11 +141,12 @@
}
}
- testSpliterator(supplier, c -> new BoxingAdapter(c));
+ testSpliterator(supplier, BoxingAdapter::new, asserter);
}
static <T, S extends Spliterator<T>> void testSpliterator(Supplier<S> supplier,
- UnaryOperator<Consumer<T>> boxingAdapter) {
+ UnaryOperator<Consumer<T>> boxingAdapter,
+ ContentAsserter<T> asserter) {
ArrayList<T> fromForEach = new ArrayList<>();
Spliterator<T> spliterator = supplier.get();
Consumer<T> addToFromForEach = boxingAdapter.apply(fromForEach::add);
@@ -121,14 +154,14 @@
Collection<T> exp = Collections.unmodifiableList(fromForEach);
- testForEach(exp, supplier, boxingAdapter);
- testTryAdvance(exp, supplier, boxingAdapter);
- testMixedTryAdvanceForEach(exp, supplier, boxingAdapter);
- testMixedTraverseAndSplit(exp, supplier, boxingAdapter);
+ testForEach(exp, supplier, boxingAdapter, asserter);
+ testTryAdvance(exp, supplier, boxingAdapter, asserter);
+ testMixedTryAdvanceForEach(exp, supplier, boxingAdapter, asserter);
+ testMixedTraverseAndSplit(exp, supplier, boxingAdapter, asserter);
testSplitAfterFullTraversal(supplier, boxingAdapter);
- testSplitOnce(exp, supplier, boxingAdapter);
- testSplitSixDeep(exp, supplier, boxingAdapter);
- testSplitUntilNull(exp, supplier, boxingAdapter);
+ testSplitOnce(exp, supplier, boxingAdapter, asserter);
+ testSplitSixDeep(exp, supplier, boxingAdapter, asserter);
+ testSplitUntilNull(exp, supplier, boxingAdapter, asserter);
}
//
@@ -136,7 +169,8 @@
private static <T, S extends Spliterator<T>> void testForEach(
Collection<T> exp,
Supplier<S> supplier,
- UnaryOperator<Consumer<T>> boxingAdapter) {
+ UnaryOperator<Consumer<T>> boxingAdapter,
+ ContentAsserter<T> asserter) {
S spliterator = supplier.get();
long sizeIfKnown = spliterator.getExactSizeIfKnown();
boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
@@ -159,13 +193,14 @@
}
assertEquals(fromForEach.size(), exp.size());
- assertContents(fromForEach, exp, isOrdered);
+ asserter.assertContents(fromForEach, exp, isOrdered);
}
private static <T, S extends Spliterator<T>> void testTryAdvance(
Collection<T> exp,
Supplier<S> supplier,
- UnaryOperator<Consumer<T>> boxingAdapter) {
+ UnaryOperator<Consumer<T>> boxingAdapter,
+ ContentAsserter<T> asserter) {
S spliterator = supplier.get();
long sizeIfKnown = spliterator.getExactSizeIfKnown();
boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
@@ -188,13 +223,14 @@
}
assertEquals(fromTryAdvance.size(), exp.size());
- assertContents(fromTryAdvance, exp, isOrdered);
+ asserter.assertContents(fromTryAdvance, exp, isOrdered);
}
private static <T, S extends Spliterator<T>> void testMixedTryAdvanceForEach(
Collection<T> exp,
Supplier<S> supplier,
- UnaryOperator<Consumer<T>> boxingAdapter) {
+ UnaryOperator<Consumer<T>> boxingAdapter,
+ ContentAsserter<T> asserter) {
S spliterator = supplier.get();
long sizeIfKnown = spliterator.getExactSizeIfKnown();
boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
@@ -218,18 +254,14 @@
}
assertEquals(dest.size(), exp.size());
- if (isOrdered) {
- assertEquals(dest, exp);
- }
- else {
- assertContentsUnordered(dest, exp);
- }
+ asserter.assertContents(dest, exp, isOrdered);
}
private static <T, S extends Spliterator<T>> void testMixedTraverseAndSplit(
Collection<T> exp,
Supplier<S> supplier,
- UnaryOperator<Consumer<T>> boxingAdapter) {
+ UnaryOperator<Consumer<T>> boxingAdapter,
+ ContentAsserter<T> asserter) {
S spliterator = supplier.get();
long sizeIfKnown = spliterator.getExactSizeIfKnown();
boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
@@ -266,12 +298,7 @@
}
assertEquals(dest.size(), exp.size());
- if (isOrdered) {
- assertEquals(dest, exp);
- }
- else {
- assertContentsUnordered(dest, exp);
- }
+ asserter.assertContents(dest, exp, isOrdered);
}
private static <T, S extends Spliterator<T>> void testSplitAfterFullTraversal(
@@ -285,16 +312,14 @@
// Full traversal using forEach
spliterator = supplier.get();
- spliterator.forEachRemaining(boxingAdapter.apply(e -> {
- }));
+ spliterator.forEachRemaining(boxingAdapter.apply(e -> { }));
split = spliterator.trySplit();
assertNull(split);
// Full traversal using tryAdvance then forEach
spliterator = supplier.get();
spliterator.tryAdvance(boxingAdapter.apply(e -> { }));
- spliterator.forEachRemaining(boxingAdapter.apply(e -> {
- }));
+ spliterator.forEachRemaining(boxingAdapter.apply(e -> { }));
split = spliterator.trySplit();
assertNull(split);
}
@@ -302,7 +327,8 @@
private static <T, S extends Spliterator<T>> void testSplitOnce(
Collection<T> exp,
Supplier<S> supplier,
- UnaryOperator<Consumer<T>> boxingAdapter) {
+ UnaryOperator<Consumer<T>> boxingAdapter,
+ ContentAsserter<T> asserter) {
S spliterator = supplier.get();
long sizeIfKnown = spliterator.getExactSizeIfKnown();
boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
@@ -322,13 +348,15 @@
if (s1Size >= 0 && s2Size >= 0)
assertEquals(sizeIfKnown, s1Size + s2Size);
}
- assertContents(fromSplit, exp, isOrdered);
+
+ asserter.assertContents(fromSplit, exp, isOrdered);
}
private static <T, S extends Spliterator<T>> void testSplitSixDeep(
Collection<T> exp,
Supplier<S> supplier,
- UnaryOperator<Consumer<T>> boxingAdapter) {
+ UnaryOperator<Consumer<T>> boxingAdapter,
+ ContentAsserter<T> asserter) {
S spliterator = supplier.get();
boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
@@ -340,13 +368,13 @@
// verify splitting with forEach
splitSixDeepVisitor(depth, 0, dest, spliterator, boxingAdapter, spliterator.characteristics(), false);
- assertContents(dest, exp, isOrdered);
+ asserter.assertContents(dest, exp, isOrdered);
// verify splitting with tryAdvance
dest.clear();
spliterator = supplier.get();
splitSixDeepVisitor(depth, 0, dest, spliterator, boxingAdapter, spliterator.characteristics(), true);
- assertContents(dest, exp, isOrdered);
+ asserter.assertContents(dest, exp, isOrdered);
}
}
@@ -411,7 +439,8 @@
private static <T, S extends Spliterator<T>> void testSplitUntilNull(
Collection<T> exp,
Supplier<S> supplier,
- UnaryOperator<Consumer<T>> boxingAdapter) {
+ UnaryOperator<Consumer<T>> boxingAdapter,
+ ContentAsserter<T> asserter) {
Spliterator<T> s = supplier.get();
boolean isOrdered = s.hasCharacteristics(Spliterator.ORDERED);
assertSpliterator(s);
@@ -420,7 +449,7 @@
Consumer<T> c = boxingAdapter.apply(splits::add);
testSplitUntilNull(new SplitNode<T>(c, s));
- assertContents(splits, exp, isOrdered);
+ asserter.assertContents(splits, exp, isOrdered);
}
private static class SplitNode<T> {
@@ -540,23 +569,10 @@
assertEquals(actual, expected);
}
else {
- assertContentsUnordered(actual, expected);
+ LambdaTestHelpers.assertContentsUnordered(actual, expected);
}
}
- private static<T> void assertContentsUnordered(Iterable<T> actual, Iterable<T> expected) {
- assertEquals(toBoxedMultiset(actual), toBoxedMultiset(expected));
- }
-
- private static <T> Map<T, Integer> toBoxedMultiset(Iterable<T> c) {
- Map<T, Integer> result = new HashMap<>();
- c.forEach(e -> {
- if (result.containsKey(e)) result.put(e, result.get(e) + 1);
- else result.put(e, 1);
- });
- return result;
- }
-
static<U> void mixedTraverseAndSplit(Consumer<U> b, Spliterator<U> splTop) {
Spliterator<U> spl1, spl2, spl3;
splTop.tryAdvance(b);
--- a/jdk/test/java/util/stream/boottest/java/util/stream/DoubleNodeTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/boottest/java/util/stream/DoubleNodeTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -102,7 +102,7 @@
double i = it.nextDouble();
if (it.hasNext()) {
- return new Nodes.DoubleConcNode(Nodes.node(new double[] {i}), degenerateTree(it));
+ return new Nodes.ConcNode.OfDouble(Nodes.node(new double[] {i}), degenerateTree(it));
}
else {
return Nodes.node(new double[] {i});
@@ -114,7 +114,7 @@
return m.apply(l);
}
else {
- return new Nodes.DoubleConcNode(
+ return new Nodes.ConcNode.OfDouble(
tree(l.subList(0, l.size() / 2), m),
tree(l.subList(l.size() / 2, l.size()), m));
}
@@ -162,4 +162,18 @@
public void testSpliterator(double[] array, Node.OfDouble n) {
SpliteratorTestHelper.testDoubleSpliterator(n::spliterator);
}
+
+ @Test(dataProvider = "nodes")
+ public void testTruncate(double[] array, Node.OfDouble n) {
+ int[] nums = new int[] { 0, 1, array.length / 2, array.length - 1, array.length };
+ for (int start : nums)
+ for (int end : nums) {
+ if (start < 0 || end < 0 || end < start || end > array.length)
+ continue;
+ Node.OfDouble slice = n.truncate(start, end, Double[]::new);
+ double[] asArray = slice.asPrimitiveArray();
+ for (int k = start; k < end; k++)
+ assertEquals(array[k], asArray[k - start]);
+ }
+ }
}
--- a/jdk/test/java/util/stream/boottest/java/util/stream/IntNodeTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/boottest/java/util/stream/IntNodeTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -102,7 +102,7 @@
int i = it.nextInt();
if (it.hasNext()) {
- return new Nodes.IntConcNode(Nodes.node(new int[] {i}), degenerateTree(it));
+ return new Nodes.ConcNode.OfInt(Nodes.node(new int[] {i}), degenerateTree(it));
}
else {
return Nodes.node(new int[] {i});
@@ -114,7 +114,7 @@
return m.apply(l);
}
else {
- return new Nodes.IntConcNode(
+ return new Nodes.ConcNode.OfInt(
tree(l.subList(0, l.size() / 2), m),
tree(l.subList(l.size() / 2, l.size()), m));
}
@@ -160,4 +160,18 @@
public void testSpliterator(int[] array, Node.OfInt n) {
SpliteratorTestHelper.testIntSpliterator(n::spliterator);
}
+
+ @Test(dataProvider = "nodes")
+ public void testTruncate(int[] array, Node.OfInt n) {
+ int[] nums = new int[] { 0, 1, array.length / 2, array.length - 1, array.length };
+ for (int start : nums)
+ for (int end : nums) {
+ if (start < 0 || end < 0 || end < start || end > array.length)
+ continue;
+ Node.OfInt slice = n.truncate(start, end, Integer[]::new);
+ int[] asArray = slice.asPrimitiveArray();
+ for (int k = start; k < end; k++)
+ assertEquals(array[k], asArray[k - start]);
+ }
+ }
}
--- a/jdk/test/java/util/stream/boottest/java/util/stream/LongNodeTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/boottest/java/util/stream/LongNodeTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -102,7 +102,7 @@
long i = it.nextLong();
if (it.hasNext()) {
- return new Nodes.LongConcNode(Nodes.node(new long[] {i}), degenerateTree(it));
+ return new Nodes.ConcNode.OfLong(Nodes.node(new long[] {i}), degenerateTree(it));
}
else {
return Nodes.node(new long[] {i});
@@ -114,7 +114,7 @@
return m.apply(l);
}
else {
- return new Nodes.LongConcNode(
+ return new Nodes.ConcNode.OfLong(
tree(l.subList(0, l.size() / 2), m),
tree(l.subList(l.size() / 2, l.size()), m));
}
@@ -161,4 +161,18 @@
public void testSpliterator(long[] array, Node.OfLong n) {
SpliteratorTestHelper.testLongSpliterator(n::spliterator);
}
+
+ @Test(dataProvider = "nodes")
+ public void testTruncate(long[] array, Node.OfLong n) {
+ int[] nums = new int[] { 0, 1, array.length / 2, array.length - 1, array.length };
+ for (int start : nums)
+ for (int end : nums) {
+ if (start < 0 || end < 0 || end < start || end > array.length)
+ continue;
+ Node.OfLong slice = n.truncate(start, end, Long[]::new);
+ long[] asArray = slice.asPrimitiveArray();
+ for (int k = start; k < end; k++)
+ assertEquals(array[k], asArray[k - start]);
+ }
+ }
}
--- a/jdk/test/java/util/stream/boottest/java/util/stream/NodeTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/boottest/java/util/stream/NodeTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -137,4 +137,18 @@
public void testSpliterator(Integer[] array, Node<Integer> n) {
SpliteratorTestHelper.testSpliterator(n::spliterator);
}
+
+ @Test(dataProvider = "nodes")
+ public void testTruncate(Integer[] array, Node<Integer> n) {
+ int[] nums = new int[] { 0, 1, array.length / 2, array.length - 1, array.length };
+ for (int start : nums)
+ for (int end : nums) {
+ if (start < 0 || end < 0 || end < start || end > array.length)
+ continue;
+ Node<Integer> slice = n.truncate(start, end, Integer[]::new);
+ Integer[] asArray = slice.asArray(Integer[]::new);
+ for (int k = start; k < end; k++)
+ assertEquals(array[k], asArray[k - start]);
+ }
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/stream/boottest/java/util/stream/SliceSpliteratorTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 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.
+ */
+package java.util.stream;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Spliterator;
+
+import static java.util.stream.Collectors.toList;
+import static org.testng.Assert.assertEquals;
+
+/**
+ * @bug 8012987
+ */
+@Test
+public class SliceSpliteratorTest extends LoggingTestCase {
+
+ static class UnorderedContentAsserter<T> implements SpliteratorTestHelper.ContentAsserter<T> {
+ Collection<T> source;
+
+ UnorderedContentAsserter(Collection<T> source) {
+ this.source = source;
+ }
+
+ @Override
+ public void assertContents(Collection<T> actual, Collection<T> expected, boolean isOrdered) {
+ if (isOrdered) {
+ assertEquals(actual, expected);
+ }
+ else {
+ assertEquals(actual.size(), expected.size());
+ assertTrue(source.containsAll(actual));
+ }
+ }
+ }
+
+ interface SliceTester {
+ void test(int size, int skip, int limit);
+ }
+
+ @DataProvider(name = "sliceSpliteratorDataProvider")
+ public static Object[][] sliceSpliteratorDataProvider() {
+ List<Object[]> data = new ArrayList<>();
+
+ // SIZED/SUBSIZED slice spliterator
+
+ {
+ SliceTester r = (size, skip, limit) -> {
+ final Collection<Integer> source = IntStream.range(0, size).boxed().collect(toList());
+
+ SpliteratorTestHelper.testSpliterator(() -> {
+ Spliterator<Integer> s = Arrays.spliterator(source.stream().toArray(Integer[]::new));
+
+ return new StreamSpliterators.SliceSpliterator.OfRef<>(s, skip, limit);
+ });
+ };
+ data.add(new Object[]{"StreamSpliterators.SliceSpliterator.OfRef", r});
+ }
+
+ {
+ SliceTester r = (size, skip, limit) -> {
+ final Collection<Integer> source = IntStream.range(0, size).boxed().collect(toList());
+
+ SpliteratorTestHelper.testIntSpliterator(() -> {
+ Spliterator.OfInt s = Arrays.spliterator(source.stream().mapToInt(i->i).toArray());
+
+ return new StreamSpliterators.SliceSpliterator.OfInt(s, skip, limit);
+ });
+ };
+ data.add(new Object[]{"StreamSpliterators.SliceSpliterator.OfInt", r});
+ }
+
+ {
+ SliceTester r = (size, skip, limit) -> {
+ final Collection<Long> source = LongStream.range(0, size).boxed().collect(toList());
+
+ SpliteratorTestHelper.testLongSpliterator(() -> {
+ Spliterator.OfLong s = Arrays.spliterator(source.stream().mapToLong(i->i).toArray());
+
+ return new StreamSpliterators.SliceSpliterator.OfLong(s, skip, limit);
+ });
+ };
+ data.add(new Object[]{"StreamSpliterators.SliceSpliterator.OfLong", r});
+ }
+
+ {
+ SliceTester r = (size, skip, limit) -> {
+ final Collection<Double> source = LongStream.range(0, size).asDoubleStream().boxed().collect(toList());
+
+ SpliteratorTestHelper.testDoubleSpliterator(() -> {
+ Spliterator.OfDouble s = Arrays.spliterator(source.stream().mapToDouble(i->i).toArray());
+
+ return new StreamSpliterators.SliceSpliterator.OfDouble(s, skip, limit);
+ });
+ };
+ data.add(new Object[]{"StreamSpliterators.SliceSpliterator.OfLong", r});
+ }
+
+
+ // Unordered slice spliterator
+
+ {
+ SliceTester r = (size, skip, limit) -> {
+ final Collection<Integer> source = IntStream.range(0, size).boxed().collect(toList());
+ final UnorderedContentAsserter<Integer> uca = new UnorderedContentAsserter<>(source);
+
+ SpliteratorTestHelper.testSpliterator(() -> {
+ Spliterator<Integer> s = Arrays.spliterator(source.stream().toArray(Integer[]::new));
+
+ return new StreamSpliterators.UnorderedSliceSpliterator.OfRef<>(s, skip, limit);
+ }, uca);
+ };
+ data.add(new Object[]{"StreamSpliterators.UnorderedSliceSpliterator.OfRef", r});
+ }
+
+ {
+ SliceTester r = (size, skip, limit) -> {
+ final Collection<Integer> source = IntStream.range(0, size).boxed().collect(toList());
+ final UnorderedContentAsserter<Integer> uca = new UnorderedContentAsserter<>(source);
+
+ SpliteratorTestHelper.testIntSpliterator(() -> {
+ Spliterator.OfInt s = Arrays.spliterator(source.stream().mapToInt(i->i).toArray());
+
+ return new StreamSpliterators.UnorderedSliceSpliterator.OfInt(s, skip, limit);
+ }, uca);
+ };
+ data.add(new Object[]{"StreamSpliterators.UnorderedSliceSpliterator.OfInt", r});
+ }
+
+ {
+ SliceTester r = (size, skip, limit) -> {
+ final Collection<Long> source = LongStream.range(0, size).boxed().collect(toList());
+ final UnorderedContentAsserter<Long> uca = new UnorderedContentAsserter<>(source);
+
+ SpliteratorTestHelper.testLongSpliterator(() -> {
+ Spliterator.OfLong s = Arrays.spliterator(source.stream().mapToLong(i->i).toArray());
+
+ return new StreamSpliterators.UnorderedSliceSpliterator.OfLong(s, skip, limit);
+ }, uca);
+ };
+ data.add(new Object[]{"StreamSpliterators.UnorderedSliceSpliterator.OfLong", r});
+ }
+
+ {
+ SliceTester r = (size, skip, limit) -> {
+ final Collection<Double> source = LongStream.range(0, size).asDoubleStream().boxed().collect(toList());
+ final UnorderedContentAsserter<Double> uca = new UnorderedContentAsserter<>(source);
+
+ SpliteratorTestHelper.testDoubleSpliterator(() -> {
+ Spliterator.OfDouble s = Arrays.spliterator(LongStream.range(0, SIZE).asDoubleStream().toArray());
+
+ return new StreamSpliterators.UnorderedSliceSpliterator.OfDouble(s, skip, limit);
+ }, uca);
+ };
+ data.add(new Object[]{"StreamSpliterators.UnorderedSliceSpliterator.OfLong", r});
+ }
+
+ return data.toArray(new Object[0][]);
+ }
+
+ static final int SIZE = 256;
+
+ static final int STEP = 32;
+
+ @Test(dataProvider = "sliceSpliteratorDataProvider")
+ public void testSliceSpliterator(String description, SliceTester r) {
+ setContext("size", SIZE);
+ for (int skip = 0; skip < SIZE; skip += STEP) {
+ setContext("skip", skip);
+ for (int limit = 0; limit < SIZE; limit += STEP) {
+ setContext("limit", skip);
+ r.test(SIZE, skip, limit);
+ }
+ }
+ }
+}
--- a/jdk/test/java/util/stream/boottest/java/util/stream/StreamFlagsTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/boottest/java/util/stream/StreamFlagsTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -80,8 +80,8 @@
EnumSet.of(ORDERED, DISTINCT, SIZED),
EnumSet.of(SORTED, SHORT_CIRCUIT));
assertFlags(OpTestCase.getStreamFlags(repeat),
- EnumSet.of(ORDERED),
- EnumSet.of(SIZED, DISTINCT, SORTED, SHORT_CIRCUIT));
+ EnumSet.noneOf(StreamOpFlag.class),
+ EnumSet.of(DISTINCT, SORTED, SHORT_CIRCUIT));
}
public void testFilter() {
--- a/jdk/test/java/util/stream/boottest/java/util/stream/UnorderedTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/boottest/java/util/stream/UnorderedTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -184,7 +184,6 @@
UnaryOperator<S> fi = interpose(f, (S s) -> (S) chain(s, checkClearOrderedOp));
withData(data).
terminal(fi, terminalF).
- without(TerminalTestScenario.ALL_PARALLEL_SEQUENTIAL).
equalator(equalityAsserter).
exercise();
}
@@ -195,7 +194,6 @@
UnaryOperator<S> fi = interpose(f, (S s) -> (S) chain(s, checkSetOrderedOp));
withData(data).
terminal(fi, s -> terminalF.apply(s.sequential())).
- without(TerminalTestScenario.ALL_PARALLEL_SEQUENTIAL).
equalator(equalityAsserter).
exercise();
}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/DistinctOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/DistinctOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -64,7 +64,6 @@
node = withData(data).
stream(s -> s.unordered().distinct()).
- parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
exercise();
assertUnique(node);
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ForEachOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ForEachOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -58,6 +58,17 @@
55);
}
+ private <U> ResultAsserter<List<U>> resultAsserter() {
+ return (act, exp, ord, par) -> {
+ if (par) {
+ LambdaTestHelpers.assertContentsUnordered(act, exp);
+ }
+ else {
+ LambdaTestHelpers.assertContents(act, exp);
+ }
+ };
+ }
+
@Test
public void testForEachOrdered() {
List<Integer> input = countTo(10000);
@@ -93,13 +104,13 @@
// Test head
withData(data).
terminal(terminalFunc).
- parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
+ resultAsserter(resultAsserter()).
exercise();
// Test multiple stages
withData(data).
terminal(s -> s.map(LambdaTestHelpers.identity()), terminalFunc).
- parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
+ resultAsserter(resultAsserter()).
exercise();
}
@@ -141,13 +152,13 @@
// Test head
withData(data).
terminal(terminalFunc).
- parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
+ resultAsserter(resultAsserter()).
exercise();
// Test multiple stages
withData(data).
terminal(s -> s.map(i -> i), terminalFunc).
- parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
+ resultAsserter(resultAsserter()).
exercise();
}
@@ -189,13 +200,13 @@
// Test head
withData(data).
terminal(terminalFunc).
- parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
+ resultAsserter(resultAsserter()).
exercise();
// Test multiple stages
withData(data).
terminal(s -> s.map(i -> i), terminalFunc).
- parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
+ resultAsserter(resultAsserter()).
exercise();
}
@@ -237,13 +248,13 @@
// Test head
withData(data).
terminal(terminalFunc).
- parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
+ resultAsserter(resultAsserter()).
exercise();
// Test multiple stages
withData(data).
terminal(s -> s.map(i -> i), terminalFunc).
- parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
+ resultAsserter(resultAsserter()).
exercise();
}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/GroupByOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/GroupByOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -133,9 +133,16 @@
Collector<Integer, Map<Object, List<Integer>>> tab = Collectors.groupingBy(md.m);
Map<Object, List<Integer>> result =
withData(data)
- .terminal(s -> s, s -> s.collect(tab))
- .parallelEqualityAsserter(s -> StreamOpFlagTestHelper.isStreamOrdered(s) ? GroupByOpTest::assertObjectEquals : GroupByOpTest::assertMultiMapEquals)
- .exercise();
+ .terminal(s -> s, s -> s.collect(tab))
+ .resultAsserter((act, exp, ord, par) -> {
+ if (par & !ord) {
+ GroupByOpTest.assertMultiMapEquals(act, exp);
+ }
+ else {
+ GroupByOpTest.assertObjectEquals(act, exp);
+ }
+ })
+ .exercise();
assertEquals(result.keySet().size(), md.expectedSize);
}
}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -22,45 +22,440 @@
*/
package org.openjdk.tests.java.util.stream;
-import java.util.stream.OpTestCase;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import java.util.Arrays;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
import java.util.List;
-import java.util.stream.Collectors;
+import java.util.Spliterator;
+import java.util.function.Function;
+import java.util.function.UnaryOperator;
+import java.util.stream.DoubleStream;
+import java.util.stream.DoubleStreamTestScenario;
+import java.util.stream.IntStream;
+import java.util.stream.IntStreamTestScenario;
+import java.util.stream.LambdaTestHelpers;
+import java.util.stream.LongStream;
+import java.util.stream.LongStreamTestScenario;
+import java.util.stream.OpTestCase;
import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+import java.util.stream.StreamTestScenario;
+import java.util.stream.TestData;
-import static java.util.stream.LambdaTestHelpers.assertContents;
+import static java.util.stream.LambdaTestHelpers.assertUnique;
@Test
public class InfiniteStreamWithLimitOpTest extends OpTestCase {
- private static final List<String> tenAs = Arrays.asList("A", "A", "A", "A", "A", "A", "A", "A", "A", "A");
+ private static final long SKIP_LIMIT_SIZE = 1 << 16;
+
+ @DataProvider(name = "Stream.limit")
+ @SuppressWarnings("rawtypes")
+ public static Object[][] sliceFunctionsDataProvider() {
+ Function<String, String> f = s -> String.format(s, SKIP_LIMIT_SIZE);
+
+ List<Object[]> data = new ArrayList<>();
+
+ data.add(new Object[]{f.apply("Stream.limit(%d)"),
+ (UnaryOperator<Stream>) s -> s.limit(SKIP_LIMIT_SIZE)});
+ data.add(new Object[]{f.apply("Stream.substream(%d)"),
+ (UnaryOperator<Stream>) s -> s.substream(SKIP_LIMIT_SIZE, SKIP_LIMIT_SIZE * 2)});
+ data.add(new Object[]{f.apply("Stream.substream(%1$d).limit(%1$d)"),
+ (UnaryOperator<Stream>) s -> s.substream(SKIP_LIMIT_SIZE).limit(SKIP_LIMIT_SIZE)});
+
+ return data.toArray(new Object[0][]);
+ }
+
+ @DataProvider(name = "IntStream.limit")
+ public static Object[][] intSliceFunctionsDataProvider() {
+ Function<String, String> f = s -> String.format(s, SKIP_LIMIT_SIZE);
+
+ List<Object[]> data = new ArrayList<>();
+
+ data.add(new Object[]{f.apply("IntStream.limit(%d)"),
+ (UnaryOperator<IntStream>) s -> s.limit(SKIP_LIMIT_SIZE)});
+ data.add(new Object[]{f.apply("IntStream.substream(%d)"),
+ (UnaryOperator<IntStream>) s -> s.substream(SKIP_LIMIT_SIZE, SKIP_LIMIT_SIZE * 2)});
+ data.add(new Object[]{f.apply("IntStream.substream(%1$d).limit(%1$d)"),
+ (UnaryOperator<IntStream>) s -> s.substream(SKIP_LIMIT_SIZE).limit(SKIP_LIMIT_SIZE)});
+
+ return data.toArray(new Object[0][]);
+ }
+
+ @DataProvider(name = "LongStream.limit")
+ public static Object[][] longSliceFunctionsDataProvider() {
+ Function<String, String> f = s -> String.format(s, SKIP_LIMIT_SIZE);
+
+ List<Object[]> data = new ArrayList<>();
+
+ data.add(new Object[]{f.apply("LongStream.limit(%d)"),
+ (UnaryOperator<LongStream>) s -> s.limit(SKIP_LIMIT_SIZE)});
+ data.add(new Object[]{f.apply("LongStream.substream(%d)"),
+ (UnaryOperator<LongStream>) s -> s.substream(SKIP_LIMIT_SIZE, SKIP_LIMIT_SIZE * 2)});
+ data.add(new Object[]{f.apply("LongStream.substream(%1$d).limit(%1$d)"),
+ (UnaryOperator<LongStream>) s -> s.substream(SKIP_LIMIT_SIZE).limit(SKIP_LIMIT_SIZE)});
- public void testRepeatLimit() {
- assertContents(Stream.generate(() -> "A").limit(10).iterator(), tenAs.iterator());
+ return data.toArray(new Object[0][]);
+ }
+
+ @DataProvider(name = "DoubleStream.limit")
+ public static Object[][] doubleSliceFunctionsDataProvider() {
+ Function<String, String> f = s -> String.format(s, SKIP_LIMIT_SIZE);
+
+ List<Object[]> data = new ArrayList<>();
+
+ data.add(new Object[]{f.apply("DoubleStream.limit(%d)"),
+ (UnaryOperator<DoubleStream>) s -> s.limit(SKIP_LIMIT_SIZE)});
+ data.add(new Object[]{f.apply("DoubleStream.substream(%d)"),
+ (UnaryOperator<DoubleStream>) s -> s.substream(SKIP_LIMIT_SIZE, SKIP_LIMIT_SIZE * 2)});
+ data.add(new Object[]{f.apply("DoubleStream.substream(%1$d).limit(%1$d)"),
+ (UnaryOperator<DoubleStream>) s -> s.substream(SKIP_LIMIT_SIZE).limit(SKIP_LIMIT_SIZE)});
+
+ return data.toArray(new Object[0][]);
+ }
+
+ private <T> ResultAsserter<Iterable<T>> unorderedAsserter() {
+ return (act, exp, ord, par) -> {
+ if (par & !ord) {
+ // Can only assert that all elements of the actual result
+ // are distinct and that the count is the limit size
+ // any element within the range [0, Long.MAX_VALUE) may be
+ // present
+ assertUnique(act);
+ long count = 0;
+ for (T l : act) {
+ count++;
+ }
+ assertEquals(count, SKIP_LIMIT_SIZE, "size not equal");
+ }
+ else {
+ LambdaTestHelpers.assertContents(act, exp);
+ }
+ };
+ }
+
+ private TestData.OfRef<Long> refLongs() {
+ return refLongRange(0, Long.MAX_VALUE);
+ }
+
+ private TestData.OfRef<Long> refLongRange(long l, long u) {
+ return TestData.Factory.ofSupplier(
+ String.format("[%d, %d)", l, u),
+ () -> LongStream.range(l, u).boxed());
}
- public void testIterateLimit() {
- assertContents(Stream.iterate("A", s -> s).limit(10).iterator(), tenAs.iterator());
+ private TestData.OfInt ints() {
+ return intRange(0, Integer.MAX_VALUE);
+ }
+
+ private TestData.OfInt intRange(int l, int u) {
+ return TestData.Factory.ofIntSupplier(
+ String.format("[%d, %d)", l, u),
+ () -> IntStream.range(l, u));
+ }
+
+ private TestData.OfLong longs() {
+ return longRange(0, Long.MAX_VALUE);
+ }
+
+ private TestData.OfLong longRange(long l, long u) {
+ return TestData.Factory.ofLongSupplier(
+ String.format("[%d, %d)", l, u),
+ () -> LongStream.range(l, u));
+ }
+
+ private TestData.OfDouble doubles() {
+ return doubleRange(0, 1L << 53);
+ }
+
+ private TestData.OfDouble doubleRange(long l, long u) {
+ return TestData.Factory.ofDoubleSupplier(
+ String.format("[%d, %d)", l, u),
+ () -> LongStream.range(l, u).mapToDouble(i -> (double) i));
+ }
+
+
+ // Sized/subsized range
+
+ @Test(dataProvider = "Stream.limit")
+ public void testSubsizedWithRange(String description, UnaryOperator<Stream<Long>> fs) {
+ // Range is [0, Long.MAX_VALUE), splits are SUBSIZED
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ withData(refLongs()).
+ stream(s -> fs.apply(s)).
+ without(StreamTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
+ exercise();
+ }
+
+ @Test(dataProvider = "IntStream.limit")
+ public void testIntSubsizedWithRange(String description, UnaryOperator<IntStream> fs) {
+ // Range is [0, Integer.MAX_VALUE), splits are SUBSIZED
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ withData(ints()).
+ stream(s -> fs.apply(s)).
+ without(IntStreamTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
+ exercise();
+ }
+
+ @Test(dataProvider = "LongStream.limit")
+ public void testLongSubsizedWithRange(String description, UnaryOperator<LongStream> fs) {
+ // Range is [0, Long.MAX_VALUE), splits are SUBSIZED
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ withData(longs()).
+ stream(s -> fs.apply(s)).
+ without(LongStreamTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
+ exercise();
+ }
+
+ @Test(dataProvider = "DoubleStream.limit")
+ public void testDoubleSubsizedWithRange(String description, UnaryOperator<DoubleStream> fs) {
+ // Range is [0, 2^53), splits are SUBSIZED
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ withData(doubles()).
+ stream(s -> fs.apply(s)).
+ without(DoubleStreamTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
+ exercise();
+ }
+
+
+ // Unordered finite not SIZED/SUBSIZED
+
+ @Test(dataProvider = "Stream.limit")
+ public void testUnorderedFinite(String description, UnaryOperator<Stream<Long>> fs) {
+ // Range is [0, Long.MAX_VALUE), splits are SUBSIZED
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ withData(longs()).
+ stream(s -> fs.apply(s.filter(i -> true).unordered().boxed())).
+ resultAsserter(unorderedAsserter()).
+ exercise();
+ }
+
+ @Test(dataProvider = "IntStream.limit")
+ public void testIntUnorderedFinite(String description, UnaryOperator<IntStream> fs) {
+ // Range is [0, Integer.MAX_VALUE), splits are SUBSIZED
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ withData(ints()).
+ stream(s -> fs.apply(s.filter(i -> true).unordered())).
+ resultAsserter(unorderedAsserter()).
+ exercise();
}
- public void testIterateFibLimit() {
- Stream<Integer> fib = Stream.iterate(new int[] {0, 1}, pair -> new int[] {pair[1], pair[0] + pair[1]})
- .map(pair -> pair[0]);
+ @Test(dataProvider = "LongStream.limit")
+ public void testLongUnorderedFinite(String description, UnaryOperator<LongStream> fs) {
+ // Range is [0, Long.MAX_VALUE), splits are SUBSIZED
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ withData(longs()).
+ stream(s -> fs.apply(s.filter(i -> true).unordered())).
+ resultAsserter(unorderedAsserter()).
+ exercise();
+ }
+
+ @Test(dataProvider = "DoubleStream.limit")
+ public void testDoubleUnorderedFinite(String description, UnaryOperator<DoubleStream> fs) {
+ // Range is [0, 1L << 53), splits are SUBSIZED
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ // Upper bound ensures values mapped to doubles will be unique
+ withData(doubles()).
+ stream(s -> fs.apply(s.filter(i -> true).unordered())).
+ resultAsserter(unorderedAsserter()).
+ exercise();
+ }
+
+
+ // Unordered finite not SUBSIZED
- assertContents(
- fib.limit(10).iterator(),
- Arrays.asList(0, 1, 1, 2, 3, 5, 8, 13, 21, 34).iterator());
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ private Spliterator.OfLong proxyNotSubsized(Spliterator.OfLong s) {
+ InvocationHandler ih = new InvocationHandler() {
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ switch (method.getName()) {
+ case "characteristics": {
+ int c = (Integer) method.invoke(s, args);
+ return c & ~Spliterator.SUBSIZED;
+ }
+ case "hasCharacteristics": {
+ int c = (Integer) args[0];
+ boolean b = (Boolean) method.invoke(s, args);
+ return b & ((c & Spliterator.SUBSIZED) == 0);
+ }
+ default:
+ return method.invoke(s, args);
+ }
+ }
+ };
+
+ return (Spliterator.OfLong) Proxy.newProxyInstance(this.getClass().getClassLoader(),
+ new Class[]{Spliterator.OfLong.class},
+ ih);
+ }
+
+ private TestData.OfLong proxiedLongRange(long l, long u) {
+ return TestData.Factory.ofLongSupplier(
+ String.format("[%d, %d)", l, u),
+ () -> StreamSupport.longStream(proxyNotSubsized(LongStream.range(l, u).spliterator())));
+ }
+
+ @Test(dataProvider = "Stream.limit")
+ public void testUnorderedSizedNotSubsizedFinite(String description, UnaryOperator<Stream<Long>> fs) {
+ // Range is [0, Long.MAX_VALUE), splits are not SUBSIZED (proxy clears
+ // the SUBSIZED characteristic)
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ withData(proxiedLongRange(0, Long.MAX_VALUE)).
+ stream(s -> fs.apply(s.unordered().boxed())).
+ resultAsserter(unorderedAsserter()).
+ exercise();
+ }
+
+ @Test(dataProvider = "IntStream.limit")
+ public void testIntUnorderedSizedNotSubsizedFinite(String description, UnaryOperator<IntStream> fs) {
+ // Range is [0, Integer.MAX_VALUE), splits are not SUBSIZED (proxy clears
+ // the SUBSIZED characteristic)
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ withData(proxiedLongRange(0, Integer.MAX_VALUE)).
+ stream(s -> fs.apply(s.unordered().mapToInt(i -> (int) i))).
+ resultAsserter(unorderedAsserter()).
+ exercise();
+ }
+
+ @Test(dataProvider = "LongStream.limit")
+ public void testLongUnorderedSizedNotSubsizedFinite(String description, UnaryOperator<LongStream> fs) {
+ // Range is [0, Long.MAX_VALUE), splits are not SUBSIZED (proxy clears
+ // the SUBSIZED characteristic)
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ withData(proxiedLongRange(0, Long.MAX_VALUE)).
+ stream(s -> fs.apply(s.unordered())).
+ resultAsserter(unorderedAsserter()).
+ exercise();
}
- public void testInfiniteWithLimitToShortCircuitTerminal() {
- Object[] array = Stream.generate(() -> 1).limit(4).toArray();
- assertEquals(4, array.length);
- array = Stream.generate(() -> 1).limit(4).filter(i -> true).toArray();
- assertEquals(4, array.length);
- List<Integer> result = Stream.generate(() -> 1).limit(4).collect(Collectors.toList());
- assertEquals(result, Arrays.asList(1, 1, 1, 1));
+ @Test(dataProvider = "DoubleStream.limit")
+ public void testDoubleUnorderedSizedNotSubsizedFinite(String description, UnaryOperator<DoubleStream> fs) {
+ // Range is [0, Double.MAX_VALUE), splits are not SUBSIZED (proxy clears
+ // the SUBSIZED characteristic)
+ // Such a size will induce out of memory errors for incorrect
+ // slice implementations
+ withData(proxiedLongRange(0, 1L << 53)).
+ stream(s -> fs.apply(s.unordered().mapToDouble(i -> (double) i))).
+ resultAsserter(unorderedAsserter()).
+ exercise();
+ }
+
+
+ // Unordered generation
+
+ @Test(dataProvider = "Stream.limit")
+ public void testUnorderedGenerator(String description, UnaryOperator<Stream<Long>> fs) {
+ // Source is spliterator of infinite size
+ TestData.OfRef<Long> generator = TestData.Factory.ofSupplier(
+ "[1L, 1L, ...]", () -> Stream.generate(() -> 1L));
+
+ withData(generator).
+ stream(s -> fs.apply(s.filter(i -> true).unordered())).
+ exercise();
+ }
+
+ @Test(dataProvider = "IntStream.limit")
+ public void testIntUnorderedGenerator(String description, UnaryOperator<IntStream> fs) {
+ // Source is spliterator of infinite size
+ TestData.OfInt generator = TestData.Factory.ofIntSupplier(
+ "[1, 1, ...]", () -> IntStream.generate(() -> 1));
+
+ withData(generator).
+ stream(s -> fs.apply(s.filter(i -> true).unordered())).
+ exercise();
+ }
+
+ @Test(dataProvider = "LongStream.limit")
+ public void testLongUnorderedGenerator(String description, UnaryOperator<LongStream> fs) {
+ // Source is spliterator of infinite size
+ TestData.OfLong generator = TestData.Factory.ofLongSupplier(
+ "[1L, 1L, ...]", () -> LongStream.generate(() -> 1));
+
+ withData(generator).
+ stream(s -> fs.apply(s.filter(i -> true).unordered())).
+ exercise();
+ }
+
+ @Test(dataProvider = "DoubleStream.limit")
+ public void testDoubleUnorderedGenerator(String description, UnaryOperator<DoubleStream> fs) {
+ // Source is spliterator of infinite size
+ TestData.OfDouble generator = TestData.Factory.ofDoubleSupplier(
+ "[1.0, 1.0, ...]", () -> DoubleStream.generate(() -> 1.0));
+
+ withData(generator).
+ stream(s -> fs.apply(s.filter(i -> true).unordered())).
+ exercise();
+ }
+
+
+ // Unordered iteration
+
+ @Test(dataProvider = "Stream.limit")
+ public void testUnorderedIteration(String description, UnaryOperator<Stream<Long>> fs) {
+ // Source is a right-balanced tree of infinite size
+ TestData.OfRef<Long> iterator = TestData.Factory.ofSupplier(
+ "[1L, 2L, 3L, ...]", () -> Stream.iterate(1L, i -> i + 1L));
+
+ // Ref
+ withData(iterator).
+ stream(s -> fs.apply(s.unordered())).
+ resultAsserter(unorderedAsserter()).
+ exercise();
+ }
+
+ @Test(dataProvider = "IntStream.limit")
+ public void testIntUnorderedIteration(String description, UnaryOperator<IntStream> fs) {
+ // Source is a right-balanced tree of infinite size
+ TestData.OfInt iterator = TestData.Factory.ofIntSupplier(
+ "[1, 2, 3, ...]", () -> IntStream.iterate(1, i -> i + 1));
+
+ // Ref
+ withData(iterator).
+ stream(s -> fs.apply(s.unordered())).
+ resultAsserter(unorderedAsserter()).
+ exercise();
+ }
+
+ @Test(dataProvider = "LongStream.limit")
+ public void testLongUnorderedIteration(String description, UnaryOperator<LongStream> fs) {
+ // Source is a right-balanced tree of infinite size
+ TestData.OfLong iterator = TestData.Factory.ofLongSupplier(
+ "[1L, 2L, 3L, ...]", () -> LongStream.iterate(1, i -> i + 1));
+
+ // Ref
+ withData(iterator).
+ stream(s -> fs.apply(s.unordered())).
+ resultAsserter(unorderedAsserter()).
+ exercise();
+ }
+
+ @Test(dataProvider = "DoubleStream.limit")
+ public void testDoubleUnorderedIteration(String description, UnaryOperator<DoubleStream> fs) {
+ // Source is a right-balanced tree of infinite size
+ TestData.OfDouble iterator = TestData.Factory.ofDoubleSupplier(
+ "[1.0, 2.0, 3.0, ...]", () -> DoubleStream.iterate(1, i -> i + 1));
+
+ // Ref
+ withData(iterator).
+ stream(s -> fs.apply(s.unordered())).
+ resultAsserter(unorderedAsserter()).
+ exercise();
}
}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntSliceOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntSliceOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -145,6 +145,7 @@
List<Integer> skips = sizes(data.size());
for (int s : skips) {
+ setContext("skip", s);
Collection<Integer> sr = exerciseOps(data, st -> st.substream(s));
assertEquals(sr.size(), sliceSize(data.size(), s));
@@ -159,7 +160,9 @@
List<Integer> limits = skips;
for (int s : skips) {
+ setContext("skip", s);
for (int limit : limits) {
+ setContext("limit", limit);
Collection<Integer> sr = exerciseOps(data, st -> st.substream(s).limit(limit));
assertEquals(sr.size(), sliceSize(sliceSize(data.size(), s), 0, limit));
@@ -174,6 +177,7 @@
List<Integer> limits = sizes(data.size());
for (int limit : limits) {
+ setContext("limit", limit);
Collection<Integer> sr = exerciseOps(data, st -> st.limit(limit));
assertEquals(sr.size(), sliceSize(data.size(), 0, limit));
@@ -189,6 +193,7 @@
@Test(groups = { "serialization-hostile" })
public void testLimitShortCircuit() {
for (int l : Arrays.asList(0, 10)) {
+ setContext("limit", l);
AtomicInteger ai = new AtomicInteger();
IntStream.range(1, 101)
.peek(i -> ai.getAndIncrement())
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntUniqOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntUniqOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -60,7 +60,6 @@
public void testOpSorted(String name, TestData.OfInt data) {
Collection<Integer> result = withData(data).
stream(s -> s.sorted().distinct().boxed()).
- parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
exercise();
assertUnique(result);
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/MatchOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/MatchOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -23,19 +23,16 @@
package org.openjdk.tests.java.util.stream;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.PrimitiveIterator;
+import java.util.Spliterators;
import java.util.function.DoublePredicate;
-import java.util.function.DoubleSupplier;
import java.util.function.Function;
import java.util.function.IntPredicate;
-import java.util.function.IntSupplier;
import java.util.function.LongPredicate;
-import java.util.function.LongSupplier;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.DoubleStream;
@@ -46,6 +43,7 @@
import java.util.stream.LongStreamTestDataProvider;
import java.util.stream.OpTestCase;
import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
import java.util.stream.StreamTestDataProvider;
import java.util.stream.TestData;
@@ -97,6 +95,7 @@
private <T> void assertPredicates(List<T> source, Kind kind, Predicate<T>[] predicates, boolean... answers) {
for (int i = 0; i < predicates.length; i++) {
+ setContext("i", i);
boolean match = this.<T>kinds().get(kind).apply(predicates[i]).apply(source.stream());
assertEquals(answers[i], match, kind.toString() + predicates[i].toString());
}
@@ -119,7 +118,9 @@
@Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
public void testStream(String name, TestData.OfRef<Integer> data) {
for (Predicate<Integer> p : INTEGER_PREDICATES) {
+ setContext("p", p);
for (Kind kind : Kind.values()) {
+ setContext("kind", kind);
exerciseTerminalOps(data, this.<Integer>kinds().get(kind).apply(p));
exerciseTerminalOps(data, s -> s.filter(pFalse), this.<Integer>kinds().get(kind).apply(p));
exerciseTerminalOps(data, s -> s.filter(pEven), this.<Integer>kinds().get(kind).apply(p));
@@ -128,29 +129,40 @@
}
public void testInfinite() {
- class CycleSupplier<T> implements Supplier<T> {
- final Iterable<T> source;
- Iterator<T> i = Collections.emptyIterator();
+ class CycleIterator implements Iterator<Integer> {
+ final Supplier<Iterator<Integer>> source;
+ Iterator<Integer> i = null;
- CycleSupplier(Iterable<T> source) {
+ CycleIterator(Supplier<Iterator<Integer>> source) {
this.source = source;
}
@Override
- public T get() {
- if (!i.hasNext()) {
- i = source.iterator();
+ public Integer next() {
+ if (i == null || !i.hasNext()) {
+ i = source.get();
}
return i.next();
}
+
+ @Override
+ public boolean hasNext() {
+ if (i == null || !i.hasNext()) {
+ i = source.get();
+ }
+ return i.hasNext();
+ }
}
- assertFalse(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).allMatch(i -> i > 3));
- assertTrue(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).anyMatch(i -> i > 3));
- assertFalse(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).noneMatch(i -> i > 3));
- assertFalse(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).parallel().allMatch(i -> i > 3));
- assertTrue(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).parallel().anyMatch(i -> i > 3));
- assertFalse(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).parallel().noneMatch(i -> i > 3));
+ Supplier<Iterator<Integer>> source = () -> Arrays.asList(1, 2, 3, 4).iterator();
+ Supplier<Stream<Integer>> s = () -> StreamSupport.stream(Spliterators.spliteratorUnknownSize(new CycleIterator(source), 0));
+
+ assertFalse(s.get().allMatch(i -> i > 3));
+ assertTrue(s.get().anyMatch(i -> i > 3));
+ assertFalse(s.get().noneMatch(i -> i > 3));
+ assertFalse(s.get().parallel().allMatch(i -> i > 3));
+ assertTrue(s.get().parallel().anyMatch(i -> i > 3));
+ assertFalse(s.get().parallel().noneMatch(i -> i > 3));
}
//
@@ -168,6 +180,7 @@
private void assertIntPredicates(Supplier<IntStream> source, Kind kind, IntPredicate[] predicates, boolean... answers) {
for (int i = 0; i < predicates.length; i++) {
+ setContext("i", i);
boolean match = intKinds.get(kind).apply(predicates[i]).apply(source.get());
assertEquals(answers[i], match, kind.toString() + predicates[i].toString());
}
@@ -189,40 +202,52 @@
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntStream(String name, TestData.OfInt data) {
- for (IntPredicate p : INT_PREDICATES)
+ for (IntPredicate p : INT_PREDICATES) {
+ setContext("p", p);
for (Kind kind : Kind.values()) {
+ setContext("kind", kind);
exerciseTerminalOps(data, intKinds.get(kind).apply(p));
exerciseTerminalOps(data, s -> s.filter(ipFalse), intKinds.get(kind).apply(p));
exerciseTerminalOps(data, s -> s.filter(ipEven), intKinds.get(kind).apply(p));
}
+ }
}
public void testIntInfinite() {
- class CycleSupplier implements IntSupplier {
+ class CycleIterator implements PrimitiveIterator.OfInt {
final Supplier<PrimitiveIterator.OfInt> source;
PrimitiveIterator.OfInt i = null;
- CycleSupplier(Supplier<PrimitiveIterator.OfInt> source) {
+ CycleIterator(Supplier<PrimitiveIterator.OfInt> source) {
this.source = source;
}
@Override
- public int getAsInt() {
+ public int nextInt() {
if (i == null || !i.hasNext()) {
i = source.get();
}
return i.nextInt();
}
+
+ @Override
+ public boolean hasNext() {
+ if (i == null || !i.hasNext()) {
+ i = source.get();
+ }
+ return i.hasNext();
+ }
}
Supplier<PrimitiveIterator.OfInt> source = () -> Arrays.stream(new int[]{1, 2, 3, 4}).iterator();
+ Supplier<IntStream> s = () -> StreamSupport.intStream(Spliterators.spliteratorUnknownSize(new CycleIterator(source), 0));
- assertFalse(IntStream.generate(new CycleSupplier(source)).allMatch(i -> i > 3));
- assertTrue(IntStream.generate(new CycleSupplier(source)).anyMatch(i -> i > 3));
- assertFalse(IntStream.generate(new CycleSupplier(source)).noneMatch(i -> i > 3));
- assertFalse(IntStream.generate(new CycleSupplier(source)).parallel().allMatch(i -> i > 3));
- assertTrue(IntStream.generate(new CycleSupplier(source)).parallel().anyMatch(i -> i > 3));
- assertFalse(IntStream.generate(new CycleSupplier(source)).parallel().noneMatch(i -> i > 3));
+ assertFalse(s.get().allMatch(i -> i > 3));
+ assertTrue(s.get().anyMatch(i -> i > 3));
+ assertFalse(s.get().noneMatch(i -> i > 3));
+ assertFalse(s.get().parallel().allMatch(i -> i > 3));
+ assertTrue(s.get().parallel().anyMatch(i -> i > 3));
+ assertFalse(s.get().parallel().noneMatch(i -> i > 3));
}
//
@@ -240,6 +265,7 @@
private void assertLongPredicates(Supplier<LongStream> source, Kind kind, LongPredicate[] predicates, boolean... answers) {
for (int i = 0; i < predicates.length; i++) {
+ setContext("i", i);
boolean match = longKinds.get(kind).apply(predicates[i]).apply(source.get());
assertEquals(answers[i], match, kind.toString() + predicates[i].toString());
}
@@ -261,40 +287,52 @@
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
- for (LongPredicate p : LONG_PREDICATES)
+ for (LongPredicate p : LONG_PREDICATES) {
+ setContext("p", p);
for (Kind kind : Kind.values()) {
+ setContext("kind", kind);
exerciseTerminalOps(data, longKinds.get(kind).apply(p));
exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
}
+ }
}
public void testLongInfinite() {
- class CycleSupplier implements LongSupplier {
+ class CycleIterator implements PrimitiveIterator.OfLong {
final Supplier<PrimitiveIterator.OfLong> source;
PrimitiveIterator.OfLong i = null;
- CycleSupplier(Supplier<PrimitiveIterator.OfLong> source) {
+ CycleIterator(Supplier<PrimitiveIterator.OfLong> source) {
this.source = source;
}
@Override
- public long getAsLong() {
+ public long nextLong() {
if (i == null || !i.hasNext()) {
i = source.get();
}
return i.nextLong();
}
+
+ @Override
+ public boolean hasNext() {
+ if (i == null || !i.hasNext()) {
+ i = source.get();
+ }
+ return i.hasNext();
+ }
}
Supplier<PrimitiveIterator.OfLong> source = () -> Arrays.stream(new long[]{1, 2, 3, 4}).iterator();
+ Supplier<LongStream> s = () -> StreamSupport.longStream(Spliterators.spliteratorUnknownSize(new CycleIterator(source), 0));
- assertFalse(LongStream.generate(new CycleSupplier(source)).allMatch(i -> i > 3));
- assertTrue(LongStream.generate(new CycleSupplier(source)).anyMatch(i -> i > 3));
- assertFalse(LongStream.generate(new CycleSupplier(source)).noneMatch(i -> i > 3));
- assertFalse(LongStream.generate(new CycleSupplier(source)).parallel().allMatch(i -> i > 3));
- assertTrue(LongStream.generate(new CycleSupplier(source)).parallel().anyMatch(i -> i > 3));
- assertFalse(LongStream.generate(new CycleSupplier(source)).parallel().noneMatch(i -> i > 3));
+ assertFalse(s.get().allMatch(i -> i > 3));
+ assertTrue(s.get().anyMatch(i -> i > 3));
+ assertFalse(s.get().noneMatch(i -> i > 3));
+ assertFalse(s.get().parallel().allMatch(i -> i > 3));
+ assertTrue(s.get().parallel().anyMatch(i -> i > 3));
+ assertFalse(s.get().parallel().noneMatch(i -> i > 3));
}
//
@@ -312,6 +350,7 @@
private void assertDoublePredicates(Supplier<DoubleStream> source, Kind kind, DoublePredicate[] predicates, boolean... answers) {
for (int i = 0; i < predicates.length; i++) {
+ setContext("i", i);
boolean match = doubleKinds.get(kind).apply(predicates[i]).apply(source.get());
assertEquals(answers[i], match, kind.toString() + predicates[i].toString());
}
@@ -333,39 +372,51 @@
@Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
public void testDoubleStream(String name, TestData.OfDouble data) {
- for (DoublePredicate p : DOUBLE_PREDICATES)
+ for (DoublePredicate p : DOUBLE_PREDICATES) {
+ setContext("p", p);
for (Kind kind : Kind.values()) {
+ setContext("kind", kind);
exerciseTerminalOps(data, doubleKinds.get(kind).apply(p));
exerciseTerminalOps(data, s -> s.filter(dpFalse), doubleKinds.get(kind).apply(p));
exerciseTerminalOps(data, s -> s.filter(dpEven), doubleKinds.get(kind).apply(p));
}
+ }
}
public void testDoubleInfinite() {
- class CycleSupplier implements DoubleSupplier {
+ class CycleIterator implements PrimitiveIterator.OfDouble {
final Supplier<PrimitiveIterator.OfDouble> source;
PrimitiveIterator.OfDouble i = null;
- CycleSupplier(Supplier<PrimitiveIterator.OfDouble> source) {
+ CycleIterator(Supplier<PrimitiveIterator.OfDouble> source) {
this.source = source;
}
@Override
- public double getAsDouble() {
+ public double nextDouble() {
if (i == null || !i.hasNext()) {
i = source.get();
}
return i.nextDouble();
}
+
+ @Override
+ public boolean hasNext() {
+ if (i == null || !i.hasNext()) {
+ i = source.get();
+ }
+ return i.hasNext();
+ }
}
Supplier<PrimitiveIterator.OfDouble> source = () -> Arrays.stream(new double[]{1, 2, 3, 4}).iterator();
+ Supplier<DoubleStream> s = () -> StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize(new CycleIterator(source), 0));
- assertFalse(DoubleStream.generate(new CycleSupplier(source)).allMatch(i -> i > 3));
- assertTrue(DoubleStream.generate(new CycleSupplier(source)).anyMatch(i -> i > 3));
- assertFalse(DoubleStream.generate(new CycleSupplier(source)).noneMatch(i -> i > 3));
- assertFalse(DoubleStream.generate(new CycleSupplier(source)).parallel().allMatch(i -> i > 3));
- assertTrue(DoubleStream.generate(new CycleSupplier(source)).parallel().anyMatch(i -> i > 3));
- assertFalse(DoubleStream.generate(new CycleSupplier(source)).parallel().noneMatch(i -> i > 3));
+ assertFalse(s.get().allMatch(i -> i > 3));
+ assertTrue(s.get().anyMatch(i -> i > 3));
+ assertFalse(s.get().noneMatch(i -> i > 3));
+ assertFalse(s.get().parallel().allMatch(i -> i > 3));
+ assertTrue(s.get().parallel().anyMatch(i -> i > 3));
+ assertFalse(s.get().parallel().noneMatch(i -> i > 3));
}
}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/RangeTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/RangeTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -58,7 +58,9 @@
public void testIntRange() {
// Half-open
for (int start : Arrays.asList(1, 10, -1, -10)) {
+ setContext("start", start);
for (int end : Arrays.asList(1, 10, -1, -10)) {
+ setContext("end", end);
int size = (start < end) ? end - start : 0;
int[] exp = new int[size];
for (int i = start, p = 0; i < end; i++, p++) {
@@ -76,7 +78,9 @@
// Closed
for (int start : Arrays.asList(1, 10, -1, -10)) {
+ setContext("start", start);
for (int end : Arrays.asList(1, 10, -1, -10)) {
+ setContext("end", end);
int size = (start <= end) ? end - start + 1 : 0;
int[] exp = new int[size];
for (int i = start, p = 0; i <= end; i++, p++) {
@@ -144,7 +148,9 @@
public void testLongRange() {
// Half-open
for (long start : Arrays.asList(1, 1000, -1, -1000)) {
+ setContext("start", start);
for (long end : Arrays.asList(1, 1000, -1, -1000)) {
+ setContext("end", end);
long size = start < end ? end - start : 0;
long[] exp = new long[(int) size];
for (long i = start, p = 0; i < end; i++, p++) {
@@ -162,7 +168,9 @@
// Closed
for (long start : Arrays.asList(1, 1000, -1, -1000)) {
+ setContext("start", start);
for (long end : Arrays.asList(1, 1000, -1, -1000)) {
+ setContext("end", end);
long size = start <= end ? end - start + 1: 0;
long[] exp = new long[(int) size];
for (long i = start, p = 0; i <= end; i++, p++) {
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ReduceByOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ReduceByOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -51,6 +51,7 @@
Map<Boolean, Integer> result = data.stream().collect(groupingBy(LambdaTestHelpers.forPredicate(pEven, true, false), reducing(0, rPlus)));
assertEquals(result.size(), gbResult.size());
for (Map.Entry<Boolean, Integer> entry : result.entrySet()) {
+ setContext("entry", entry);
Boolean key = entry.getKey();
assertEquals(entry.getValue(), data.stream().filter(e -> pEven.test(e) == key).reduce(0, rPlus));
}
@@ -59,7 +60,9 @@
Map<Integer, List<Integer>> mgResult = exerciseTerminalOps(data, s -> s.collect(groupingBy(mId)));
Map<Integer, Integer> miResult = exerciseTerminalOps(data, s -> s.collect(groupingBy(mId, reducing(0, e -> 1, Integer::sum))));
assertEquals(miResult.keySet().size(), uniqueSize);
- for (Map.Entry<Integer, Integer> entry : miResult.entrySet())
+ for (Map.Entry<Integer, Integer> entry : miResult.entrySet()) {
+ setContext("entry", entry);
assertEquals((int) entry.getValue(), mgResult.get(entry.getKey()).size());
+ }
}
}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SequentialOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SequentialOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -27,8 +27,8 @@
import java.util.stream.StreamTestDataProvider;
import org.testng.annotations.Test;
-import java.util.Comparators;
import java.util.Iterator;
+import java.util.Comparator;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -64,8 +64,12 @@
(UnaryOperator<Stream<Integer>>) s -> s.parallel().map(id).peek(e -> { counter.incrementAndGet(); }).map(id)
};
- for (Supplier<Stream<Integer>> supp : suppliers)
- for (UnaryOperator<Stream<Integer>> config : configs) {
+ for (int i = 0; i < suppliers.length; i++) {
+ setContext("supplierIndex", i);
+ Supplier<Stream<Integer>> supp = suppliers[i];
+ for (int j = 0; j < configs.length; j++) {
+ setContext("configIndex", j);
+ UnaryOperator<Stream<Integer>> config = configs[j];
counter.set(0);
Stream<Integer> stream = config.apply(supp.get());
assertEquals(0, counter.get());
@@ -86,6 +90,7 @@
});
assertTrue(data.size() == 0 || counter.get() > 0);
}
+ }
}
@SuppressWarnings({"rawtypes", "unchecked"})
@@ -96,23 +101,35 @@
= new UnaryOperator[] {
(UnaryOperator<Stream<Integer>>) s -> s,
(UnaryOperator<Stream<Integer>>) s -> s.sequential(),
- (UnaryOperator<Stream<Integer>>) s -> s.parallel()
+ (UnaryOperator<Stream<Integer>>) s -> s.parallel(),
+ (UnaryOperator<Stream<Integer>>) s -> s.unordered()
};
UnaryOperator<Stream<Integer>>[] stuff
= new UnaryOperator[] {
(UnaryOperator<Stream<Integer>>) s -> s,
(UnaryOperator<Stream<Integer>>) s -> s.map(id),
- (UnaryOperator<Stream<Integer>>) s -> s.sorted(Comparators.naturalOrder()),
- (UnaryOperator<Stream<Integer>>) s -> s.map(id).sorted(Comparators.naturalOrder()).map(id),
- (UnaryOperator<Stream<Integer>>) s -> s.filter(LambdaTestHelpers.pEven).sorted(Comparators.naturalOrder()).map(id),
+ (UnaryOperator<Stream<Integer>>) s -> s.sorted(Comparator.naturalOrder()),
+ (UnaryOperator<Stream<Integer>>) s -> s.map(id).sorted(Comparator.naturalOrder()).map(id),
+ (UnaryOperator<Stream<Integer>>) s -> s.filter(LambdaTestHelpers.pEven).sorted(Comparator.naturalOrder()).map(id),
};
- for (UnaryOperator<Stream<Integer>> c1 : changers)
- for (UnaryOperator<Stream<Integer>> s1 : stuff)
- for (UnaryOperator<Stream<Integer>> c2 : changers)
- for (UnaryOperator<Stream<Integer>> s2 : stuff) {
+ for (int c1Index = 0; c1Index < changers.length; c1Index++) {
+ setContext("c1Index", c1Index);
+ UnaryOperator<Stream<Integer>> c1 = changers[c1Index];
+ for (int s1Index = 0; s1Index < stuff.length; s1Index++) {
+ setContext("s1Index", s1Index);
+ UnaryOperator<Stream<Integer>> s1 = stuff[s1Index];
+ for (int c2Index = 0; c2Index < changers.length; c2Index++) {
+ setContext("c2Index", c2Index);
+ UnaryOperator<Stream<Integer>> c2 = changers[c2Index];
+ for (int s2Index = 0; s2Index < stuff.length; s2Index++) {
+ setContext("s2Index", s2Index);
+ UnaryOperator<Stream<Integer>> s2 = stuff[s2Index];
UnaryOperator<Stream<Integer>> composed = s -> s2.apply(c2.apply(s1.apply(c1.apply(s))));
exerciseOps(data, composed);
}
+ }
+ }
+ }
}
}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -26,7 +26,11 @@
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Collectors;
+import java.util.function.Function;
+import java.util.stream.DoubleStream;
+import java.util.stream.IntStream;
+import java.util.stream.LambdaTestHelpers;
+import java.util.stream.LongStream;
import java.util.stream.OpTestCase;
import java.util.stream.Stream;
import java.util.stream.StreamTestDataProvider;
@@ -145,19 +149,20 @@
List<Integer> skips = sizes(data.size());
for (int s : skips) {
- Collection<Integer> sr = exerciseOpsInt(data,
- st -> st.substream(s),
- st -> st.substream(s),
- st -> st.substream(s),
- st -> st.substream(s));
- assertEquals(sr.size(), sliceSize(data.size(), s));
+ setContext("skip", s);
+ testSliceMulti(data,
+ sliceSize(data.size(), s),
+ st -> st.substream(s),
+ st -> st.substream(s),
+ st -> st.substream(s),
+ st -> st.substream(s));
- sr = exerciseOpsInt(data,
- st -> st.substream(s).substream(s / 2),
- st -> st.substream(s).substream(s / 2),
- st -> st.substream(s).substream(s / 2),
- st -> st.substream(s).substream(s / 2));
- assertEquals(sr.size(), sliceSize(sliceSize(data.size(), s), s/2));
+ testSliceMulti(data,
+ sliceSize(sliceSize(data.size(), s), s/2),
+ st -> st.substream(s).substream(s / 2),
+ st -> st.substream(s).substream(s / 2),
+ st -> st.substream(s).substream(s / 2),
+ st -> st.substream(s).substream(s / 2));
}
}
@@ -167,20 +172,22 @@
List<Integer> limits = skips;
for (int s : skips) {
- for (int limit : limits) {
- Collection<Integer> sr = exerciseOpsInt(data,
- st -> st.substream(s).limit(limit),
- st -> st.substream(s).limit(limit),
- st -> st.substream(s).limit(limit),
- st -> st.substream(s).limit(limit));
- assertEquals(sr.size(), sliceSize(sliceSize(data.size(), s), 0, limit));
+ setContext("skip", s);
+ for (int l : limits) {
+ setContext("limit", l);
+ testSliceMulti(data,
+ sliceSize(sliceSize(data.size(), s), 0, l),
+ st -> st.substream(s).limit(l),
+ st -> st.substream(s).limit(l),
+ st -> st.substream(s).limit(l),
+ st -> st.substream(s).limit(l));
- sr = exerciseOpsInt(data,
- st -> st.substream(s, limit+s),
- st -> st.substream(s, limit+s),
- st -> st.substream(s, limit+s),
- st -> st.substream(s, limit+s));
- assertEquals(sr.size(), sliceSize(data.size(), s, limit));
+ testSliceMulti(data,
+ sliceSize(data.size(), s, l),
+ st -> st.substream(s, l+s),
+ st -> st.substream(s, l+s),
+ st -> st.substream(s, l+s),
+ st -> st.substream(s, l+s));
}
}
}
@@ -189,32 +196,87 @@
public void testLimitOps(String name, TestData.OfRef<Integer> data) {
List<Integer> limits = sizes(data.size());
- for (int limit : limits) {
- Collection<Integer> sr = exerciseOpsInt(data,
- st -> st.limit(limit),
- st -> st.limit(limit),
- st -> st.limit(limit),
- st -> st.limit(limit));
- assertEquals(sr.size(), sliceSize(data.size(), 0, limit));
+ for (int l : limits) {
+ setContext("limit", l);
+ testSliceMulti(data,
+ sliceSize(data.size(), 0, l),
+ st -> st.limit(l),
+ st -> st.limit(l),
+ st -> st.limit(l),
+ st -> st.limit(l));
+ }
+
+ for (int l : limits) {
+ setContext("limit", l);
+ testSliceMulti(data,
+ sliceSize(sliceSize(data.size(), 0, l), 0, l / 2),
+ st -> st.limit(l).limit(l / 2),
+ st -> st.limit(l).limit(l / 2),
+ st -> st.limit(l).limit(l / 2),
+ st -> st.limit(l).limit(l / 2));
+ }
+ }
+
+ private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
+ int expectedSize) {
+ return (act, exp, ord, par) -> {
+ if (par & !ord) {
+ List<Integer> expected = new ArrayList<>();
+ data.forEach(expected::add);
+
+ List<Integer> actual = new ArrayList<>();
+ act.forEach(actual::add);
- sr = exerciseOpsInt(data,
- st -> st.limit(limit).limit(limit / 2),
- st -> st.limit(limit).limit(limit / 2),
- st -> st.limit(limit).limit(limit / 2),
- st -> st.limit(limit).limit(limit / 2));
- assertEquals(sr.size(), sliceSize(sliceSize(data.size(), 0, limit), 0, limit/2));
+ assertEquals(actual.size(), expectedSize);
+ assertTrue(expected.containsAll(actual));
+ }
+ else {
+ LambdaTestHelpers.assertContents(act, exp);
+ }
+ };
+ }
+
+ private void testSliceMulti(TestData.OfRef<Integer> data,
+ int expectedSize,
+ Function<Stream<Integer>, Stream<Integer>> mRef,
+ Function<IntStream, IntStream> mInt,
+ Function<LongStream, LongStream> mLong,
+ Function<DoubleStream, DoubleStream> mDouble) {
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ Function<Stream<Integer>, Stream<Integer>>[] ms = new Function[4];
+ ms[0] = mRef;
+ ms[1] = s -> mInt.apply(s.mapToInt(e -> e)).mapToObj(e -> e);
+ ms[2] = s -> mLong.apply(s.mapToLong(e -> e)).mapToObj(e -> (int) e);
+ ms[3] = s -> mDouble.apply(s.mapToDouble(e -> e)).mapToObj(e -> (int) e);
+ testSliceMulti(data, expectedSize, ms);
+ }
+
+ @SafeVarargs
+ private final void testSliceMulti(TestData.OfRef<Integer> data,
+ int expectedSize,
+ Function<Stream<Integer>, Stream<Integer>>... ms) {
+ for (int i = 0; i < ms.length; i++) {
+ setContext("mIndex", i);
+ Function<Stream<Integer>, Stream<Integer>> m = ms[i];
+ Collection<Integer> sr = withData(data)
+ .stream(m)
+ .resultAsserter(sliceResultAsserter(data, expectedSize))
+ .exercise();
+ assertEquals(sr.size(), expectedSize);
}
}
public void testLimitSort() {
List<Integer> l = countTo(100);
Collections.reverse(l);
- exerciseOps(l, s -> s.limit(10).sorted(Comparators.naturalOrder()));
+ exerciseOps(l, s -> s.limit(10).sorted(Comparator.naturalOrder()));
}
@Test(groups = { "serialization-hostile" })
public void testLimitShortCircuit() {
for (int l : Arrays.asList(0, 10)) {
+ setContext("l", l);
AtomicInteger ai = new AtomicInteger();
countTo(100).stream()
.peek(i -> ai.getAndIncrement())
@@ -224,18 +286,6 @@
}
}
- public void testSkipParallel() {
- List<Integer> l = countTo(1000).parallelStream().substream(200).limit(200).sequential().collect(Collectors.toList());
- assertEquals(l.size(), 200);
- assertEquals(l.get(l.size() -1).intValue(), 400);
- }
-
- public void testLimitParallel() {
- List<Integer> l = countTo(1000).parallelStream().limit(500).sequential().collect(Collectors.toList());
- assertEquals(l.size(), 500);
- assertEquals(l.get(l.size() -1).intValue(), 500);
- }
-
private List<Integer> sizes(int size) {
if (size < 4) {
return Arrays.asList(0, 1, 2, 3, 4, 6);
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SortedOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SortedOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -40,10 +40,10 @@
public void testSorted() {
assertCountSum(countTo(0).stream().sorted(), 0, 0);
assertCountSum(countTo(10).stream().sorted(), 10, 55);
- assertCountSum(countTo(10).stream().sorted(cInteger.reverseOrder()), 10, 55);
+ assertCountSum(countTo(10).stream().sorted(cInteger.reversed()), 10, 55);
List<Integer> to10 = countTo(10);
- assertSorted(to10.stream().sorted(cInteger.reverseOrder()).iterator(), cInteger.reverseOrder());
+ assertSorted(to10.stream().sorted(cInteger.reversed()).iterator(), cInteger.reversed());
Collections.reverse(to10);
assertSorted(to10.stream().sorted().iterator());
@@ -51,7 +51,7 @@
Spliterator<Integer> s = to10.stream().sorted().spliterator();
assertTrue(s.hasCharacteristics(Spliterator.SORTED));
- s = to10.stream().sorted(cInteger.reverseOrder()).spliterator();
+ s = to10.stream().sorted(cInteger.reversed()).spliterator();
assertFalse(s.hasCharacteristics(Spliterator.SORTED));
}
@@ -87,8 +87,8 @@
assertSorted(result.iterator());
assertContentsUnordered(data, result);
- result = exerciseOps(data, s -> s.sorted(cInteger.reverseOrder()));
- assertSorted(result.iterator(), cInteger.reverseOrder());
+ result = exerciseOps(data, s -> s.sorted(cInteger.reversed()));
+ assertSorted(result.iterator(), cInteger.reversed());
assertContentsUnordered(data, result);
}
@@ -104,23 +104,23 @@
assertContentsUnordered(data, result);
result = withData(data)
- .stream(s -> s.sorted(cInteger.reverseOrder()).sorted(cInteger.reverseOrder()),
+ .stream(s -> s.sorted(cInteger.reversed()).sorted(cInteger.reversed()),
new CollectorOps.TestParallelSizedOp<Integer>())
.exercise();
- assertSorted(result, cInteger.reverseOrder());
+ assertSorted(result, cInteger.reversed());
assertContentsUnordered(data, result);
result = withData(data)
- .stream(s -> s.sorted().sorted(cInteger.reverseOrder()),
+ .stream(s -> s.sorted().sorted(cInteger.reversed()),
new CollectorOps.TestParallelSizedOp<Integer>())
.exercise();
- assertSorted(result, cInteger.reverseOrder());
+ assertSorted(result, cInteger.reversed());
assertContentsUnordered(data, result);
result = withData(data)
- .stream(s -> s.sorted(cInteger.reverseOrder()).sorted(),
+ .stream(s -> s.sorted(cInteger.reversed()).sorted(),
new CollectorOps.TestParallelSizedOp<Integer>())
.exercise();
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamLinkTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamLinkTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -47,6 +47,7 @@
@Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
public void testManyStreams(String name, TestData.OfRef<Integer> data) {
for (int n : sizes) {
+ setContext("n", n);
List<Integer> expected = data.stream().map(e -> (Integer) (e + n)).collect(Collectors.toList());
withData(data).
@@ -59,6 +60,7 @@
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntManyStreams(String name, TestData.OfInt data) {
for (int n : sizes) {
+ setContext("n", n);
int[] expected = data.stream().map(e -> e + n).toArray();
withData(data).
@@ -71,6 +73,7 @@
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongManyStreams(String name, TestData.OfLong data) {
for (int n : sizes) {
+ setContext("n", n);
long[] expected = data.stream().map(e -> e + n).toArray();
withData(data).
@@ -83,6 +86,7 @@
@Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
public void testDoubleManyStreams(String name, TestData.OfDouble data) {
for (int n : sizes) {
+ setContext("n", n);
double[] expected = data.stream().map(e -> accumulate(e, n)).toArray();
withData(data).
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamSpliteratorTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamSpliteratorTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -256,9 +256,14 @@
s -> s.map(LambdaTestHelpers.identity()).parallel()
);
- for (Consumer<Stream<Integer>> terminalOp : terminalOps) {
- for (UnaryOperator<Stream<Integer>> intermediateOp : intermediateOps) {
- for (boolean proxyEstimateSize : new boolean[]{false, true}) {
+ for (int i = 0; i < terminalOps.size(); i++) {
+ setContext("termOpIndex", i);
+ Consumer<Stream<Integer>> terminalOp = terminalOps.get(i);
+ for (int j = 0; j < intermediateOps.size(); j++) {
+ setContext("intOpIndex", j);
+ UnaryOperator<Stream<Integer>> intermediateOp = intermediateOps.get(j);
+ for (boolean proxyEstimateSize : new boolean[] {false, true}) {
+ setContext("proxyEstimateSize", proxyEstimateSize);
Spliterator<Integer> sp = intermediateOp.apply(l.stream()).spliterator();
ProxyNoExactSizeSpliterator<Integer> psp = new ProxyNoExactSizeSpliterator<>(sp, proxyEstimateSize);
Stream<Integer> s = StreamSupport.parallelStream(psp);
@@ -345,9 +350,14 @@
s -> s.map(i -> i).parallel()
);
- for (Consumer<IntStream> terminalOp : terminalOps) {
- for (UnaryOperator<IntStream> intermediateOp : intermediateOps) {
- for (boolean proxyEstimateSize : new boolean[]{false, true}) {
+ for (int i = 0; i < terminalOps.size(); i++) {
+ setContext("termOpIndex", i);
+ Consumer<IntStream> terminalOp = terminalOps.get(i);
+ for (int j = 0; j < intermediateOps.size(); j++) {
+ setContext("intOpIndex", j);
+ UnaryOperator<IntStream> intermediateOp = intermediateOps.get(j);
+ for (boolean proxyEstimateSize : new boolean[] {false, true}) {
+ setContext("proxyEstimateSize", proxyEstimateSize);
// Size is assumed to be larger than the target size for no splitting
// @@@ Need way to obtain the target size
Spliterator.OfInt sp = intermediateOp.apply(IntStream.range(0, 1000)).spliterator();
@@ -433,9 +443,14 @@
s -> s.map(i -> i).parallel()
);
- for (Consumer<LongStream> terminalOp : terminalOps) {
- for (UnaryOperator<LongStream> intermediateOp : intermediateOps) {
- for (boolean proxyEstimateSize : new boolean[]{false, true}) {
+ for (int i = 0; i < terminalOps.size(); i++) {
+ Consumer<LongStream> terminalOp = terminalOps.get(i);
+ setContext("termOpIndex", i);
+ for (int j = 0; j < intermediateOps.size(); j++) {
+ setContext("intOpIndex", j);
+ UnaryOperator<LongStream> intermediateOp = intermediateOps.get(j);
+ for (boolean proxyEstimateSize : new boolean[] {false, true}) {
+ setContext("proxyEstimateSize", proxyEstimateSize);
// Size is assumed to be larger than the target size for no splitting
// @@@ Need way to obtain the target size
Spliterator.OfLong sp = intermediateOp.apply(LongStream.range(0, 1000)).spliterator();
@@ -521,9 +536,14 @@
s -> s.map(i -> i).parallel()
);
- for (Consumer<DoubleStream> terminalOp : terminalOps) {
- for (UnaryOperator<DoubleStream> intermediateOp : intermediateOps) {
- for (boolean proxyEstimateSize : new boolean[]{false, true}) {
+ for (int i = 0; i < terminalOps.size(); i++) {
+ Consumer<DoubleStream> terminalOp = terminalOps.get(i);
+ setContext("termOpIndex", i);
+ for (int j = 0; j < intermediateOps.size(); j++) {
+ UnaryOperator<DoubleStream> intermediateOp = intermediateOps.get(j);
+ setContext("intOpIndex", j);
+ for (boolean proxyEstimateSize : new boolean[] {false, true}) {
+ setContext("proxyEstimateSize", proxyEstimateSize);
// Size is assumed to be larger than the target size for no splitting
// @@@ Need way to obtain the target size
Spliterator.OfDouble sp = intermediateOp.apply(IntStream.range(0, 1000).asDoubleStream()).spliterator();
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/TabulatorsTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/TabulatorsTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -202,26 +202,38 @@
}
}
+ private <T> ResultAsserter<T> mapTabulationAsserter(boolean ordered) {
+ return (act, exp, ord, par) -> {
+ if (par & (!ordered || !ord)) {
+ TabulatorsTest.nestedMapEqualityAssertion(act, exp);
+ }
+ else {
+ LambdaTestHelpers.assertContentsEqual(act, exp);
+ }
+ };
+ }
+
private<T, M extends Map>
void exerciseMapTabulation(TestData<T, Stream<T>> data,
Collector<T, ? extends M> collector,
TabulationAssertion<T, M> assertion)
throws ReflectiveOperationException {
- boolean ordered = data.isOrdered()
- && !collector.characteristics().contains(Collector.Characteristics.UNORDERED);
+ boolean ordered = !collector.characteristics().contains(Collector.Characteristics.UNORDERED);
+
M m = withData(data)
.terminal(s -> s.collect(collector))
- .parallelEqualityAsserter(ordered ? LambdaTestHelpers::assertContentsEqual : this::nestedMapEqualityAssertion)
+ .resultAsserter(mapTabulationAsserter(ordered))
.exercise();
assertion.assertValue(m, () -> data.stream(), ordered);
+
m = withData(data)
.terminal(s -> s.unordered().collect(collector))
- .parallelEqualityAsserter(this::nestedMapEqualityAssertion)
+ .resultAsserter(mapTabulationAsserter(ordered))
.exercise();
assertion.assertValue(m, () -> data.stream(), false);
}
- private void nestedMapEqualityAssertion(Object o1, Object o2) {
+ private static void nestedMapEqualityAssertion(Object o1, Object o2) {
if (o1 instanceof Map) {
Map m1 = (Map) o1;
Map m2 = (Map) o2;
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ToArrayOpTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ToArrayOpTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -29,6 +29,7 @@
import java.util.stream.*;
import static java.util.stream.LambdaTestHelpers.*;
+import static org.testng.Assert.assertEquals;
/**
@@ -134,15 +135,51 @@
s -> s.sorted()
));
+ private <T extends Object> ResultAsserter<T[]> statefulOpResultAsserter(TestData.OfRef<Integer> data) {
+ return (act, exp, ord, par) -> {
+ if (par) {
+ if (!data.isOrdered()) {
+ // Relax the checking if the data source is unordered
+ // It is not exactly possible to determine if the limit
+ // operation is present and if it is before or after
+ // the sorted operation
+ // If the limit operation is present and before the sorted
+ // operation then the sub-set output after limit is a
+ // non-deterministic sub-set of the source
+ List<Integer> expected = new ArrayList<>();
+ data.forEach(expected::add);
+
+ List<T> actual = Arrays.asList(act);
+
+ assertEquals(actual.size(), exp.length);
+ assertTrue(expected.containsAll(actual));
+ return;
+ }
+ else if (!ord) {
+ LambdaTestHelpers.assertContentsUnordered(Arrays.asList(act),
+ Arrays.asList(exp));
+ return;
+ }
+ }
+ assertEquals(act, exp);
+ };
+ }
+
@Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
public void testStatefulOpPermutations(String name, TestData.OfRef<Integer> data) {
for (Function<Stream<Integer>, Stream<Integer>> f : statefulOpPermutations) {
- exerciseTerminalOps(data, f, s -> s.toArray());
+ withData(data).terminal(f, s -> s.toArray())
+ .resultAsserter(statefulOpResultAsserter(data))
+ .exercise();
- Integer[] is = exerciseTerminalOps(data, f, s -> s.toArray(Integer[]::new));
+ Integer[] is = withData(data).terminal(f, s -> s.toArray(Integer[]::new))
+ .resultAsserter(statefulOpResultAsserter(data))
+ .exercise();
assertEquals(is.getClass(), Integer[].class);
- Number[] ns = exerciseTerminalOps(data, f, s -> s.toArray(Number[]::new));
+ Number[] ns = withData(data).terminal(f, s -> s.toArray(Number[]::new))
+ .resultAsserter(statefulOpResultAsserter(data))
+ .exercise();
assertEquals(ns.getClass(), Number[].class);
if (data.size() > 0) {
--- a/jdk/test/sun/misc/FloatingDecimal/TestFDBigInteger.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/misc/FloatingDecimal/TestFDBigInteger.java Tue Jul 02 15:23:23 2013 -0700
@@ -351,6 +351,10 @@
if (!isImmutable && diff != left) {
throw new Exception("leftInplaceSub of doesn't reuse its argument");
}
+ if (isImmutable) {
+ check(biLeft, left, "leftInplaceSub corrupts its left immutable argument");
+ }
+ check(biRight, right, "leftInplaceSub corrupts its right argument");
check(biLeft.subtract(biRight), diff, "leftInplaceSub returns wrong result");
}
@@ -381,6 +385,10 @@
if (!isImmutable && diff != right) {
throw new Exception("rightInplaceSub of doesn't reuse its argument");
}
+ check(biLeft, left, "leftInplaceSub corrupts its left argument");
+ if (isImmutable) {
+ check(biRight, right, "leftInplaceSub corrupts its right immutable argument");
+ }
try {
check(biLeft.subtract(biRight), diff, "rightInplaceSub returns wrong result");
} catch (Exception e) {
--- a/jdk/test/sun/misc/JavaLangAccess/NewUnsafeString.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/misc/JavaLangAccess/NewUnsafeString.java Tue Jul 02 15:23:23 2013 -0700
@@ -22,7 +22,7 @@
*/
import java.util.Objects;
-import java.util.Comparators;
+import java.util.Comparator;
import sun.misc.JavaLangAccess;
import sun.misc.SharedSecrets;
@@ -48,7 +48,7 @@
if (!benchmark.equals(constructorCopy)) {
throw new Error("Copy not equal");
}
- if (0 != Objects.compare(benchmark, constructorCopy, Comparators.naturalOrder())) {
+ if (0 != Objects.compare(benchmark, constructorCopy, Comparator.naturalOrder())) {
throw new Error("Copy not equal");
}
@@ -58,7 +58,7 @@
if (!benchmark.equals(jlaCopy)) {
throw new Error("Copy not equal");
}
- if (0 != Objects.compare(benchmark, jlaCopy, Comparators.naturalOrder())) {
+ if (0 != Objects.compare(benchmark, jlaCopy, Comparator.naturalOrder())) {
throw new Error("Copy not equal");
}
@@ -68,7 +68,7 @@
if (!constructorCopy.equals(jlaCopy)) {
throw new Error("Copy not equal");
}
- if (0 != Objects.compare(constructorCopy, jlaCopy, Comparators.naturalOrder())) {
+ if (0 != Objects.compare(constructorCopy, jlaCopy, Comparator.naturalOrder())) {
throw new Error("Copy not equal");
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/www/http/HttpURLConnection/PostOnDelete.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 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.
+ */
+
+import com.sun.net.httpserver.*;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.*;
+
+/*
+ * @test
+ * @bug 7157360
+ * @summary HttpURLConnection: HTTP method DELETE doesn't support output
+ */
+public class PostOnDelete {
+
+ /* string to send */
+ private static String msg = "Hello Server";
+ /* length of the string to verify */
+ private int len = msg.length();
+
+ public static void main(String[] args) throws Exception {
+ new PostOnDelete().runTest();
+ }
+
+ public void runTest() throws Exception {
+ Server s = null;
+ try {
+ s = new Server();
+ s.startServer();
+ URL url = new URL("http://localhost:" + s.getPort());
+ HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection();
+ urlConnection.setRequestMethod("DELETE");
+ urlConnection.setDoOutput(true);
+ OutputStream os = urlConnection.getOutputStream();
+ os.write(msg.getBytes());
+ os.close();
+ int code = urlConnection.getResponseCode();
+
+ if (code != 200) {
+ throw new RuntimeException("Request entity for DELETE failed!");
+ }
+ } finally {
+ s.stopServer();
+ }
+ }
+
+ class Server {
+ HttpServer server;
+
+ public void startServer() {
+ InetSocketAddress addr = new InetSocketAddress(0);
+ try {
+ server = HttpServer.create(addr, 0);
+ } catch (IOException ioe) {
+ throw new RuntimeException("Server could not be created");
+ }
+
+ server.createContext("/", new EmptyPathHandler());
+ server.start();
+ }
+
+ public int getPort() {
+ return server.getAddress().getPort();
+ }
+
+ public void stopServer() {
+ server.stop(0);
+ }
+ }
+
+ class EmptyPathHandler implements HttpHandler {
+
+ @Override
+ public void handle(HttpExchange exchange) throws IOException {
+ String requestMethod = exchange.getRequestMethod();
+
+ if (requestMethod.equalsIgnoreCase("DELETE")) {
+ InputStream is = exchange.getRequestBody();
+
+ int count = 0;
+ while (is.read() != -1) {
+ count++;
+ }
+ is.close();
+
+ Headers responseHeaders = exchange.getResponseHeaders();
+ responseHeaders.set("Content-Type", "text/plain");
+ exchange.sendResponseHeaders((count == len) ? 200 : 400, 0);
+ OutputStream os = exchange.getResponseBody();
+ String str = "Hello from server!";
+ os.write(str.getBytes());
+ os.flush();
+ os.close();
+ }
+ }
+ }
+}
--- a/jdk/test/sun/security/krb5/auto/AcceptorSubKey.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/security/krb5/auto/AcceptorSubKey.java Tue Jul 02 15:23:23 2013 -0700
@@ -26,10 +26,10 @@
* @bug 7077646
* @summary gssapi wrap for CFX per-message tokens always set FLAG_ACCEPTOR_SUBKEY
* @compile -XDignore.symbol.file AcceptorSubKey.java
- * @run main/othervm AcceptorSubKey
+ * @run main/othervm AcceptorSubKey 0
+ * @run main/othervm AcceptorSubKey 4
*/
-import java.util.Arrays;
import sun.security.jgss.GSSUtil;
// The basic krb5 test skeleton you can copy from
@@ -37,8 +37,14 @@
public static void main(String[] args) throws Exception {
+ int expected = Integer.parseInt(args[0]);
+
new OneKDC(null).writeJAASConf();
+ if (expected != 0) {
+ System.setProperty("sun.security.krb5.acceptor.subkey", "true");
+ }
+
Context c, s;
c = Context.fromJAAS("client");
s = Context.fromJAAS("server");
@@ -53,8 +59,8 @@
// FLAG_ACCEPTOR_SUBKEY is 4
int flagOn = wrapped[2] & 4;
- if (flagOn != 0) {
- throw new Exception("Java GSS should not have set acceptor subkey");
+ if (flagOn != expected) {
+ throw new Exception("not expected");
}
s.dispose();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/BasicProc.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 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.
+ */
+
+/*
+ * @test
+ * @bug 8009977
+ * @summary A test library to launch multiple Java processes
+ * @library ../../../../java/security/testlibrary/
+ * @compile -XDignore.symbol.file BasicProc.java
+ * @run main/othervm BasicProc
+ */
+
+import java.io.File;
+import org.ietf.jgss.Oid;
+
+import javax.security.auth.PrivateCredentialPermission;
+
+public class BasicProc {
+
+ static String CONF = "krb5.conf";
+ static String KTAB = "ktab";
+ public static void main(String[] args) throws Exception {
+ String HOST = "localhost";
+ String SERVER = "server/" + HOST;
+ String BACKEND = "backend/" + HOST;
+ String USER = "user";
+ char[] PASS = "password".toCharArray();
+ String REALM = "REALM";
+
+ Oid oid = new Oid("1.2.840.113554.1.2.2");
+
+ if (args.length == 0) {
+ System.setProperty("java.security.krb5.conf", CONF);
+ KDC kdc = KDC.create(REALM, HOST, 0, true);
+ kdc.addPrincipal(USER, PASS);
+ kdc.addPrincipalRandKey("krbtgt/" + REALM);
+ kdc.addPrincipalRandKey(SERVER);
+ kdc.addPrincipalRandKey(BACKEND);
+
+ String cwd = System.getProperty("user.dir");
+ kdc.writeKtab(KTAB);
+ KDC.saveConfig(CONF, kdc, "forwardable = true");
+
+ Proc pc = Proc.create("BasicProc")
+ .args("client")
+ .prop("java.security.krb5.conf", CONF)
+ .prop("java.security.manager", "")
+ .perm(new java.util.PropertyPermission(
+ "sun.security.krb5.principal", "read"))
+ .perm(new javax.security.auth.AuthPermission(
+ "modifyPrincipals"))
+ .perm(new javax.security.auth.AuthPermission(
+ "modifyPrivateCredentials"))
+ .perm(new javax.security.auth.AuthPermission("doAs"))
+ .perm(new javax.security.auth.kerberos.ServicePermission(
+ "krbtgt/" + REALM + "@" + REALM, "initiate"))
+ .perm(new javax.security.auth.kerberos.ServicePermission(
+ "server/localhost@" + REALM, "initiate"))
+ .perm(new javax.security.auth.kerberos.DelegationPermission(
+ "\"server/localhost@" + REALM + "\" " +
+ "\"krbtgt/" + REALM + "@" + REALM + "\""))
+ .debug("C")
+ .start();
+ Proc ps = Proc.create("BasicProc")
+ .args("server")
+ .prop("java.security.krb5.conf", CONF)
+ .prop("java.security.manager", "")
+ .perm(new java.util.PropertyPermission(
+ "sun.security.krb5.principal", "read"))
+ .perm(new javax.security.auth.AuthPermission(
+ "modifyPrincipals"))
+ .perm(new javax.security.auth.AuthPermission(
+ "modifyPrivateCredentials"))
+ .perm(new javax.security.auth.AuthPermission("doAs"))
+ .perm(new PrivateCredentialPermission(
+ "javax.security.auth.kerberos.KeyTab * \"*\"",
+ "read"))
+ .perm(new javax.security.auth.kerberos.ServicePermission(
+ "server/localhost@" + REALM, "accept"))
+ .perm(new java.io.FilePermission(
+ cwd + File.separator + KTAB, "read"))
+ .perm(new javax.security.auth.kerberos.ServicePermission(
+ "backend/localhost@" + REALM, "initiate"))
+ .debug("S")
+ .start();
+ Proc pb = Proc.create("BasicProc")
+ .args("backend")
+ .prop("java.security.krb5.conf", CONF)
+ .prop("java.security.manager", "")
+ .perm(new java.util.PropertyPermission(
+ "sun.security.krb5.principal", "read"))
+ .perm(new javax.security.auth.AuthPermission(
+ "modifyPrincipals"))
+ .perm(new javax.security.auth.AuthPermission(
+ "modifyPrivateCredentials"))
+ .perm(new javax.security.auth.AuthPermission("doAs"))
+ .perm(new PrivateCredentialPermission(
+ "javax.security.auth.kerberos.KeyTab * \"*\"",
+ "read"))
+ .perm(new javax.security.auth.kerberos.ServicePermission(
+ "backend/localhost@" + REALM, "accept"))
+ .perm(new java.io.FilePermission(
+ cwd + File.separator + KTAB, "read"))
+ .debug("B")
+ .start();
+
+ // Client and server handshake
+ String token = pc.readData();
+ ps.println(token);
+ token = ps.readData();
+ pc.println(token);
+ // Server and backend handshake
+ token = ps.readData();
+ pb.println(token);
+ token = pb.readData();
+ ps.println(token);
+ // wrap/unwrap/getMic/verifyMic and plain text
+ token = ps.readData();
+ pb.println(token);
+ token = pb.readData();
+ ps.println(token);
+ token = pb.readData();
+ ps.println(token);
+
+ if ((pc.waitFor() | ps.waitFor() | pb.waitFor()) != 0) {
+ throw new Exception();
+ }
+ } else if (args[0].equals("client")) {
+ Context c = Context.fromUserPass(USER, PASS, false);
+ c.startAsClient(SERVER, oid);
+ c.x().requestCredDeleg(true);
+ Proc.binOut(c.take(new byte[0]));
+ byte[] token = Proc.binIn();
+ c.take(token);
+ } else if (args[0].equals("server")) {
+ Context s = Context.fromUserKtab(SERVER, KTAB, true);
+ s.startAsServer(oid);
+ byte[] token = Proc.binIn();
+ token = s.take(token);
+ Proc.binOut(token);
+ Context s2 = s.delegated();
+ s2.startAsClient(BACKEND, oid);
+ Proc.binOut(s2.take(new byte[0]));
+ token = Proc.binIn();
+ s2.take(token);
+ byte[] msg = "Hello".getBytes();
+ Proc.binOut(s2.wrap(msg, true));
+ s2.verifyMic(Proc.binIn(), msg);
+ String in = Proc.textIn();
+ if (!in.equals("Hello")) {
+ throw new Exception();
+ }
+ } else if (args[0].equals("backend")) {
+ Context b = Context.fromUserKtab(BACKEND, KTAB, true);
+ b.startAsServer(oid);
+ byte[] token = Proc.binIn();
+ Proc.binOut(b.take(token));
+ byte[] msg = b.unwrap(Proc.binIn(), true);
+ Proc.binOut(b.getMic(msg));
+ Proc.textOut(new String(msg));
+ }
+ }
+ // create a native server
+ private static Proc ns(Proc p) throws Exception {
+ return p
+ .env("KRB5_CONFIG", CONF)
+ .env("KRB5_KTNAME", KTAB)
+ .prop("sun.security.jgss.native", "true")
+ .prop("javax.security.auth.useSubjectCredsOnly", "false")
+ .prop("sun.security.nativegss.debug", "true");
+ }
+}
--- a/jdk/test/sun/security/krb5/auto/Context.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/security/krb5/auto/Context.java Tue Jul 02 15:23:23 2013 -0700
@@ -195,6 +195,7 @@
Krb5LoginModule krb5 = new Krb5LoginModule();
Map<String, String> map = new HashMap<>();
+ map.put("isInitiator", "false");
map.put("doNotPrompt", "true");
map.put("useTicketCache", "false");
map.put("useKeyTab", "true");
@@ -616,9 +617,10 @@
*/
static public void handshake(final Context c, final Context s) throws Exception {
byte[] t = new byte[0];
- while (!c.x.isEstablished() || !s.x.isEstablished()) {
- t = c.take(t);
- t = s.take(t);
+ while (true) {
+ if (t != null || !c.x.isEstablished()) t = c.take(t);
+ if (t != null || !s.x.isEstablished()) t = s.take(t);
+ if (c.x.isEstablished() && s.x.isEstablished()) break;
}
}
}
--- a/jdk/test/sun/security/krb5/auto/KDC.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/security/krb5/auto/KDC.java Tue Jul 02 15:23:23 2013 -0700
@@ -1137,7 +1137,7 @@
* @return REALM.NAME = { kdc = host:port }
*/
private static String realmLineForKDC(KDC kdc) {
- return String.format(" %s = {\n kdc = %s:%d\n }\n",
+ return String.format("%s = {\n kdc = %s:%d\n}\n",
kdc.realm,
kdc.kdc,
kdc.port);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/NoneReplayCacheTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2013 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 8001326
+ * @run main/othervm NoneReplayCacheTest
+ * @summary the replaycache type none cannot stop an authenticator replay,
+ * but it can stop a message replay when s.s.k.acceptor.subkey is true.
+ * You should not really use none in production environment. This test merely
+ * shows there can be other protections when replay cache is not working fine.
+ */
+
+import org.ietf.jgss.GSSException;
+import sun.security.jgss.GSSUtil;
+
+public class NoneReplayCacheTest {
+
+ public static void main(String[] args)
+ throws Exception {
+
+ new OneKDC(null);
+
+ System.setProperty("sun.security.krb5.rcache", "none");
+ System.setProperty("sun.security.krb5.acceptor.subkey", "true");
+
+ Context c, s;
+ c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
+ s = Context.fromUserKtab(OneKDC.SERVER, OneKDC.KTAB, true);
+
+ c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+ s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+
+ byte[] first = c.take(new byte[0]);
+
+ c.take(s.take(first));
+
+ byte[] msg = c.wrap("hello".getBytes(), true);
+ s.unwrap(msg, true);
+
+ s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+ s.take(first); // apreq replay not detectable
+ try {
+ s.unwrap(msg, true); // msg replay detectable
+ throw new Exception("This method should fail");
+ } catch (GSSException gsse) {
+ gsse.printStackTrace();
+ }
+ }
+}
--- a/jdk/test/sun/security/krb5/auto/ReplayCache.java Tue Jul 02 15:20:55 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 7118809
- * @run main/othervm ReplayCache
- * @summary rcache deadlock
- */
-
-import org.ietf.jgss.GSSException;
-import sun.security.jgss.GSSUtil;
-import sun.security.krb5.KrbException;
-import sun.security.krb5.internal.Krb5;
-
-public class ReplayCache {
-
- public static void main(String[] args)
- throws Exception {
-
- new OneKDC(null).writeJAASConf();
-
- Context c, s;
- c = Context.fromJAAS("client");
- s = Context.fromJAAS("server");
-
- c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
- s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
-
- byte[] first = c.take(new byte[0]);
- s.take(first);
-
- s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
- try {
- s.take(first); // Replay the last token sent
- throw new Exception("This method should fail");
- } catch (GSSException gsse) {
- KrbException ke = (KrbException)gsse.getCause();
- if (ke.returnCode() != Krb5.KRB_AP_ERR_REPEAT) {
- throw gsse;
- }
- }
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/ReplayCacheExpunge.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 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.
+*/
+
+/*
+ * @test
+ * @bug 8001326
+ * @run main/othervm ReplayCacheExpunge 16
+ * @run main/othervm/fail ReplayCacheExpunge 15
+ * @summary when number of expired entries minus number of good entries
+ * is more than 30, expunge occurs, and expired entries are forgotten.
+*/
+
+import java.util.Random;
+import sun.security.krb5.internal.KerberosTime;
+import sun.security.krb5.internal.ReplayCache;
+import sun.security.krb5.internal.rcache.AuthTimeWithHash;
+
+public class ReplayCacheExpunge {
+ static final String client = "dummy@REALM";
+ static final String server = "server/localhost@REALM";
+ static final Random rand = new Random();
+
+ public static void main(String[] args) throws Exception {
+ // Make sure clockskew is default value
+ System.setProperty("java.security.krb5.conf", "nothing");
+
+ int count = Integer.parseInt(args[0]);
+ ReplayCache cache = ReplayCache.getInstance("dfl:./");
+ AuthTimeWithHash a1 =
+ new AuthTimeWithHash(client, server, time(-400), 0, hash("1"));
+ AuthTimeWithHash a2 =
+ new AuthTimeWithHash(client, server, time(0), 0, hash("4"));
+ KerberosTime now = new KerberosTime(time(0)*1000L);
+ KerberosTime then = new KerberosTime(time(-300)*1000L);
+
+ // Once upon a time, we added a lot of events
+ for (int i=0; i<count; i++) {
+ a1 = new AuthTimeWithHash(client, server, time(-400), 0, hash(""));
+ cache.checkAndStore(then, a1);
+ }
+
+ // Now, we add a new one. If some conditions hold, the old ones
+ // will be expunged.
+ cache.checkAndStore(now, a2);
+
+ // and adding an old one will not trigger any error
+ cache.checkAndStore(now, a1);
+ }
+
+ private static String hash(String s) {
+ char[] data = new char[16];
+ for (int i=0; i<16; i++) {
+ if (i < s.length()) data[i] = s.charAt(i);
+ else data[i] = (char)('0' + rand.nextInt(10));
+ }
+ return new String(data);
+ }
+
+ private static int time(int x) {
+ return (int)(System.currentTimeMillis()/1000) + x;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/ReplayCachePrecise.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 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.
+*/
+
+/*
+ * @test
+ * @bug 8001326
+ * @run main/othervm ReplayCachePrecise
+ * @summary when there are 2 two AuthTime with the same time but different hash,
+ * it's not a replay.
+*/
+
+import java.nio.ByteBuffer;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.Random;
+import sun.security.krb5.KrbException;
+import sun.security.krb5.internal.KerberosTime;
+import sun.security.krb5.internal.ReplayCache;
+import sun.security.krb5.internal.rcache.AuthTimeWithHash;
+
+public class ReplayCachePrecise {
+ static final String client = "dummy@REALM";
+ static final String server = "server/localhost@REALM";
+ static final Random rand = new Random();
+
+ public static void main(String[] args) throws Exception {
+
+ AuthTimeWithHash a1 = new AuthTimeWithHash(client, server, time(0), 0,
+ "1111111111111111");
+ AuthTimeWithHash a2 = new AuthTimeWithHash(client, server, time(0), 0,
+ "2222222222222222");
+ KerberosTime now = new KerberosTime(time(0)*1000L);
+
+ // When all new styles, must exact match
+ ReplayCache cache = ReplayCache.getInstance("dfl:./c1");
+ cache.checkAndStore(now, a1);
+ cache.checkAndStore(now, a2);
+
+ // When only old style in cache, partial match
+ cache = ReplayCache.getInstance("dfl:./c2");
+ cache.checkAndStore(now, a1);
+ // A small surgery to remove the new style from the cache file
+ SeekableByteChannel ch = Files.newByteChannel(Paths.get("c2"),
+ StandardOpenOption.WRITE,
+ StandardOpenOption.READ);
+ ch.position(6);
+ ch.write(ByteBuffer.wrap(a1.encode(false)));
+ ch.truncate(ch.position());
+ ch.close();
+ try {
+ cache.checkAndStore(now, a2);
+ throw new Exception();
+ } catch (KrbException ke) {
+ // Correct
+ System.out.println(ke);
+ }
+ }
+
+ private static int time(int x) {
+ return (int)(System.currentTimeMillis()/1000) + x;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/ReplayCacheTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7118809 8001326
+ * @run main/othervm ReplayCacheTest jvm
+ * @run main/othervm ReplayCacheTest dfl
+ * @summary rcache deadlock
+ */
+
+import java.io.File;
+import org.ietf.jgss.GSSException;
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.KrbException;
+import sun.security.krb5.internal.Krb5;
+
+public class ReplayCacheTest {
+
+ public static void main(String[] args)
+ throws Exception {
+
+ new OneKDC(null);
+
+ if (args[0].equals("dfl")) {
+ // Store file in scratch directory
+ args[0] = "dfl:" + System.getProperty("user.dir") + File.separator;
+ System.setProperty("sun.security.krb5.rcache", args[0]);
+ }
+
+ Context c, s;
+ c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
+ s = Context.fromUserKtab(OneKDC.SERVER, OneKDC.KTAB, true);
+
+ c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+ s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+
+ byte[] first = c.take(new byte[0]);
+ c.take(s.take(first));
+
+ s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+ try {
+ s.take(first); // Replay the last apreq sent
+ throw new Exception("This method should fail");
+ } catch (GSSException gsse) {
+ gsse.printStackTrace();
+ KrbException ke = (KrbException)gsse.getCause();
+ if (ke.returnCode() != Krb5.KRB_AP_ERR_REPEAT) {
+ throw gsse;
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java Tue Jul 02 15:23:23 2013 -0700
@@ -0,0 +1,333 @@
+/*
+ * Copyright (c) 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.
+ */
+
+/*
+ * @test
+ * @bug 7152176
+ * @summary More krb5 tests
+ * @library ../../../../java/security/testlibrary/
+ * @compile -XDignore.symbol.file ReplayCacheTestProc.java
+ * @run main/othervm/timeout=100 ReplayCacheTestProc
+ */
+
+import java.io.*;
+import java.nio.BufferUnderflowException;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.StandardOpenOption;
+import java.security.MessageDigest;
+import java.util.*;
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.internal.APReq;
+import sun.security.krb5.internal.rcache.AuthTime;
+
+// This test runs multiple acceptor Procs to mimin AP-REQ replays.
+public class ReplayCacheTestProc {
+
+ private static Proc[] ps;
+ private static Proc pc;
+ private static List<Req> reqs = new ArrayList<>();
+ private static String HOST = "localhost";
+
+ // Where should the rcache be saved. It seems KRB5RCACHEDIR is not
+ // recognized on Solaris. Maybe version too low? I see 1.6.
+ private static String cwd =
+ System.getProperty("os.name").startsWith("SunOS") ?
+ "/var/krb5/rcache/" :
+ System.getProperty("user.dir");
+
+
+ private static int uid;
+
+ public static void main0(String[] args) throws Exception {
+ System.setProperty("java.security.krb5.conf", OneKDC.KRB5_CONF);
+ if (args.length == 0) { // The controller
+ int ns = 5; // number of servers
+ int nu = 5; // number of users
+ int nx = 50; // number of experiments
+ int np = 5; // number of peers (services)
+ int mode = 0; // native(1), random(0), java(-1)
+ boolean random = true; // random experiments choreograph
+
+ // Do not test interop with native GSS on some platforms
+ String os = System.getProperty("os.name", "???");
+ if (!os.startsWith("SunOS") && !os.startsWith("Linux")) {
+ mode = -1;
+ }
+
+ try {
+ Class<?> clazz = Class.forName(
+ "com.sun.security.auth.module.UnixSystem");
+ uid = (int)(long)(Long)
+ clazz.getMethod("getUid").invoke(clazz.newInstance());
+ } catch (Exception e) {
+ uid = -1;
+ }
+
+ KDC kdc = KDC.create(OneKDC.REALM, HOST, 0, true);
+ for (int i=0; i<nu; i++) {
+ kdc.addPrincipal(user(i), OneKDC.PASS);
+ }
+ kdc.addPrincipalRandKey("krbtgt/" + OneKDC.REALM);
+ for (int i=0; i<np; i++) {
+ kdc.addPrincipalRandKey(peer(i));
+ }
+
+ kdc.writeKtab(OneKDC.KTAB);
+ KDC.saveConfig(OneKDC.KRB5_CONF, kdc);
+
+ pc = Proc.create("ReplayCacheTestProc").debug("C")
+ .args("client")
+ .start();
+ ps = new Proc[ns];
+ Ex[] result = new Ex[nx];
+
+ if (!random) {
+ // 2 experiments, 2 server, 1 peer, 1 user
+ nx = 2; ns = 2; np = 1; nu = 1;
+
+ // Creates reqs from user# to peer#
+ req(0, 0);
+
+ // Creates server#
+ ps[0] = ns(0);
+ ps[1] = js(1);
+
+ // Runs ex# using req# to server# with expected result
+ result[0] = round(0, 0, 0, true);
+ result[1] = round(1, 0, 1, false);
+ } else {
+ Random r = new Random();
+ for (int i=0; i<ns; i++) {
+ boolean useNative = (mode == 1) ? true
+ : (mode == -1 ? false : r.nextBoolean());
+ ps[i] = useNative?ns(i):js(i);
+ }
+ for (int i=0; i<nx; i++) {
+ result[i] = new Ex();
+ int old; // which req to send
+ boolean expected;
+ if (reqs.isEmpty() || r.nextBoolean()) {
+ Proc.d("Console get new AP-REQ");
+ old = req(r.nextInt(nu), r.nextInt(np));
+ expected = true;
+ } else {
+ Proc.d("Console resue old");
+ old = r.nextInt(reqs.size());
+ expected = false;
+ }
+ int s = r.nextInt(ns);
+ Proc.d("Console send to " + s);
+ result[i] = round(i, old, s, expected);
+ Proc.d("Console sees " + result[i].actual);
+ }
+ }
+
+ pc.println("END");
+ for (int i=0; i<ns; i++) {
+ ps[i].println("END");
+ }
+ System.out.println("Result\n======");
+ boolean finalOut = true;
+ for (int i=0; i<nx; i++) {
+ boolean out = result[i].expected==result[i].actual;
+ finalOut &= out;
+ System.out.printf("%3d: %s (%2d): u%d h%d %s %s %s %2d\n",
+ i,
+ result[i].expected?"----":" ",
+ result[i].old,
+ result[i].user, result[i].peer, result[i].server,
+ result[i].actual?"Good":"Bad ",
+ out?" ":"xxx",
+ result[i].csize);
+ }
+ if (!finalOut) throw new Exception();
+ } else if (args[0].equals("client")) {
+ while (true) {
+ String title = Proc.textIn();
+ Proc.d("Client see " + title);
+ if (title.equals("END")) break;
+ String[] cas = title.split(" ");
+ Context c = Context.fromUserPass(cas[0], OneKDC.PASS, false);
+ c.startAsClient(cas[1], GSSUtil.GSS_KRB5_MECH_OID);
+ c.x().requestCredDeleg(true);
+ byte[] token = c.take(new byte[0]);
+ Proc.d("Client AP-REQ generated");
+ Proc.binOut(token);
+ }
+ } else {
+ Proc.d("Server start");
+ Context s = Context.fromUserKtab("*", OneKDC.KTAB, true);
+ Proc.d("Server login");
+ while (true) {
+ String title = Proc.textIn();
+ Proc.d("Server " + args[0] + " sees " + title);
+ if (title.equals("END")) break;
+ s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+ byte[] token = Proc.binIn();
+ try {
+ s.take(token);
+ Proc.textOut("true");
+ Proc.d(args[0] + " Good");
+ } catch (Exception e) {
+ Proc.textOut("false");
+ Proc.d(args[0] + " Bad");
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ try {
+ main0(args);
+ } catch (Exception e) {
+ Proc.d(e);
+ throw e;
+ }
+ }
+
+ // returns the user name
+ private static String user(int p) {
+ return "USER" + p;
+ }
+ // returns the peer name
+ private static String peer(int p) {
+ return "host" + p + "/" + HOST;
+ }
+ // returns the dfl name for a host
+ private static String dfl(int p) {
+ return cwd + "host" + p + (uid == -1 ? "" : ("_"+uid));
+ }
+ // generates an ap-req and save into reqs, returns the index
+ private static int req(int user, int peer) throws Exception {
+ pc.println(user(user) + " " + peer(peer));
+ Req req = new Req(user, peer, pc.readData());
+ reqs.add(req);
+ return reqs.size() - 1;
+ }
+ // carries out a round of experiment
+ // i: ex#, old: which req, server: which server, expected: result?
+ private static Ex round(int i, int old, int server, boolean expected)
+ throws Exception {
+ ps[server].println("TEST");
+ ps[server].println(reqs.get(old).msg);
+ String reply = ps[server].readData();
+ Ex result = new Ex();
+ result.i = i;
+ result.expected = expected;
+ result.server = ps[server].debug();
+ result.actual = Boolean.valueOf(reply);
+ result.user = reqs.get(old).user;
+ result.peer = reqs.get(old).peer;
+ result.old = old;
+ result.csize = csize(result.peer);
+ result.hash = hash(reqs.get(old).msg);
+ if (new File(dfl(result.peer)).exists()) {
+ Files.copy(Paths.get(dfl(result.peer)), Paths.get(
+ String.format("%03d-USER%d-host%d-%s-%s",
+ i, result.user, result.peer, result.server,
+ result.actual)
+ + "-" + result.hash),
+ StandardCopyOption.COPY_ATTRIBUTES);
+ }
+ return result;
+ }
+ // create a native server
+ private static Proc ns(int i) throws Exception {
+ return Proc.create("ReplayCacheTestProc")
+ .args("N"+i)
+ .env("KRB5_CONFIG", OneKDC.KRB5_CONF)
+ .env("KRB5_KTNAME", OneKDC.KTAB)
+ .env("KRB5RCACHEDIR", cwd)
+ .prop("sun.security.jgss.native", "true")
+ .prop("javax.security.auth.useSubjectCredsOnly", "false")
+ .prop("sun.security.nativegss.debug", "true")
+ .debug("N"+i)
+ .start();
+ }
+ // creates a java server
+ private static Proc js(int i) throws Exception {
+ return Proc.create("ReplayCacheTestProc")
+ .debug("S"+i)
+ .args("S"+i)
+ .prop("sun.security.krb5.rcache", "dfl")
+ .prop("java.io.tmpdir", cwd)
+ .start();
+ }
+ // generates hash of authenticator inside ap-req inside initsectoken
+ private static String hash(String req) throws Exception {
+ byte[] data = Base64.getDecoder().decode(req);
+ data = Arrays.copyOfRange(data, 17, data.length);
+ byte[] hash = MessageDigest.getInstance("MD5").digest(new APReq(data).authenticator.getBytes());
+ char[] h = new char[hash.length * 2];
+ char[] hexConst = "0123456789ABCDEF".toCharArray();
+ for (int i=0; i<hash.length; i++) {
+ h[2*i] = hexConst[(hash[i]&0xff)>>4];
+ h[2*i+1] = hexConst[hash[i]&0xf];
+ }
+ return new String(h);
+ }
+ // return size of dfl file, excluding the null hash ones
+ private static int csize(int p) throws Exception {
+ try (SeekableByteChannel chan = Files.newByteChannel(
+ Paths.get(dfl(p)), StandardOpenOption.READ)) {
+ chan.position(6);
+ int cc = 0;
+ while (true) {
+ try {
+ if (AuthTime.readFrom(chan) != null) cc++;
+ } catch (BufferUnderflowException e) {
+ break;
+ }
+ }
+ return cc;
+ } catch (IOException ioe) {
+ return 0;
+ }
+ }
+ // models an experiement
+ private static class Ex {
+ int i; // #
+ boolean expected; // expected result
+ boolean actual; // actual output
+ int old; // which ap-req to send
+ String server; // which server to send to
+ String hash; // the hash of req
+ int user; // which initiator
+ int peer; // which acceptor
+ int csize; // size of rcache after test
+ }
+ // models a saved ap-req msg
+ private static class Req {
+ String msg; // based64-ed req
+ int user; // which initiator
+ int peer; // which accceptor
+ Req(int user, int peer, String msg) {
+ this.msg = msg;
+ this.user= user;
+ this.peer = peer;
+ }
+ }
+}
--- a/jdk/test/sun/security/krb5/ccache/EmptyCC.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/security/krb5/ccache/EmptyCC.java Tue Jul 02 15:23:23 2013 -0700
@@ -26,15 +26,12 @@
* @bug 7158329
* @bug 8001208
* @summary NPE in sun.security.krb5.Credentials.acquireDefaultCreds()
+ * @library ../../../../java/security/testlibrary/
* @compile -XDignore.symbol.file EmptyCC.java
* @run main EmptyCC tmpcc
* @run main EmptyCC FILE:tmpcc
*/
import java.io.File;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
import sun.security.krb5.Credentials;
import sun.security.krb5.PrincipalName;
import sun.security.krb5.internal.ccache.CredentialsCache;
@@ -48,32 +45,9 @@
// Main process, write the ccache and launch sub process
CredentialsCache cache = CredentialsCache.create(pn, ccache);
cache.save();
-
- // java -cp $test.classes EmptyCC readcc
- ProcessBuilder pb = new ProcessBuilder(
- new File(new File(System.getProperty("java.home"), "bin"),
- "java").getPath(),
- "-cp",
- System.getProperty("test.classes"),
- "EmptyCC",
- ccache,
- "readcc"
- );
-
- pb.environment().put("KRB5CCNAME", ccache);
- pb.redirectErrorStream(true);
-
- Process p = pb.start();
- try (InputStream ins = p.getInputStream()) {
- byte[] buf = new byte[8192];
- int n;
- while ((n = ins.read(buf)) > 0) {
- System.out.write(buf, 0, n);
- }
- }
- if (p.waitFor() != 0) {
- throw new Exception("Test failed");
- }
+ Proc p = Proc.create("EmptyCC").args(ccache, "readcc")
+ .env("KRB5CCNAME", ccache).start();
+ p.waitFor();
} else {
// Sub process, read the ccache
String cc = System.getenv("KRB5CCNAME");
--- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NoImpactServerRenego.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NoImpactServerRenego.java Tue Jul 02 15:23:23 2013 -0700
@@ -29,7 +29,7 @@
* @bug 7188658
* @summary Add possibility to disable client initiated renegotiation
* @run main/othervm
- * -Djdk.tls.rejectClientInitializedRenego=true NoImpactServerRenego
+ * -Djdk.tls.rejectClientInitiatedRenegotiation=true NoImpactServerRenego
*/
import java.io.*;
--- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/RejectClientRenego.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/RejectClientRenego.java Tue Jul 02 15:23:23 2013 -0700
@@ -131,7 +131,7 @@
sslOS.flush();
}
throw new Exception("Not reject client initialized renegotiation");
- } catch (SSLHandshakeException she) {
+ } catch (IOException ioe) {
System.out.println("Got the expected exception");
} finally {
sslSocket.close();
@@ -181,7 +181,7 @@
sslIS.read();
}
throw new Exception("Not reject client initialized renegotiation");
- } catch (SSLHandshakeException she) {
+ } catch (IOException ioe) {
System.out.println("Got the expected exception");
} finally {
sslSocket.close();
@@ -216,7 +216,8 @@
System.setProperty("javax.net.ssl.trustStorePassword", passwd);
// reject client initialized SSL renegotiation.
- System.setProperty("jdk.tls.rejectClientInitializedRenego", "true");
+ System.setProperty(
+ "jdk.tls.rejectClientInitiatedRenegotiation", "true");
if (debug)
System.setProperty("javax.net.debug", "all");
--- a/jdk/test/sun/text/resources/LocaleData Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/text/resources/LocaleData Tue Jul 02 15:23:23 2013 -0700
@@ -11,7 +11,7 @@
# bug #4052679
LocaleNames/fr/fr=fran\u00e7ais
-# bug #4055602, 4290801
+# bug #4055602, 4290801, 8013836
CurrencyNames/pt_BR/BRL=R$
FormatData/pt_BR/NumberPatterns/0=#,##0.###;-#,##0.###
# FormatData/pt_BR/NumberPatterns/1=R$ #,##0.##;-R$ #,##0.## # Changed; see bug 4122840
@@ -34,7 +34,7 @@
FormatData/pt_BR/DayNames/0=Domingo
FormatData/pt_BR/DayNames/1=Segunda-feira
FormatData/pt_BR/DayNames/2=Ter\u00e7a-feira
-CalendarData/pt_BR/firstDayOfWeek=2
+CalendarData/pt_BR/firstDayOfWeek=1
CalendarData/pt_BR/minimalDaysInFirstWeek=1
FormatData/pt_BR/MonthNames/0=Janeiro
FormatData/pt_BR/MonthNames/1=Fevereiro
--- a/jdk/test/sun/text/resources/LocaleDataTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -35,7 +35,7 @@
* 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787
* 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
* 7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
- * 7114053 7074882 7040556
+ * 7114053 7074882 7040556 8013836
* @summary Verify locale data
*
*/
--- a/jdk/test/sun/tools/jcmd/jcmd_Output1.awk Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/tools/jcmd/jcmd_Output1.awk Tue Jul 02 15:23:23 2013 -0700
@@ -8,10 +8,10 @@
current=1;
}
-# or match on a path name to a jar file followed by arbitraty arguments
+# or match on a path name to a jar or war file followed by arbitraty arguments
# - note, jar files ending with ".jar" is only a convention, not a requirement.
#Theoretically, any valid file name could occur here.
-/^[0-9]+ .*\.jar($| .*$)/ {
+/^[0-9]+ .*\.(jar|war)($| .*$)/ {
current=1;
}
--- a/jdk/test/sun/tools/jps/jps-l_Output1.awk Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/tools/jps/jps-l_Output1.awk Tue Jul 02 15:23:23 2013 -0700
@@ -8,10 +8,10 @@
matched++;
}
-# or match on a jar file name - note, jar files ending with
+# or match on a jar or war file name - note, jar files ending with
# ".jar" is only a convention , not a requirement. Theoretically,
# any valid file name could occur here.
-/^[0-9]+ .*\.jar$/ {
+/^[0-9]+ .*\.(jar|war)$/ {
matched++;
}
--- a/jdk/test/sun/tools/jps/jps_Output1.awk Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/sun/tools/jps/jps_Output1.awk Tue Jul 02 15:23:23 2013 -0700
@@ -8,10 +8,10 @@
matched++;
}
-# or match on a path name to a jar file - note, jar files ending with
+# or match on a path name to a jar or war file - note, jar files ending with
# ".jar" is only a convention, not a requirement. Theoretically,
# any valid file name could occur here.
-/^[0-9]+ .*\.jar$/ {
+/^[0-9]+ .*\.(jar|war)$/ {
matched++;
}
--- a/jdk/test/tools/pack200/AttributeTests.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/AttributeTests.java Tue Jul 02 15:23:23 2013 -0700
@@ -37,6 +37,7 @@
public static void main(String... args) throws Exception {
test6746111();
testMethodParameters();
+ Utils.cleanup();
}
/*
--- a/jdk/test/tools/pack200/BandIntegrity.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/BandIntegrity.java Tue Jul 02 15:23:23 2013 -0700
@@ -40,7 +40,7 @@
* the java packer and unpacker must be called in the same java instance.
*/
public class BandIntegrity {
- public static void main(String... args) throws IOException {
+ public static void main(String... args) throws IOException {
File testFile = new File("test.jar");
Utils.jar("cvf", testFile.getName(),
"-C", Utils.TEST_CLS_DIR.getAbsolutePath(),
@@ -56,6 +56,7 @@
Utils.createFile(configFile, scratch);
File outFile = new File("out.jar");
Utils.repack(testFile, outFile, true,
- "-v", "--config-file=" + configFile.getName());
+ "-v", "--config-file=" + configFile.getName());
+ Utils.cleanup();
}
}
--- a/jdk/test/tools/pack200/CommandLineTests.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/CommandLineTests.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -83,6 +83,11 @@
Utils.recursiveCopy(Utils.JavaSDK, EXP_SDK);
creatConfigFile();
}
+ // cleanup the test area
+ static void cleanup() throws IOException {
+ Utils.recursiveDelete(EXP_SDK);
+ Utils.cleanup();
+ }
// Hopefully, this should be kept in sync with what the installer does.
static void creatConfigFile() throws IOException {
@@ -172,6 +177,7 @@
init();
testJRE();
testJDK();
+ cleanup(); // cleanup only if we pass successfully
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
--- a/jdk/test/tools/pack200/InstructionTests.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/InstructionTests.java Tue Jul 02 15:23:23 2013 -0700
@@ -35,6 +35,7 @@
public class InstructionTests {
public static void main(String... args) throws Exception {
testInvokeOpCodes();
+ Utils.cleanup();
}
/*
* the following should produce invokestatic and invokespecial
--- a/jdk/test/tools/pack200/Pack200Props.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/Pack200Props.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -31,6 +31,7 @@
*/
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -45,11 +46,12 @@
public class Pack200Props {
- public static void main(String... args) {
+ public static void main(String... args) throws IOException {
verifyDefaults();
File out = new File("test" + Utils.PACK_FILE_EXT);
out.delete();
verifySegmentLimit(out);
+ Utils.cleanup();
}
static void verifySegmentLimit(File outFile) {
--- a/jdk/test/tools/pack200/Pack200Test.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/Pack200Test.java Tue Jul 02 15:23:23 2013 -0700
@@ -66,7 +66,7 @@
}
}
- private static void doPackUnpack() {
+ private static void doPackUnpack() throws IOException {
for (File in : jarList) {
JarOutputStream javaUnpackerStream = null;
JarOutputStream nativeUnpackerStream = null;
@@ -117,12 +117,13 @@
Utils.close((Closeable) jarFile);
}
}
+ Utils.cleanup(); // cleanup artifacts, if successful run
}
/**
* @param args the command line arguments
*/
- public static void main(String[] args) {
+ public static void main(String[] args) throws IOException {
// select the jars carefully, adding more jars will increase the
// testing time, especially for jprt.
jarList.add(Utils.locateJar("tools.jar"));
--- a/jdk/test/tools/pack200/PackageVersionTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/PackageVersionTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,6 +1,5 @@
-
/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -54,7 +53,7 @@
public final static int JAVA7_PACKAGE_MAJOR_VERSION = 170;
public final static int JAVA7_PACKAGE_MINOR_VERSION = 1;
- public static void main(String... args) {
+ public static void main(String... args) throws IOException {
if (!javaHome.getName().endsWith("jre")) {
throw new RuntimeException("Error: requires an SDK to run");
}
@@ -78,6 +77,7 @@
// test for resource file, ie. no class files
verifyPack("Test6.java", JAVA5_PACKAGE_MAJOR_VERSION,
JAVA5_PACKAGE_MINOR_VERSION);
+ Utils.cleanup();
}
static void verify6991164() {
--- a/jdk/test/tools/pack200/RepackTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/RepackTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -36,6 +36,7 @@
public static void main(String... args) throws Exception {
testRepack();
+ Utils.cleanup();
}
/*
--- a/jdk/test/tools/pack200/T7007157.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/T7007157.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -63,5 +63,6 @@
Utils.close(fos);
Utils.close(jarFile);
}
+ Utils.cleanup();
}
}
--- a/jdk/test/tools/pack200/TestExceptions.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/TestExceptions.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -219,12 +219,13 @@
}
}
- public static void main(String... args) {
+ public static void main(String... args) throws IOException {
init();
pack200Test1();
pack200Test2();
pack200Test3();
unpack200Test1();
+ Utils.cleanup();
}
// containers for test inputs and management
--- a/jdk/test/tools/pack200/TimeStamp.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/TimeStamp.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -149,6 +149,7 @@
Utils.close(jf1);
Utils.close(jf2);
}
+ Utils.cleanup();
if (errors > 0) {
throw new RuntimeException("FAIL:" + errors + " error(s) encounted");
}
--- a/jdk/test/tools/pack200/UnpackerMemoryTest.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/UnpackerMemoryTest.java Tue Jul 02 15:23:23 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -81,6 +81,7 @@
Utils.close(fos);
}
}
+ Utils.cleanup();
}
}
--- a/jdk/test/tools/pack200/Utils.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/Utils.java Tue Jul 02 15:23:23 2013 -0700
@@ -75,6 +75,7 @@
static final File TEST_CLS_DIR = new File(System.getProperty("test.classes"));
static final String VERIFIER_DIR_NAME = "pack200-verifier";
static final File VerifierJar = new File(VERIFIER_DIR_NAME + JAR_FILE_EXT);
+ static final File XCLASSES = new File("xclasses");
private Utils() {} // all static
@@ -95,8 +96,7 @@
}
List<File> javaFileList = findFiles(srcDir, createFilter(JAVA_FILE_EXT));
File tmpFile = File.createTempFile("javac", ".tmp");
- File classesDir = new File("xclasses");
- classesDir.mkdirs();
+ XCLASSES.mkdirs();
FileOutputStream fos = null;
PrintStream ps = null;
try {
@@ -111,14 +111,14 @@
}
compiler("-d",
- "xclasses",
+ XCLASSES.getName(),
"@" + tmpFile.getAbsolutePath());
jar("cvfe",
VerifierJar.getName(),
"sun.tools.pack.verify.Main",
"-C",
- "xclasses",
+ XCLASSES.getName(),
".");
}
@@ -175,6 +175,33 @@
};
}
+ /*
+ * clean up all the usual suspects
+ */
+ static void cleanup() throws IOException {
+ recursiveDelete(XCLASSES);
+ List<File> toDelete = new ArrayList<>();
+ toDelete.addAll(Utils.findFiles(new File("."),
+ Utils.createFilter(".out")));
+ toDelete.addAll(Utils.findFiles(new File("."),
+ Utils.createFilter(".bak")));
+ toDelete.addAll(Utils.findFiles(new File("."),
+ Utils.createFilter(".jar")));
+ toDelete.addAll(Utils.findFiles(new File("."),
+ Utils.createFilter(".pack")));
+ toDelete.addAll(Utils.findFiles(new File("."),
+ Utils.createFilter(".bnd")));
+ toDelete.addAll(Utils.findFiles(new File("."),
+ Utils.createFilter(".txt")));
+ toDelete.addAll(Utils.findFiles(new File("."),
+ Utils.createFilter(".idx")));
+ toDelete.addAll(Utils.findFiles(new File("."),
+ Utils.createFilter(".gidx")));
+ for (File f : toDelete) {
+ f.delete();
+ }
+ }
+
static final FileFilter DIR_FILTER = new FileFilter() {
public boolean accept(File pathname) {
if (pathname.isDirectory()) {
@@ -199,6 +226,9 @@
Files.createDirectories(parent);
}
Files.copy(src.toPath(), dst.toPath(), COPY_ATTRIBUTES, REPLACE_EXISTING);
+ if (dst.isDirectory() && !dst.canWrite()) {
+ dst.setWritable(true);
+ }
}
static String baseName(File file, String extension) {
--- a/jdk/test/tools/pack200/typeannos/TestTypeAnnotations.java Tue Jul 02 15:20:55 2013 -0700
+++ b/jdk/test/tools/pack200/typeannos/TestTypeAnnotations.java Tue Jul 02 15:23:23 2013 -0700
@@ -41,5 +41,6 @@
"-C", Utils.TEST_CLS_DIR.getAbsolutePath(),
".");
Utils.testWithRepack(testFile, "--unknown-attribute=error");
+ Utils.cleanup();
}
}