--- a/jdk/make/CreateSecurityJars.gmk Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/make/CreateSecurityJars.gmk Thu Dec 05 10:33:57 2013 -0800
@@ -54,7 +54,7 @@
##########################################################################################
# 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
+# targets and explicitly added to the TARGETS 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
@@ -63,7 +63,7 @@
# other way to get the jars than to build them.
SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
-SUNPKCS11_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunpkcs11.jar
+SUNPKCS11_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunpkcs11.jar
$(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes_security, \
@@ -78,19 +78,19 @@
ifndef OPENJDK
SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
$(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_SRC)
- @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..."
+ @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
else
$(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_UNSIGNED)
$(install-file)
endif
-JARS += $(SUNPKCS11_JAR_UNSIGNED) $(SUNPKCS11_JAR_DST)
+TARGETS += $(SUNPKCS11_JAR_UNSIGNED) $(SUNPKCS11_JAR_DST)
##########################################################################################
SUNEC_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunec.jar
-SUNEC_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunec.jar
+SUNEC_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunec.jar
$(eval $(call SetupArchive,BUILD_SUNEC_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes_security, \
@@ -105,19 +105,19 @@
ifndef OPENJDK
SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar
$(SUNEC_JAR_DST): $(SUNEC_JAR_SRC)
- @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
+ @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
else
$(SUNEC_JAR_DST): $(SUNEC_JAR_UNSIGNED)
$(install-file)
endif
-JARS += $(SUNEC_JAR_UNSIGNED) $(SUNEC_JAR_DST)
+TARGETS += $(SUNEC_JAR_UNSIGNED) $(SUNEC_JAR_DST)
##########################################################################################
SUNJCE_PROVIDER_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunjce_provider.jar
-SUNJCE_PROVIDER_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunjce_provider.jar
+SUNJCE_PROVIDER_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunjce_provider.jar
ifneq ($(BUILD_CRYPTO), no)
$(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR, , \
@@ -130,25 +130,25 @@
$(SUNJCE_PROVIDER_JAR_UNSIGNED): $(JCE_MANIFEST)
- JARS += $(SUNJCE_PROVIDER_JAR_UNSIGNED)
+ TARGETS += $(SUNJCE_PROVIDER_JAR_UNSIGNED)
endif
ifndef OPENJDK
SUNJCE_PROVIDER_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/sunjce_provider.jar
$(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_SRC)
- @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..."
+ @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
else
$(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_UNSIGNED)
$(install-file)
endif
-JARS += $(SUNJCE_PROVIDER_JAR_DST)
+TARGETS += $(SUNJCE_PROVIDER_JAR_DST)
##########################################################################################
JCE_JAR_DST := $(JDK_OUTPUTDIR)/lib/jce.jar
-JCE_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/jce.jar
+JCE_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/jce.jar
ifneq ($(BUILD_CRYPTO), no)
$(eval $(call SetupArchive,BUILD_JCE_JAR, , \
@@ -161,36 +161,43 @@
$(JCE_JAR_UNSIGNED): $(JCE_MANIFEST)
- JARS += $(JCE_JAR_UNSIGNED)
+ TARGETS += $(JCE_JAR_UNSIGNED)
endif
ifndef OPENJDK
JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
$(JCE_JAR_DST): $(JCE_JAR_SRC)
- @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
+ @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
else
$(JCE_JAR_DST): $(JCE_JAR_UNSIGNED)
$(install-file)
endif
-JARS += $(JCE_JAR_DST)
+TARGETS += $(JCE_JAR_DST)
##########################################################################################
US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar
-US_EXPORT_POLICY_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/US_export_policy.jar
ifneq ($(BUILD_CRYPTO), no)
+
+ US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED := \
+ $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/US_export_policy.jar
+ US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED := \
+ $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/US_export_policy.jar
+
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
# NOTE: We currently do not place restrictions on our limited export
- # policy. This was not a typo.
+ # policy. This was not a typo. This means we are shipping the same file
+ # for both limimted and unlimited US_export_policy.jar.
#
US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited
- US_EXPORT_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/US_export_policy_jar.tmp
+ US_EXPORT_POLICY_JAR_TMP := \
+ $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/US_export_policy_jar.tmp
$(US_EXPORT_POLICY_JAR_TMP)/%: $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
$(install-file)
@@ -200,77 +207,113 @@
$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, $(US_EXPORT_POLICY_JAR_DEPS), \
SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
SUFFIXES := .policy, \
- JAR := $(US_EXPORT_POLICY_JAR_UNSIGNED), \
+ JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED), \
EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
SKIP_METAINF := true))
- JARS += $(US_EXPORT_POLICY_JAR_UNSIGNED)
+ $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
+ $(ECHO) $(LOG_INFO) Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+
+ TARGETS += $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED) \
+ $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
endif
ifndef OPENJDK
+ ifeq ($(UNLIMITED_CRYPTO), true)
+ $(error No prebuilt unlimited crypto jars available)
+ endif
$(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
- $(ECHO) $(LOG_INFO) Copying $(@F)
+ $(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
else
- $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNSIGNED)
+ ifeq ($(UNLIMITED_CRYPTO), true)
+ $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
$(install-file)
+ else
+ $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED)
+ $(install-file)
+ endif
endif
-JARS += $(US_EXPORT_POLICY_JAR_DST)
+TARGETS += $(US_EXPORT_POLICY_JAR_DST)
##########################################################################################
LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
-LOCAL_POLICY_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/local_policy.jar
ifneq ($(BUILD_CRYPTO), no)
+
+ LOCAL_POLICY_JAR_LIMITED_UNSIGNED := \
+ $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/local_policy.jar
+ LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED := \
+ $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/local_policy.jar
+
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
- LOCAL_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/local_policy_jar.tmp
+ LOCAL_POLICY_JAR_LIMITED_TMP := \
+ $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/local_policy_jar.tmp
+ LOCAL_POLICY_JAR_UNLIMITED_TMP := \
+ $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/local_policy_jar.tmp
- ifeq ($(UNLIMITED_CRYPTO), true)
- LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited
- LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
- LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
- else
- LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/data/cryptopolicy/limited
- LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
- $(LOCAL_POLICY_JAR_TMP)/default_local.policy
- LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
- endif
+ $(LOCAL_POLICY_JAR_LIMITED_TMP)/%: $(JDK_TOPDIR)/make/data/cryptopolicy/limited/%
+ $(install-file)
- $(LOCAL_POLICY_JAR_TMP)/%: $(LOCAL_POLICY_JAR_SRC_DIR)/%
+ $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/%: $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited/%
$(install-file)
- $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR, $(LOCAL_POLICY_JAR_DEPS), \
- SRCS := $(LOCAL_POLICY_JAR_TMP), \
+ $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_LIMITED, \
+ $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
+ $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
+ SRCS := $(LOCAL_POLICY_JAR_LIMITED_TMP), \
SUFFIXES := .policy, \
- JAR := $(LOCAL_POLICY_JAR_UNSIGNED), \
- EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \
+ JAR := $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED), \
+ EXTRA_MANIFEST_ATTR := Crypto-Strength: limited, \
SKIP_METAINF := true))
- JARS += $(LOCAL_POLICY_JAR_UNSIGNED)
+ $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_UNLIMITED, \
+ $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
+ SRCS := $(LOCAL_POLICY_JAR_UNLIMITED_TMP), \
+ SUFFIXES := .policy, \
+ JAR := $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED), \
+ EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
+ SKIP_METAINF := true))
+
+ TARGETS += $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED) $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
+
+ ifndef OPENJDK
+ $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/README.txt: \
+ $(JDK_TOPDIR)/make/closed/javax/crypto/doc/README.txt
+ $(install-file)
+
+ TARGETS += $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/README.txt
+ endif
endif
ifndef OPENJDK
$(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
- $(ECHO) $(LOG_INFO) Copying $(@F)
+ $(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
else
- $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNSIGNED)
+ ifeq ($(UNLIMITED_CRYPTO), true)
+ $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
$(install-file)
+ else
+ $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED)
+ $(install-file)
+ endif
endif
-JARS += $(LOCAL_POLICY_JAR_DST)
+TARGETS += $(LOCAL_POLICY_JAR_DST)
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS), windows)
SUNMSCAPI_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunmscapi.jar
- SUNMSCAPI_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunmscapi.jar
+ SUNMSCAPI_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunmscapi.jar
$(eval $(call SetupArchive,BUILD_SUNMSCAPI_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes_security, \
@@ -285,14 +328,14 @@
ifndef OPENJDK
SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar
$(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_SRC)
- @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..."
+ @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
else
$(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_UNSIGNED)
$(install-file)
endif
- JARS += $(SUNMSCAPI_JAR_UNSIGNED) $(SUNMSCAPI_JAR_DST)
+ TARGETS += $(SUNMSCAPI_JAR_UNSIGNED) $(SUNMSCAPI_JAR_DST)
endif
@@ -302,7 +345,7 @@
ifndef OPENJDK
UCRYPTO_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/ucrypto.jar
- UCRYPTO_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/ucrypto.jar
+ UCRYPTO_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/ucrypto.jar
UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar
$(eval $(call SetupArchive,BUILD_UCRYPTO_JAR, , \
@@ -316,14 +359,14 @@
$(UCRYPTO_JAR_UNSIGNED): $(JCE_MANIFEST)
$(UCRYPTO_JAR_DST): $(UCRYPTO_JAR_SRC)
- @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
+ @$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
- JARS += $(UCRYPTO_JAR_UNSIGNED) $(UCRYPTO_JAR_DST)
+ TARGETS += $(UCRYPTO_JAR_UNSIGNED) $(UCRYPTO_JAR_DST)
endif
endif
-all: $(JARS)
+all: $(TARGETS)
.PHONY: default all
--- a/jdk/make/SignJars.gmk Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/make/SignJars.gmk Thu Dec 05 10:33:57 2013 -0800
@@ -80,7 +80,7 @@
exit 2; \
fi
-$(JCE_OUTPUTDIR)/%: $(JDK_OUTPUTDIR)/unsigned/%
+$(JDK_OUTPUTDIR)/jce/signed/%: $(JDK_OUTPUTDIR)/jce/unsigned/%
$(call install-file)
$(JARSIGNER) -keystore $(SIGNING_KEYSTORE) \
$@ $(SIGNING_ALIAS) < $(SIGNING_PASSPHRASE)
@@ -88,26 +88,33 @@
JAR_LIST := \
jce.jar \
- local_policy.jar \
+ policy/limited/local_policy.jar \
+ policy/limited/US_export_policy.jar \
+ policy/unlimited/local_policy.jar \
+ policy/unlimited/US_export_policy.jar \
sunec.jar \
sunjce_provider.jar \
sunpkcs11.jar \
- US_export_policy.jar \
sunmscapi.jar \
ucrypto.jar \
#
-UNSIGNED_JARS := $(wildcard $(addprefix $(JDK_OUTPUTDIR)/unsigned/, $(JAR_LIST)))
+UNSIGNED_JARS := $(wildcard $(addprefix $(JDK_OUTPUTDIR)/jce/unsigned/, $(JAR_LIST)))
ifeq ($(UNSIGNED_JARS), )
- $(error No jars found in $(JDK_OUTPUTDIR)/unsigned/)
+ $(error No jars found in $(JDK_OUTPUTDIR)/jce/unsigned/)
endif
-SIGNED_JARS := $(patsubst $(JDK_OUTPUTDIR)/unsigned/%,$(JCE_OUTPUTDIR)/%, $(UNSIGNED_JARS))
+SIGNED_JARS := $(patsubst $(JDK_OUTPUTDIR)/jce/unsigned/%,$(JDK_OUTPUTDIR)/jce/signed/%, \
+ $(UNSIGNED_JARS))
$(SIGNED_JARS): check-keystore
-all: $(SIGNED_JARS)
+$(JDK_OUTPUTDIR)/jce/signed/policy/unlimited/README.txt: \
+ $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/README.txt
+ $(install-file)
+
+all: $(SIGNED_JARS) $(JDK_OUTPUTDIR)/jce/signed/policy/unlimited/README.txt
@$(PRINTF) "\n*** The jar files built by the 'sign-jars' target are developer ***"
@$(PRINTF) "\n*** builds only and *MUST NOT* be checked into the closed workspace. ***"
@$(PRINTF) "\n*** ***"
--- a/jdk/make/data/cryptopolicy/limited/LIMITED Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Crypto-Strength: limited
--- a/jdk/make/data/cryptopolicy/unlimited/UNLIMITED Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Crypto-Strength: unlimited
--- a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Thu Dec 05 10:33:57 2013 -0800
@@ -916,8 +916,7 @@
char[] tmpPassword = ((PasswordCallback)
callbacks[0]).getPassword();
if (tmpPassword == null) {
- // treat a NULL password as an empty password
- tmpPassword = new char[0];
+ throw new LoginException("No password provided");
}
password = new char[tmpPassword.length];
System.arraycopy(tmpPassword, 0,
--- a/jdk/src/share/classes/java/applet/Applet.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/applet/Applet.java Thu Dec 05 10:33:57 2013 -0800
@@ -392,7 +392,7 @@
* Each element of the array should be a set of three
* <code>Strings</code> containing the name, the type, and a
* description. For example:
- * <p><blockquote><pre>
+ * <blockquote><pre>
* String pinfo[][] = {
* {"fps", "1-10", "frames per second"},
* {"repeat", "boolean", "repeat image loop"},
--- a/jdk/src/share/classes/java/applet/AppletContext.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/applet/AppletContext.java Thu Dec 05 10:33:57 2013 -0800
@@ -107,7 +107,7 @@
* <code>target</code> argument indicates in which HTML frame the
* document is to be displayed.
* The target argument is interpreted as follows:
- * <p>
+ *
* <center><table border="3" summary="Target arguments and their descriptions">
* <tr><th>Target Argument</th><th>Description</th></tr>
* <tr><td><code>"_self"</code> <td>Show in the window and frame that
--- a/jdk/src/share/classes/java/awt/AWTPermission.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/AWTPermission.java Thu Dec 05 10:33:57 2013 -0800
@@ -43,7 +43,6 @@
* target names, and for each provides a description of what the
* permission allows and a discussion of the risks of granting code
* the permission.
- * <P>
*
* <table border=1 cellpadding=5 summary="AWTPermission target names, descriptions, and associated risks.">
* <tr>
--- a/jdk/src/share/classes/java/awt/AlphaComposite.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/AlphaComposite.java Thu Dec 05 10:33:57 2013 -0800
@@ -175,7 +175,6 @@
* <em>F<sub>s</sub></em> and <em>F<sub>d</sub></em> and then the resulting
* premultiplied components <em>A<sub>r</sub></em> and <em>C<sub>r</sub></em>.
*
- * <p>
* <h3>Preparing Results</h3>
*
* <p>
@@ -193,7 +192,6 @@
* by zero" and the color components are left as
* all zeros.
*
- * <p>
* <h3>Performance Considerations</h3>
*
* <p>
@@ -216,7 +214,6 @@
* for their pixels. Such sources supply an alpha of 1.0 for
* all of their pixels.
*
- * <p>
* <li>
* Many destinations also have no place to store the alpha values
* that result from the blending calculations performed by this class.
@@ -227,7 +224,6 @@
* values by the resulting alpha value before storing the color
* values and discarding the alpha value.
*
- * <p>
* <li>
* The accuracy of the results depends on the manner in which pixels
* are stored in the destination.
@@ -248,7 +244,6 @@
* the need to choose a pixel from a limited palette to match the
* results of the blending equations.
*
- * <p>
* <li>
* Nearly all formats store pixels as discrete integers rather than
* the floating point values used in the reference equations above.
@@ -268,7 +263,6 @@
* represents 0.0 and 0xff represents
* 1.0.
*
- * <p>
* <li>
* The internal implementation can approximate some of the equations
* and it can also eliminate some steps to avoid unnecessary operations.
@@ -332,7 +326,6 @@
* <p>
* and thus they would all match.
*
- * <p>
* <li>
* Because of the technique of simplifying the equations for
* calculation efficiency, some implementations might perform
--- a/jdk/src/share/classes/java/awt/BasicStroke.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/BasicStroke.java Thu Dec 05 10:33:57 2013 -0800
@@ -39,7 +39,7 @@
* {@link Shape} and the decorations applied at the ends and joins of
* path segments of the <code>Shape</code>.
* These rendering attributes include:
- * <dl compact>
+ * <dl>
* <dt><i>width</i>
* <dd>The pen width, measured perpendicularly to the pen trajectory.
* <dt><i>end caps</i>
--- a/jdk/src/share/classes/java/awt/BorderLayout.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/BorderLayout.java Thu Dec 05 10:33:57 2013 -0800
@@ -99,7 +99,7 @@
* style="float:center; margin: 7px 10px;">
* <p>
* The code for this applet is as follows:
- * <p>
+ *
* <hr><blockquote><pre>
* import java.awt.*;
* import java.applet.Applet;
--- a/jdk/src/share/classes/java/awt/Button.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Button.java Thu Dec 05 10:33:57 2013 -0800
@@ -388,7 +388,7 @@
* This method is not called unless action events are
* enabled for this button. Action events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>ActionListener</code> object is registered
* via <code>addActionListener</code>.
* <li>Action events are enabled via <code>enableEvents</code>.
--- a/jdk/src/share/classes/java/awt/Checkbox.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Checkbox.java Thu Dec 05 10:33:57 2013 -0800
@@ -41,7 +41,7 @@
* <p>
* The following code example creates a set of check boxes in
* a grid layout:
- * <p>
+ *
* <hr><blockquote><pre>
* setLayout(new GridLayout(3, 1));
* add(new Checkbox("one", null, true));
@@ -558,7 +558,7 @@
* This method is not called unless item events are
* enabled for this component. Item events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>ItemListener</code> object is registered
* via <code>addItemListener</code>.
* <li>Item events are enabled via <code>enableEvents</code>.
--- a/jdk/src/share/classes/java/awt/CheckboxGroup.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/CheckboxGroup.java Thu Dec 05 10:33:57 2013 -0800
@@ -35,7 +35,7 @@
* <p>
* The following code example produces a new check box group,
* with three check boxes:
- * <p>
+ *
* <hr><blockquote><pre>
* setLayout(new GridLayout(3, 1));
* CheckboxGroup cbg = new CheckboxGroup();
--- a/jdk/src/share/classes/java/awt/CheckboxMenuItem.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/CheckboxMenuItem.java Thu Dec 05 10:33:57 2013 -0800
@@ -367,7 +367,7 @@
* This method is not called unless item events are
* enabled for this menu item. Item events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>ItemListener</code> object is registered
* via <code>addItemListener</code>.
* <li>Item events are enabled via <code>enableEvents</code>.
--- a/jdk/src/share/classes/java/awt/Choice.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Choice.java Thu Dec 05 10:33:57 2013 -0800
@@ -40,7 +40,7 @@
* The current choice is displayed as the title of the menu.
* <p>
* The following code example produces a pop-up menu:
- * <p>
+ *
* <hr><blockquote><pre>
* Choice ColorChooser = new Choice();
* ColorChooser.add("Green");
@@ -609,7 +609,7 @@
* This method is not called unless item events are
* enabled for this component. Item events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>ItemListener</code> object is registered
* via <code>addItemListener</code>.
* <li>Item events are enabled via <code>enableEvents</code>.
--- a/jdk/src/share/classes/java/awt/Component.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Component.java Thu Dec 05 10:33:57 2013 -0800
@@ -106,7 +106,7 @@
* adding/removing components to/from containers, the whole hierarchy must be
* validated afterwards by means of the {@link Container#validate()} method
* invoked on the top-most invalid container of the hierarchy.
- * <p>
+ *
* <h3>Serialization</h3>
* It is important to note that only AWT listeners which conform
* to the <code>Serializable</code> protocol will be saved when
@@ -3859,7 +3859,7 @@
* This is a proxy capabilities class used when a FlipBufferStrategy
* is created instead of the requested Blit strategy.
*
- * @see sun.awt.SunGraphicsEnvironment#isFlipStrategyPreferred(ComponentPeer)
+ * @see sun.java2d.SunGraphicsEnvironment#isFlipStrategyPreferred(ComponentPeer)
*/
private class ProxyCapabilities extends ExtendedBufferCapabilities {
private BufferCapabilities orig;
@@ -4515,7 +4515,7 @@
* Private class to perform sub-region blitting. Swing will use
* this subclass via the SubRegionShowable interface in order to
* copy only the area changed during a repaint.
- * @see javax.swing.BufferStrategyPaintManager
+ * See javax.swing.BufferStrategyPaintManager.
*/
private class BltSubRegionBufferStrategy extends BltBufferStrategy
implements SubRegionShowable
@@ -6328,7 +6328,7 @@
* This method is not called unless component events are
* enabled for this component. Component events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>A <code>ComponentListener</code> object is registered
* via <code>addComponentListener</code>.
* <li>Component events are enabled via <code>enableEvents</code>.
@@ -6373,7 +6373,7 @@
* This method is not called unless focus events are
* enabled for this component. Focus events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>A <code>FocusListener</code> object is registered
* via <code>addFocusListener</code>.
* <li>Focus events are enabled via <code>enableEvents</code>.
@@ -6393,7 +6393,7 @@
* with a <code>FocusEvent</code> as the argument will result in a
* call to the <code>Component</code>'s <code>processFocusEvent</code>
* method regardless of the current <code>KeyboardFocusManager</code>.
- * <p>
+ *
* <p>Note that if the event parameter is <code>null</code>
* the behavior is unspecified and may result in an
* exception.
@@ -6430,7 +6430,7 @@
* This method is not called unless key events are
* enabled for this component. Key events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>A <code>KeyListener</code> object is registered
* via <code>addKeyListener</code>.
* <li>Key events are enabled via <code>enableEvents</code>.
@@ -6499,7 +6499,7 @@
* This method is not called unless mouse events are
* enabled for this component. Mouse events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>A <code>MouseListener</code> object is registered
* via <code>addMouseListener</code>.
* <li>Mouse events are enabled via <code>enableEvents</code>.
@@ -6547,7 +6547,7 @@
* This method is not called unless mouse motion events are
* enabled for this component. Mouse motion events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>A <code>MouseMotionListener</code> object is registered
* via <code>addMouseMotionListener</code>.
* <li>Mouse motion events are enabled via <code>enableEvents</code>.
@@ -6586,7 +6586,7 @@
* This method is not called unless mouse wheel events are
* enabled for this component. Mouse wheel events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>A <code>MouseWheelListener</code> object is registered
* via <code>addMouseWheelListener</code>.
* <li>Mouse wheel events are enabled via <code>enableEvents</code>.
@@ -6630,7 +6630,7 @@
* This method is not called unless input method events
* are enabled for this component. Input method events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>InputMethodListener</code> object is registered
* via <code>addInputMethodListener</code>.
* <li>Input method events are enabled via <code>enableEvents</code>.
@@ -6669,7 +6669,7 @@
* This method is not called unless hierarchy events
* are enabled for this component. Hierarchy events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>HierarchyListener</code> object is registered
* via <code>addHierarchyListener</code>.
* <li>Hierarchy events are enabled via <code>enableEvents</code>.
@@ -6705,7 +6705,7 @@
* This method is not called unless hierarchy bounds events
* are enabled for this component. Hierarchy bounds events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>HierarchyBoundsListener</code> object is registered
* via <code>addHierarchyBoundsListener</code>.
* <li>Hierarchy bounds events are enabled via <code>enableEvents</code>.
--- a/jdk/src/share/classes/java/awt/Container.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Container.java Thu Dec 05 10:33:57 2013 -0800
@@ -185,7 +185,7 @@
* the method can return the Container on which it is originally called
* in case if none of its children are the current mouse event targets.
*
- * @see #getMouseEventTarget(int, int, boolean, boolean, boolean)
+ * @see #getMouseEventTarget(int, int, boolean)
*/
static final boolean INCLUDE_SELF = true;
@@ -194,7 +194,7 @@
* of <code>getMouseEventTarget</code>. It is used to specify whether
* the method should search only lightweight components.
*
- * @see #getMouseEventTarget(int, int, boolean, boolean, boolean)
+ * @see #getMouseEventTarget(int, int, boolean)
*/
static final boolean SEARCH_HEAVYWEIGHTS = true;
@@ -1036,7 +1036,7 @@
* every add request to a container as all other add methods defer
* to this one. An overriding method should
* usually include a call to the superclass's version of the method:
- * <p>
+ *
* <blockquote>
* <code>super.addImpl(comp, constraints, index)</code>
* </blockquote>
--- a/jdk/src/share/classes/java/awt/EventFilter.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/EventFilter.java Thu Dec 05 10:33:57 2013 -0800
@@ -28,20 +28,20 @@
/**
* Enumeration for possible values for <code>acceptEvent(AWTEvent ev)</code> method.
- * @see EventDispatchThread#pumpEventsForFilters(EventFilter)
+ * @see EventDispatchThread#pumpEventsForFilter
*/
static enum FilterAction {
/**
* ACCEPT means that this filter do not filter the event and allowes other
* active filters to proceed it. If all the active filters accept the event, it
* is dispatched by the <code>EventDispatchThread</code>
- * @see EventDispatchThread#pumpEventsForFilters(EventFilter)
+ * @see EventDispatchThread#pumpEventsForFilter
*/
ACCEPT,
/**
* REJECT means that this filter filter the event. No other filters are queried,
* and the event is not dispatched by the <code>EventDispatchedThread</code>
- * @see EventDispatchThread#pumpEventsForFilters(EventFilter)
+ * @see EventDispatchThread#pumpEventsForFilter
*/
REJECT,
/**
@@ -51,7 +51,7 @@
* It is not recommended to use ACCEPT_IMMEDIATELY as there may be some active
* filters not queried yet that do not accept this event. It is primarily used
* by modal filters.
- * @see EventDispatchThread#pumpEventsForFilters(EventFilter)
+ * @see EventDispatchThread#pumpEventsForFilter
* @see ModalEventFilter
*/
ACCEPT_IMMEDIATELY
--- a/jdk/src/share/classes/java/awt/EventQueue.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/EventQueue.java Thu Dec 05 10:33:57 2013 -0800
@@ -652,7 +652,7 @@
* Dispatches an event. The manner in which the event is
* dispatched depends upon the type of the event and the
* type of the event's source object:
- * <p>
+ *
* <table border=1 summary="Event types, source types, and dispatch methods">
* <tr>
* <th>Event Type</th>
--- a/jdk/src/share/classes/java/awt/FileDialog.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/FileDialog.java Thu Dec 05 10:33:57 2013 -0800
@@ -439,7 +439,6 @@
* Note that the method is private and it's intended to be used
* by the peers through the AWTAccessor API.
*
- * @param directory the current directory
* @param files the array that contains the short names of
* all the files that the user selects.
*
--- a/jdk/src/share/classes/java/awt/FlowLayout.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/FlowLayout.java Thu Dec 05 10:33:57 2013 -0800
@@ -57,7 +57,7 @@
* style="float:center; margin: 7px 10px;">
* <p>
* Here is the code for this applet:
- * <p>
+ *
* <hr><blockquote><pre>
* import java.awt.*;
* import java.applet.Applet;
@@ -129,9 +129,9 @@
* how each row distributes empty space.
* It can be one of the following values:
* <ul>
- * <code>LEFT</code>
- * <code>RIGHT</code>
- * <code>CENTER</code>
+ * <li><code>LEFT</code>
+ * <li><code>RIGHT</code>
+ * <li><code>CENTER</code>
* </ul>
*
* @serial
@@ -146,11 +146,11 @@
* v1.2 and greater.
* It can be one of the following three values:
* <ul>
- * <code>LEFT</code>
- * <code>RIGHT</code>
- * <code>CENTER</code>
- * <code>LEADING</code>
- * <code>TRAILING</code>
+ * <li><code>LEFT</code>
+ * <li><code>RIGHT</code>
+ * <li><code>CENTER</code>
+ * <li><code>LEADING</code>
+ * <li><code>TRAILING</code>
* </ul>
*
* @serial
--- a/jdk/src/share/classes/java/awt/Font.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Font.java Thu Dec 05 10:33:57 2013 -0800
@@ -75,13 +75,13 @@
*
* A <em>character</em> is a symbol that represents an item such as a letter,
* a digit, or punctuation in an abstract way. For example, <code>'g'</code>,
- * <font size=-1>LATIN SMALL LETTER G</font>, is a character.
+ * LATIN SMALL LETTER G, is a character.
* <p>
* A <em>glyph</em> is a shape used to render a character or a sequence of
* characters. In simple writing systems, such as Latin, typically one glyph
* represents one character. In general, however, characters and glyphs do not
* have one-to-one correspondence. For example, the character 'á'
- * <font size=-1>LATIN SMALL LETTER A WITH ACUTE</font>, can be represented by
+ * LATIN SMALL LETTER A WITH ACUTE, can be represented by
* two glyphs: one for 'a' and one for '´'. On the other hand, the
* two-character string "fi" can be represented by a single glyph, an
* "fi" ligature. In complex writing systems, such as Arabic or the South
@@ -93,7 +93,7 @@
* of characters as well as the tables needed to map sequences of characters to
* corresponding sequences of glyphs.
*
- * <h4>Physical and Logical Fonts</h4>
+ * <h3>Physical and Logical Fonts</h3>
*
* The Java Platform distinguishes between two kinds of fonts:
* <em>physical</em> fonts and <em>logical</em> fonts.
@@ -130,7 +130,7 @@
* <a href="http://www.oracle.com/technetwork/java/javase/tech/faq-jsp-138165.html">Internationalization FAQ</a>
* document.
*
- * <h4>Font Faces and Names</h4>
+ * <h3>Font Faces and Names</h3>
*
* A <code>Font</code>
* can have many faces, such as heavy, medium, oblique, gothic and
@@ -160,7 +160,7 @@
* with varying sizes, styles, transforms and font features via the
* <code>deriveFont</code> methods in this class.
*
- * <h4>Font and TextAttribute</h4>
+ * <h3>Font and TextAttribute</h3>
*
* <p><code>Font</code> supports most
* <code>TextAttribute</code>s. This makes some operations, such as
@@ -197,7 +197,7 @@
* avoid this problem. Clients who use input method highlights can
* convert these to the platform-specific attributes for that
* highlight on the current platform and set them on the Font as
- * a workaround.</p>
+ * a workaround.
*
* <p>The <code>Map</code>-based constructor and
* <code>deriveFont</code> APIs ignore the FONT attribute, and it is
@@ -1419,7 +1419,7 @@
* To ensure that this method returns the desired Font,
* format the <code>str</code> parameter in
* one of these ways
- * <p>
+ *
* <ul>
* <li><em>fontname-style-pointsize</em>
* <li><em>fontname-pointsize</em>
--- a/jdk/src/share/classes/java/awt/Graphics.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Graphics.java Thu Dec 05 10:33:57 2013 -0800
@@ -39,7 +39,7 @@
* A <code>Graphics</code> object encapsulates state information needed
* for the basic rendering operations that Java supports. This
* state information includes the following properties:
- * <p>
+ *
* <ul>
* <li>The <code>Component</code> object on which to draw.
* <li>A translation origin for rendering and clipping coordinates.
@@ -63,7 +63,7 @@
* <p>
* The graphics pen hangs down and to the right from the path it traverses.
* This has the following implications:
- * <p><ul>
+ * <ul>
* <li>If you draw a figure that covers a given rectangle, that
* figure occupies one extra row of pixels on the right and bottom edges
* as compared to filling a figure that is bounded by that same rectangle.
@@ -136,7 +136,7 @@
* interpreted in the coordinate system of the original
* <code>Graphics</code> object. The new graphics context is
* identical to the original, except in two respects:
- * <p>
+ *
* <ul>
* <li>
* The new graphics context is translated by (<i>x</i>, <i>y</i>).
--- a/jdk/src/share/classes/java/awt/GridBagConstraints.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/GridBagConstraints.java Thu Dec 05 10:33:57 2013 -0800
@@ -457,7 +457,7 @@
* resize the component, and if so, how.
* <p>
* The following values are valid for <code>fill</code>:
- * <p>
+ *
* <ul>
* <li>
* <code>NONE</code>: Do not resize the component.
--- a/jdk/src/share/classes/java/awt/GridBagLayout.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/GridBagLayout.java Thu Dec 05 10:33:57 2013 -0800
@@ -55,7 +55,7 @@
* of the <code>GridBagConstraints</code> objects that are associated
* with its components. You customize a <code>GridBagConstraints</code>
* object by setting one or more of its instance variables:
- * <p>
+ *
* <dl>
* <dt>{@link GridBagConstraints#gridx},
* {@link GridBagConstraints#gridy}
@@ -121,7 +121,7 @@
* <code>ComponentOrientation</code> property while absolute values
* are not. Baseline relative values are calculated relative to the
* baseline. Valid values are:
- * <p>
+ *
* <center><table BORDER=0 WIDTH=800
* SUMMARY="absolute, relative and baseline values as described above">
* <tr>
@@ -251,7 +251,7 @@
* managed by a grid bag layout. Figure 2 shows the layout for a horizontal,
* left-to-right container and Figure 3 shows the layout for a horizontal,
* right-to-left container.
- * <p>
+ *
* <center><table WIDTH=600 summary="layout">
* <tr ALIGN=CENTER>
* <td>
@@ -270,7 +270,7 @@
* of its associated <code>GridBagConstraints</code> object
* set to <code>GridBagConstraints.BOTH</code>.
* In addition, the components have the following non-default constraints:
- * <p>
+ *
* <ul>
* <li>Button1, Button2, Button3: <code>weightx = 1.0</code>
* <li>Button4: <code>weightx = 1.0</code>,
@@ -285,7 +285,7 @@
* </ul>
* <p>
* Here is the code that implements the example shown above:
- * <p>
+ *
* <hr><blockquote><pre>
* import java.awt.*;
* import java.util.*;
--- a/jdk/src/share/classes/java/awt/GridLayout.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/GridLayout.java Thu Dec 05 10:33:57 2013 -0800
@@ -32,7 +32,7 @@
* and one component is placed in each rectangle.
* For example, the following is an applet that lays out six buttons
* into three rows and two columns:
- * <p>
+ *
* <hr><blockquote>
* <pre>
* import java.awt.*;
@@ -54,7 +54,7 @@
* and left-to-right, the above example produces the output shown in Figure 1.
* If the container's <code>ComponentOrientation</code> property is horizontal
* and right-to-left, the example produces the output shown in Figure 2.
- * <p>
+ *
* <table style="float:center" WIDTH=600 summary="layout">
* <tr ALIGN=CENTER>
* <td><img SRC="doc-files/GridLayout-1.gif"
--- a/jdk/src/share/classes/java/awt/Label.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Label.java Thu Dec 05 10:33:57 2013 -0800
@@ -36,7 +36,7 @@
* directly.
* <p>
* For example, the code . . .
- * <p>
+ *
* <hr><blockquote><pre>
* setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
* add(new Label("Hi There!"));
--- a/jdk/src/share/classes/java/awt/LinearGradientPaint.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/LinearGradientPaint.java Thu Dec 05 10:33:57 2013 -0800
@@ -75,7 +75,6 @@
* <p>
* The following code demonstrates typical usage of
* {@code LinearGradientPaint}:
- * <p>
* <pre>
* Point2D start = new Point2D.Float(0, 0);
* Point2D end = new Point2D.Float(50, 50);
@@ -92,7 +91,6 @@
* <p>
* This image demonstrates the example code above for each
* of the three cycle methods:
- * <p>
* <center>
* <img src = "doc-files/LinearGradientPaint.png"
* alt="image showing the output of the example code">
--- a/jdk/src/share/classes/java/awt/LinearGradientPaintContext.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/LinearGradientPaintContext.java Thu Dec 05 10:33:57 2013 -0800
@@ -66,8 +66,8 @@
* concatenated with this)
* @param hints the hints that the context object uses to choose
* between rendering alternatives
- * @param dStart gradient start point, in user space
- * @param dEnd gradient end point, in user space
+ * @param start gradient start point, in user space
+ * @param end gradient end point, in user space
* @param fractions the fractions specifying the gradient distribution
* @param colors the gradient colors
* @param cycleMethod either NO_CYCLE, REFLECT, or REPEAT
--- a/jdk/src/share/classes/java/awt/List.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/List.java Thu Dec 05 10:33:57 2013 -0800
@@ -41,7 +41,7 @@
* the user can choose either one item or multiple items.
* <p>
* For example, the code . . .
- * <p>
+ *
* <hr><blockquote><pre>
* List lst = new List(4, false);
* lst.add("Mercury");
@@ -1082,7 +1082,7 @@
* This method is not called unless item events are
* enabled for this component. Item events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>ItemListener</code> object is registered
* via <code>addItemListener</code>.
* <li>Item events are enabled via <code>enableEvents</code>.
@@ -1113,7 +1113,7 @@
* This method is not called unless action events are
* enabled for this component. Action events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>ActionListener</code> object is registered
* via <code>addActionListener</code>.
* <li>Action events are enabled via <code>enableEvents</code>.
--- a/jdk/src/share/classes/java/awt/MenuItem.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/MenuItem.java Thu Dec 05 10:33:57 2013 -0800
@@ -648,7 +648,7 @@
* This method is not called unless action events are
* enabled for this component. Action events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>ActionListener</code> object is registered
* via <code>addActionListener</code>.
* <li>Action events are enabled via <code>enableEvents</code>.
--- a/jdk/src/share/classes/java/awt/RadialGradientPaint.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/RadialGradientPaint.java Thu Dec 05 10:33:57 2013 -0800
@@ -104,7 +104,6 @@
* The following code demonstrates typical usage of
* {@code RadialGradientPaint}, where the center and focus points are
* the same:
- * <p>
* <pre>
* Point2D center = new Point2D.Float(50, 50);
* float radius = 25;
@@ -117,7 +116,6 @@
* <p>
* This image demonstrates the example code above, with default
* (centered) focus for each of the three cycle methods:
- * <p>
* <center>
* <img src = "doc-files/RadialGradientPaint-1.png" alt="image showing the
* output of the sameple code">
@@ -126,7 +124,6 @@
* <p>
* It is also possible to specify a non-centered focus point, as
* in the following code:
- * <p>
* <pre>
* Point2D center = new Point2D.Float(50, 50);
* float radius = 25;
@@ -142,7 +139,6 @@
* <p>
* This image demonstrates the previous example code, with non-centered
* focus for each of the three cycle methods:
- * <p>
* <center>
* <img src = "doc-files/RadialGradientPaint-2.png" alt="image showing the
* output of the sample code">
--- a/jdk/src/share/classes/java/awt/Scrollbar.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Scrollbar.java Thu Dec 05 10:33:57 2013 -0800
@@ -46,7 +46,7 @@
* <p>
* Each scroll bar in this example could be created with
* code similar to the following:
- * <p>
+ *
* <hr><blockquote><pre>
* redSlider=new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, 255);
* add(redSlider);
@@ -65,7 +65,7 @@
* The value range represented by the bubble in this example
* is the <em>visible amount</em>. The horizontal scroll bar
* in this example could be created with code like the following:
- * <p>
+ *
* <hr><blockquote><pre>
* ranger = new Scrollbar(Scrollbar.HORIZONTAL, 0, 60, 0, 300);
* add(ranger);
@@ -103,7 +103,7 @@
* <p>
* The <code>AdjustmentEvent</code> class defines five types
* of adjustment event, listed here:
- * <p>
+ *
* <ul>
* <li><code>AdjustmentEvent.TRACK</code> is sent out when the
* user drags the scroll bar's bubble.
@@ -136,7 +136,7 @@
* that are associated with scroll bars in previous platform versions.
* The following list gives the adjustment event type,
* and the corresponding JDK 1.0 event type it replaces.
- * <p>
+ *
* <ul>
* <li><code>AdjustmentEvent.TRACK</code> replaces
* <code>Event.SCROLL_ABSOLUTE</code>
@@ -295,7 +295,7 @@
* Constructs a new vertical scroll bar.
* The default properties of the scroll bar are listed in
* the following table:
- * <p>
+ *
* <table border=1 summary="Scrollbar default properties">
* <tr>
* <th>Property</th>
@@ -1104,11 +1104,11 @@
* This method is not called unless adjustment events are
* enabled for this component. Adjustment events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>AdjustmentListener</code> object is registered
* via <code>addAdjustmentListener</code>.
* <li>Adjustment events are enabled via <code>enableEvents</code>.
- * </ul><p>
+ * </ul>
* <p>Note that if the event parameter is <code>null</code>
* the behavior is unspecified and may result in an
* exception.
--- a/jdk/src/share/classes/java/awt/SystemColor.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/SystemColor.java Thu Dec 05 10:33:57 2013 -0800
@@ -463,7 +463,7 @@
}
/**
- * Called from <init> & toolkit to update the above systemColors cache.
+ * Called from {@code <init>} and toolkit to update the above systemColors cache.
*/
private static void updateSystemColors() {
if (!GraphicsEnvironment.isHeadless()) {
--- a/jdk/src/share/classes/java/awt/SystemTray.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/SystemTray.java Thu Dec 05 10:33:57 2013 -0800
@@ -361,7 +361,7 @@
/**
* Adds a {@code PropertyChangeListener} to the list of listeners for the
* specific property. The following properties are currently supported:
- * <p>
+ *
* <table border=1 summary="SystemTray properties">
* <tr>
* <th>Property</th>
--- a/jdk/src/share/classes/java/awt/TextArea.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/TextArea.java Thu Dec 05 10:33:57 2013 -0800
@@ -45,7 +45,7 @@
* style="float:center; margin: 7px 10px;">
* <p>
* This text area could be created by the following line of code:
- * <p>
+ *
* <hr><blockquote><pre>
* new TextArea("Hello", 5, 40);
* </pre></blockquote><hr>
--- a/jdk/src/share/classes/java/awt/TextField.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/TextField.java Thu Dec 05 10:33:57 2013 -0800
@@ -45,7 +45,7 @@
* style="float:center; margin: 7px 10px;">
* <p>
* Here is the code that produces these four text fields:
- * <p>
+ *
* <hr><blockquote><pre>
* TextField tf1, tf2, tf3, tf4;
* // a blank text field
@@ -596,7 +596,7 @@
* This method is not called unless action events are
* enabled for this component. Action events are enabled
* when one of the following occurs:
- * <p><ul>
+ * <ul>
* <li>An <code>ActionListener</code> object is registered
* via <code>addActionListener</code>.
* <li>Action events are enabled via <code>enableEvents</code>.
--- a/jdk/src/share/classes/java/awt/Toolkit.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Toolkit.java Thu Dec 05 10:33:57 2013 -0800
@@ -80,19 +80,19 @@
* <br>For example, calling <code>ScrollPane.setScrollPosition</code>
* and then <code>getScrollPosition</code> may return an incorrect
* value if the original request has not yet been processed.
- * <p>
+ *
* <li>Moving the focus from one component to another.
* <br>For more information, see
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/misc/focus.html#transferTiming">Timing
* Focus Transfers</a>, a section in
* <a href="http://java.sun.com/docs/books/tutorial/uiswing/">The Swing
* Tutorial</a>.
- * <p>
+ *
* <li>Making a top-level container visible.
* <br>Calling <code>setVisible(true)</code> on a <code>Window</code>,
* <code>Frame</code> or <code>Dialog</code> may occur
* asynchronously.
- * <p>
+ *
* <li>Setting the size or location of a top-level container.
* <br>Calls to <code>setSize</code>, <code>setBounds</code> or
* <code>setLocation</code> on a <code>Window</code>,
--- a/jdk/src/share/classes/java/awt/WaitDispatchSupport.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/WaitDispatchSupport.java Thu Dec 05 10:33:57 2013 -0800
@@ -91,7 +91,7 @@
*
* @param dispatchThread An event dispatch thread that
* should not stop dispatching events while waiting
- * @param extCondition A conditional object used to determine
+ * @param extCond A conditional object used to determine
* if the loop should be terminated
*
* @since 1.7
@@ -161,7 +161,7 @@
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
@Override
public boolean enter() {
@@ -281,7 +281,7 @@
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
public boolean exit() {
if (log.isLoggable(PlatformLogger.Level.FINE)) {
--- a/jdk/src/share/classes/java/awt/Window.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Window.java Thu Dec 05 10:33:57 2013 -0800
@@ -212,7 +212,7 @@
*
* @serial
* @see #getIconImages
- * @see #setIconImages(List<? extends Image>)
+ * @see #setIconImages
*/
transient java.util.List<Image> icons;
--- a/jdk/src/share/classes/java/awt/color/CMMException.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/color/CMMException.java Thu Dec 05 10:33:57 2013 -0800
@@ -27,7 +27,8 @@
*
*/
-/**********************************************************************
+/*
+ **********************************************************************
**********************************************************************
**********************************************************************
*** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
--- a/jdk/src/share/classes/java/awt/color/ColorSpace.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/color/ColorSpace.java Thu Dec 05 10:33:57 2013 -0800
@@ -23,7 +23,8 @@
* questions.
*/
-/**********************************************************************
+/*
+ **********************************************************************
**********************************************************************
**********************************************************************
*** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
@@ -91,7 +92,6 @@
</pre>
*
- * <p>
* @see ICC_ColorSpace
*/
--- a/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java Thu Dec 05 10:33:57 2013 -0800
@@ -23,7 +23,8 @@
* questions.
*/
-/**********************************************************************
+/*
+ **********************************************************************
**********************************************************************
**********************************************************************
*** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
@@ -77,7 +78,6 @@
* imported images with a known color space. At most, such applets
* would need to get one of the default color spaces via
* ColorSpace.getInstance().
- * <p>
* @see ColorSpace
* @see ICC_Profile
*/
@@ -481,7 +481,6 @@
* be the same as the media white point tag XYZ value in the ICC
* profile for an sRGB device.
* <p>
- * <p>
* @param colorvalue a float array with length of at least 3.
* @return a float array with length equal to the number of
* components in this ColorSpace.
--- a/jdk/src/share/classes/java/awt/color/ICC_Profile.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/color/ICC_Profile.java Thu Dec 05 10:33:57 2013 -0800
@@ -23,7 +23,8 @@
* questions.
*/
-/**********************************************************************
+/*
+ **********************************************************************
**********************************************************************
**********************************************************************
*** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
@@ -86,7 +87,6 @@
* ICC Profile Format Specification. Most profiles of interest
* either have invertible transformations or explicitly specify
* transformations going both directions.
- * <p>
* @see ICC_ColorSpace
*/
--- a/jdk/src/share/classes/java/awt/color/ICC_ProfileGray.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/color/ICC_ProfileGray.java Thu Dec 05 10:33:57 2013 -0800
@@ -23,7 +23,8 @@
* questions.
*/
-/**********************************************************************
+/*
+ **********************************************************************
**********************************************************************
**********************************************************************
*** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
@@ -63,7 +64,6 @@
</pre>
* The inverse transform is done by converting the PCS Y components to
* device Gray via the inverse of the grayTRC.
- * <p>
*/
--- a/jdk/src/share/classes/java/awt/color/ICC_ProfileRGB.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/color/ICC_ProfileRGB.java Thu Dec 05 10:33:57 2013 -0800
@@ -23,7 +23,8 @@
* questions.
*/
-/**********************************************************************
+/*
+ **********************************************************************
**********************************************************************
**********************************************************************
*** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
@@ -82,7 +83,6 @@
* The inverse transform is performed by converting PCS XYZ components to linear
* RGB components through the inverse of the above 3x3 matrix, and then converting
* linear RGB to device RGB through inverses of the TRCs.
- * <p>
*/
@@ -111,7 +111,7 @@
/**
* Constructs an new <code>ICC_ProfileRGB</code> from a CMM ID.
*
- * @param ID The CMM ID for the profile.
+ * @param p The CMM ID for the profile.
*
*/
ICC_ProfileRGB(Profile p) {
--- a/jdk/src/share/classes/java/awt/dnd/DnDEventMulticaster.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/dnd/DnDEventMulticaster.java Thu Dec 05 10:33:57 2013 -0800
@@ -71,7 +71,7 @@
* Handles the <code>DragSourceDragEvent</code> by invoking
* <code>dragOver</code> on listener-a and listener-b.
*
- * @param e the <code>DragSourceDragEvent</code>
+ * @param dsde the <code>DragSourceDragEvent</code>
*/
public void dragOver(DragSourceDragEvent dsde) {
((DragSourceListener)a).dragOver(dsde);
--- a/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java Thu Dec 05 10:33:57 2013 -0800
@@ -37,7 +37,6 @@
* to provide appropriate feedback to the end user
* when the operation completes.
* <P>
- * <P>
* @since 1.2
*/
--- a/jdk/src/share/classes/java/awt/dnd/DropTarget.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/dnd/DropTarget.java Thu Dec 05 10:33:57 2013 -0800
@@ -197,7 +197,7 @@
* <P>
* The Component will receive drops only if it is enabled.
* @param c The new <code>Component</code> this <code>DropTarget</code>
- * is to be associated with.<P>
+ * is to be associated with.
*/
public synchronized void setComponent(Component c) {
@@ -246,7 +246,6 @@
* Sets the default acceptable actions for this <code>DropTarget</code>
* <P>
* @param ops the default actions
- * <P>
* @see java.awt.dnd.DnDConstants
*/
--- a/jdk/src/share/classes/java/awt/event/MouseAdapter.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/event/MouseAdapter.java Thu Dec 05 10:33:57 2013 -0800
@@ -49,7 +49,7 @@
* methods.
* The relevant method in the listener object is invoked and the {@code MouseEvent}
* or {@code MouseWheelEvent} is passed to it in following cases:
- * <p><ul>
+ * <ul>
* <li>when a mouse button is pressed, released, or clicked (pressed and released)
* <li>when the mouse cursor enters or exits the component
* <li>when the mouse wheel rotated, or mouse moved or dragged
--- a/jdk/src/share/classes/java/awt/font/FontRenderContext.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/font/FontRenderContext.java Thu Dec 05 10:33:57 2013 -0800
@@ -57,7 +57,6 @@
* <code>FontRenderContext</code> which is directly constructed will
* most likely not represent any actual graphics device, and may lead
* to unexpected or incorrect results.
-* <p>
* @see java.awt.RenderingHints#KEY_TEXT_ANTIALIASING
* @see java.awt.RenderingHints#KEY_FRACTIONALMETRICS
* @see java.awt.Graphics2D#getFontRenderContext()
--- a/jdk/src/share/classes/java/awt/font/StyledParagraph.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/font/StyledParagraph.java Thu Dec 05 10:33:57 2013 -0800
@@ -322,7 +322,7 @@
}
/**
- * Return i such that starts[i] <= index < starts[i+1]. starts
+ * Return i such that starts[i] <= index < starts[i+1]. starts
* must be in increasing order, with at least one element greater
* than index.
*/
--- a/jdk/src/share/classes/java/awt/geom/AffineTransform.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/geom/AffineTransform.java Thu Dec 05 10:33:57 2013 -0800
@@ -46,8 +46,7 @@
* [ y'] = [ m10 m11 m12 ] [ y ] = [ m10x + m11y + m12 ]
* [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
* </pre>
- * <p>
- * <h4><a name="quadrantapproximation">Handling 90-Degree Rotations</a></h4>
+ * <h3><a name="quadrantapproximation">Handling 90-Degree Rotations</a></h3>
* <p>
* In some variations of the <code>rotate</code> methods in the
* <code>AffineTransform</code> class, a double-precision argument
--- a/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java Thu Dec 05 10:33:57 2013 -0800
@@ -1047,7 +1047,7 @@
/**
* Evaluate the t values in the first num slots of the vals[] array
* and place the evaluated values back into the same array. Only
- * evaluate t values that are within the range <0, 1>, including
+ * evaluate t values that are within the range <0, 1>, including
* the 0 and 1 ends of the range iff the include0 or include1
* booleans are true. If an "inflection" equation is handed in,
* then any points which represent a point of inflection for that
@@ -1081,7 +1081,7 @@
/**
* Determine where coord lies with respect to the range from
- * low to high. It is assumed that low <= high. The return
+ * low to high. It is assumed that low <= high. The return
* value is one of the 5 values BELOW, LOWEDGE, INSIDE, HIGHEDGE,
* or ABOVE.
*/
--- a/jdk/src/share/classes/java/awt/image/BufferStrategy.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/image/BufferStrategy.java Thu Dec 05 10:33:57 2013 -0800
@@ -54,7 +54,6 @@
* <p>
* Alternatively, the contents of the back buffer can be copied, or
* <i>blitted</i> forward in a chain instead of moving the video pointer.
- * <p>
* <pre>{@code
* Double buffering:
*
--- a/jdk/src/share/classes/java/awt/image/BufferedImage.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/image/BufferedImage.java Thu Dec 05 10:33:57 2013 -0800
@@ -927,7 +927,6 @@
* each color component in the returned data when
* using this method. With a specified coordinate (x, y) in the
* image, the ARGB pixel can be accessed in this way:
- * <p>
*
* <pre>
* pixel = rgbArray[offset + (y-startY)*scansize + (x-startX)]; </pre>
--- a/jdk/src/share/classes/java/awt/image/ColorConvertOp.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/image/ColorConvertOp.java Thu Dec 05 10:33:57 2013 -0800
@@ -23,7 +23,8 @@
* questions.
*/
-/**********************************************************************
+/*
+ **********************************************************************
**********************************************************************
**********************************************************************
*** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
@@ -64,7 +65,6 @@
* color conversion.
* <p>
* Note that Source and Destination may be the same object.
- * <p>
* @see java.awt.RenderingHints#KEY_COLOR_RENDERING
* @see java.awt.RenderingHints#KEY_DITHERING
*/
--- a/jdk/src/share/classes/java/awt/peer/CheckboxPeer.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/peer/CheckboxPeer.java Thu Dec 05 10:33:57 2013 -0800
@@ -41,7 +41,7 @@
* Sets the state of the checkbox to be checked ({@code true}) or
* unchecked ({@code false}).
*
- * @param t the state to set on the checkbox
+ * @param state the state to set on the checkbox
*
* @see Checkbox#setState(boolean)
*/
--- a/jdk/src/share/classes/java/awt/peer/DesktopPeer.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/awt/peer/DesktopPeer.java Thu Dec 05 10:33:57 2013 -0800
@@ -87,7 +87,7 @@
* filling the message fields including to, cc, etc, with the values
* specified by the given mailto URL.
*
- * @param uri represents a mailto URL with specified values of the message.
+ * @param mailtoURL represents a mailto URL with specified values of the message.
* The syntax of mailto URL is defined by
* <a href="http://www.ietf.org/rfc/rfc2368.txt">RFC2368: The mailto
* URL scheme</a>
@@ -103,5 +103,5 @@
* @throws IOException If the user default browser is not found,
* or it fails to be launched.
*/
- void browse(URI url) throws IOException;
+ void browse(URI uri) throws IOException;
}
--- a/jdk/src/share/classes/java/io/BufferedReader.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/io/BufferedReader.java Thu Dec 05 10:33:57 2013 -0800
@@ -533,7 +533,7 @@
/**
* Returns a {@code Stream}, the elements of which are lines read from
* this {@code BufferedReader}. The {@link Stream} is lazily populated,
- * i.e, read only occurs during the
+ * i.e., read only occurs during the
* <a href="../util/stream/package-summary.html#StreamOps">terminal
* stream operation</a>.
*
@@ -550,8 +550,8 @@
* UncheckedIOException} which will be thrown from the {@code Stream}
* method that caused the read to take place. This method will return a
* Stream if invoked on a BufferedReader that is closed. Any operation on
- * that stream requires reading from the BufferedReader after is it closed
- * will cause an UncheckedIOException to be thrown.
+ * that stream that requires reading from the BufferedReader after it is
+ * closed, will cause an UncheckedIOException to be thrown.
*
* @return a {@code Stream<String>} providing the lines of text
* described by this {@code BufferedReader}
@@ -587,6 +587,7 @@
}
}
};
- return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iter, Spliterator.ORDERED), false);
+ return StreamSupport.stream(Spliterators.spliteratorUnknownSize(
+ iter, Spliterator.ORDERED | Spliterator.NONNULL), false);
}
}
--- a/jdk/src/share/classes/java/lang/CharSequence.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/lang/CharSequence.java Thu Dec 05 10:33:57 2013 -0800
@@ -87,7 +87,7 @@
char charAt(int index);
/**
- * Returns a new <code>CharSequence</code> that is a subsequence of this sequence.
+ * Returns a <code>CharSequence</code> that is a subsequence of this sequence.
* The subsequence starts with the <code>char</code> value at the specified index and
* ends with the <code>char</code> value at index <tt>end - 1</tt>. The length
* (in <code>char</code>s) of the
--- a/jdk/src/share/classes/java/lang/Class.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/lang/Class.java Thu Dec 05 10:33:57 2013 -0800
@@ -1565,8 +1565,12 @@
* methods inherited by the array type from {@code Object}. It does not
* contain a {@code Method} object for {@code clone()}.
*
- * <p> If this {@code Class} object represents a class or interface with no
- * public methods, then the returned array has length 0.
+ * <p> If this {@code Class} object represents an interface then the
+ * returned array does not contain any implicitly declared methods from
+ * {@code Object}. Therefore, if no methods are explicitly declared in
+ * this interface or any of its superinterfaces then the returned array
+ * has length 0. (Note that a {@code Class} object which represents a class
+ * always has public methods, inherited from {@code Object}.)
*
* <p> If this {@code Class} object represents a primitive type or void,
* then the returned array has length 0.
@@ -1699,25 +1703,29 @@
* order. If {@code parameterTypes} is {@code null}, it is
* treated as if it were an empty array.
*
- * <p> If the {@code name} is "{@code <init>};"or "{@code <clinit>}" a
+ * <p> If the {@code name} is "{@code <init>}" or "{@code <clinit>}" a
* {@code NoSuchMethodException} is raised. Otherwise, the method to
* be reflected is determined by the algorithm that follows. Let C be the
- * class represented by this object:
+ * class or interface represented by this object:
* <OL>
- * <LI> C is searched for any <I>matching methods</I>. If no matching
- * method is found, the algorithm of step 1 is invoked recursively on
- * the superclass of C.</LI>
- * <LI> If no method was found in step 1 above, the superinterfaces of C
- * are searched for a matching method. If any such method is found, it
- * is reflected.</LI>
+ * <LI> C is searched for a <I>matching method</I>, as defined below. If a
+ * matching method is found, it is reflected.</LI>
+ * <LI> If no matching method is found by step 1 then:
+ * <OL TYPE="a">
+ * <LI> If C is a class other than {@code Object}, then this algorithm is
+ * invoked recursively on the superclass of C.</LI>
+ * <LI> If C is the class {@code Object}, or if C is an interface, then
+ * the superinterfaces of C (if any) are searched for a matching
+ * method. If any such method is found, it is reflected.</LI>
+ * </OL></LI>
* </OL>
*
- * To find a matching method in a class C: If C declares exactly one
- * public method with the specified name and exactly the same formal
- * parameter types, that is the method reflected. If more than one such
- * method is found in C, and one of these methods has a return type that is
- * more specific than any of the others, that method is reflected;
- * otherwise one of the methods is chosen arbitrarily.
+ * <p> To find a matching method in a class or interface C: If C
+ * declares exactly one public method with the specified name and exactly
+ * the same formal parameter types, that is the method reflected. If more
+ * than one such method is found in C, and one of these methods has a
+ * return type that is more specific than any of the others, that method is
+ * reflected; otherwise one of the methods is chosen arbitrarily.
*
* <p>Note that there may be more than one matching method in a
* class because while the Java language forbids a class to
--- a/jdk/src/share/classes/java/lang/String.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/lang/String.java Thu Dec 05 10:33:57 2013 -0800
@@ -1958,7 +1958,7 @@
}
/**
- * Returns a new character sequence that is a subsequence of this sequence.
+ * Returns a character sequence that is a subsequence of this sequence.
*
* <p> An invocation of this method of the form
*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/doc-files/ValueBased.html Thu Dec 05 10:33:57 2013 -0800
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+ <title>Value-based Classes</title>
+ <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
+</head>
+<body>
+<h2 id="ValueBased">Value-based Classes</h2>
+
+Some classes, such as <code>java.util.Optional</code> and
+<code>java.time.LocalDateTime</code>, are <em>value-based</em>. Instances of a
+value-based class:
+<ul>
+ <li>are final and immutable (though may contain references to mutable
+ objects);</li>
+ <li>have implementations of <code>equals</code>,
+ <code>hashCode</code>, and <code>toString</code> which are computed
+ solely from the instance's state and not from its identity or the state
+ of any other object or variable;</li>
+ <li>make no use of identity-sensitive operations such as reference
+ equality (<code>==</code>) between instances, identity hash code of
+ instances, or synchronization on an instances's intrinsic lock;</li>
+ <li>are considered equal solely based on <code>equals()</code>, not
+ based on reference equality (<code>==</code>);</li>
+ <li>do not have accessible constructors, but are instead instantiated
+ through factory methods which make no committment as to the identity
+ of returned instances;</li>
+ <li>are <em>freely substitutable</em> when equal, meaning that interchanging
+ any two instances <code>x</code> and <code>y</code> that are equal
+ according to <code>equals()</code> in any computation or method
+ invocation should produce no visible change in behavior.
+ </li>
+</ul>
+
+<p>A program may produce unpredictable results if it attempts to distinguish two
+ references to equal values of a value-based class, whether directly via reference
+ equality or indirectly via an appeal to synchronization, identity hashing,
+ serialization, or any other identity-sensitive mechanism. Use of such
+ identity-sensitive operations on instances of value-based classes may have
+ unpredictable effects and should be avoided.</p>
+</body>
+</html>
--- a/jdk/src/share/classes/java/math/BigInteger.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/math/BigInteger.java Thu Dec 05 10:33:57 2013 -0800
@@ -215,7 +215,7 @@
* Karatsuba multiplication will be used. This value is found
* experimentally to work well.
*/
- private static final int KARATSUBA_THRESHOLD = 50;
+ private static final int KARATSUBA_THRESHOLD = 80;
/**
* The threshold value for using 3-way Toom-Cook multiplication.
@@ -224,7 +224,7 @@
* the mag arrays is greater than this threshold, then Toom-Cook
* multiplication will be used.
*/
- private static final int TOOM_COOK_THRESHOLD = 75;
+ private static final int TOOM_COOK_THRESHOLD = 240;
/**
* The threshold value for using Karatsuba squaring. If the number
@@ -232,7 +232,7 @@
* Karatsuba squaring will be used. This value is found
* experimentally to work well.
*/
- private static final int KARATSUBA_SQUARE_THRESHOLD = 90;
+ private static final int KARATSUBA_SQUARE_THRESHOLD = 128;
/**
* The threshold value for using Toom-Cook squaring. If the number
@@ -240,15 +240,23 @@
* Toom-Cook squaring will be used. This value is found
* experimentally to work well.
*/
- private static final int TOOM_COOK_SQUARE_THRESHOLD = 140;
+ private static final int TOOM_COOK_SQUARE_THRESHOLD = 216;
/**
* The threshold value for using Burnikel-Ziegler division. If the number
- * of ints in the number are larger than this value,
- * Burnikel-Ziegler division will be used. This value is found
- * experimentally to work well.
+ * of ints in the divisor are larger than this value, Burnikel-Ziegler
+ * division may be used. This value is found experimentally to work well.
*/
- static final int BURNIKEL_ZIEGLER_THRESHOLD = 50;
+ static final int BURNIKEL_ZIEGLER_THRESHOLD = 80;
+
+ /**
+ * The offset value for using Burnikel-Ziegler division. If the number
+ * of ints in the divisor exceeds the Burnikel-Ziegler threshold, and the
+ * number of ints in the dividend is greater than the number of ints in the
+ * divisor plus this value, Burnikel-Ziegler division will be used. This
+ * value is found experimentally to work well.
+ */
+ static final int BURNIKEL_ZIEGLER_OFFSET = 40;
/**
* The threshold value for using Schoenhage recursive base conversion. If
@@ -258,7 +266,7 @@
* 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;
+ private static final int SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 20;
//Constructors
@@ -1815,7 +1823,7 @@
int len = mag.length;
if (len <= n) {
- return this;
+ return abs();
}
int lowerInts[] = new int[n];
@@ -2017,8 +2025,8 @@
* @throws ArithmeticException if {@code val} is zero.
*/
public BigInteger divide(BigInteger val) {
- if (mag.length < BURNIKEL_ZIEGLER_THRESHOLD ||
- val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD) {
+ if (val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD ||
+ mag.length - val.mag.length < BURNIKEL_ZIEGLER_OFFSET) {
return divideKnuth(val);
} else {
return divideBurnikelZiegler(val);
@@ -2054,8 +2062,8 @@
* @throws ArithmeticException if {@code val} is zero.
*/
public BigInteger[] divideAndRemainder(BigInteger val) {
- if (mag.length < BURNIKEL_ZIEGLER_THRESHOLD ||
- val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD) {
+ if (val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD ||
+ mag.length - val.mag.length < BURNIKEL_ZIEGLER_OFFSET) {
return divideAndRemainderKnuth(val);
} else {
return divideAndRemainderBurnikelZiegler(val);
@@ -2083,8 +2091,8 @@
* @throws ArithmeticException if {@code val} is zero.
*/
public BigInteger remainder(BigInteger val) {
- if (mag.length < BURNIKEL_ZIEGLER_THRESHOLD ||
- val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD) {
+ if (val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD ||
+ mag.length - val.mag.length < BURNIKEL_ZIEGLER_OFFSET) {
return remainderKnuth(val);
} else {
return remainderBurnikelZiegler(val);
--- a/jdk/src/share/classes/java/math/MutableBigInteger.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/math/MutableBigInteger.java Thu Dec 05 10:33:57 2013 -0800
@@ -1148,8 +1148,8 @@
}
MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient, boolean needRemainder) {
- if (intLen < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD ||
- b.intLen < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD) {
+ if (b.intLen < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD ||
+ intLen - b.intLen < BigInteger.BURNIKEL_ZIEGLER_OFFSET) {
return divideKnuth(b, quotient, needRemainder);
} else {
return divideAndRemainderBurnikelZiegler(b, quotient);
--- a/jdk/src/share/classes/java/security/Provider.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/security/Provider.java Thu Dec 05 10:33:57 2013 -0800
@@ -336,6 +336,8 @@
* if a security manager exists and its {@link
* java.lang.SecurityManager#checkSecurityAccess} method
* denies access to set property values.
+ *
+ * @since 1.8
*/
@Override
public synchronized Object putIfAbsent(Object key, Object value) {
@@ -385,6 +387,8 @@
* if a security manager exists and its {@link
* java.lang.SecurityManager#checkSecurityAccess} method
* denies access to remove this provider's properties.
+ *
+ * @since 1.8
*/
@Override
public synchronized boolean remove(Object key, Object value) {
@@ -408,6 +412,8 @@
* if a security manager exists and its {@link
* java.lang.SecurityManager#checkSecurityAccess} method
* denies access to set property values.
+ *
+ * @since 1.8
*/
@Override
public synchronized boolean replace(Object key, Object oldValue,
@@ -433,6 +439,8 @@
* if a security manager exists and its {@link
* java.lang.SecurityManager#checkSecurityAccess} method
* denies access to set property values.
+ *
+ * @since 1.8
*/
@Override
public synchronized Object replace(Object key, Object value) {
@@ -459,6 +467,8 @@
* if a security manager exists and its {@link
* java.lang.SecurityManager#checkSecurityAccess} method
* denies access to set property values.
+ *
+ * @since 1.8
*/
@Override
public synchronized void replaceAll(BiFunction<? super Object, ? super Object, ? extends Object> function) {
@@ -485,6 +495,8 @@
* if a security manager exists and its {@link
* java.lang.SecurityManager#checkSecurityAccess} method
* denies access to set property values or remove properties.
+ *
+ * @since 1.8
*/
@Override
public synchronized Object compute(Object key,
@@ -514,6 +526,8 @@
* if a security manager exists and its {@link
* java.lang.SecurityManager#checkSecurityAccess} method
* denies access to set property values and remove properties.
+ *
+ * @since 1.8
*/
@Override
public synchronized Object computeIfAbsent(Object key, Function<? super Object, ? extends Object> mappingFunction) {
@@ -541,6 +555,8 @@
* if a security manager exists and its {@link
* java.lang.SecurityManager#checkSecurityAccess} method
* denies access to set property values or remove properties.
+ *
+ * @since 1.8
*/
@Override
public synchronized Object computeIfPresent(Object key, BiFunction<? super Object, ? super Object, ? extends Object> remappingFunction) {
@@ -571,6 +587,8 @@
* if a security manager exists and its {@link
* java.lang.SecurityManager#checkSecurityAccess} method
* denies access to set property values or remove properties.
+ *
+ * @since 1.8
*/
@Override
public synchronized Object merge(Object key, Object value, BiFunction<? super Object, ? super Object, ? extends Object> remappingFunction) {
@@ -589,13 +607,18 @@
checkInitialized();
return super.get(key);
}
-
+ /**
+ * @since 1.8
+ */
@Override
public synchronized Object getOrDefault(Object key, Object defaultValue) {
checkInitialized();
return super.getOrDefault(key, defaultValue);
}
+ /**
+ * @since 1.8
+ */
@Override
public synchronized void forEach(BiConsumer<? super Object, ? super Object> action) {
checkInitialized();
--- a/jdk/src/share/classes/java/sql/CallableStatement.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/sql/CallableStatement.java Thu Dec 05 10:33:57 2013 -0800
@@ -1108,7 +1108,7 @@
* parameter; if a database access error occurs or
* this method is called on a closed <code>CallableStatement</code>
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified targetSqlType
* @see Types
* @see #getObject
* @since 1.4
@@ -1131,7 +1131,7 @@
* parameter; if a database access error occurs or
* this method is called on a closed <code>CallableStatement</code>
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified targetSqlType
* @see #getObject
* @since 1.4
*/
@@ -2536,7 +2536,7 @@
* or Reader object and the value of the scale parameter is less
* than zero
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified targetSqlType
* @see JDBCType
* @see SQLType
*
@@ -2562,7 +2562,7 @@
* parameter; if a database access error occurs
* or this method is called on a closed {@code CallableStatement}
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified targetSqlType
* @see JDBCType
* @see SQLType
* @since 1.8
@@ -2603,7 +2603,7 @@
* if a database access error occurs or
* this method is called on a closed {@code CallableStatement}
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified sqlType
* @see JDBCType
* @see SQLType
* @since 1.8
@@ -2639,7 +2639,7 @@
* if a database access error occurs or
* this method is called on a closed {@code CallableStatement}
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified sqlType
* @see JDBCType
* @see SQLType
* @since 1.8
@@ -2686,7 +2686,7 @@
* if a database access error occurs or
* this method is called on a closed {@code CallableStatement}
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified sqlType
* @see JDBCType
* @see SQLType
* @since 1.8
@@ -2725,7 +2725,7 @@
* parameter; if a database access error occurs or
* this method is called on a closed {@code CallableStatement}
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified sqlType
* or if the JDBC driver does not support
* this method
* @since 1.8
@@ -2762,7 +2762,7 @@
* parameter; if a database access error occurs or
* this method is called on a closed {@code CallableStatement}
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified sqlType
* or if the JDBC driver does not support
* this method
* @since 1.8
@@ -2811,7 +2811,7 @@
* parameter; if a database access error occurs or
* this method is called on a closed {@code CallableStatement}
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified sqlType
* or if the JDBC driver does not support this method
* @see JDBCType
* @see SQLType
--- a/jdk/src/share/classes/java/sql/DriverManager.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/sql/DriverManager.java Thu Dec 05 10:33:57 2013 -0800
@@ -213,8 +213,8 @@
* The <code>DriverManager</code> attempts to select an appropriate driver from
* the set of registered JDBC drivers.
*<p>
- * <B>Note:</B> If a property is specified as part of the {@code url} and
- * is also specified in the {@code Properties} object, it is
+ * <B>Note:</B> If the {@code user} or {@code password} property are
+ * also specified as part of the {@code url}, it is
* implementation-defined as to which value will take precedence.
* For maximum portability, an application should only specify a
* property once.
@@ -320,7 +320,7 @@
* Registers the given driver with the {@code DriverManager}.
* A newly-loaded driver class should call
* the method {@code registerDriver} to make itself
- * known to the {@code DriverManager}. If the driver had previously been
+ * known to the {@code DriverManager}. If the driver is currently
* registered, no action is taken.
*
* @param driver the new JDBC Driver that is to be registered with the
@@ -338,7 +338,7 @@
* Registers the given driver with the {@code DriverManager}.
* A newly-loaded driver class should call
* the method {@code registerDriver} to make itself
- * known to the {@code DriverManager}. If the driver had previously been
+ * known to the {@code DriverManager}. If the driver is currently
* registered, no action is taken.
*
* @param driver the new JDBC Driver that is to be registered with the
@@ -347,6 +347,7 @@
* {@code DriverManager#deregisterDriver} is called
* @exception SQLException if a database access error occurs
* @exception NullPointerException if {@code driver} is null
+ * @since 1.8
*/
public static synchronized void registerDriver(java.sql.Driver driver,
DriverAction da)
--- a/jdk/src/share/classes/java/sql/JDBCType.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/sql/JDBCType.java Thu Dec 05 10:33:57 2013 -0800
@@ -218,8 +218,8 @@
}
/**
- * Returns the name of the data type.
- * @return The name of the data type.
+ *{@inheritDoc }
+ * @return The name of this {@code SQLType}.
*/
public String getName() {
return name();
--- a/jdk/src/share/classes/java/sql/PreparedStatement.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/sql/PreparedStatement.java Thu Dec 05 10:33:57 2013 -0800
@@ -401,7 +401,7 @@
* marker in the SQL statement; if a database access error occurs or this
* method is called on a closed PreparedStatement
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified targetSqlType
* @see Types
*/
void setObject(int parameterIndex, Object x, int targetSqlType)
@@ -951,7 +951,7 @@
* or Reader object and the value of the scale parameter is less
* than zero
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified targetSqlType
* @see Types
*
*/
@@ -1255,7 +1255,7 @@
* or Reader object and the value of the scale parameter is less
* than zero
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified targetSqlType
* @see JDBCType
* @see SQLType
* @since 1.8
@@ -1281,7 +1281,7 @@
* parameter marker in the SQL statement; if a database access error occurs
* or this method is called on a closed {@code PreparedStatement}
* @exception SQLFeatureNotSupportedException if
- * the JDBC driver does not support this data type
+ * the JDBC driver does not support the specified targetSqlType
* @see JDBCType
* @see SQLType
* @since 1.8
--- a/jdk/src/share/classes/java/sql/ResultSet.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/sql/ResultSet.java Thu Dec 05 10:33:57 2013 -0800
@@ -4178,7 +4178,7 @@
* the result set concurrency is {@code CONCUR_READ_ONLY}
* or this method is called on a closed result set
* @exception SQLFeatureNotSupportedException if the JDBC driver does not
- * support this method; if the JDBC driver does not support this data type
+ * support this method; if the JDBC driver does not support the specified targetSqlType
* @see JDBCType
* @see SQLType
* @since 1.8
@@ -4221,7 +4221,7 @@
* the result set concurrency is {@code CONCUR_READ_ONLY}
* or this method is called on a closed result set
* @exception SQLFeatureNotSupportedException if the JDBC driver does not
- * support this method; if the JDBC driver does not support this data type
+ * support this method; if the JDBC driver does not support the specified targetSqlType
* @see JDBCType
* @see SQLType
* @since 1.8
@@ -4249,7 +4249,7 @@
* the result set concurrency is {@code CONCUR_READ_ONLY}
* or this method is called on a closed result set
* @exception SQLFeatureNotSupportedException if the JDBC driver does not
- * support this method; if the JDBC driver does not support this data type
+ * support this method; if the JDBC driver does not support the specified targetSqlType
* @see JDBCType
* @see SQLType
* @since 1.8
@@ -4279,7 +4279,7 @@
* the result set concurrency is {@code CONCUR_READ_ONLY}
* or this method is called on a closed result set
* @exception SQLFeatureNotSupportedException if the JDBC driver does not
- * support this method; if the JDBC driver does not support this data type
+ * support this method; if the JDBC driver does not support the specified targetSqlType
* @see JDBCType
* @see SQLType
* @since 1.8
--- a/jdk/src/share/classes/java/sql/SQLPermission.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/sql/SQLPermission.java Thu Dec 05 10:33:57 2013 -0800
@@ -122,7 +122,7 @@
*
* @param name the name of this <code>SQLPermission</code> object, which must
* be either {@code setLog}, {@code callAbort}, {@code setSyncFactory},
- * or {@code setNetworkTimeout}
+ * {@code deregisterDriver}, or {@code setNetworkTimeout}
* @throws NullPointerException if <code>name</code> is <code>null</code>.
* @throws IllegalArgumentException if <code>name</code> is empty.
@@ -140,7 +140,7 @@
*
* @param name the name of this <code>SQLPermission</code> object, which must
* be either {@code setLog}, {@code callAbort}, {@code setSyncFactory},
- * or {@code setNetworkTimeout}
+ * {@code deregisterDriver}, or {@code setNetworkTimeout}
* @param actions should be <code>null</code>
* @throws NullPointerException if <code>name</code> is <code>null</code>.
* @throws IllegalArgumentException if <code>name</code> is empty.
--- a/jdk/src/share/classes/java/util/Base64.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/Base64.java Thu Dec 05 10:33:57 2013 -0800
@@ -351,62 +351,6 @@
}
/**
- * Encodes as many bytes as possible from the input byte buffer
- * using the {@link Base64} encoding scheme, writing the resulting
- * bytes to the given output byte buffer.
- *
- * <p>The buffers are read from, and written to, starting at their
- * current positions. Upon return, the input and output buffers'
- * positions will be advanced to reflect the bytes read and written,
- * but their limits will not be modified.
- *
- * <p>The encoding operation will stop and return if either all
- * remaining bytes in the input buffer have been encoded and written
- * to the output buffer, or the output buffer has insufficient space
- * to encode any more input bytes. The encoding operation can be
- * continued, if there is more bytes in input buffer to be encoded,
- * by invoking this method again with an output buffer that has more
- * {@linkplain java.nio.Buffer#remaining remaining} bytes. This is
- * typically done by draining any encoded bytes from the output buffer.
- * The value returned from last invocation needs to be passed in as the
- * third parameter {@code bytesOut} if it is to continue an unfinished
- * encoding, 0 otherwise.
- *
- * <p><b>Recommended Usage Example</b>
- * <pre>
- * ByteBuffer src = ...;
- * ByteBuffer dst = ...;
- * Base64.Encoder enc = Base64.getMimeDecoder();
- *
- * int bytesOut = 0;
- * while (src.hasRemaining()) {
- * // clear output buffer for decoding
- * dst.clear();
- * bytesOut = enc.encode(src, dst, bytesOut);
- *
- * // read encoded bytes out of "dst"
- * dst.flip();
- * ...
- * }
- * </pre>
- *
- * @param src
- * the input byte buffer to encode
- * @param dst
- * the output byte buffer
- * @param bytesOut
- * the return value of last invocation if this is to continue
- * an unfinished encoding operation, 0 otherwise
- * @return The sum total of {@code bytesOut} and the number of bytes
- * written to the output ByteBuffer during this invocation.
- */
- public int encode(ByteBuffer src, ByteBuffer dst, int bytesOut) {
- if (src.hasArray() && dst.hasArray())
- return encodeArray(src, dst, bytesOut);
- return encodeBuffer(src, dst, bytesOut);
- }
-
- /**
* Wraps an output stream for encoding byte data using the {@link Base64}
* encoding scheme.
*
@@ -444,160 +388,6 @@
return new Encoder(isURL, newline, linemax, false);
}
- private int encodeArray(ByteBuffer src, ByteBuffer dst, int bytesOut) {
- char[] base64 = isURL? toBase64URL : toBase64;
- byte[] sa = src.array();
- int sp = src.arrayOffset() + src.position();
- int sl = src.arrayOffset() + src.limit();
- byte[] da = dst.array();
- int dp = dst.arrayOffset() + dst.position();
- int dl = dst.arrayOffset() + dst.limit();
- int dp00 = dp;
- int dpos = 0; // dp of each line
- if (linemax > 0 && bytesOut > 0)
- dpos = bytesOut % (linemax + newline.length);
- try {
- if (dpos == linemax && sp < src.limit()) {
- if (dp + newline.length > dl)
- return dp - dp00 + bytesOut;
- for (byte b : newline){
- dst.put(dp++, b);
- }
- dpos = 0;
- }
- sl = sp + (sl - sp) / 3 * 3;
- while (sp < sl) {
- int slen = (linemax > 0) ? (linemax - dpos) / 4 * 3
- : sl - sp;
- int sl0 = Math.min(sp + slen, sl);
- for (int sp0 = sp, dp0 = dp ; sp0 < sl0; ) {
- if (dp0 + 4 > dl) {
- sp = sp0; dp = dp0;
- return dp0 - dp00 + bytesOut;
- }
- int bits = (sa[sp0++] & 0xff) << 16 |
- (sa[sp0++] & 0xff) << 8 |
- (sa[sp0++] & 0xff);
- da[dp0++] = (byte)base64[(bits >>> 18) & 0x3f];
- da[dp0++] = (byte)base64[(bits >>> 12) & 0x3f];
- da[dp0++] = (byte)base64[(bits >>> 6) & 0x3f];
- da[dp0++] = (byte)base64[bits & 0x3f];
- }
- int n = (sl0 - sp) / 3 * 4;
- dpos += n;
- dp += n;
- sp = sl0;
- if (dpos == linemax && sp < src.limit()) {
- if (dp + newline.length > dl)
- return dp - dp00 + bytesOut;
- for (byte b : newline){
- da[dp++] = b;
- }
- dpos = 0;
- }
- }
- sl = src.arrayOffset() + src.limit();
- if (sp < sl && dl >= dp + 4) { // 1 or 2 leftover bytes
- int b0 = sa[sp++] & 0xff;
- da[dp++] = (byte)base64[b0 >> 2];
- if (sp == sl) {
- da[dp++] = (byte)base64[(b0 << 4) & 0x3f];
- if (doPadding) {
- da[dp++] = '=';
- da[dp++] = '=';
- }
- } else {
- int b1 = sa[sp++] & 0xff;
- da[dp++] = (byte)base64[(b0 << 4) & 0x3f | (b1 >> 4)];
- da[dp++] = (byte)base64[(b1 << 2) & 0x3f];
- if (doPadding) {
- da[dp++] = '=';
- }
- }
- }
- return dp - dp00 + bytesOut;
- } finally {
- src.position(sp - src.arrayOffset());
- dst.position(dp - dst.arrayOffset());
- }
- }
-
- private int encodeBuffer(ByteBuffer src, ByteBuffer dst, int bytesOut) {
- char[] base64 = isURL? toBase64URL : toBase64;
- int sp = src.position();
- int sl = src.limit();
- int dp = dst.position();
- int dl = dst.limit();
- int dp00 = dp;
-
- int dpos = 0; // dp of each line
- if (linemax > 0 && bytesOut > 0)
- dpos = bytesOut % (linemax + newline.length);
- try {
- if (dpos == linemax && sp < src.limit()) {
- if (dp + newline.length > dl)
- return dp - dp00 + bytesOut;
- for (byte b : newline){
- dst.put(dp++, b);
- }
- dpos = 0;
- }
- sl = sp + (sl - sp) / 3 * 3;
- while (sp < sl) {
- int slen = (linemax > 0) ? (linemax - dpos) / 4 * 3
- : sl - sp;
- int sl0 = Math.min(sp + slen, sl);
- for (int sp0 = sp, dp0 = dp ; sp0 < sl0; ) {
- if (dp0 + 4 > dl) {
- sp = sp0; dp = dp0;
- return dp0 - dp00 + bytesOut;
- }
- int bits = (src.get(sp0++) & 0xff) << 16 |
- (src.get(sp0++) & 0xff) << 8 |
- (src.get(sp0++) & 0xff);
- dst.put(dp0++, (byte)base64[(bits >>> 18) & 0x3f]);
- dst.put(dp0++, (byte)base64[(bits >>> 12) & 0x3f]);
- dst.put(dp0++, (byte)base64[(bits >>> 6) & 0x3f]);
- dst.put(dp0++, (byte)base64[bits & 0x3f]);
- }
- int n = (sl0 - sp) / 3 * 4;
- dpos += n;
- dp += n;
- sp = sl0;
- if (dpos == linemax && sp < src.limit()) {
- if (dp + newline.length > dl)
- return dp - dp00 + bytesOut;
- for (byte b : newline){
- dst.put(dp++, b);
- }
- dpos = 0;
- }
- }
- if (sp < src.limit() && dl >= dp + 4) { // 1 or 2 leftover bytes
- int b0 = src.get(sp++) & 0xff;
- dst.put(dp++, (byte)base64[b0 >> 2]);
- if (sp == src.limit()) {
- dst.put(dp++, (byte)base64[(b0 << 4) & 0x3f]);
- if (doPadding) {
- dst.put(dp++, (byte)'=');
- dst.put(dp++, (byte)'=');
- }
- } else {
- int b1 = src.get(sp++) & 0xff;
- dst.put(dp++, (byte)base64[(b0 << 4) & 0x3f | (b1 >> 4)]);
- dst.put(dp++, (byte)base64[(b1 << 2) & 0x3f]);
- if (doPadding) {
- dst.put(dp++, (byte)'=');
- }
- }
- }
- return dp - dp00 + bytesOut;
- } finally {
- src.position(sp);
- dst.position(dp);
- }
- }
-
private int encode0(byte[] src, int off, int end, byte[] dst) {
char[] base64 = isURL ? toBase64URL : toBase64;
int sp = off;
@@ -657,20 +447,11 @@
* required. So if the final unit of the encoded byte data only has
* two or three Base64 characters (without the corresponding padding
* character(s) padded), they are decoded as if followed by padding
- * character(s).
- * <p>
- * For decoders that use the <a href="#basic">Basic</a> and
- * <a href="#url">URL and Filename safe</a> type base64 scheme, and
- * if there is padding character present in the final unit, the
- * correct number of padding character(s) must be present, otherwise
- * {@code IllegalArgumentException} ({@code IOException} when reading
- * from a Base64 stream) is thrown during decoding.
- * <p>
- * Decoders that use the <a href="#mime">MIME</a> type base64 scheme
- * are more lenient when decoding the padding character(s). If the
- * padding character(s) is incorrectly encoded, the first padding
- * character encountered is interpreted as the end of the encoded byte
- * data, the decoding operation will then end and return normally.
+ * character(s). If there is a padding character present in the
+ * final unit, the correct number of padding character(s) must be
+ * present, otherwise {@code IllegalArgumentException} (
+ * {@code IOException} when reading from a Base64 stream) is thrown
+ * during decoding.
*
* <p> Instances of {@link Decoder} class are safe for use by
* multiple concurrent threads.
@@ -810,6 +591,10 @@
* output buffer's position will be zero and its limit will be the
* number of resulting decoded bytes
*
+ * <p> {@code IllegalArgumentException} is thrown if the input buffer
+ * is not in valid Base64 encoding scheme. The position of the input
+ * buffer will not be advanced in this case.
+ *
* @param buffer
* the ByteBuffer to decode
*
@@ -843,76 +628,6 @@
}
/**
- * Decodes as many bytes as possible from the input byte buffer
- * using the {@link Base64} encoding scheme, writing the resulting
- * bytes to the given output byte buffer.
- *
- * <p>The buffers are read from, and written to, starting at their
- * current positions. Upon return, the input and output buffers'
- * positions will be advanced to reflect the bytes read and written,
- * but their limits will not be modified.
- *
- * <p> If the input buffer is not in valid Base64 encoding scheme
- * then some bytes may have been written to the output buffer
- * before IllegalArgumentException is thrown. The positions of
- * both input and output buffer will not be advanced in this case.
- *
- * <p>The decoding operation will end and return if all remaining
- * bytes in the input buffer have been decoded and written to the
- * output buffer.
- *
- * <p> The decoding operation will stop and return if the output
- * buffer has insufficient space to decode any more input bytes.
- * The decoding operation can be continued, if there is more bytes
- * in input buffer to be decoded, by invoking this method again with
- * an output buffer that has more {@linkplain java.nio.Buffer#remaining
- * remaining} bytes. This is typically done by draining any decoded
- * bytes from the output buffer.
- *
- * <p><b>Recommended Usage Example</b>
- * <pre>
- * ByteBuffer src = ...;
- * ByteBuffer dst = ...;
- * Base64.Decoder dec = Base64.getDecoder();
- *
- * while (src.hasRemaining()) {
- *
- * // prepare the output byte buffer
- * dst.clear();
- * dec.decode(src, dst);
- *
- * // read bytes from the output buffer
- * dst.flip();
- * ...
- * }
- * </pre>
- *
- * @param src
- * the input byte buffer to decode
- * @param dst
- * the output byte buffer
- *
- * @return The number of bytes written to the output byte buffer during
- * this decoding invocation
- *
- * @throws IllegalArgumentException
- * if {@code src} is not in valid Base64 scheme.
- */
- public int decode(ByteBuffer src, ByteBuffer dst) {
- int sp0 = src.position();
- int dp0 = dst.position();
- try {
- if (src.hasArray() && dst.hasArray())
- return decodeArray(src, dst);
- return decodeBuffer(src, dst);
- } catch (IllegalArgumentException iae) {
- src.position(sp0);
- dst.position(dp0);
- throw iae;
- }
- }
-
- /**
* Returns an input stream for decoding {@link Base64} encoded byte stream.
*
* <p> The {@code read} methods of the returned {@code InputStream} will
@@ -932,150 +647,6 @@
return new DecInputStream(is, isURL ? fromBase64URL : fromBase64, isMIME);
}
- private int decodeArray(ByteBuffer src, ByteBuffer dst) {
- int[] base64 = isURL ? fromBase64URL : fromBase64;
- int bits = 0;
- int shiftto = 18; // pos of first byte of 4-byte atom
- byte[] sa = src.array();
- int sp = src.arrayOffset() + src.position();
- int sl = src.arrayOffset() + src.limit();
- byte[] da = dst.array();
- int dp = dst.arrayOffset() + dst.position();
- int dl = dst.arrayOffset() + dst.limit();
- int dp0 = dp;
- int mark = sp;
- try {
- while (sp < sl) {
- int b = sa[sp++] & 0xff;
- if ((b = base64[b]) < 0) {
- if (b == -2) { // padding byte
- if (!isMIME &&
- (shiftto == 6 && (sp == sl || sa[sp++] != '=') ||
- shiftto == 18)) {
- throw new IllegalArgumentException(
- "Input byte array has wrong 4-byte ending unit");
- }
- break;
- }
- if (isMIME) // skip if for rfc2045
- continue;
- else
- throw new IllegalArgumentException(
- "Illegal base64 character " +
- Integer.toString(sa[sp - 1], 16));
- }
- bits |= (b << shiftto);
- shiftto -= 6;
- if (shiftto < 0) {
- if (dl < dp + 3)
- return dp - dp0;
- da[dp++] = (byte)(bits >> 16);
- da[dp++] = (byte)(bits >> 8);
- da[dp++] = (byte)(bits);
- shiftto = 18;
- bits = 0;
- mark = sp;
- }
- }
- if (shiftto == 6) {
- if (dl - dp < 1)
- return dp - dp0;
- da[dp++] = (byte)(bits >> 16);
- } else if (shiftto == 0) {
- if (dl - dp < 2)
- return dp - dp0;
- da[dp++] = (byte)(bits >> 16);
- da[dp++] = (byte)(bits >> 8);
- } else if (shiftto == 12) {
- throw new IllegalArgumentException(
- "Last unit does not have enough valid bits");
- }
- if (sp < sl) {
- if (isMIME)
- sp = sl;
- else
- throw new IllegalArgumentException(
- "Input byte array has incorrect ending byte at " + sp);
- }
- mark = sp;
- return dp - dp0;
- } finally {
- src.position(mark);
- dst.position(dp);
- }
- }
-
- private int decodeBuffer(ByteBuffer src, ByteBuffer dst) {
- int[] base64 = isURL ? fromBase64URL : fromBase64;
- int bits = 0;
- int shiftto = 18; // pos of first byte of 4-byte atom
- int sp = src.position();
- int sl = src.limit();
- int dp = dst.position();
- int dl = dst.limit();
- int dp0 = dp;
- int mark = sp;
- try {
- while (sp < sl) {
- int b = src.get(sp++) & 0xff;
- if ((b = base64[b]) < 0) {
- if (b == -2) { // padding byte
- if (!isMIME &&
- (shiftto == 6 && (sp == sl || src.get(sp++) != '=') ||
- shiftto == 18)) {
- throw new IllegalArgumentException(
- "Input byte array has wrong 4-byte ending unit");
- }
- break;
- }
- if (isMIME) // skip if for rfc2045
- continue;
- else
- throw new IllegalArgumentException(
- "Illegal base64 character " +
- Integer.toString(src.get(sp - 1), 16));
- }
- bits |= (b << shiftto);
- shiftto -= 6;
- if (shiftto < 0) {
- if (dl < dp + 3)
- return dp - dp0;
- dst.put(dp++, (byte)(bits >> 16));
- dst.put(dp++, (byte)(bits >> 8));
- dst.put(dp++, (byte)(bits));
- shiftto = 18;
- bits = 0;
- mark = sp;
- }
- }
- if (shiftto == 6) {
- if (dl - dp < 1)
- return dp - dp0;
- dst.put(dp++, (byte)(bits >> 16));
- } else if (shiftto == 0) {
- if (dl - dp < 2)
- return dp - dp0;
- dst.put(dp++, (byte)(bits >> 16));
- dst.put(dp++, (byte)(bits >> 8));
- } else if (shiftto == 12) {
- throw new IllegalArgumentException(
- "Last unit does not have enough valid bits");
- }
- if (sp < sl) {
- if (isMIME)
- sp = sl;
- else
- throw new IllegalArgumentException(
- "Input byte array has incorrect ending byte at " + sp);
- }
- mark = sp;
- return dp - dp0;
- } finally {
- src.position(mark);
- dst.position(dp);
- }
- }
-
private int outLength(byte[] src, int sp, int sl) {
int[] base64 = isURL ? fromBase64URL : fromBase64;
int paddings = 0;
@@ -1123,14 +694,13 @@
int b = src[sp++] & 0xff;
if ((b = base64[b]) < 0) {
if (b == -2) { // padding byte '='
- if (!isMIME && // be lenient for rfc2045
- // = shiftto==18 unnecessary padding
- // x= shiftto==12 a dangling single x
- // x to be handled together with non-padding case
- // xx= shiftto==6&&sp==sl missing last =
- // xx=y shiftto==6 last is not =
- (shiftto == 6 && (sp == sl || src[sp++] != '=') ||
- shiftto == 18)) {
+ // = shiftto==18 unnecessary padding
+ // x= shiftto==12 a dangling single x
+ // x to be handled together with non-padding case
+ // xx= shiftto==6&&sp==sl missing last =
+ // xx=y shiftto==6 last is not =
+ if (shiftto == 6 && (sp == sl || src[sp++] != '=') ||
+ shiftto == 18) {
throw new IllegalArgumentException(
"Input byte array has wrong 4-byte ending unit");
}
@@ -1160,14 +730,15 @@
dst[dp++] = (byte)(bits >> 16);
dst[dp++] = (byte)(bits >> 8);
} else if (shiftto == 12) {
- // dangling single "x", throw exception even in lenient mode,
- // it's incorrectly encoded.
+ // dangling single "x", incorrectly encoded.
throw new IllegalArgumentException(
"Last unit does not have enough valid bits");
}
// anything left is invalid, if is not MIME.
- // if MIME (lenient), just ignore all leftover
- if (sp < sl && !isMIME) {
+ // if MIME, ignore all non-base64 character
+ while (sp < sl) {
+ if (isMIME && base64[src[sp++]] < 0)
+ continue;
throw new IllegalArgumentException(
"Input byte array has incorrect ending byte at " + sp);
}
@@ -1367,26 +938,16 @@
// xx=y or last is not '='
if (nextin == 18 || nextin == 12 ||
nextin == 6 && is.read() != '=') {
- if (!isMIME || nextin == 12) {
- throw new IOException("Illegal base64 ending sequence:" + nextin);
- } else if (nextin != 18) {
- // lenient mode for mime
- // (1) handle the "unnecessary padding in "xxxx ="
- // case as the eof (nextin == 18)
- // (2) decode "xx=" and "xx=y" normally
- b[off++] = (byte)(bits >> (16));
- len--;
- }
- } else {
- b[off++] = (byte)(bits >> (16));
- len--;
- if (nextin == 0) { // only one padding byte
- if (len == 0) { // no enough output space
- bits >>= 8; // shift to lowest byte
- nextout = 0;
- } else {
- b[off++] = (byte) (bits >> 8);
- }
+ throw new IOException("Illegal base64 ending sequence:" + nextin);
+ }
+ b[off++] = (byte)(bits >> (16));
+ len--;
+ if (nextin == 0) { // only one padding byte
+ if (len == 0) { // no enough output space
+ bits >>= 8; // shift to lowest byte
+ nextout = 0;
+ } else {
+ b[off++] = (byte) (bits >> 8);
}
}
eof = true;
--- a/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java Thu Dec 05 10:33:57 2013 -0800
@@ -63,6 +63,7 @@
public class DoubleSummaryStatistics implements DoubleConsumer {
private long count;
private double sum;
+ private double sumCompensation; // Low order bits of sum
private double min = Double.POSITIVE_INFINITY;
private double max = Double.NEGATIVE_INFINITY;
@@ -81,7 +82,7 @@
@Override
public void accept(double value) {
++count;
- sum += value;
+ sumWithCompensation(value);
min = Math.min(min, value);
max = Math.max(max, value);
}
@@ -95,12 +96,24 @@
*/
public void combine(DoubleSummaryStatistics other) {
count += other.count;
- sum += other.sum;
+ sumWithCompensation(other.sum);
+ sumWithCompensation(other.sumCompensation);
min = Math.min(min, other.min);
max = Math.max(max, other.max);
}
/**
+ * Incorporate a new double value using Kahan summation /
+ * compensated summation.
+ */
+ private void sumWithCompensation(double value) {
+ double tmp = value - sumCompensation;
+ double velvel = sum + tmp; // Little wolf of rounding error
+ sumCompensation = (velvel - sum) - tmp;
+ sum = velvel;
+ }
+
+ /**
* Return the count of values recorded.
*
* @return the count of values
@@ -133,7 +146,8 @@
* @return the sum of values, or zero if none
*/
public final double getSum() {
- return sum;
+ // Better error bounds to add both terms as the final sum
+ return sum + sumCompensation;
}
/**
--- a/jdk/src/share/classes/java/util/ListResourceBundle.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/ListResourceBundle.java Thu Dec 05 10:33:57 2013 -0800
@@ -105,6 +105,12 @@
* }
* </pre>
* </blockquote>
+ *
+ * <p>
+ * The implementation of a {@code ListResourceBundle} subclass must be thread-safe
+ * if it's simultaneously used by multiple threads. The default implementations
+ * of the methods in this class are thread-safe.
+ *
* @see ResourceBundle
* @see PropertyResourceBundle
* @since JDK1.1
--- a/jdk/src/share/classes/java/util/Optional.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/Optional.java Thu Dec 05 10:33:57 2013 -0800
@@ -40,6 +40,11 @@
* {@link #ifPresent(java.util.function.Consumer) ifPresent()} (execute a block
* of code if the value is present).
*
+ * <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code Optional} may have unpredictable results and should be avoided.
+ *
* @since 1.8
*/
public final class Optional<T> {
--- a/jdk/src/share/classes/java/util/OptionalDouble.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/OptionalDouble.java Thu Dec 05 10:33:57 2013 -0800
@@ -31,7 +31,7 @@
/**
* A container object which may or may not contain a {@code double} value.
* If a value is present, {@code isPresent()} will return {@code true} and
- * {@code get()} will return the value.
+ * {@code getAsDouble()} will return the value.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(double) orElse()}
@@ -39,6 +39,11 @@
* {@link #ifPresent(java.util.function.DoubleConsumer) ifPresent()} (execute a block
* of code if the value is present).
*
+ * <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code OptionalDouble} may have unpredictable results and should be avoided.
+ *
* @since 1.8
*/
public final class OptionalDouble {
--- a/jdk/src/share/classes/java/util/OptionalInt.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/OptionalInt.java Thu Dec 05 10:33:57 2013 -0800
@@ -31,7 +31,7 @@
/**
* A container object which may or may not contain a {@code int} value.
* If a value is present, {@code isPresent()} will return {@code true} and
- * {@code get()} will return the value.
+ * {@code getAsInt()} will return the value.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(int) orElse()}
@@ -39,6 +39,11 @@
* {@link #ifPresent(java.util.function.IntConsumer) ifPresent()} (execute a block
* of code if the value is present).
*
+ * <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code OptionalInt} may have unpredictable results and should be avoided.
+ *
* @since 1.8
*/
public final class OptionalInt {
--- a/jdk/src/share/classes/java/util/OptionalLong.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/OptionalLong.java Thu Dec 05 10:33:57 2013 -0800
@@ -31,7 +31,7 @@
/**
* A container object which may or may not contain a {@code long} value.
* If a value is present, {@code isPresent()} will return {@code true} and
- * {@code get()} will return the value.
+ * {@code getAsLong()} will return the value.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(long) orElse()}
@@ -39,6 +39,11 @@
* {@link #ifPresent(java.util.function.LongConsumer) ifPresent()} (execute a block
* of code if the value is present).
*
+ * <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code OptionalLong} may have unpredictable results and should be avoided.
+ *
* @since 1.8
*/
public final class OptionalLong {
--- a/jdk/src/share/classes/java/util/PropertyResourceBundle.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/PropertyResourceBundle.java Thu Dec 05 10:33:57 2013 -0800
@@ -100,6 +100,11 @@
* </blockquote>
*
* <p>
+ * The implementation of a {@code PropertyResourceBundle} subclass must be
+ * thread-safe if it's simultaneously used by multiple threads. The default
+ * implementations of the non-abstract methods in this class are thread-safe.
+ *
+ * <p>
* <strong>Note:</strong> PropertyResourceBundle can be constructed either
* from an InputStream or a Reader, which represents a property file.
* Constructing a PropertyResourceBundle instance from an InputStream requires
--- a/jdk/src/share/classes/java/util/ResourceBundle.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/ResourceBundle.java Thu Dec 05 10:33:57 2013 -0800
@@ -184,6 +184,13 @@
* subclass. Your subclasses must override two methods: <code>handleGetObject</code>
* and <code>getKeys()</code>.
*
+ * <p>
+ * The implementation of a {@code ResourceBundle} subclass must be thread-safe
+ * if it's simultaneously used by multiple threads. The default implementations
+ * of the non-abstract methods in this class, and the methods in the direct
+ * known concrete subclasses {@code ListResourceBundle} and
+ * {@code PropertyResourceBundle} are thread-safe.
+ *
* <h3>ResourceBundle.Control</h3>
*
* The {@link ResourceBundle.Control} class provides information necessary
--- a/jdk/src/share/classes/java/util/StringJoiner.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/StringJoiner.java Thu Dec 05 10:33:57 2013 -0800
@@ -131,7 +131,7 @@
/**
* Sets the sequence of characters to be used when determining the string
* representation of this {@code StringJoiner} and no elements have been
- * added yet, i.e. when it is empty. A copy of the {@code emptyValue}
+ * added yet, that is, when it is empty. A copy of the {@code emptyValue}
* parameter is made for this purpose. Note that once an add method has been
* called, the {@code StringJoiner} is no longer considered empty, even if
* the element(s) added correspond to the empty {@code String}.
@@ -228,8 +228,8 @@
}
/**
- * The length of the {@code StringJoiner} value, i.e. the length of
- * {@code String} representation of the {@code StringJoiner}. Note that if
+ * Returns the length of the {@code String} representation
+ * of this {@code StringJoiner}. Note that if
* no add methods have been called, then the length of the {@code String}
* representation (either {@code prefix + suffix} or {@code emptyValue})
* will be returned. The value should be equivalent to
--- a/jdk/src/share/classes/java/util/concurrent/Callable.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/Callable.java Thu Dec 05 10:33:57 2013 -0800
@@ -54,6 +54,7 @@
* @author Doug Lea
* @param <V> the result type of method {@code call}
*/
+@FunctionalInterface
public interface Callable<V> {
/**
* Computes a result, or throws an exception if unable to do so.
--- a/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java Thu Dec 05 10:33:57 2013 -0800
@@ -2004,7 +2004,7 @@
}
if (dst == null)
dst = new CompletableFuture<U>();
- if (e == null || ex != null)
+ if (ex != null)
dst.internalComplete(null, ex);
}
helpPostComplete();
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java Thu Dec 05 10:33:57 2013 -0800
@@ -49,7 +49,6 @@
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.Set;
import java.util.Spliterator;
import java.util.concurrent.ConcurrentMap;
@@ -381,19 +380,21 @@
* progress. Resizing proceeds by transferring bins, one by one,
* from the table to the next table. However, threads claim small
* blocks of indices to transfer (via field transferIndex) before
- * doing so, reducing contention. Because we are using
- * power-of-two expansion, the elements from each bin must either
- * stay at same index, or move with a power of two offset. We
- * eliminate unnecessary node creation by catching cases where old
- * nodes can be reused because their next fields won't change. On
- * average, only about one-sixth of them need cloning when a table
- * doubles. The nodes they replace will be garbage collectable as
- * soon as they are no longer referenced by any reader thread that
- * may be in the midst of concurrently traversing table. Upon
- * transfer, the old table bin contains only a special forwarding
- * node (with hash field "MOVED") that contains the next table as
- * its key. On encountering a forwarding node, access and update
- * operations restart, using the new table.
+ * doing so, reducing contention. A generation stamp in field
+ * sizeCtl ensures that resizings do not overlap. Because we are
+ * using power-of-two expansion, the elements from each bin must
+ * either stay at same index, or move with a power of two
+ * offset. We eliminate unnecessary node creation by catching
+ * cases where old nodes can be reused because their next fields
+ * won't change. On average, only about one-sixth of them need
+ * cloning when a table doubles. The nodes they replace will be
+ * garbage collectable as soon as they are no longer referenced by
+ * any reader thread that may be in the midst of concurrently
+ * traversing table. Upon transfer, the old table bin contains
+ * only a special forwarding node (with hash field "MOVED") that
+ * contains the next table as its key. On encountering a
+ * forwarding node, access and update operations restart, using
+ * the new table.
*
* Each bin transfer requires its bin lock, which can stall
* waiting for locks while resizing. However, because other
@@ -570,6 +571,23 @@
*/
private static final int MIN_TRANSFER_STRIDE = 16;
+ /**
+ * The number of bits used for generation stamp in sizeCtl.
+ * Must be at least 6 for 32bit arrays.
+ */
+ private static int RESIZE_STAMP_BITS = 16;
+
+ /**
+ * The maximum number of threads that can help resize.
+ * Must fit in 32 - RESIZE_STAMP_BITS bits.
+ */
+ private static final int MAX_RESIZERS = (1 << (32 - RESIZE_STAMP_BITS)) - 1;
+
+ /**
+ * The bit shift for recording size stamp in sizeCtl.
+ */
+ private static final int RESIZE_STAMP_SHIFT = 32 - RESIZE_STAMP_BITS;
+
/*
* Encodings for Node hash fields. See above for explanation.
*/
@@ -727,7 +745,7 @@
* errors by users, these checks must operate on local variables,
* which accounts for some odd-looking inline assignments below.
* Note that calls to setTabAt always occur within locked regions,
- * and so in principle require only release ordering, not need
+ * and so in principle require only release ordering, not
* full volatile semantics, but are currently coded as volatile
* writes to be conservative.
*/
@@ -2192,6 +2210,14 @@
/* ---------------- Table Initialization and Resizing -------------- */
/**
+ * Returns the stamp bits for resizing a table of size n.
+ * Must be negative when shifted left by RESIZE_STAMP_SHIFT.
+ */
+ static final int resizeStamp(int n) {
+ return Integer.numberOfLeadingZeros(n) | (1 << (RESIZE_STAMP_BITS - 1));
+ }
+
+ /**
* Initializes table, using the size recorded in sizeCtl.
*/
private final Node<K,V>[] initTable() {
@@ -2245,17 +2271,20 @@
s = sumCount();
}
if (check >= 0) {
- Node<K,V>[] tab, nt; int sc;
+ Node<K,V>[] tab, nt; int n, sc;
while (s >= (long)(sc = sizeCtl) && (tab = table) != null &&
- tab.length < MAXIMUM_CAPACITY) {
+ (n = tab.length) < MAXIMUM_CAPACITY) {
+ int rs = resizeStamp(n);
if (sc < 0) {
- if (sc == -1 || transferIndex <= 0 ||
- (nt = nextTable) == null)
+ if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 ||
+ sc == rs + MAX_RESIZERS || (nt = nextTable) == null ||
+ transferIndex <= 0)
break;
- if (U.compareAndSwapInt(this, SIZECTL, sc, sc - 1))
+ if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1))
transfer(tab, nt);
}
- else if (U.compareAndSwapInt(this, SIZECTL, sc, -2))
+ else if (U.compareAndSwapInt(this, SIZECTL, sc,
+ (rs << RESIZE_STAMP_SHIFT) + 2))
transfer(tab, null);
s = sumCount();
}
@@ -2267,11 +2296,15 @@
*/
final Node<K,V>[] helpTransfer(Node<K,V>[] tab, Node<K,V> f) {
Node<K,V>[] nextTab; int sc;
- if ((f instanceof ForwardingNode) &&
+ if (tab != null && (f instanceof ForwardingNode) &&
(nextTab = ((ForwardingNode<K,V>)f).nextTable) != null) {
- while (transferIndex > 0 && nextTab == nextTable &&
- (sc = sizeCtl) < -1) {
- if (U.compareAndSwapInt(this, SIZECTL, sc, sc - 1)) {
+ int rs = resizeStamp(tab.length);
+ while (nextTab == nextTable && table == tab &&
+ (sc = sizeCtl) < 0) {
+ if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 ||
+ sc == rs + MAX_RESIZERS || transferIndex <= 0)
+ break;
+ if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) {
transfer(tab, nextTab);
break;
}
@@ -2309,9 +2342,21 @@
}
else if (c <= sc || n >= MAXIMUM_CAPACITY)
break;
- else if (tab == table &&
- U.compareAndSwapInt(this, SIZECTL, sc, -2))
- transfer(tab, null);
+ else if (tab == table) {
+ int rs = resizeStamp(n);
+ if (sc < 0) {
+ Node<K,V>[] nt;
+ if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 ||
+ sc == rs + MAX_RESIZERS || (nt = nextTable) == null ||
+ transferIndex <= 0)
+ break;
+ if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1))
+ transfer(tab, nt);
+ }
+ else if (U.compareAndSwapInt(this, SIZECTL, sc,
+ (rs << RESIZE_STAMP_SHIFT) + 2))
+ transfer(tab, null);
+ }
}
}
@@ -2366,8 +2411,8 @@
sizeCtl = (n << 1) - (n >>> 1);
return;
}
- if (U.compareAndSwapInt(this, SIZECTL, sc = sizeCtl, ++sc)) {
- if (sc != -1)
+ if (U.compareAndSwapInt(this, SIZECTL, sc = sizeCtl, sc - 1)) {
+ if ((sc - 2) != resizeStamp(n) << RESIZE_STAMP_SHIFT)
return;
finishing = advance = true;
i = n; // recheck before commit
@@ -2566,11 +2611,8 @@
private final void treeifyBin(Node<K,V>[] tab, int index) {
Node<K,V> b; int n, sc;
if (tab != null) {
- if ((n = tab.length) < MIN_TREEIFY_CAPACITY) {
- if (tab == table && (sc = sizeCtl) >= 0 &&
- U.compareAndSwapInt(this, SIZECTL, sc, -2))
- transfer(tab, null);
- }
+ if ((n = tab.length) < MIN_TREEIFY_CAPACITY)
+ tryPresize(n << 1);
else if ((b = tabAt(tab, index)) != null && b.hash >= 0) {
synchronized (b) {
if (tabAt(tab, index) == b) {
@@ -2768,7 +2810,7 @@
private final void contendedLock() {
boolean waiting = false;
for (int s;;) {
- if (((s = lockState) & WRITER) == 0) {
+ if (((s = lockState) & ~WAITER) == 0) {
if (U.compareAndSwapInt(this, LOCKSTATE, s, WRITER)) {
if (waiting)
waiter = null;
@@ -2793,12 +2835,13 @@
*/
final Node<K,V> find(int h, Object k) {
if (k != null) {
- for (Node<K,V> e = first; e != null; e = e.next) {
+ for (Node<K,V> e = first; e != null; ) {
int s; K ek;
if (((s = lockState) & (WAITER|WRITER)) != 0) {
if (e.hash == h &&
((ek = e.key) == k || (ek != null && k.equals(ek))))
return e;
+ e = e.next;
}
else if (U.compareAndSwapInt(this, LOCKSTATE, s,
s + READER)) {
@@ -4454,7 +4497,7 @@
}
public final boolean removeAll(Collection<?> c) {
- Objects.requireNonNull(c);
+ if (c == null) throw new NullPointerException();
boolean modified = false;
for (Iterator<E> it = iterator(); it.hasNext();) {
if (c.contains(it.next())) {
@@ -4466,7 +4509,7 @@
}
public final boolean retainAll(Collection<?> c) {
- Objects.requireNonNull(c);
+ if (c == null) throw new NullPointerException();
boolean modified = false;
for (Iterator<E> it = iterator(); it.hasNext();) {
if (!c.contains(it.next())) {
--- a/jdk/src/share/classes/java/util/logging/LogManager.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java Thu Dec 05 10:33:57 2013 -0800
@@ -146,7 +146,14 @@
// The global LogManager object
private static final LogManager manager;
- private Properties props = new Properties();
+ // 'props' is assigned within a lock but accessed without it.
+ // Declaring it volatile makes sure that another thread will not
+ // be able to see a partially constructed 'props' object.
+ // (seeing a partially constructed 'props' object can result in
+ // NPE being thrown in Hashtable.get(), because it leaves the door
+ // open for props.getProperties() to be called before the construcor
+ // of Hashtable is actually completed).
+ private volatile Properties props = new Properties();
private final static Level defaultLevel = Level.INFO;
// The map of the registered listeners. The map value is the registration
@@ -670,7 +677,7 @@
if (logger == null) {
// Hashtable holds stale weak reference
// to a logger which has been GC-ed.
- removeLogger(name);
+ ref.dispose();
}
return logger;
}
@@ -756,7 +763,7 @@
// It's possible that the Logger was GC'ed after a
// drainLoggerRefQueueBounded() call above so allow
// a new one to be registered.
- removeLogger(name);
+ ref.dispose();
} else {
// We already have a registered logger with the given name.
return false;
@@ -808,10 +815,8 @@
return true;
}
- // note: all calls to removeLogger are synchronized on LogManager's
- // intrinsic lock
- void removeLogger(String name) {
- namedLoggers.remove(name);
+ synchronized void removeLoggerRef(String name, LoggerWeakRef ref) {
+ namedLoggers.remove(name, ref);
}
synchronized Enumeration<String> getLoggerNames() {
@@ -993,6 +998,7 @@
private String name; // for namedLoggers cleanup
private LogNode node; // for loggerRef cleanup
private WeakReference<Logger> parentRef; // for kids cleanup
+ private boolean disposed = false; // avoid calling dispose twice
LoggerWeakRef(Logger logger) {
super(logger, loggerRefQueue);
@@ -1002,14 +1008,45 @@
// dispose of this LoggerWeakRef object
void dispose() {
- if (node != null) {
- // if we have a LogNode, then we were a named Logger
- // so clear namedLoggers weak ref to us
- node.context.removeLogger(name);
- name = null; // clear our ref to the Logger's name
+ // Avoid calling dispose twice. When a Logger is gc'ed, its
+ // LoggerWeakRef will be enqueued.
+ // However, a new logger of the same name may be added (or looked
+ // up) before the queue is drained. When that happens, dispose()
+ // will be called by addLocalLogger() or findLogger().
+ // Later when the queue is drained, dispose() will be called again
+ // for the same LoggerWeakRef. Marking LoggerWeakRef as disposed
+ // avoids processing the data twice (even though the code should
+ // now be reentrant).
+ synchronized(this) {
+ // Note to maintainers:
+ // Be careful not to call any method that tries to acquire
+ // another lock from within this block - as this would surely
+ // lead to deadlocks, given that dispose() can be called by
+ // multiple threads, and from within different synchronized
+ // methods/blocks.
+ if (disposed) return;
+ disposed = true;
+ }
- node.loggerRef = null; // clear LogNode's weak ref to us
- node = null; // clear our ref to LogNode
+ final LogNode n = node;
+ if (n != null) {
+ // n.loggerRef can only be safely modified from within
+ // a lock on LoggerContext. removeLoggerRef is already
+ // synchronized on LoggerContext so calling
+ // n.context.removeLoggerRef from within this lock is safe.
+ synchronized (n.context) {
+ // if we have a LogNode, then we were a named Logger
+ // so clear namedLoggers weak ref to us
+ n.context.removeLoggerRef(name, this);
+ name = null; // clear our ref to the Logger's name
+
+ // LogNode may have been reused - so only clear
+ // LogNode.loggerRef if LogNode.loggerRef == this
+ if (n.loggerRef == this) {
+ n.loggerRef = null; // clear LogNode's weak ref to us
+ }
+ node = null; // clear our ref to LogNode
+ }
}
if (parentRef != null) {
@@ -1062,7 +1099,7 @@
// - maximum: 10.9 ms
//
private final static int MAX_ITERATIONS = 400;
- final synchronized void drainLoggerRefQueueBounded() {
+ final void drainLoggerRefQueueBounded() {
for (int i = 0; i < MAX_ITERATIONS; i++) {
if (loggerRefQueue == null) {
// haven't finished loading LogManager yet
--- a/jdk/src/share/classes/java/util/logging/Logger.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/Logger.java Thu Dec 05 10:33:57 2013 -0800
@@ -218,12 +218,46 @@
public class Logger {
private static final Handler emptyHandlers[] = new Handler[0];
private static final int offValue = Level.OFF.intValue();
- private LogManager manager;
+
+ static final String SYSTEM_LOGGER_RB_NAME = "sun.util.logging.resources.logging";
+
+ // This class is immutable and it is important that it remains so.
+ private static final class LoggerBundle {
+ final String resourceBundleName; // Base name of the bundle.
+ final ResourceBundle userBundle; // Bundle set through setResourceBundle.
+ private LoggerBundle(String resourceBundleName, ResourceBundle bundle) {
+ this.resourceBundleName = resourceBundleName;
+ this.userBundle = bundle;
+ }
+ boolean isSystemBundle() {
+ return SYSTEM_LOGGER_RB_NAME.equals(resourceBundleName);
+ }
+ static LoggerBundle get(String name, ResourceBundle bundle) {
+ if (name == null && bundle == null) {
+ return NO_RESOURCE_BUNDLE;
+ } else if (SYSTEM_LOGGER_RB_NAME.equals(name) && bundle == null) {
+ return SYSTEM_BUNDLE;
+ } else {
+ return new LoggerBundle(name, bundle);
+ }
+ }
+ }
+
+ // This instance will be shared by all loggers created by the system
+ // code
+ private static final LoggerBundle SYSTEM_BUNDLE =
+ new LoggerBundle(SYSTEM_LOGGER_RB_NAME, null);
+
+ // This instance indicates that no resource bundle has been specified yet,
+ // and it will be shared by all loggers which have no resource bundle.
+ private static final LoggerBundle NO_RESOURCE_BUNDLE =
+ new LoggerBundle(null, null);
+
+ private volatile LogManager manager;
private String name;
private final CopyOnWriteArrayList<Handler> handlers =
new CopyOnWriteArrayList<>();
- private String resourceBundleName; // Base name of the bundle.
- private ResourceBundle userBundle; // Bundle set through setResourceBundle.
+ private volatile LoggerBundle loggerBundle = NO_RESOURCE_BUNDLE;
private volatile boolean useParentHandlers = true;
private volatile Filter filter;
private boolean anonymous;
@@ -641,7 +675,7 @@
* @return localization bundle name (may be {@code null})
*/
public String getResourceBundleName() {
- return resourceBundleName;
+ return loggerBundle.resourceBundleName;
}
/**
@@ -710,8 +744,9 @@
// resource bundle and then call "void log(LogRecord)".
private void doLog(LogRecord lr) {
lr.setLoggerName(name);
- final ResourceBundle bundle = getEffectiveResourceBundle();
- final String ebname = getEffectiveResourceBundleName();
+ final LoggerBundle lb = getEffectiveLoggerBundle();
+ final ResourceBundle bundle = lb.userBundle;
+ final String ebname = lb.resourceBundleName;
if (ebname != null && bundle != null) {
lr.setResourceBundleName(ebname);
lr.setResourceBundle(bundle);
@@ -1757,8 +1792,6 @@
return useParentHandlers;
}
- static final String SYSTEM_LOGGER_RB_NAME = "sun.util.logging.resources.logging";
-
private static ResourceBundle findSystemResourceBundle(final Locale locale) {
// the resource bundle is in a restricted package
return AccessController.doPrivileged(new PrivilegedAction<ResourceBundle>() {
@@ -1801,11 +1834,12 @@
}
Locale currentLocale = Locale.getDefault();
+ final LoggerBundle lb = loggerBundle;
// Normally we should hit on our simple one entry cache.
- if (userBundle != null &&
- name.equals(resourceBundleName)) {
- return userBundle;
+ if (lb.userBundle != null &&
+ name.equals(lb.resourceBundleName)) {
+ return lb.userBundle;
} else if (catalog != null && currentLocale.equals(catalogLocale)
&& name.equals(catalogName)) {
return catalog;
@@ -1864,17 +1898,18 @@
// Synchronized to prevent races in setting the fields.
private synchronized void setupResourceInfo(String name,
Class<?> callersClass) {
- if (resourceBundleName != null) {
+ final LoggerBundle lb = loggerBundle;
+ if (lb.resourceBundleName != null) {
// this Logger already has a ResourceBundle
- if (resourceBundleName.equals(name)) {
+ if (lb.resourceBundleName.equals(name)) {
// the names match so there is nothing more to do
return;
}
// cannot change ResourceBundles once they are set
throw new IllegalArgumentException(
- resourceBundleName + " != " + name);
+ lb.resourceBundleName + " != " + name);
}
if (name == null) {
@@ -1890,7 +1925,10 @@
throw new MissingResourceException("Can't find " + name + " bundle",
name, "");
}
- resourceBundleName = name;
+
+ // if lb.userBundle is not null we won't reach this line.
+ assert lb.userBundle == null;
+ loggerBundle = LoggerBundle.get(name, null);
}
/**
@@ -1920,16 +1958,16 @@
}
synchronized (this) {
- final boolean canReplaceResourceBundle = resourceBundleName == null
- || resourceBundleName.equals(baseName);
+ LoggerBundle lb = loggerBundle;
+ final boolean canReplaceResourceBundle = lb.resourceBundleName == null
+ || lb.resourceBundleName.equals(baseName);
if (!canReplaceResourceBundle) {
throw new IllegalArgumentException("can't replace resource bundle");
}
- userBundle = bundle;
- resourceBundleName = baseName;
+ loggerBundle = LoggerBundle.get(baseName, bundle);
}
}
@@ -2082,45 +2120,44 @@
// Private method to get the potentially inherited
- // resource bundle name for this Logger.
- // May return null
- private String getEffectiveResourceBundleName() {
- Logger target = this;
+ // resource bundle and resource bundle name for this Logger.
+ // This method never returns null.
+ private LoggerBundle getEffectiveLoggerBundle() {
+ final LoggerBundle lb = loggerBundle;
+ if (lb.isSystemBundle()) {
+ return SYSTEM_BUNDLE;
+ }
+
+ // first take care of this logger
+ final ResourceBundle b = getResourceBundle();
+ if (b != null && b == lb.userBundle) {
+ return lb;
+ } else if (b != null) {
+ // either lb.userBundle is null or getResourceBundle() is
+ // overriden
+ final String rbName = getResourceBundleName();
+ return LoggerBundle.get(rbName, b);
+ }
+
+ // no resource bundle was specified on this logger, look up the
+ // parent stack.
+ Logger target = this.parent;
while (target != null) {
- String rbn = target.getResourceBundleName();
- if (rbn != null) {
- return rbn;
+ final LoggerBundle trb = target.loggerBundle;
+ if (trb.isSystemBundle()) {
+ return SYSTEM_BUNDLE;
+ }
+ if (trb.userBundle != null) {
+ return trb;
+ }
+ final String rbName = target.getResourceBundleName();
+ if (rbName != null) {
+ return LoggerBundle.get(rbName,
+ findResourceBundle(rbName, true));
}
target = target.getParent();
}
- return null;
- }
-
-
- private ResourceBundle getEffectiveResourceBundle() {
- Logger target = this;
- if (SYSTEM_LOGGER_RB_NAME.equals(resourceBundleName)) return null;
- ResourceBundle localRB = getResourceBundle();
- if (localRB != null) {
- return localRB;
- }
-
- while (target != null) {
- final ResourceBundle rb = target.userBundle;
- if (rb != null) {
- return rb;
- }
- final String rbn = target.getResourceBundleName();
- if (rbn != null) {
- if (!SYSTEM_LOGGER_RB_NAME.equals(rbn)) {
- return findResourceBundle(rbn, true);
- } else {
- return null;
- }
- }
- target = target.getParent();
- }
- return null;
+ return NO_RESOURCE_BUNDLE;
}
}
--- a/jdk/src/share/classes/java/util/stream/Collectors.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/stream/Collectors.java Thu Dec 05 10:33:57 2013 -0800
@@ -505,14 +505,43 @@
*/
public static <T> Collector<T, ?, Double>
summingDouble(ToDoubleFunction<? super T> mapper) {
+ /*
+ * In the arrays allocated for the collect operation, index 0
+ * holds the high-order bits of the running sum and index 1
+ * holds the low-order bits of the sum computed via
+ * compensated summation.
+ */
return new CollectorImpl<>(
- () -> new double[1],
- (a, t) -> { a[0] += mapper.applyAsDouble(t); },
- (a, b) -> { a[0] += b[0]; return a; },
- a -> a[0], CH_NOID);
+ () -> new double[2],
+ (a, t) -> { sumWithCompensation(a, mapper.applyAsDouble(t)); },
+ (a, b) -> { sumWithCompensation(a, b[0]); return sumWithCompensation(a, b[1]); },
+ // Better error bounds to add both terms as the final sum
+ a -> a[0] + a[1],
+ CH_NOID);
}
/**
+ * Incorporate a new double value using Kahan summation /
+ * compensation summation.
+ *
+ * High-order bits of the sum are in intermediateSum[0], low-order
+ * bits of the sum are in intermediateSum[1], any additional
+ * elements are application-specific.
+ *
+ * @param intermediateSum the high-order and low-order words of the intermediate sum
+ * @param value the name value to be included in the running sum
+ */
+ static double[] sumWithCompensation(double[] intermediateSum, double value) {
+ double tmp = value - intermediateSum[1];
+ double sum = intermediateSum[0];
+ double velvel = sum + tmp; // Little wolf of rounding error
+ intermediateSum[1] = (velvel - sum) - tmp;
+ intermediateSum[0] = velvel;
+ return intermediateSum;
+ }
+
+
+ /**
* Returns a {@code Collector} that produces the arithmetic mean of an integer-valued
* function applied to the input elements. If no elements are present,
* the result is 0.
@@ -560,17 +589,31 @@
* value is a {@code NaN} or the sum is at any point a {@code NaN} then the
* average will be {@code NaN}.
*
+ * @implNote The {@code double} format can represent all
+ * consecutive integers in the range -2<sup>53</sup> to
+ * 2<sup>53</sup>. If the pipeline has more than 2<sup>53</sup>
+ * values, the divisor in the average computation will saturate at
+ * 2<sup>53</sup>, leading to additional numerical errors.
+ *
* @param <T> the type of the input elements
* @param mapper a function extracting the property to be summed
* @return a {@code Collector} that produces the sum of a derived property
*/
public static <T> Collector<T, ?, Double>
averagingDouble(ToDoubleFunction<? super T> mapper) {
+ /*
+ * In the arrays allocated for the collect operation, index 0
+ * holds the high-order bits of the running sum, index 1 holds
+ * the low-order bits of the sum computed via compensated
+ * summation, and index 2 holds the number of values seen.
+ */
return new CollectorImpl<>(
- () -> new double[2],
- (a, t) -> { a[0] += mapper.applyAsDouble(t); a[1]++; },
- (a, b) -> { a[0] += b[0]; a[1] += b[1]; return a; },
- a -> (a[1] == 0) ? 0.0d : a[0] / a[1], CH_NOID);
+ () -> new double[3],
+ (a, t) -> { sumWithCompensation(a, mapper.applyAsDouble(t)); a[2]++; },
+ (a, b) -> { sumWithCompensation(a, b[0]); sumWithCompensation(a, b[1]); a[2] += b[2]; return a; },
+ // Better error bounds to add both terms as the final sum to compute average
+ a -> (a[2] == 0) ? 0.0d : ((a[0] + a[1]) / a[2]),
+ CH_NOID);
}
/**
--- a/jdk/src/share/classes/java/util/stream/DoublePipeline.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/java/util/stream/DoublePipeline.java Thu Dec 05 10:33:57 2013 -0800
@@ -377,8 +377,23 @@
@Override
public final double sum() {
- // TODO: better algorithm to compensate for errors
- return reduce(0.0, Double::sum);
+ /*
+ * In the arrays allocated for the collect operation, index 0
+ * holds the high-order bits of the running sum and index 1
+ * holds the low-order bits of the sum computed via
+ * compensated summation.
+ */
+ double[] summation = collect(() -> new double[2],
+ (ll, d) -> {
+ Collectors.sumWithCompensation(ll, d);
+ },
+ (ll, rr) -> {
+ Collectors.sumWithCompensation(ll, rr[0]);
+ Collectors.sumWithCompensation(ll, rr[1]);
+ });
+
+ // Better error bounds to add both terms as the final sum
+ return summation[0] + summation[1];
}
@Override
@@ -391,20 +406,37 @@
return reduce(Math::max);
}
+ /**
+ * {@inheritDoc}
+ *
+ * @implNote The {@code double} format can represent all
+ * consecutive integers in the range -2<sup>53</sup> to
+ * 2<sup>53</sup>. If the pipeline has more than 2<sup>53</sup>
+ * values, the divisor in the average computation will saturate at
+ * 2<sup>53</sup>, leading to additional numerical errors.
+ */
@Override
public final OptionalDouble average() {
- double[] avg = collect(() -> new double[2],
- (ll, i) -> {
- ll[0]++;
- ll[1] += i;
+ /*
+ * In the arrays allocated for the collect operation, index 0
+ * holds the high-order bits of the running sum, index 1 holds
+ * the low-order bits of the sum computed via compensated
+ * summation, and index 2 holds the number of values seen.
+ */
+ double[] avg = collect(() -> new double[3],
+ (ll, d) -> {
+ ll[2]++;
+ Collectors.sumWithCompensation(ll, d);
},
(ll, rr) -> {
- ll[0] += rr[0];
- ll[1] += rr[1];
+ Collectors.sumWithCompensation(ll, rr[0]);
+ Collectors.sumWithCompensation(ll, rr[1]);
+ ll[2] += rr[2];
});
- return avg[0] > 0
- ? OptionalDouble.of(avg[1] / avg[0])
- : OptionalDouble.empty();
+ return avg[2] > 0
+ // Better error bounds to add both terms as the final sum to compute average
+ ? OptionalDouble.of((avg[0] + avg[1]) / avg[2])
+ : OptionalDouble.empty();
}
@Override
--- a/jdk/src/share/classes/javax/crypto/Cipher.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/crypto/Cipher.java Thu Dec 05 10:33:57 2013 -0800
@@ -62,17 +62,17 @@
* algorithm (e.g., <i>DES</i>), and may be followed by a feedback mode and
* padding scheme.
*
- * <p> A transformation is of the form:<p>
+ * <p> A transformation is of the form:
*
* <ul>
* <li>"<i>algorithm/mode/padding</i>" or
- * <p>
+ *
* <li>"<i>algorithm</i>"
* </ul>
*
* <P> (in the latter case,
* provider-specific default values for the mode and padding scheme are used).
- * For example, the following is a valid transformation:<p>
+ * For example, the following is a valid transformation:
*
* <pre>
* Cipher c = Cipher.getInstance("<i>DES/CBC/PKCS5Padding</i>");
--- a/jdk/src/share/classes/javax/crypto/CipherSpi.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/crypto/CipherSpi.java Thu Dec 05 10:33:57 2013 -0800
@@ -62,17 +62,17 @@
* algorithm (e.g., <i>DES</i>), and may be followed by a feedback mode and
* padding scheme.
*
- * <p> A transformation is of the form:<p>
+ * <p> A transformation is of the form:
*
* <ul>
* <li>"<i>algorithm/mode/padding</i>" or
- * <p>
+ *
* <li>"<i>algorithm</i>"
* </ul>
*
* <P> (in the latter case,
* provider-specific default values for the mode and padding scheme are used).
- * For example, the following is a valid transformation:<p>
+ * For example, the following is a valid transformation:
*
* <pre>
* Cipher c = Cipher.getInstance("<i>DES/CBC/PKCS5Padding</i>");
@@ -129,7 +129,7 @@
* <i>DES/CBC/PKCS5Padding</i>, one that implements
* <i>DES/CFB/PKCS5Padding</i>, and yet another one that implements
* <i>DES/OFB/PKCS5Padding</i>. That provider would have the following
- * <code>Cipher</code> properties in its master class:<p>
+ * <code>Cipher</code> properties in its master class:
*
* <ul>
*
@@ -160,7 +160,7 @@
* and one for <i>OFB</i>), one class for <i>PKCS5Padding</i>,
* and a generic <i>DES</i> class that subclasses from <code>CipherSpi</code>.
* That provider would have the following
- * <code>Cipher</code> properties in its master class:<p>
+ * <code>Cipher</code> properties in its master class:
*
* <ul>
*
@@ -197,20 +197,20 @@
* Check if the provider has registered a subclass of <code>CipherSpi</code>
* for the specified "<i>algorithm/mode/padding</i>" transformation.
* <p>If the answer is YES, instantiate it.
- * <p>If the answer is NO, go to the next step.<p>
+ * <p>If the answer is NO, go to the next step.
* <li>
* Check if the provider has registered a subclass of <code>CipherSpi</code>
* for the sub-transformation "<i>algorithm/mode</i>".
* <p>If the answer is YES, instantiate it, and call
* <code>engineSetPadding(<i>padding</i>)</code> on the new instance.
- * <p>If the answer is NO, go to the next step.<p>
+ * <p>If the answer is NO, go to the next step.
* <li>
* Check if the provider has registered a subclass of <code>CipherSpi</code>
* for the sub-transformation "<i>algorithm//padding</i>" (note the double
* slashes).
* <p>If the answer is YES, instantiate it, and call
* <code>engineSetMode(<i>mode</i>)</code> on the new instance.
- * <p>If the answer is NO, go to the next step.<p>
+ * <p>If the answer is NO, go to the next step.
* <li>
* Check if the provider has registered a subclass of <code>CipherSpi</code>
* for the sub-transformation "<i>algorithm</i>".
--- a/jdk/src/share/classes/javax/crypto/KeyGenerator.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/crypto/KeyGenerator.java Thu Dec 05 10:33:57 2013 -0800
@@ -66,7 +66,6 @@
* algorithm-independent <code>init</code> 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>
*
* <li><b>Algorithm-Specific Initialization</b>
* <p>For situations where a set of algorithm-specific parameters already
--- a/jdk/src/share/classes/javax/crypto/SealedObject.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/crypto/SealedObject.java Thu Dec 05 10:33:57 2013 -0800
@@ -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
@@ -50,7 +50,7 @@
* to a SealedObject.
*
* <p> The original object that was sealed can be recovered in two different
- * ways: <p>
+ * ways:
*
* <ul>
*
@@ -68,8 +68,6 @@
* decryption key, it could hand over the cipher object to
* another party who then unseals the sealed object.
*
- * <p>
- *
* <li>by using one of the
* {@link #getObject(java.security.Key) getObject} methods
* that take a <code>Key</code> object.
--- a/jdk/src/share/classes/javax/net/ssl/SSLEngine.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/net/ssl/SSLEngine.java Thu Dec 05 10:33:57 2013 -0800
@@ -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
@@ -329,7 +329,7 @@
* is saved. All future delegated tasks will be processed using this
* context: that is, all access control decisions will be made using the
* context captured at engine creation.
- * <P>
+ *
* <HR>
*
* <B>Concurrency Notes</B>:
@@ -345,7 +345,7 @@
* out-of-order, unexpected or fatal results may occur.
* <P>
* For example:
- * <P>
+ *
* <pre>
* synchronized (outboundLock) {
* sslEngine.wrap(src, dst);
--- a/jdk/src/share/classes/javax/net/ssl/SSLPermission.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/net/ssl/SSLPermission.java Thu Dec 05 10:33:57 2013 -0800
@@ -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
@@ -43,7 +43,6 @@
* The following table lists all the possible SSLPermission target names,
* and for each provides a description of what the permission allows
* and a discussion of the risks of granting code the permission.
- * <P>
*
* <table border=1 cellpadding=5
* summary="permission name, what it allows, and associated risks">
--- a/jdk/src/share/classes/javax/script/ScriptEngineFactory.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/script/ScriptEngineFactory.java Thu Dec 05 10:33:57 2013 -0800
@@ -144,7 +144,7 @@
* Returns a String which can be used to invoke a method of a Java object using the syntax
* of the supported scripting language. For instance, an implementation for a Javascript
* engine might be;
- * <p>
+ *
* <pre>{@code
* public String getMethodCallSyntax(String obj,
* String m, String... args) {
@@ -180,7 +180,7 @@
* Returns a String that can be used as a statement to display the specified String using
* the syntax of the supported scripting language. For instance, the implementation for a Perl
* engine might be;
- * <p>
+ *
* <pre><code>
* public String getOutputStatement(String toDisplay) {
* return "print(" + toDisplay + ")";
@@ -198,7 +198,7 @@
/**
* Returns a valid scripting language executable program with given statements.
* For instance an implementation for a PHP engine might be:
- * <p>
+ *
* <pre>{@code
* public String getProgram(String... statements) {
* String retval = "<?\n";
--- a/jdk/src/share/classes/javax/security/auth/PrivateCredentialPermission.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/security/auth/PrivateCredentialPermission.java Thu Dec 05 10:33:57 2013 -0800
@@ -228,8 +228,8 @@
* <p>
*
* This method returns true if:
- * <p><ul>
- * <li> <i>p</i> is an instanceof PrivateCredentialPermission and <p>
+ * <ul>
+ * <li> <i>p</i> is an instanceof PrivateCredentialPermission and
* <li> the target name for <i>p</i> is implied by this object's
* target name. For example:
* <pre>
--- a/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java Thu Dec 05 10:33:57 2013 -0800
@@ -48,14 +48,14 @@
* <p>
* For example, to specify the "host" service use of a forwardable TGT the
* target permission is specified as follows:
- * <p>
+ *
* <pre>
* DelegationPermission("\"host/foo.example.com@EXAMPLE.COM\" \"krbtgt/EXAMPLE.COM@EXAMPLE.COM\"");
* </pre>
* <p>
* To give the "backup" service a proxiable nfs service ticket the target permission
* might be specified:
- * <p>
+ *
* <pre>
* DelegationPermission("\"backup/bar.example.com@EXAMPLE.COM\" \"nfs/home.EXAMPLE.COM@EXAMPLE.COM\"");
* </pre>
--- a/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java Thu Dec 05 10:33:57 2013 -0800
@@ -62,7 +62,7 @@
* Authentication Service exchange.
* <p>
* The possible actions are:
- * <p>
+ *
* <pre>
* initiate - allow the caller to use the credential to
* initiate a security context with a service
@@ -75,7 +75,7 @@
*
* For example, to specify the permission to access to the TGT to
* initiate a security context the permission is constructed as follows:
- * <p>
+ *
* <pre>
* ServicePermission("krbtgt/EXAMPLE.COM@EXAMPLE.COM", "initiate");
* </pre>
@@ -89,7 +89,7 @@
* For a Kerberized server the action is "accept". For example, the permission
* necessary to access and use the secret key of the Kerberized "host"
* service (telnet and the likes) would be constructed as follows:
- * <p>
+ *
* <pre>
* ServicePermission("host/foo.example.com@EXAMPLE.COM", "accept");
* </pre>
--- a/jdk/src/share/classes/javax/security/auth/login/LoginContext.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/security/auth/login/LoginContext.java Thu Dec 05 10:33:57 2013 -0800
@@ -101,11 +101,11 @@
* <li> If the constructor has a Subject
* input parameter, the LoginContext uses the caller-specified
* Subject object.
- * <p>
+ *
* <li> If the caller specifies a {@code null} Subject
* and a {@code null} value is permitted,
* the LoginContext instantiates a new Subject.
- * <p>
+ *
* <li> If the constructor does <b>not</b> have a Subject
* input parameter, the LoginContext instantiates a new Subject.
* <p>
@@ -132,7 +132,7 @@
* {@code getAppConfigurationEntry} with the name, "<i>other</i>"
* (the default entry name). If there is no entry for "<i>other</i>",
* then a {@code LoginException} is thrown.
- * <p>
+ *
* <li> When LoginContext uses the installed Configuration, the caller
* requires the createLoginContext.<em>name</em> and possibly
* createLoginContext.other AuthPermissions. Furthermore, the
@@ -141,7 +141,7 @@
* perform security-sensitive tasks (such as connecting to remote hosts,
* and updating the Subject) will require the respective permissions, but
* the callers of the LoginContext will not require those permissions.
- * <p>
+ *
* <li> When LoginContext uses a caller-specified Configuration, the caller
* does not require any createLoginContext AuthPermission. The LoginContext
* saves the {@code AccessControlContext} for the caller,
@@ -158,7 +158,7 @@
* <li> If the constructor has a CallbackHandler
* input parameter, the LoginContext uses the caller-specified
* CallbackHandler object.
- * <p>
+ *
* <li> If the constructor does <b>not</b> have a CallbackHandler
* input parameter, or if the caller specifies a {@code null}
* CallbackHandler object (and a {@code null} value is permitted),
@@ -171,7 +171,7 @@
* with users. The caller thus assumes that the configured
* modules have alternative means for authenticating the user.
*
- * <p>
+ *
* <li> When the LoginContext uses the installed Configuration (instead of
* a caller-specified Configuration, see above),
* then this LoginContext must wrap any
--- a/jdk/src/share/classes/javax/security/auth/x500/X500Principal.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/security/auth/x500/X500Principal.java Thu Dec 05 10:33:57 2013 -0800
@@ -314,7 +314,7 @@
* this method returns an RFC 2253 conformant string representation
* with the following additional canonicalizations:
*
- * <p><ol>
+ * <ol>
* <li> Leading zeros are removed from attribute types
* that are encoded as dotted decimal OIDs
* <li> DirectoryString attribute values of type
--- a/jdk/src/share/classes/javax/swing/Action.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/Action.java Thu Dec 05 10:33:57 2013 -0800
@@ -67,7 +67,7 @@
* functionality and broadcast of property changes. For this reason,
* you should take care to only use <code>Action</code>s where their benefits
* are desired, and use simple <code>ActionListener</code>s elsewhere.
- * <p>
+ * <br>
*
* <h3><a name="buttonActions"></a>Swing Components Supporting <code>Action</code></h3>
* <p>
@@ -93,7 +93,7 @@
* <code>null</code> property value in an <code>Action</code> (or a
* <code>Action</code> that is <code>null</code>) results in the
* button's corresponding property being set to <code>null</code>.
- * <p>
+ *
* <table border="1" cellpadding="1" cellspacing="0"
* summary="Supported Action properties">
* <tr valign="top" align="left">
--- a/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java Thu Dec 05 10:33:57 2013 -0800
@@ -83,7 +83,7 @@
// implements javax.swing.ComboBoxModel
/**
* Set the value of the selected item. The selected item may be null.
- * <p>
+ *
* @param anObject The combo box value or null for no selection.
*/
public void setSelectedItem(Object anObject) {
--- a/jdk/src/share/classes/javax/swing/GroupLayout.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/GroupLayout.java Thu Dec 05 10:33:57 2013 -0800
@@ -100,7 +100,7 @@
* The following diagram shows the same three components, but with the
* parallel group along the horizontal axis and the sequential group along
* the vertical axis.
- * <p>
+ *
* <p style="text-align:center">
* <img src="doc-files/groupLayout.2.gif" alt="Sequential group along the vertical axis in three components">
* <p>
--- a/jdk/src/share/classes/javax/swing/InputVerifier.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/InputVerifier.java Thu Dec 05 10:33:57 2013 -0800
@@ -47,7 +47,7 @@
* either by clicking in it or by pressing TAB. However, if another string
* is entered in the first text field, then the user will be unable to
* transfer focus to the second text field.
- * <p>
+ *
* <pre>
* import java.awt.*;
* import java.util.*;
--- a/jdk/src/share/classes/javax/swing/JComponent.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JComponent.java Thu Dec 05 10:33:57 2013 -0800
@@ -4827,7 +4827,6 @@
* updating differs from the AWT because programs generally no
* longer need to invoke <code>validate</code> to get the contents of the
* GUI to update.
- * <p>
*
* @see java.awt.Component#invalidate
* @see java.awt.Container#validate
--- a/jdk/src/share/classes/javax/swing/JDialog.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JDialog.java Thu Dec 05 10:33:57 2013 -0800
@@ -701,7 +701,7 @@
* Sets the operation that will happen by default when
* the user initiates a "close" on this dialog.
* You must specify one of the following choices:
- * <p>
+ * <br><br>
* <ul>
* <li>{@code DO_NOTHING_ON_CLOSE}
* (defined in {@code WindowConstants}):
--- a/jdk/src/share/classes/javax/swing/JFrame.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JFrame.java Thu Dec 05 10:33:57 2013 -0800
@@ -324,7 +324,7 @@
* Sets the operation that will happen by default when
* the user initiates a "close" on this frame.
* You must specify one of the following choices:
- * <p>
+ * <br><br>
* <ul>
* <li><code>DO_NOTHING_ON_CLOSE</code>
* (defined in <code>WindowConstants</code>):
--- a/jdk/src/share/classes/javax/swing/JInternalFrame.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JInternalFrame.java Thu Dec 05 10:33:57 2013 -0800
@@ -1645,7 +1645,7 @@
* Sets the operation that will happen by default when
* the user initiates a "close" on this internal frame.
* The possible choices are:
- * <p>
+ * <br><br>
* <dl>
* <dt><code>DO_NOTHING_ON_CLOSE</code>
* <dd> Do nothing.
--- a/jdk/src/share/classes/javax/swing/JLayeredPane.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JLayeredPane.java Thu Dec 05 10:33:57 2013 -0800
@@ -43,7 +43,7 @@
* For task-oriented documentation and examples of using layered panes see
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/layeredpane.html">How to Use a Layered Pane</a>,
* a section in <em>The Java Tutorial</em>.
- * <P>
+ *
* <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout">
* <TR>
* <TD ALIGN="CENTER">
--- a/jdk/src/share/classes/javax/swing/JList.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JList.java Thu Dec 05 10:33:57 2013 -0800
@@ -950,7 +950,7 @@
/**
* Defines the way list cells are layed out. Consider a {@code JList}
* with five cells. Cells can be layed out in one of the following ways:
- * <p>
+ *
* <pre>
* VERTICAL: 0
* 1
--- a/jdk/src/share/classes/javax/swing/JOptionPane.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JOptionPane.java Thu Dec 05 10:33:57 2013 -0800
@@ -106,7 +106,6 @@
* <p>
* All dialogs are modal. Each <code>showXxxDialog</code> method blocks
* the caller until the user's interaction is complete.
- * <p>
*
* <table cellspacing=6 cellpadding=4 border=0 style="float:right" summary="layout">
* <tr>
@@ -143,7 +142,7 @@
* just below the component. This parameter may be <code>null</code>,
* in which case a default <code>Frame</code> is used as the parent,
* and the dialog will be
- * centered on the screen (depending on the L&F).
+ * centered on the screen (depending on the {@literal L&F}).
* <dt><a name=message>message</a><dd>
* A descriptive message to be placed in the dialog box.
* In the most common usage, message is just a <code>String</code> or
@@ -225,42 +224,42 @@
* <dt>Show an error dialog that displays the message, 'alert':
* <dd><code>
* JOptionPane.showMessageDialog(null, "alert", "alert", JOptionPane.ERROR_MESSAGE);
- * </code><p>
+ * </code>
* <dt>Show an internal information dialog with the message, 'information':
- * <dd><code>
- * JOptionPane.showInternalMessageDialog(frame, "information",<br>
- * <ul><ul>"information", JOptionPane.INFORMATION_MESSAGE);</ul></ul>
- * </code><p>
+ * <dd><pre>
+ * JOptionPane.showInternalMessageDialog(frame, "information",
+ * "information", JOptionPane.INFORMATION_MESSAGE);
+ * </pre>
* <dt>Show an information panel with the options yes/no and message 'choose one':
- * <dd><code>JOptionPane.showConfirmDialog(null,
- * <ul><ul>"choose one", "choose one", JOptionPane.YES_NO_OPTION);</ul></ul>
- * </code><p>
+ * <dd><pre>JOptionPane.showConfirmDialog(null,
+ * "choose one", "choose one", JOptionPane.YES_NO_OPTION);
+ * </pre>
* <dt>Show an internal information dialog with the options yes/no/cancel and
* message 'please choose one' and title information:
- * <dd><code>JOptionPane.showInternalConfirmDialog(frame,
- * <ul><ul>"please choose one", "information",</ul></ul>
- * <ul><ul>JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);</ul></ul>
- * </code><p>
+ * <dd><pre>JOptionPane.showInternalConfirmDialog(frame,
+ * "please choose one", "information",
+ * JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
+ * </pre>
* <dt>Show a warning dialog with the options OK, CANCEL, title 'Warning', and
* message 'Click OK to continue':
- * <dd><code>
- * Object[] options = { "OK", "CANCEL" };<br>
+ * <dd><pre>
+ * Object[] options = { "OK", "CANCEL" };
* JOptionPane.showOptionDialog(null, "Click OK to continue", "Warning",
- * <ul><ul>JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,</ul></ul>
- * <ul><ul>null, options, options[0]);</ul></ul>
- * </code><p>
+ * JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
+ * null, options, options[0]);
+ * </pre>
* <dt>Show a dialog asking the user to type in a String:
* <dd><code>
* String inputValue = JOptionPane.showInputDialog("Please input a value");
- * </code><p>
+ * </code>
* <dt>Show a dialog asking the user to select a String:
- * <dd><code>
+ * <dd><pre>
* Object[] possibleValues = { "First", "Second", "Third" };<br>
* Object selectedValue = JOptionPane.showInputDialog(null,
- * <ul><ul>"Choose one", "Input",</ul></ul>
- * <ul><ul>JOptionPane.INFORMATION_MESSAGE, null,</ul></ul>
- * <ul><ul>possibleValues, possibleValues[0]);</ul></ul>
- * </code><p>
+ * "Choose one", "Input",
+ * JOptionPane.INFORMATION_MESSAGE, null,
+ * possibleValues, possibleValues[0]);
+ * </pre><p>
* </dl>
* <b>Direct Use:</b><br>
* To create and use an <code>JOptionPane</code> directly, the
@@ -281,7 +280,7 @@
* }
* <i>//If there is an array of option buttons:</i>
* for(int counter = 0, maxCounter = options.length;
- * counter < maxCounter; counter++) {
+ * counter < maxCounter; counter++) {
* if(options[counter].equals(selectedValue))
* return counter;
* }
@@ -1847,9 +1846,9 @@
}
/**
- * Sets the UI object which implements the L&F for this component.
+ * Sets the UI object which implements the {@literal L&F} for this component.
*
- * @param ui the <code>OptionPaneUI</code> L&F object
+ * @param ui the <code>OptionPaneUI</code> {@literal L&F} object
* @see UIDefaults#getUI
* @beaninfo
* bound: true
@@ -1864,7 +1863,7 @@
}
/**
- * Returns the UI object which implements the L&F for this component.
+ * Returns the UI object which implements the {@literal L&F} for this component.
*
* @return the <code>OptionPaneUI</code> object
*/
@@ -1873,7 +1872,7 @@
}
/**
- * Notification from the <code>UIManager</code> that the L&F has changed.
+ * Notification from the <code>UIManager</code> that the {@literal L&F} has changed.
* Replaces the current UI object with the latest version from the
* <code>UIManager</code>.
*
@@ -1886,7 +1885,7 @@
/**
* Returns the name of the UI class that implements the
- * L&F for this component.
+ * {@literal L&F} for this component.
*
* @return the string "OptionPaneUI"
* @see JComponent#getUIClassID
@@ -2103,7 +2102,7 @@
* Sets the options to display.
* The option type is used by the Look and Feel to
* determine what buttons to show (unless options are supplied).
- * @param newType an integer specifying the options the L&F is to display:
+ * @param newType an integer specifying the options the {@literal L&F} is to display:
* <code>DEFAULT_OPTION</code>,
* <code>YES_NO_OPTION</code>,
* <code>YES_NO_CANCEL_OPTION</code>,
--- a/jdk/src/share/classes/javax/swing/JScrollBar.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JScrollBar.java Thu Dec 05 10:33:57 2013 -0800
@@ -192,9 +192,9 @@
/**
- * Sets the L&F object that renders this component.
+ * Sets the {@literal L&F} object that renders this component.
*
- * @param ui the <code>ScrollBarUI</code> L&F object
+ * @param ui the <code>ScrollBarUI</code> {@literal L&F} object
* @see UIDefaults#getUI
* @since 1.4
* @beaninfo
@@ -606,9 +606,9 @@
* Sets the four BoundedRangeModel properties after forcing
* the arguments to obey the usual constraints:
* <pre>
- * minimum <= value <= value+extent <= maximum
+ * minimum ≤ value ≤ value+extent ≤ maximum
* </pre>
- * <p>
+ *
*
* @see BoundedRangeModel#setRangeProperties
* @see #setValue
--- a/jdk/src/share/classes/javax/swing/JScrollPane.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JScrollPane.java Thu Dec 05 10:33:57 2013 -0800
@@ -53,7 +53,7 @@
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/scrollpane.html">How to Use Scroll Panes</a>,
* a section in <em>The Java Tutorial</em>. Note that
* <code>JScrollPane</code> does not support heavyweight components.
- * <p>
+ *
* <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout">
* <TR>
* <TD ALIGN="CENTER">
--- a/jdk/src/share/classes/javax/swing/JTable.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JTable.java Thu Dec 05 10:33:57 2013 -0800
@@ -73,7 +73,7 @@
* but provides defaults for these features so that simple tables can be
* set up easily. For example, to set up a table with 10 rows and 10
* columns of numbers:
- * <p>
+ *
* <pre>
* TableModel dataModel = new AbstractTableModel() {
* public int getColumnCount() { return 10; }
@@ -659,7 +659,7 @@
* should contain the values for that row. In other words,
* the value of the cell at row 1, column 5 can be obtained
* with the following code:
- * <p>
+ *
* <pre>((Vector)rowData.elementAt(1)).elementAt(5);</pre>
* <p>
* @param rowData the data for the new table
@@ -674,7 +674,7 @@
* <code>rowData</code>, with column names, <code>columnNames</code>.
* <code>rowData</code> is an array of rows, so the value of the cell at row 1,
* column 5 can be obtained with the following code:
- * <p>
+ *
* <pre> rowData[1][5]; </pre>
* <p>
* All rows must be of the same length as <code>columnNames</code>.
@@ -3062,9 +3062,9 @@
* interface that allows any data structure containing a collection
* of elements with a size, preferred size, maximum size and minimum size
* to have its elements manipulated by the algorithm.
- * <p>
+ *
* <H3> Distributing the delta </H3>
- * <p>
+ *
* <H4> Overview </H4>
* <P>
* Call "DELTA" the difference between the target size and the
@@ -3073,7 +3073,7 @@
* sizes and adding a share of the DELTA - that share being based on
* how far each preferred size is from its limiting bound (minimum or
* maximum).
- * <p>
+ *
* <H4>Definition</H4>
* <P>
* Call the individual constraints min[i], max[i], and pref[i].
@@ -3081,21 +3081,21 @@
* Call their respective sums: MIN, MAX, and PREF.
* <p>
* Each new size will be calculated using:
- * <p>
+ *
* <pre>
* size[i] = pref[i] + delta[i]
* </pre>
* where each individual delta[i] is calculated according to:
* <p>
* If (DELTA < 0) we are in shrink mode where:
- * <p>
+ *
* <PRE>
* DELTA
* delta[i] = ------------ * (pref[i] - min[i])
* (PREF - MIN)
* </PRE>
* If (DELTA > 0) we are in expand mode where:
- * <p>
+ *
* <PRE>
* DELTA
* delta[i] = ------------ * (max[i] - pref[i])
@@ -6373,7 +6373,7 @@
* <p>
* Here's an example of creating a <code>MessageFormat</code> that can be
* used to print "Duke's Table: Page - " and the current page number:
- * <p>
+ *
* <pre>
* // notice the escaping of the single quote
* // notice how the page number is included with "{0}"
@@ -7686,7 +7686,7 @@
* Returns a boolean value indicating whether the specified column
* is selected.
*
- * @param r zero-based column of the table
+ * @param c zero-based column of the table
* @return the boolean value true if the specified column is selected.
* Otherwise, false.
* @since 1.3
--- a/jdk/src/share/classes/javax/swing/JTextArea.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JTextArea.java Thu Dec 05 10:33:57 2013 -0800
@@ -93,7 +93,7 @@
* JTextArea myArea = ??;
* myArea.getDocument().addDocumentListener(myListener);
* </pre>
- * <p>
+ *
* <dl>
* <dt><b><font size=+1>Newlines</font></b>
* <dd>
--- a/jdk/src/share/classes/javax/swing/JTextPane.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JTextPane.java Thu Dec 05 10:33:57 2013 -0800
@@ -49,7 +49,7 @@
* the default attributes to use if not overridden by attributes set
* on the paragraph or character run. Components and images may
* be embedded in the flow of text.
- * <p>
+ *
* <dl>
* <dt><b><font size=+1>Newlines</font></b>
* <dd>
--- a/jdk/src/share/classes/javax/swing/JTree.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JTree.java Thu Dec 05 10:33:57 2013 -0800
@@ -3956,7 +3956,7 @@
* allows children depends on how it was created.
*
* @return true if this node allows children, false otherwise
- * @see #JTree.DynamicUtilTreeNode
+ * @see JTree.DynamicUtilTreeNode
*/
public boolean isLeaf() {
return !getAllowsChildren();
--- a/jdk/src/share/classes/javax/swing/LookAndFeel.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/LookAndFeel.java Thu Dec 05 10:33:57 2013 -0800
@@ -91,7 +91,7 @@
* to provide a specific set of defaults. These are documented in the
* classes that require the specific default.
*
- * <h3><a name="#defaultRecommendation">ComponentUIs and defaults</a></h3>
+ * <h3><a name="defaultRecommendation">ComponentUIs and defaults</a></h3>
*
* All {@code ComponentUIs} typically need to set various properties
* on the {@code JComponent} the {@code ComponentUI} is providing the
@@ -120,7 +120,7 @@
* {@code ComponentUI} implementations should use the various install methods
* provided by this class as they handle the necessary checking and install
* the property using the recommended guidelines.
- * <p>
+ *
* <h3><a name="exceptions"></a>Exceptions</h3>
*
* All of the install methods provided by {@code LookAndFeel} need to
--- a/jdk/src/share/classes/javax/swing/Painter.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/Painter.java Thu Dec 05 10:33:57 2013 -0800
@@ -54,7 +54,7 @@
* }
* }
* }
- * </pre></p>
+ * </pre>
*
* <p>This interface makes no guarantees of threadsafety.</p>
*
--- a/jdk/src/share/classes/javax/swing/RowFilter.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/RowFilter.java Thu Dec 05 10:33:57 2013 -0800
@@ -31,6 +31,7 @@
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
/**
* <code>RowFilter</code> is used to filter out entries from the
@@ -129,7 +130,7 @@
/**
* Throws an IllegalArgumentException if any of the values in
- * columns are < 0.
+ * columns are {@literal <} 0.
*/
private static void checkIndices(int[] columns) {
for (int i = columns.length - 1; i >= 0; i--) {
--- a/jdk/src/share/classes/javax/swing/SizeSequence.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/SizeSequence.java Thu Dec 05 10:33:57 2013 -0800
@@ -52,7 +52,7 @@
* <p>
* The following figure shows the relationship between size and position data
* for a multi-column component.
- * <p>
+ *
* <center>
* <img src="doc-files/SizeSequence-1.gif" width=384 height = 100
* alt="The first item begins at position 0, the second at the position equal
@@ -76,7 +76,6 @@
* However, any other unit of measure (for example, time in days)
* could be just as valid.
*
- * <p>
*
* <h3>Implementation Notes</h3>
*
--- a/jdk/src/share/classes/javax/swing/Spring.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/Spring.java Thu Dec 05 10:33:57 2013 -0800
@@ -65,7 +65,7 @@
* from <code>a</code>
* to <code>b</code>,
* where <code>a <= b</code>).
- * <p>
+ *
* <pre>
* [a1, b1] + [a2, b2] = [a1 + a2, b1 + b2]
*
@@ -78,7 +78,7 @@
* If we denote <code>Spring</code>s as <code>[a, b, c]</code>,
* where <code>a <= b <= c</code>, we can define the same
* arithmetic operators on <code>Spring</code>s:
- * <p>
+ *
* <pre>
* [a1, b1, c1] + [a2, b2, c2] = [a1 + a2, b1 + b2, c1 + c2]
*
@@ -89,7 +89,7 @@
* <p>
* With both intervals and <code>Spring</code>s we can define "-" and <em>min</em>
* in terms of negation:
- * <p>
+ *
* <pre>
* X - Y = X + (-Y)
*
--- a/jdk/src/share/classes/javax/swing/SpringLayout.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/SpringLayout.java Thu Dec 05 10:33:57 2013 -0800
@@ -297,7 +297,7 @@
* and "a - b" is equal to
* <code>Spring.sum(a, Spring.minus(b))</code>.
* See the
- * {@link Spring <code>Spring</code> API documentation}
+ * {@link Spring Spring API documentation}
* for further details
* of spring arithmetic.
*
--- a/jdk/src/share/classes/javax/swing/SwingWorker.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/SwingWorker.java Thu Dec 05 10:33:57 2013 -0800
@@ -62,7 +62,6 @@
* </li>
* </ul>
*
- * <p>
*
* <p>
* These constraints mean that a GUI application with time intensive
--- a/jdk/src/share/classes/javax/swing/border/CompoundBorder.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/border/CompoundBorder.java Thu Dec 05 10:33:57 2013 -0800
@@ -36,7 +36,7 @@
*
* For example, this class may be used to add blank margin space
* to a component with an existing decorative border:
- * <p>
+ *
* <pre>
* Border border = comp.getBorder();
* Border margin = new EmptyBorder(10,10,10,10);
--- a/jdk/src/share/classes/javax/swing/event/TableModelEvent.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/event/TableModelEvent.java Thu Dec 05 10:33:57 2013 -0800
@@ -34,7 +34,7 @@
* and all references to rows and columns are in the co-ordinate
* system of the model.
* Depending on the parameters used in the constructors, the TableModelevent
- * can be used to specify the following types of changes: <p>
+ * can be used to specify the following types of changes:
*
* <pre>
* TableModelEvent(source); // The data, ie. all rows changed
--- a/jdk/src/share/classes/javax/swing/event/TreeModelListener.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/event/TreeModelListener.java Thu Dec 05 10:33:57 2013 -0800
@@ -86,7 +86,7 @@
* <p>Invoked after the tree has drastically changed structure from a
* given node down. If the path returned by e.getPath() is of length
* one and the first element does not identify the current root node
- * the first element should become the new root of the tree.<p>
+ * the first element should become the new root of the tree.
*
* <p>Use <code>e.getPath()</code>
* to get the path to the node.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Thu Dec 05 10:33:57 2013 -0800
@@ -48,7 +48,7 @@
* Provides the basic look and feel for a <code>JOptionPane</code>.
* <code>BasicMessagePaneUI</code> provides a means to place an icon,
* message and buttons into a <code>Container</code>.
- * Generally, the layout will look like:<p>
+ * Generally, the layout will look like:
* <pre>
* ------------------
* | i | message |
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java Thu Dec 05 10:33:57 2013 -0800
@@ -521,7 +521,7 @@
* MouseHandler is responsible for converting mouse events
* (released, dragged...) into the appropriate DragController
* methods.
- * <p>
+ *
*/
protected class MouseHandler extends MouseAdapter
implements MouseMotionListener
@@ -890,7 +890,7 @@
* Used to layout a <code>BasicSplitPaneDivider</code>.
* Layout for the divider
* involves appropriately moving the left/right buttons around.
- * <p>
+ *
*/
protected class DividerLayout implements LayoutManager
{
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java Thu Dec 05 10:33:57 2013 -0800
@@ -2015,7 +2015,7 @@
/**
* LayoutManager used for JSplitPanes with an orientation of
* VERTICAL_SPLIT.
- * <p>
+ *
*/
public class BasicVerticalLayoutManager extends
BasicHorizontalLayoutManager
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Thu Dec 05 10:33:57 2013 -0800
@@ -1398,7 +1398,7 @@
/**
* Paints the vertical part of the leg. The receiver should
- * NOT modify <code>clipBounds</code>, <code>insets</code>.<p>
+ * NOT modify <code>clipBounds</code>, <code>insets</code>.
*/
protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds,
Insets insets, TreePath path) {
--- a/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java Thu Dec 05 10:33:57 2013 -0800
@@ -182,7 +182,7 @@
* each a single row of values. In other words, to get to the cell
* at row 1, column 5: <p>
*
- * <code>((Vector)getDataVector().elementAt(1)).elementAt(5);</code><p>
+ * <code>((Vector)getDataVector().elementAt(1)).elementAt(5);</code>
*
* @return the vector of vectors containing the tables data values
*
@@ -306,7 +306,7 @@
* Sets the number of rows in the model. If the new size is greater
* than the current size, new rows are added to the end of the model
* If the new size is less than the current size, all
- * rows at index <code>rowCount</code> and greater are discarded. <p>
+ * rows at index <code>rowCount</code> and greater are discarded.
*
* @param rowCount the new number of rows
* @see #setRowCount
@@ -330,7 +330,7 @@
* Sets the number of rows in the model. If the new size is greater
* than the current size, new rows are added to the end of the model
* If the new size is less than the current size, all
- * rows at index <code>rowCount</code> and greater are discarded. <p>
+ * rows at index <code>rowCount</code> and greater are discarded.
*
* @see #setColumnCount
* @since 1.3
@@ -414,7 +414,7 @@
* After the move, the row that was at index <code>start</code>
* will be at index <code>to</code>.
* This method will send a <code>tableChanged</code> notification
- * message to all the listeners. <p>
+ message to all the listeners.
*
* <pre>
* Examples of moves:
@@ -473,7 +473,7 @@
* of columns, new columns are added to the end of each row in the model.
* If the number of <code>newIdentifier</code>s is less than the current
* number of columns, all the extra columns at the end of a row are
- * discarded. <p>
+ * discarded.
*
* @param columnIdentifiers vector of column identifiers. If
* <code>null</code>, set the model
@@ -490,7 +490,7 @@
* of columns, new columns are added to the end of each row in the model.
* If the number of <code>newIdentifier</code>s is less than the current
* number of columns, all the extra columns at the end of a row are
- * discarded. <p>
+ * discarded.
*
* @param newIdentifiers array of column identifiers.
* If <code>null</code>, set
--- a/jdk/src/share/classes/javax/swing/table/TableModel.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/table/TableModel.java Thu Dec 05 10:33:57 2013 -0800
@@ -34,7 +34,7 @@
*
* The <code>JTable</code> can be set up to display any data
* model which implements the
- * <code>TableModel</code> interface with a couple of lines of code: <p>
+ * <code>TableModel</code> interface with a couple of lines of code:
* <pre>
* TableModel myData = new MyTableModel();
* JTable table = new JTable(myData);
@@ -42,7 +42,7 @@
*
* For further documentation, see <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#data">Creating a Table Model</a>
* in <em>The Java Tutorial</em>.
- * <p>
+ *
* @author Philip Milne
* @see JTable
*/
--- a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java Thu Dec 05 10:33:57 2013 -0800
@@ -804,7 +804,7 @@
* returns will give better performance for situations where large
* parts of the document are being scanned. The following is an example
* of using the partial return to access the entire document:
- * <p>
+ *
* <pre>
* int nleft = doc.getDocumentLength();
* Segment text = new Segment();
--- a/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java Thu Dec 05 10:33:57 2013 -0800
@@ -41,7 +41,7 @@
* of text document. This implementation provides a default
* implementation which treats text as plain text and
* provides a minimal set of actions for a simple editor.
- * <p>
+ *
* <dl>
* <dt><b><font size=+1>Newlines</font></b>
* <dd>
--- a/jdk/src/share/classes/javax/swing/text/Document.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/text/Document.java Thu Dec 05 10:33:57 2013 -0800
@@ -354,7 +354,7 @@
* returns will give better performance for situations where large
* parts of the document are being scanned. The following is an example
* of using the partial return to access the entire document:
- * <p>
+ *
* <pre><code>
*
* int nleft = doc.getDocumentLength();
--- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java Thu Dec 05 10:33:57 2013 -0800
@@ -87,7 +87,6 @@
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/generaltext.html">General Rules for Using Text Components</a>,
* a section in <em>The Java Tutorial.</em>
*
- * <p>
* <dl>
* <dt><b><font size=+1>Caret Changes</font></b>
* <dd>
@@ -108,7 +107,6 @@
* <b>Note</b>: Non-editable text components also have a caret though
* it may not be painted.
*
- * <p>
* <dt><b><font size=+1>Commands</font></b>
* <dd>
* Text components provide a number of commands that can be used
@@ -120,7 +118,6 @@
* found with the {@link #getActions} method. These actions
* can be bound to key events, fired from buttons, etc.
*
- * <p>
* <dt><b><font size=+1>Text Input</font></b>
* <dd>
* The text components support flexible and internationalized text input, using
@@ -206,7 +203,6 @@
* <li>caret movement forward and backward
* </ul>
*
- * <p>
* <dt><b><font size=+1>Model/View Split</font></b>
* <dd>
* The text components have a model-view split. A text component pulls
@@ -231,14 +227,12 @@
* {@link DocumentListener}
* interface and registered interest with the model being observed.
*
- * <p>
* <dt><b><font size=+1>Location Information</font></b>
* <dd>
* The capability of determining the location of text in
* the view is provided. There are two methods, {@link #modelToView}
* and {@link #viewToModel} for determining this information.
*
- * <p>
* <dt><b><font size=+1>Undo/Redo support</font></b>
* <dd>
* Support for an edit history mechanism is provided to allow
@@ -249,7 +243,6 @@
* The support is provided by the Document model, which allows
* one to attach UndoableEditListener implementations.
*
- * <p>
* <dt><b><font size=+1>Thread Safety</font></b>
* <dd>
* The swing text components provide some support of thread
@@ -261,13 +254,12 @@
* The methods that are safe to call asynchronously are marked
* with comments.
*
- * <p>
* <dt><b><font size=+1>Newlines</font></b>
* <dd>
* For a discussion on how newlines are handled, see
* <a href="DefaultEditorKit.html">DefaultEditorKit</a>.
*
- * <p>
+ *
* <dt><b><font size=+1>Printing support</font></b>
* <dd>
* Several {@link #print print} methods are provided for basic
--- a/jdk/src/share/classes/javax/swing/text/View.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/text/View.java Thu Dec 05 10:33:57 2013 -0800
@@ -144,7 +144,6 @@
<ul>
<li>{@link #paint(java.awt.Graphics, java.awt.Shape) paint}
</ul>
- <p>
<dt><b>Translate between the model and view coordinate systems.</b>
<dd>
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Thu Dec 05 10:33:57 2013 -0800
@@ -2089,7 +2089,7 @@
*
* <p>
* The assignment of the actions described is shown in the
- * following table for the tags defined in <code>HTML.Tag</code>.<P>
+ * following table for the tags defined in <code>HTML.Tag</code>.
* <table border=1 summary="HTML tags and assigned actions">
* <tr><th>Tag</th><th>Action</th></tr>
* <tr><td><code>HTML.Tag.A</code> <td>CharacterAction
@@ -3968,7 +3968,7 @@
}
/**
- * This is set to true when and end is invoked for <html>.
+ * This is set to true when and end is invoked for {@literal <html>}.
*/
private boolean receivedEndHTML;
/** Number of times <code>flushBuffer</code> has been invoked. */
@@ -3990,7 +3990,7 @@
boolean inTitle = false;
boolean lastWasNewline = true;
boolean emptyAnchor;
- /** True if (!emptyDocument && insertTag == null), this is used so
+ /** True if (!emptyDocument && insertTag == null), this is used so
* much it is cached. */
boolean midInsert;
/** True when the body has been encountered. */
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java Thu Dec 05 10:33:57 2013 -0800
@@ -71,7 +71,7 @@
* The modeling of HTML is provided by the class <code>HTMLDocument</code>.
* Its documentation describes the details of how the HTML is modeled.
* The editing support leverages heavily off of the text package.
- * <p>
+ *
* <dt>
* Extendable/Scalable
* <dd>
@@ -114,7 +114,7 @@
* attributes for display. This helps make the View implementations
* more general purpose
* </ol>
- * <p>
+ *
* <dt>
* Asynchronous Loading
* <dd>
@@ -127,7 +127,7 @@
* by the <code>HTMLDocument.HTMLReader</code> class. The actual
* work is done by the <code>DefaultStyledDocument</code> and
* <code>AbstractDocument</code> classes in the text package.
- * <p>
+ *
* <dt>
* Customization from current LAF
* <dd>
@@ -141,7 +141,7 @@
* The support for this is provided by the <code>StyleSheet</code>
* class. The presentation of the HTML can be heavily influenced
* by the setting of the StyleSheet property on the EditorKit.
- * <p>
+ *
* <dt>
* Not lossy
* <dd>
@@ -839,7 +839,7 @@
* if the given position represents a link. If this was the result
* of a mouse click, <code>x</code> and
* <code>y</code> will give the location of the mouse, otherwise
- * they will be < 0.
+ * they will be {@literal <} 0.
*
* @param pos the position
* @param html the editor pane
@@ -2027,8 +2027,8 @@
* Paints a portion of a highlight.
*
* @param g the graphics context
- * @param offs0 the starting model offset >= 0
- * @param offs1 the ending model offset >= offs1
+ * @param offs0 the starting model offset ≥ 0
+ * @param offs1 the ending model offset ≥ offs1
* @param bounds the bounding box of the view, which is not
* necessarily the region to paint.
* @param c the editor
--- a/jdk/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java Thu Dec 05 10:33:57 2013 -0800
@@ -469,7 +469,7 @@
* <p>Invoked after the tree has drastically changed structure from a
* given node down. If the path returned by e.getPath() is of length
* one and the first element does not identify the current root node
- * the first element should become the new root of the tree.<p>
+ * the first element should become the new root of the tree.
*
* <p>e.path() holds the path to the node.</p>
* <p>e.childIndices() returns null.</p>
@@ -677,7 +677,7 @@
/**
* Messages getTreeNodeForPage(path, onlyIfVisible, shouldCreate,
- * path.length) as long as path is non-null and the length is > 0.
+ * path.length) as long as path is non-null and the length is {@literal >} 0.
* Otherwise returns null.
*/
private FHTreeStateNode getNodeForPath(TreePath path,
@@ -1283,7 +1283,7 @@
/**
* Messaged when a child has been inserted at index. For all the
- * children that have a childIndex >= index their index is incremented
+ * children that have a childIndex ≥ index their index is incremented
* by one.
*/
protected void childInsertedAtModelIndex(int index,
--- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Thu Dec 05 10:33:57 2013 -0800
@@ -2594,7 +2594,7 @@
requests = new MessageHeader();
setRequests = false;
- setRequestMethod("GET");
+ super.setRequestMethod("GET"); // avoid the connecting check
poster = null;
if (!checkReuseConnection())
connect();
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_de.properties Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_de.properties Thu Dec 05 10:33:57 2013 -0800
@@ -33,6 +33,7 @@
error.write.file=Fehler beim Schreiben in vorhandener JAR-Datei
error.create.dir={0}: Verzeichnis konnte nicht erstellt werden
error.incorrect.length=Falsche L\u00E4nge bei der Verarbeitung: {0}
+error.create.tempfile=Es konnte keine tempor\u00E4re Datei erstellt werden
out.added.manifest=Manifest wurde hinzugef\u00FCgt
out.update.manifest=Manifest wurde aktualisiert
out.ignore.entry=Eintrag {0} wird ignoriert
@@ -44,4 +45,4 @@
out.inflated=\ vergr\u00F6\u00DFert: {0}
out.size=(ein = {0}) (aus = {1})
-usage=Verwendung: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] Dateien...\nOptionen:\n -c Neues Archiv erstellen\n -t Inhaltsverzeichnis f\u00FCr Archiv auflisten\n -x Genannte (oder alle) Dateien aus Archiv extrahieren\n -u Vorhandenes Archiv aktualisieren\n -v Verbose-Ausgabe f\u00FCr Standardausgabe generieren\n -f Namen der Archivdatei angeben\n -m Manifest-Informationen von angegebener Manifest-Datei einschlie\u00DFen\n -e Anwendungs-Einstiegspunkt f\u00FCr die \n in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelte Standalone-Anwendung angeben\n -0 Nur speichern (keine ZIP-Komprimierung)\n -M Keine Manifest-Datei f\u00FCr die Eintr\u00E4ge erstellen\n -i Indexinformationen f\u00FCr angegebenen JAR-Dateien erstellen\n -C zum angegebenen Verzeichnis wechseln und folgende Datei einschlie\u00DFen\nFalls eine Datei ein Verzeichnis ist, wird dieses rekursiv verarbeitet.\nDer Name der Manifest-Datei, der Name der Archivdatei und der Name des Einstiegspunkts werden\nin derselben Reihenfolge wie die Kennzeichen "m", "f" und "e" angegeben.\n\nBeispiel 1: Archivieren Sie zwei Klassendateien in ein Archiv mit Namen "classes.jar": \n jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden Sie die vorhandenen Manifest-Datei "mymanifest", und archivieren Sie\n alle Dateien im Verzeichnis foo/ in "classes.jar": \n jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Verwendung: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] Dateien ...\nOptionen:\n -c Neues Archiv erstellen\n -t Inhaltsverzeichnis f\u00FCr Archiv anzeigen\n -x Benannte (oder alle) Dateien aus dem Archiv extrahieren\n -u Vorhandenes Archiv aktualisieren\n -v Ausgabe im Verbose-Modus aus Standard-Ausgabe generieren\n -f Dateinamen f\u00FCr Archiv angeben\n -m Manifest-Informationen aus angegebener Manifest-Datei einschlie\u00DFen\n -n Pack200-Normalisierung nach Erstellung eines neuen Archivs ausf\u00FChren\n -e Anwendungs-Einstiegspunkt f\u00FCr alleinstehende Anwendung angeben\n in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelt\n -0 nur speichern; keine ZIP-Komprimierung verwenden\n -M keine Manifest-Datei f\u00FCr die Eintr\u00E4ge erstellen\n -i Index-Informationen f\u00FCr die angegebenen JAR-Dateien generieren\n -C zu angegebenem Verzeichnis wechseln und die folgende Datei einschlie\u00DFen\nDateien, die Verzeichnisse sind, werden rekursiv verarbeitet.\nDie Namen der Manifest-Datei, der Archiv-Datei und des Einstiegspunkts sind\nin derselben Reihenfolge wie die Kennzeichen f\u00FCr "m", "f" und "e" angegeben.\n\nBeispiel 1: Archivieren von zwei Klassendateien in einem Archiv mit dem Namen "classes.jar": \n jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden einer vorhandenen Manifest-Datei mit dem Namen "mymanifest" und Archivieren aller\n Dateien im Verzeichnis mit dem Namen "foo/" in die Archiv-Datei "classes.jar": \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties Thu Dec 05 10:33:57 2013 -0800
@@ -33,6 +33,7 @@
error.write.file=Error al escribir un archivo jar existente
error.create.dir={0} : no se ha podido crear el directorio
error.incorrect.length=longitud incorrecta al procesar: {0}
+error.create.tempfile=No se ha podido crear el archivo temporal
out.added.manifest=manifiesto agregado
out.update.manifest=manifiesto actualizado
out.ignore.entry=ignorando entrada {0}
@@ -44,4 +45,4 @@
out.inflated=\ inflado: {0}
out.size=(entrada = {0}) (salida = {1})
-usage=Sintaxis: jar {ctxui}[vfm0Me] [archive-jar] [archive-manifiesto] [punto-entrada] [-C dir] archivos...\nOpciones:\n -c crear nuevo archivo\n -t crear la tabla de contenido del archivo\n -x extraer el archive mencionado (o todos) del archivo\n -u actualizar archive existente\n -v generar salida detallada de los datos de salida est\u00E1ndar\n -f especificar nombre de archive de almacenamiento\n -m incluir informaci\u00F3n de manifiesto del archive de manifiesto especificado\n -e especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n que se incluye dentro de un archive jar ejecutable\n -0 s\u00F3lo almacenar; no utilizar compresi\u00F3n ZIP\n -M no crear un archive de manifiesto para las entradas\n -i generar informaci\u00F3n de \u00EDndice para los archives jar especificados\n -C cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente.\nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\nespecifican en el mismo orden que los indicadores 'm', 'f' y 'e'.\n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n archivos del directorio foo/ en 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Sintaxis: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] archivos...\nOpciones:\n -c crear nuevo archivo\n -t crear la tabla de contenido del archivo\n -x extraer el archive mencionado (o todos) del archivo\n -u actualizar archive existente\n -v generar salida detallada de los datos de salida est\u00E1ndar\n -f especificar nombre de archive de almacenamiento\n -m incluir informaci\u00F3n de manifiesto del archive de manifiesto especificado\n -n realizar normalizaci\u00F3n de Pack200 despu\u00E9s de crear un nuevo archivo\n -e especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n que se incluye dentro de un archive jar ejecutable\n -0 s\u00F3lo almacenar; no utilizar compresi\u00F3n ZIP\n -M no crear un archive de manifiesto para las entradas\n -i generar informaci\u00F3n de \u00EDndice para los archives jar especificados\n -C cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente.\nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\nespecifican en el mismo orden que los indicadores 'm', 'f' y 'e'.\n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n archivos del directorio foo/ en 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_fr.properties Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_fr.properties Thu Dec 05 10:33:57 2013 -0800
@@ -33,6 +33,7 @@
error.write.file=Erreur lors de l'\u00E9criture d'un fichier JAR existant
error.create.dir={0} : impossible de cr\u00E9er le r\u00E9pertoire
error.incorrect.length=longueur incorrecte lors du traitement de : {0}
+error.create.tempfile=Impossible de cr\u00E9er un fichier temporaire
out.added.manifest=manifeste ajout\u00E9
out.update.manifest=manifeste mis \u00E0 jour
out.ignore.entry=entr\u00E9e {0} ignor\u00E9e
@@ -44,4 +45,4 @@
out.inflated=\ d\u00E9compress\u00E9 : {0}
out.size=(entr\u00E9e = {0}) (sortie = {1})
-usage=Syntaxe : jar {ctxui}[vfm0Me] [fichier-jar] [fichier-manifeste] [point-entr\u00E9e] [-C r\u00E9p] fichiers...\nOptions :\n -c cr\u00E9e une archive\n -t affiche la table des mati\u00E8res de l'archive\n -x extrait les fichiers nomm\u00E9s (ou tous les fichiers) de l'archive\n -u met \u00E0 jour l'archive existante\n -v g\u00E9n\u00E8re une version d\u00E9taill\u00E9e d'une sortie standard\n -f sp\u00E9cifie le nom du fichier archive\n -m inclut les informations de manifeste \u00E0 partir du fichier de manifeste sp\u00E9cifi\u00E9\n -e sp\u00E9cifie le point d'entr\u00E9e d'une application en mode autonome \n int\u00E9gr\u00E9e \u00E0 un fichier JAR ex\u00E9cutable\n -0 stockage uniquement, pas de compression ZIP\n -M ne cr\u00E9e pas de fichier manifeste pour les entr\u00E9es\n -i g\u00E9n\u00E8re les informations d'index des fichiers JAR sp\u00E9cifi\u00E9s\n -C passe au r\u00E9pertoire sp\u00E9cifi\u00E9 et inclut le fichier suivant\nSi l'un des fichiers est un r\u00E9pertoire, celui-ci est trait\u00E9 r\u00E9cursivement.\nLes noms du fichier manifeste, du fichier archive et du point d'entr\u00E9e sont\nsp\u00E9cifi\u00E9s dans le m\u00EAme ordre que celui des indicateurs m, f et e.\n\nExemple 1 : pour archiver deux fichiers de classe dans une archive intitul\u00E9e classes.jar : \n jar cvf classes.jar Foo.class Bar.class \nExemple 2 : pour utiliser un fichier manifeste existant 'monmanifeste', puis archiver tous les\n fichiers du r\u00E9pertoire foo/ dans 'classes.jar' : \n jar cvfm classes.jar monmanifeste -C foo/ .\n
+usage=Syntaxe : jar {ctxui}[vfmn0Me] [fichier-jar] [fichier-manifeste] [point-entr\u00E9e] [-C r\u00E9p] fichiers...\nOptions :\n -c cr\u00E9e une archive\n -t affiche la table des mati\u00E8res de l'archive\n -x extrait les fichiers nomm\u00E9s (ou tous les fichiers) de l'archive\n -u met \u00E0 jour l'archive existante\n -v g\u00E9n\u00E8re une version d\u00E9taill\u00E9e d'une sortie standard\n -f sp\u00E9cifie le nom du fichier archive\n -m inclut les informations de manifeste \u00E0 partir du fichier manifeste sp\u00E9cifi\u00E9\n -n effectue une normalisation Pack200 apr\u00E8s la cr\u00E9ation d'une archive\n -e sp\u00E9cifie le point d'entr\u00E9e d'une application en mode autonome \n int\u00E9gr\u00E9e \u00E0 un fichier JAR ex\u00E9cutable\n -0 stockage uniquement, pas de compression ZIP\n -M ne cr\u00E9e pas de fichier manifeste pour les entr\u00E9es\n -i g\u00E9n\u00E8re les informations d'index des fichiers JAR sp\u00E9cifi\u00E9s\n -C passe au r\u00E9pertoire sp\u00E9cifi\u00E9 et inclut le fichier suivant\nSi l'un des fichiers est un r\u00E9pertoire, celui-ci est trait\u00E9 r\u00E9cursivement.\nLes noms du fichier manifeste, du fichier d'archive et du point d'entr\u00E9e sont\nsp\u00E9cifi\u00E9s dans le m\u00EAme ordre que celui des indicateurs m, f et e.\n\nExemple 1 : pour archiver deux fichiers de classe dans une archive intitul\u00E9e classes.jar : \n jar cvf classes.jar Foo.class Bar.class \nExemple 2 : pour utiliser un fichier manifeste existant 'monmanifeste', puis archiver tous les\n fichiers du r\u00E9pertoire foo/ dans 'classes.jar' : \n jar cvfm classes.jar monmanifeste -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties Thu Dec 05 10:33:57 2013 -0800
@@ -33,6 +33,7 @@
error.write.file=Errore durante la scrittura del file jar esistente
error.create.dir={0} : impossibile creare la directory
error.incorrect.length=lunghezza non valida durante l''elaborazione: {0}
+error.create.tempfile=Impossibile creare il file temporaneo.
out.added.manifest=aggiunto manifest
out.update.manifest=aggiornato manifest
out.ignore.entry=la voce {0} sar\u00E0 ignorata
@@ -44,4 +45,4 @@
out.inflated=\ decompresso: {0}
out.size=(in = {0}) (out = {1})
-usage=Uso: jar {ctxui}[vfm0Me] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file ...\nOpzioni:\n -c crea un nuovo archivio\n -t visualizza l'indice dell'archivio\n -x estrae i file con nome (o tutti i file) dall'archivio\n -u aggiorna l'archivio esistente\n -v genera output commentato dall'output standard\n -f specifica il nome file dell'archivio\n -m include informazioni manifest dal file manifest specificato\n -e specifica il punto di ingresso per l'applicazione stand-alone \n inclusa nel file jar eseguibile\n -0 solo memorizzazione; senza compressione ZIP\n -M consente di non creare un file manifest per le voci\n -i genera informazioni sull'indice per i file jar specificati\n -C imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n file della directory foo/ in 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Uso: jar {ctxui}[vfmn0Me] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file ...\nOpzioni:\n -c crea un nuovo archivio\n -t visualizza l'indice dell'archivio\n -x estrae i file con nome (o tutti i file) dall'archivio\n -u aggiorna l'archivio esistente\n -v genera output commentato dall'output standard\n -f specifica il nome file dell'archivio\n -m include informazioni manifest dal file manifest specificato\n -n esegue la normalizzazione Pack200 dopo la creazione di un nuovo archivio\n -e specifica il punto di ingresso per l'applicazione standalone \n inclusa nel file jar eseguibile\n -0 solo memorizzazione; senza compressione ZIP\n -M consente di non creare un file manifest per le voci\n -i genera informazioni sull'indice per i file jar specificati\n -C imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n file della directory foo/ in 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties Thu Dec 05 10:33:57 2013 -0800
@@ -33,6 +33,7 @@
error.write.file=\u65E2\u5B58jar\u30D5\u30A1\u30A4\u30EB\u306E\u66F8\u8FBC\u307F\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
error.create.dir=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA{0}\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
error.incorrect.length={0}\u306E\u51E6\u7406\u4E2D\u306B\u4E0D\u6B63\u306A\u9577\u3055\u304C\u3042\u308A\u307E\u3057\u305F
+error.create.tempfile=\u4E00\u6642\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
out.added.manifest=\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304C\u8FFD\u52A0\u3055\u308C\u307E\u3057\u305F
out.update.manifest=\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F
out.ignore.entry=\u30A8\u30F3\u30C8\u30EA{0}\u3092\u7121\u8996\u3057\u307E\u3059
@@ -44,4 +45,4 @@
out.inflated=\ {0}\u304C\u5C55\u958B\u3055\u308C\u307E\u3057\u305F
out.size=(\u5165={0})(\u51FA={1})
-usage=\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n -c \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n -t \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n -x \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n -u \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n -v \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n -f \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n -m \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n -e \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\n \u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n -0 \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n -M \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n -i \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n -C \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u4EE5\u4E0B\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B:\n jar cvf classes.jar Foo.class Bar.class\n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B:\n jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n -c \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n -t \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n -x \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n -u \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n -v \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n -f \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n -m \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n -n \u65B0\u898F\u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u4F5C\u6210\u5F8C\u306BPack200\u6B63\u898F\u5316\u3092\u5B9F\u884C\u3059\u308B\n -e \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\n \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n -0 \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n -M \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n -i \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n -C \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u6B21\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B: \n jar cvf classes.jar Foo.class Bar.class \n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B: \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_ko.properties Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_ko.properties Thu Dec 05 10:33:57 2013 -0800
@@ -33,6 +33,7 @@
error.write.file=\uAE30\uC874 jar \uD30C\uC77C\uC5D0 \uC4F0\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
error.create.dir={0}: \uB514\uB809\uD1A0\uB9AC\uB97C \uC0DD\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
error.incorrect.length=\uCC98\uB9AC \uC911 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC740 \uAE38\uC774\uAC00 \uBC1C\uACAC\uB428: {0}
+error.create.tempfile=\uC784\uC2DC \uD30C\uC77C\uC744 \uC0DD\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
out.added.manifest=Manifest\uB97C \uCD94\uAC00\uD568
out.update.manifest=Manifest\uB97C \uC5C5\uB370\uC774\uD2B8\uD568
out.ignore.entry={0} \uD56D\uBAA9\uC744 \uBB34\uC2DC\uD558\uB294 \uC911
@@ -44,4 +45,4 @@
out.inflated=\ \uC99D\uAC00\uB428: {0}
out.size=(\uC785\uB825 = {0}) (\uCD9C\uB825 = {1})
-usage=\uC0AC\uC6A9\uBC95: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\uC635\uC158:\n -c \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n -t \uC544\uCE74\uC774\uBE0C\uC5D0 \uB300\uD55C \uBAA9\uCC28\uB97C \uB098\uC5F4\uD569\uB2C8\uB2E4.\n -x \uBA85\uBA85\uB41C(\uB610\uB294 \uBAA8\uB4E0) \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C \uCD94\uCD9C\uD569\uB2C8\uB2E4.\n -u \uAE30\uC874 \uC544\uCE74\uC774\uBE0C\uB97C \uC5C5\uB370\uC774\uD2B8\uD569\uB2C8\uB2E4.\n -v \uD45C\uC900 \uCD9C\uB825\uC5D0 \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n -f \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n -m \uC9C0\uC815\uB41C Manifest \uD30C\uC77C\uC758 Manifest \uC815\uBCF4\uB97C \uD3EC\uD568\uD569\uB2C8\uB2E4.\n -e jar \uC2E4\uD589 \uD30C\uC77C\uC5D0 \uBC88\uB4E4\uB85C \uC81C\uACF5\uB41C \uB3C5\uB9BD\uD615 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8\uC758 \n \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC2DC\uC791 \uC9C0\uC810\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n -0 \uC800\uC7A5 \uC804\uC6A9: ZIP \uC555\uCD95\uC744 \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n -M \uD56D\uBAA9\uC5D0 \uB300\uD574 Manifest \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n -i \uC9C0\uC815\uB41C jar \uD30C\uC77C\uC5D0 \uB300\uD55C \uC778\uB371\uC2A4 \uC815\uBCF4\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n -C \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uB85C \uBCC0\uACBD\uD558\uACE0 \uB2E4\uC74C \uD30C\uC77C\uC744 \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\uD2B9\uC815 \uD30C\uC77C\uC774 \uB514\uB809\uD1A0\uB9AC\uC77C \uACBD\uC6B0 \uC21C\uD658\uC801\uC73C\uB85C \uCC98\uB9AC\uB429\uB2C8\uB2E4.\nManifest \uD30C\uC77C \uC774\uB984, \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984 \uBC0F \uC2DC\uC791 \uC9C0\uC810 \uC774\uB984\uC740\n'm', 'f' \uBC0F 'e' \uD50C\uB798\uADF8\uC640 \uB3D9\uC77C\uD55C \uC21C\uC11C\uB85C \uC9C0\uC815\uB429\uB2C8\uB2E4.\n\n\uC608 1: classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C\uC5D0 \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n jar cvf classes.jar Foo.class Bar.class \n\uC608 2: \uAE30\uC874 Manifest \uD30C\uC77C 'mymanifest'\uB97C \uC0AC\uC6A9\uD558\uC5EC\n foo/ \uB514\uB809\uD1A0\uB9AC\uC758 \uBAA8\uB4E0 \uD30C\uC77C\uC744 'classes.jar'\uB85C \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=\uC0AC\uC6A9\uBC95: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\uC635\uC158:\n -c \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n -t \uC544\uCE74\uC774\uBE0C\uC5D0 \uB300\uD55C \uBAA9\uCC28\uB97C \uB098\uC5F4\uD569\uB2C8\uB2E4.\n -x \uBA85\uBA85\uB41C(\uB610\uB294 \uBAA8\uB4E0) \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C \uCD94\uCD9C\uD569\uB2C8\uB2E4.\n -u \uAE30\uC874 \uC544\uCE74\uC774\uBE0C\uB97C \uC5C5\uB370\uC774\uD2B8\uD569\uB2C8\uB2E4.\n -v \uD45C\uC900 \uCD9C\uB825\uC5D0 \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n -f \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n -m \uC9C0\uC815\uB41C Manifest \uD30C\uC77C\uC758 Manifest \uC815\uBCF4\uB97C \uD3EC\uD568\uD569\uB2C8\uB2E4.\n -n \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD55C \uD6C4 Pack200 \uC815\uADDC\uD654\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n -e jar \uC2E4\uD589 \uD30C\uC77C\uC5D0 \uBC88\uB4E4\uB85C \uC81C\uACF5\uB41C \uB3C5\uB9BD\uD615 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8\uC758 \n \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC2DC\uC791 \uC9C0\uC810\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n -0 \uC800\uC7A5 \uC804\uC6A9: ZIP \uC555\uCD95\uC744 \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n -M \uD56D\uBAA9\uC5D0 \uB300\uD574 Manifest \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n -i \uC9C0\uC815\uB41C jar \uD30C\uC77C\uC5D0 \uB300\uD55C \uC778\uB371\uC2A4 \uC815\uBCF4\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n -C \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uB85C \uBCC0\uACBD\uD558\uACE0 \uB2E4\uC74C \uD30C\uC77C\uC744 \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\uD2B9\uC815 \uD30C\uC77C\uC774 \uB514\uB809\uD1A0\uB9AC\uC77C \uACBD\uC6B0 \uC21C\uD658\uC801\uC73C\uB85C \uCC98\uB9AC\uB429\uB2C8\uB2E4.\nManifest \uD30C\uC77C \uC774\uB984, \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984 \uBC0F \uC2DC\uC791 \uC9C0\uC810 \uC774\uB984\uC740\n'm', 'f' \uBC0F 'e' \uD50C\uB798\uADF8\uC640 \uB3D9\uC77C\uD55C \uC21C\uC11C\uB85C \uC9C0\uC815\uB429\uB2C8\uB2E4.\n\n\uC608 1: classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C\uC5D0 \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n jar cvf classes.jar Foo.class Bar.class \n\uC608 2: \uAE30\uC874 Manifest \uD30C\uC77C 'mymanifest'\uB97C \uC0AC\uC6A9\uD558\uC5EC\n foo/ \uB514\uB809\uD1A0\uB9AC\uC758 \uBAA8\uB4E0 \uD30C\uC77C\uC744 'classes.jar'\uB85C \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n jar cvfm classes.jar mymanifest -C foo/ .
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties Thu Dec 05 10:33:57 2013 -0800
@@ -33,6 +33,7 @@
error.write.file=Erro ao gravar o arquivo jar existente
error.create.dir={0} : n\u00E3o foi poss\u00EDvel criar o diret\u00F3rio
error.incorrect.length=largura incorreta durante o processamento: {0}
+error.create.tempfile=N\u00E3o foi poss\u00EDvel criar um arquivo tempor\u00E1rio
out.added.manifest=manifesto adicionado
out.update.manifest=manifesto atualizado
out.ignore.entry=ignorando entrada {0}
@@ -44,4 +45,4 @@
out.inflated=\ inflado: {0}
out.size=(entrada = {0}) (sa\u00EDda= {1})
-usage=Uso: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] arquivos ...\nOp\u00E7\u00F5es:\n -c cria novo arquivo compactado\n -t lista o sum\u00E1rio do arquivo compactado\n -x extrai arquivos com o nome (ou todos) do arquivo compactado\n -u atualizar o arquivo compactado existente\n -v gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n -f especifica o nome do arquivo do arquivo compactado\n -m inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n -e especifica o ponto de entrada da aplica\u00E7\u00E3o para aplica\u00E7\u00E3o independente \n empacotando em um arquivo jar execut\u00E1vel\n -0 armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n -M n\u00E3o cria um arquivo de manifesto para as entradas\n -i gera informa\u00E7\u00F5es de \u00EDndice para os arquivos especificados\n -C altera para o diret\u00F3rio e inclui o arquivo seguinte\nSe nenhum arquivo for um diret\u00F3rio, ent\u00E3o ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do arquivo compactado e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags 'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um arquivo compactado com o nome classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n arquivos no diret\u00F3rio foo/ na 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Uso: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] arquivos ...\nOp\u00E7\u00F5es:\n -c cria novo archive\n -t lista o sum\u00E1rio do archive\n -x extrai arquivos com o nome (ou todos) do arquivo compactado\n -u atualiza o archive existente\n -v gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n -f especifica o nome do archive\n -m inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n -n executa a normaliza\u00E7\u00E3o Pack200 ap\u00F3s a cria\u00E7\u00E3o de um novo archive\n -e especifica o ponto de entrada da aplica\u00E7\u00E3o para aplica\u00E7\u00E3o independente \n empacotada em um arquivo jar execut\u00E1vel\n -0 armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n -M n\u00E3o cria um arquivo de manifesto para as entradas\n -i gera informa\u00E7\u00F5es de \u00EDndice para os arquivos jar especificados\n -C altera para o diret\u00F3rio especificado e inclui o arquivo seguinte\nSe algum arquivo for um diret\u00F3rio, ent\u00E3o ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do archive e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags 'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um archive chamado classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n arquivos no diret\u00F3rio foo/ na 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties Thu Dec 05 10:33:57 2013 -0800
@@ -33,6 +33,7 @@
error.write.file=Det uppstod ett fel vid skrivning till befintlig jar-fil.
error.create.dir={0} : kunde inte skapa n\u00E5gon katalog
error.incorrect.length=ogiltig l\u00E4ngd vid bearbetning: {0}
+error.create.tempfile=Kunde inte skapa en tillf\u00E4llig fil
out.added.manifest=tillagt manifestfil
out.update.manifest=uppdaterat manifest
out.ignore.entry=ignorerar posten {0}
@@ -44,4 +45,4 @@
out.inflated=\ uppackat: {0}
out.size=(in = {0}) (ut = {1})
-usage=Syntax: jar {ctxui}[vfm0Me] [jar-fil] [manifestfil] [startpunkt] [-C katalog] filer...\nAlternativ:\n -c skapa nytt arkiv\n -t lista inneh\u00E5llsf\u00F6rteckning f\u00F6r arkiv\n -x extrahera namngivna (eller alla) filer fr\u00E5n arkiv\n -u uppdatera befintligt arkiv\n -v generera utf\u00F6rliga utdata vid standardutmatning\n -f ange arkivfilens namn\n -m inkludera manifestinformation fr\u00E5n angivet manifest\n -e ange programstartpunkt f\u00F6r frist\u00E5ende applikation \n som medf\u00F6ljer i en jar-programfil\n -0 endast lagra (ingen zip-komprimering)\n -M skapa inte n\u00E5gon manifestfil f\u00F6r posterna\n -i generera indexinformation f\u00F6r de angivna jar-filerna\n -C \u00E4ndra till den angivna katalogen och inkludera f\u00F6ljande fil\nOm en fil \u00E4r en katalog bearbetas den rekursivt.\nNamnen p\u00E5 manifestfilen, arkivfilen och startpunkten anges i samma\nordning som m-, f- och e-flaggorna.\n\nExempel 1: S\u00E5 h\u00E4r arkiverar du tv\u00E5 klassfiler i ett arkiv med namnet classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nExempel 2: Anv\u00E4nd en befintlig manifestfil (mymanifest) och arkivera alla\n filer fr\u00E5n katalogen foo/ i classes.jar: \n jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Syntax: jar {ctxui}[vfmn0Me] [jar-fil] [manifestfil] [startpunkt] [-C katalog] filer ...\nAlternativ:\n -c skapa nytt arkiv\n -t lista inneh\u00E5llsf\u00F6rteckning f\u00F6r arkiv\n -x extrahera namngivna (eller alla) filer fr\u00E5n arkiv\n -u uppdatera befintligt arkiv\n -v generera utf\u00F6rliga utdata vid standardutmatning\n -f ange arkivfilens namn\n -m inkludera manifestinformation fr\u00E5n angivet manifest\n -n utf\u00F6r Pack200-normalisering efter att ha skapat ett nytt arkiv\n -e ange programstartpunkt f\u00F6r frist\u00E5ende applikation \n som medf\u00F6ljer i en jar-programfil\n -0 endast lagra (ingen zip-komprimering)\n -M skapa inte n\u00E5gon manifestfil f\u00F6r posterna\n -i generera indexinformation f\u00F6r de angivna jar-filerna\n -C \u00E4ndra till den angivna katalogen och inkludera f\u00F6ljande fil\nOm en fil \u00E4r en katalog bearbetas den rekursivt.\nNamnen p\u00E5 manifestfilen, arkivfilen och startpunkten anges\ni samma ordning som m-, f- och e-flaggorna.\n\nExempel 1: S\u00E5 h\u00E4r arkiverar du tv\u00E5 klassfiler i ett arkiv med namnet classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nExempel 2: Anv\u00E4nd en befintlig manifestfil (mymanifest) och arkivera alla\n filer fr\u00E5n katalogen foo/ i classes.jar: \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties Thu Dec 05 10:33:57 2013 -0800
@@ -33,6 +33,7 @@
error.write.file=\u5199\u5165\u73B0\u6709\u7684 jar \u6587\u4EF6\u65F6\u51FA\u9519
error.create.dir={0}: \u65E0\u6CD5\u521B\u5EFA\u76EE\u5F55
error.incorrect.length=\u5904\u7406\u65F6\u9047\u5230\u4E0D\u6B63\u786E\u7684\u957F\u5EA6: {0}
+error.create.tempfile=\u65E0\u6CD5\u521B\u5EFA\u4E34\u65F6\u6587\u4EF6
out.added.manifest=\u5DF2\u6DFB\u52A0\u6E05\u5355
out.update.manifest=\u5DF2\u66F4\u65B0\u6E05\u5355
out.ignore.entry=\u6B63\u5728\u5FFD\u7565\u6761\u76EE{0}
@@ -44,4 +45,4 @@
out.inflated=\ \u5DF2\u89E3\u538B: {0}
out.size=(\u8F93\u5165 = {0}) (\u8F93\u51FA = {1})
-usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u9009\u9879\u5305\u62EC: \n -c \u521B\u5EFA\u65B0\u7684\u5F52\u6863\u6587\u4EF6\n -t \u5217\u51FA\u5F52\u6863\u76EE\u5F55\n -x \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n -u \u66F4\u65B0\u73B0\u6709\u7684\u5F52\u6863\u6587\u4EF6\n -v \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n -f \u6307\u5B9A\u5F52\u6863\u6587\u4EF6\u540D\n -m \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n -e \u4E3A\u6346\u7ED1\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n -0 \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528\u60C5\u51B5\u4EFB\u4F55 ZIP \u538B\u7F29\n -M \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n -i \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n -C \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u5176\u4E2D\u7684\u6587\u4EF6\n\u5982\u679C\u6709\u4EFB\u4F55\u76EE\u5F55\u6587\u4EF6, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u5F52\u6863\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u5F52\u6863\u6587\u4EF6\u4E2D: \n jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=\u7528\u6CD5: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u9009\u9879:\n -c \u521B\u5EFA\u65B0\u6863\u6848\n -t \u5217\u51FA\u6863\u6848\u76EE\u5F55\n -x \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n -u \u66F4\u65B0\u73B0\u6709\u6863\u6848\n -v \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n -f \u6307\u5B9A\u6863\u6848\u6587\u4EF6\u540D\n -m \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n -n \u521B\u5EFA\u65B0\u6863\u6848\u540E\u6267\u884C Pack200 \u89C4\u8303\u5316\n -e \u4E3A\u7ED1\u5B9A\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n -0 \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528\u4EFB\u4F55 ZIP \u538B\u7F29\n -M \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n -i \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n -C \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u4EE5\u4E0B\u6587\u4EF6\n\u5982\u679C\u4EFB\u4F55\u6587\u4EF6\u4E3A\u76EE\u5F55, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u6863\u6848\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u6863\u6848\u4E2D: \n jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_TW.properties Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_TW.properties Thu Dec 05 10:33:57 2013 -0800
@@ -33,6 +33,7 @@
error.write.file=\u5BEB\u5165\u73FE\u6709\u7684 jar \u6A94\u6848\u6642\u767C\u751F\u932F\u8AA4
error.create.dir={0} : \u7121\u6CD5\u5EFA\u7ACB\u76EE\u9304
error.incorrect.length=\u8655\u7406 {0} \u6642\u9577\u5EA6\u4E0D\u6B63\u78BA
+error.create.tempfile=\u7121\u6CD5\u5EFA\u7ACB\u66AB\u5B58\u6A94\u6848
out.added.manifest=\u5DF2\u65B0\u589E\u8CC7\u8A0A\u6E05\u55AE
out.update.manifest=\u5DF2\u66F4\u65B0\u8CC7\u8A0A\u6E05\u55AE
out.ignore.entry=\u5FFD\u7565\u9805\u76EE {0}
@@ -44,4 +45,4 @@
out.inflated=\ \u64F4\u5C55: {0}
out.size=\ (\u8B80={0})(\u5BEB={1})
-usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] \u6A94\u6848 ...\n\u9078\u9805:\n -c \u5EFA\u7ACB\u65B0\u7684\u6B78\u6A94\n -t \u5217\u51FA\u6B78\u6A94\u7684\u76EE\u9304\n -x \u5F9E\u6B78\u6A94\u4E2D\u64F7\u53D6\u5DF2\u547D\u540D\u7684 (\u6216\u6240\u6709) \u6A94\u6848\n -u \u66F4\u65B0\u73FE\u6709\u6B78\u6A94\n -v \u5728\u6A19\u6E96\u8F38\u51FA\u4E2D\u7522\u751F\u8A73\u7D30\u8F38\u51FA\n -f \u6307\u5B9A\u6B78\u6A94\u6A94\u6848\u540D\u7A31\n -m \u5305\u542B\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u4E2D\u7684\u8CC7\u8A0A\u6E05\u55AE\u8CC7\u8A0A\n -e \u70BA\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F\u6307\u5B9A\u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE\n \u5DF2\u96A8\u9644\u65BC\u53EF\u57F7\u884C jar \u6A94\u6848\u4E2D\n -0 \u50C5\u5132\u5B58; \u4E0D\u4F7F\u7528 ZIP \u58D3\u7E2E\u65B9\u5F0F\n -M \u4E0D\u70BA\u9805\u76EE\u5EFA\u7ACB\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\n -i \u70BA\u6307\u5B9A\u7684 jar \u6A94\u6848\u7522\u751F\u7D22\u5F15\u8CC7\u8A0A\n -C \u8B8A\u66F4\u81F3\u6307\u5B9A\u76EE\u9304\u4E26\u5305\u542B\u5F8C\u9762\u6240\u5217\u7684\u6A94\u6848\n\u5982\u679C\u6709\u4EFB\u4F55\u6A94\u6848\u662F\u76EE\u9304\uFF0C\u5247\u6703\u5C0D\u5176\u9032\u884C\u905E\u8FF4\u8655\u7406\u3002\n\u6E05\u55AE\u6A94\u6848\u540D\u7A31\u3001\u6B78\u6A94\u6A94\u6848\u540D\u7A31\u548C\u9032\u5165\u9EDE\u540D\u7A31\n\u7684\u6307\u5B9A\u9806\u5E8F\u8207\u6307\u5B9A 'm' \u65D7\u6A19\u3001'f' \u65D7\u6A19\u548C 'e' \u65D7\u6A19\u7684\u9806\u5E8F\u76F8\u540C\u3002\n\n\u7BC4\u4F8B 1: \u5C07\u5169\u500B\u985E\u5225\u6A94\u6848\u6B78\u6A94\u81F3\u540D\u70BA classes.jar \u7684\u6B78\u6A94\u4E2D: \n jar cvf classes.jar Foo.class Bar.class\n\u7BC4\u4F8B 2: \u4F7F\u7528\u73FE\u6709\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848 'mymanifest' \u4E26\u5C07\n foo/ \u76EE\u9304\u4E2D\u7684\u6240\u6709\u6A94\u6848\u6B78\u6A94\u81F3 'classes.jar' \u4E2D: \n jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=\u7528\u6CD5: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] \u6A94\u6848 ...\n\u9078\u9805:\n -c \u5EFA\u7ACB\u65B0\u7684\u6B78\u6A94\n -t \u5217\u51FA\u6B78\u6A94\u7684\u76EE\u9304\n -x \u5F9E\u6B78\u6A94\u4E2D\u64F7\u53D6\u5DF2\u547D\u540D\u7684 (\u6216\u6240\u6709) \u6A94\u6848\n -u \u66F4\u65B0\u73FE\u6709\u6B78\u6A94\n -v \u5728\u6A19\u6E96\u8F38\u51FA\u4E2D\u7522\u751F\u8A73\u7D30\u8F38\u51FA\n -f \u6307\u5B9A\u6B78\u6A94\u6A94\u6848\u540D\u7A31\n -m \u5305\u542B\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u4E2D\u7684\u8CC7\u8A0A\u6E05\u55AE\u8CC7\u8A0A\n -n \u5728\u5EFA\u7ACB\u65B0\u6B78\u6A94\u4E4B\u5F8C\u57F7\u884C Pack200 \u6B63\u898F\u5316\n -e \u70BA\u5DF2\u96A8\u9644\u65BC\u53EF\u57F7\u884C jar \u6A94\u6848\u4E2D\u7684\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F\n \u6307\u5B9A\u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE\n -0 \u50C5\u5132\u5B58; \u4E0D\u4F7F\u7528 ZIP \u58D3\u7E2E\u65B9\u5F0F\n -M \u4E0D\u70BA\u9805\u76EE\u5EFA\u7ACB\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\n -i \u70BA\u6307\u5B9A\u7684 jar \u6A94\u6848\u7522\u751F\u7D22\u5F15\u8CC7\u8A0A\n -C \u8B8A\u66F4\u81F3\u6307\u5B9A\u76EE\u9304\u4E26\u5305\u542B\u5F8C\u9762\u6240\u5217\u7684\u6A94\u6848\n\u5982\u679C\u6709\u4EFB\u4F55\u6A94\u6848\u662F\u76EE\u9304\uFF0C\u5247\u6703\u5C0D\u5176\u9032\u884C\u905E\u8FF4\u8655\u7406\u3002\n\u6E05\u55AE\u6A94\u6848\u540D\u7A31\u3001\u6B78\u6A94\u6A94\u6848\u540D\u7A31\u548C\u9032\u5165\u9EDE\u540D\u7A31\n\u7684\u6307\u5B9A\u9806\u5E8F\u8207\u6307\u5B9A 'm' \u65D7\u6A19\u3001'f' \u65D7\u6A19\u548C 'e' \u65D7\u6A19\u7684\u9806\u5E8F\u76F8\u540C\u3002\n\n\u7BC4\u4F8B 1: \u5C07\u5169\u500B\u985E\u5225\u6A94\u6848\u6B78\u6A94\u81F3\u540D\u70BA classes.jar \u7684\u6B78\u6A94\u4E2D: \n jar cvf classes.jar Foo.class Bar.class\n\u7BC4\u4F8B 2: \u4F7F\u7528\u73FE\u6709\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848 'mymanifest' \u4E26\u5C07\n foo/ \u76EE\u9304\u4E2D\u7684\u6240\u6709\u6A94\u6848\u6B78\u6A94\u81F3 'classes.jar' \u4E2D: \n jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/test/ProblemList.txt Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/ProblemList.txt Thu Dec 05 10:33:57 2013 -0800
@@ -120,9 +120,6 @@
# jdk_lang
-# 7067973
-java/lang/management/MemoryMXBean/CollectionUsageThreshold.java generic-all
-
# 8029415
java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java generic-all
@@ -208,9 +205,6 @@
# 7146541
java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java linux-all
-# 7190106
-java/rmi/reliability/benchmark/runRmiBench.sh generic-all
-
# 7191877
java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java generic-all
@@ -269,9 +263,6 @@
# jdk_tools
-# 6461635
-com/sun/tools/attach/BasicTests.sh generic-all
-
# 7132203
sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
@@ -299,9 +290,6 @@
# jdk_util
-# Filed 6933803
-java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java generic-all
-
# Filed 6772009
java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all
--- a/jdk/test/com/sun/jmx/snmp/NoInfoLeakTest.java Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * 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 8026028
- * @summary Tests no leak of internal info
- * @author Shanliang JIANG
- * @run clean NoInfoLeakTest
- * @run build NoInfoLeakTest
- * @run main NoInfoLeakTest
- */
-
-import com.sun.jmx.snmp.SnmpString;
-import com.sun.jmx.snmp.agent.SnmpMib;
-import com.sun.jmx.snmp.agent.SnmpMibTable;
-import com.sun.jmx.snmp.daemon.CommunicatorServer;
-import com.sun.jmx.snmp.daemon.SnmpAdaptorServer;
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-public class NoInfoLeakTest {
- public static void main(String[] args) throws Exception {
- boolean ok = true;
- ok &= snmpStringTest();
- ok &= snmpMibTest();
- ok &= communicatorServerTest();
-
- if (!ok) {
- throw new RuntimeException("Some tests are failed!");
- }
- }
-
- private static boolean snmpStringTest() {
- System.out.println("\n---NoInfoLeakTest-snmpStringTest: testing the method byteValue()...");
- boolean passed = true;
-
- byte[] mine = new byte[]{1,1,1,};
- SnmpString ss = new SnmpString(mine);
- byte[] got = ss.byteValue();
- got[0]=0;
-
- if (ss.byteValue()[0] == 0) {
- System.err.println("Failed: SnmpString.byteValue() returns an internal mutable object value");
- passed = false;
- } else {
- System.out.println("---NoInfoLeakTest-snmpStringTest done.");
- }
- return passed;
- }
-
- private static boolean snmpMibTest() {
- boolean passed = true;
- System.out.println("\n---NoInfoLeakTest-snmpMibTest: testing the method "
- + "SnmpMib.getRootOid()...");
- SnmpMib mib = new MySnmpMib();
-
- if (mib.getRootOid() == mib.getRootOid()) {
- System.err.println("Failed: SnmpMib.getRootOid() returns an internal"
- + " mutable object value "+mib.getRootOid());
- } else {
- System.out.println("---NoInfoLeakTest-snmpMibTest done.");
- }
- return passed;
- }
-
- private static boolean communicatorServerTest() {
- boolean passed = true;
- System.out.println("\n---NoInfoLeakTest-communicatorServerTest: testing the method CommunicatorServer.getNotificationInfo()...");
- CommunicatorServer server = new SnmpAdaptorServer();
- MBeanNotificationInfo[] notifs = server.getNotificationInfo();
-
- assert notifs.length > 0 && notifs[0] != null; // the current implementation ensures this
- notifs[0] = null;
- if (server.getNotificationInfo()[0] == null) {
- System.err.println("Failed: CommunicatorServer.getNotificationInfo()"
- + " returns an internal mutable object value");
- passed = false;
- } else {
- System.out.println("---NoInfoLeakTest-communicatorServerTest done.");
- }
- return passed;
- }
-
- private static class MySnmpMib extends SnmpMib {
- @Override
- public void registerTableMeta(String name, SnmpMibTable table) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public SnmpMibTable getRegisteredTableMeta(String name) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void init() throws IllegalAccessException {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
- throw new UnsupportedOperationException("Not supported yet.");
- }
- }
-}
--- a/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java Thu Dec 05 10:33:57 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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,11 @@
* @summary Sanity Test for GarbageCollectorMXBean.getLastGcInfo().
* @author Mandy Chung
*
- * @run main LastGCInfo
+ * @run main/othervm -XX:-ExplicitGCInvokesConcurrent LastGCInfo
*/
+// Passing "-XX:-ExplicitGCInvokesConcurrent" to force System.gc()
+// run on foreground when CMS is used and prevent situations when "GcInfo"
+// is missing even though System.gc() was successfuly processed.
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
--- a/jdk/test/com/sun/tools/attach/AgentSetup.sh Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 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.
-#
-# 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.
-#
-
-
-#
-#
-# Agent set - creates Agent.jar, BadAgent.jar and RedefineAgent.jar in ${TESTCLASSES}
-
-$JAVAC -d "${TESTCLASSES}" "${TESTSRC}"/Agent.java "${TESTSRC}"/BadAgent.java "${TESTSRC}"/RedefineAgent.java
-
-$JAR -cfm "${TESTCLASSES}"/Agent.jar "${TESTSRC}"/agent.mf \
- -C "${TESTCLASSES}" Agent.class
-
-$JAR -cfm "${TESTCLASSES}"/BadAgent.jar "${TESTSRC}"/badagent.mf \
- -C "${TESTCLASSES}" BadAgent.class
-
-$JAR -cfm "${TESTCLASSES}"/RedefineAgent.jar "${TESTSRC}"/redefineagent.mf \
- -C "${TESTCLASSES}" RedefineAgent.class
-
-agent="${TESTCLASSES}${FS}Agent.jar"
-badagent="${TESTCLASSES}${FS}BadAgent.jar"
-redefineagent="${TESTCLASSES}${FS}RedefineAgent.jar"
-
--- a/jdk/test/com/sun/tools/attach/Application.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/com/sun/tools/attach/Application.java Thu Dec 05 10:33:57 2013 -0800
@@ -22,25 +22,39 @@
*/
/*
- *
- *
* A simple "Application" used by the Attach API unit tests. This application is
* launched by the test. It binds to a random port and shuts down when somebody
* connects to that port.
+ * Used port and pid are written both to stdout and to a specified file.
*/
import java.net.Socket;
import java.net.ServerSocket;
+import java.io.PrintWriter;
+import jdk.testlibrary.ProcessTools;
public class Application {
public static void main(String args[]) throws Exception {
// bind to a random port
+ if (args.length < 1) {
+ System.err.println("First argument should be path to output file.");
+ }
+ String outFileName = args[0];
+
ServerSocket ss = new ServerSocket(0);
int port = ss.getLocalPort();
+ int pid = ProcessTools.getProcessId();
- // signal test that we are started - do not remove this line!!
- System.out.println(port);
+ System.out.println("shutdownPort=" + port);
+ System.out.println("pid=" + pid);
System.out.flush();
+ try (PrintWriter writer = new PrintWriter(outFileName)) {
+ writer.println("shutdownPort=" + port);
+ writer.println("pid=" + pid);
+ writer.println("done");
+ writer.flush();
+ }
+
// wait for test harness to connect
Socket s = ss.accept();
s.close();
--- a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-
-#
-#
-# Application Setup - creates ${TESTCLASSES}/Application.jar and the following
-# procedures:
-# startApplication - starts target application
-# stopApplication $1 - stops application via TCP shutdown port $1
-
-$JAVAC -d "${TESTCLASSES}" "${TESTSRC}"/Application.java "${TESTSRC}"/Shutdown.java
-$JAR -cfm "${TESTCLASSES}"/Application.jar "${TESTSRC}"/application.mf \
- -C "${TESTCLASSES}" Application.class
-
-OUTPUTFILE=${TESTCLASSES}/Application.out
-rm -f ${OUTPUTFILE}
-
-startApplication()
-{
- # put all output from the app into ${OUTPUTFILE}
- ${JAVA} ${TESTVMOPTS} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} 2>&1 &
- pid="$!"
-
- # MKS creates an intermediate shell to launch ${JAVA} so
- # ${pid} is not the actual pid. We have put in a small sleep
- # to give the intermediate shell process time to launch the
- # "java" process.
- if [ "$OS" = "Windows" ]; then
- sleep 2
- if [ "${isCygwin}" = "true" ] ; then
- realpid=`ps -p ${pid} | tail -1 | awk '{print $4;}'`
- else
- realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6`
- fi
- pid=${realpid}
- fi
-
- echo "Waiting for Application to initialize..."
- attempts=0
- while true; do
- sleep 1
- port=`tail -1 ${OUTPUTFILE} | sed -e 's@\\r@@g' `
- if [ ! -z "$port" ]; then
- # In case of errors wait time for output to be flushed
- sleep 1
- cat ${OUTPUTFILE}
- break
- fi
- attempts=`expr $attempts + 1`
- echo "Waiting $attempts second(s) ..."
- done
- echo "Application is process $pid, shutdown port is $port"
- return $port
-}
-
-stopApplication()
-{
- $JAVA ${TESTVMOPTS} -classpath "${TESTCLASSES}" Shutdown $1
-}
-
--- a/jdk/test/com/sun/tools/attach/BasicTests.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java Thu Dec 05 10:33:57 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, 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
@@ -21,160 +21,257 @@
* questions.
*/
-/*
- *
- *
- * Unit test for Attach API. Attaches to the given VM and performs a number
- * unit tests.
- */
import com.sun.tools.attach.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.io.IOException;
import java.util.Properties;
import java.util.List;
+import java.io.File;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.ProcessThread;
+/*
+ * @test
+ * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
+ * @summary Basic unit tests for the VM attach mechanism.
+ * @library /lib/testlibrary
+ * @run build Agent BadAgent RedefineAgent Application Shutdown RedefineDummy
+ * @run main BasicTests
+ *
+ * This test will perform a number of basic attach tests.
+ */
public class BasicTests {
- public static void main(String args[]) throws Exception {
- String pid = args[0];
- String agent = args[1];
- String badagent = args[2];
- String redefineagent = args[3];
- System.out.println(" - Attaching to application ...");
- VirtualMachine vm = VirtualMachine.attach(pid);
+ /*
+ * The actual test is in the nested class TestMain.
+ * The responsibility of this class is to:
+ * 1. Build all needed jars.
+ * 2. Start the Application class in a separate process.
+ * 3. Find the pid and shutdown port of the running Application.
+ * 4. Launches the tests in nested class TestMain that will attach to the Application.
+ * 5. Shut down the Application.
+ */
+ public static void main(String args[]) throws Throwable {
+ final String pidFile = "TestsBasic.Application.pid";
+ ProcessThread processThread = null;
+ RunnerUtil.ProcessInfo info = null;
+ try {
+ buildJars();
+ processThread = RunnerUtil.startApplication(pidFile);
+ info = RunnerUtil.readProcessInfo(pidFile);
+ runTests(info.pid);
+ } catch (Throwable t) {
+ System.out.println("TestBasic got unexpected exception: " + t);
+ t.printStackTrace();
+ throw t;
+ } finally {
+ // Make sure the Application process is stopped.
+ RunnerUtil.stopApplication(info.shutdownPort, processThread);
+ }
+ }
- // Test 1 - read the system properties from the target VM and
- // check that property is set
- System.out.println(" - Test: system properties in target VM");
- Properties props = vm.getSystemProperties();
- String value = props.getProperty("attach.test");
- if (value == null || !value.equals("true")) {
- throw new RuntimeException("attach.test property not set");
- }
- System.out.println(" - attach.test property set as expected");
+ /**
+ * Runs the actual tests in nested class TestMain.
+ * The reason for running the tests in a separate process
+ * is that we need to modify the class path.
+ */
+ private static void runTests(int pid) throws Throwable {
+ final String sep = File.separator;
- // Test 1a - read the agent properties from the target VM.
- // By default, the agent property contains "sun.java.command",
- // "sun.jvm.flags", and "sun.jvm.args".
- // Just sanity check - make sure not empty.
- System.out.println(" - Test: agent properties in target VM");
- props = vm.getAgentProperties();
- if (props == null || props.size() == 0) {
- throw new RuntimeException("Agent properties is empty");
- }
- System.out.println(" - agent properties non-empty as expected");
+ // Need to add jdk/lib/tools.jar to classpath.
+ String classpath =
+ System.getProperty("test.class.path", "") + File.pathSeparator +
+ System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar";
+ String testClassDir = System.getProperty("test.classes", "") + sep;
+
+ // Argumenta : -classpath cp BasicTests$TestMain pid agent badagent redefineagent
+ String[] args = {
+ "-classpath",
+ classpath,
+ "BasicTests$TestMain",
+ Integer.toString(pid),
+ testClassDir + "Agent.jar",
+ testClassDir + "BadAgent.jar",
+ testClassDir + "RedefineAgent.jar" };
+ OutputAnalyzer output = ProcessTools.executeTestJvm(args);
+ output.shouldHaveExitValue(0);
+ }
- // Test 2 - attempt to load an agent that does not exist
- System.out.println(" - Test: Load an agent that does not exist");
- try {
- vm.loadAgent("SilverBullet.jar");
- } catch (AgentLoadException x) {
- System.out.println(" - AgentLoadException thrown as expected!");
+ /**
+ * Will build all jars needed by the tests.
+ */
+ private static void buildJars() throws Throwable {
+ String[] jars = {"Agent", "BadAgent", "RedefineAgent", "Application" };
+ for (String jar : jars) {
+ buildJar(jar);
}
+ }
- // Test 3 - load an "bad" agent (agentmain throws an exception)
- System.out.println(" - Test: Load a bad agent");
- System.out.println("INFO: This test will cause error messages "
- + "to appear in the application log about SilverBullet.jar "
- + "not being found and an agent failing to start.");
- try {
- vm.loadAgent(badagent);
- throw new RuntimeException(
- "AgentInitializationException not thrown as expected!");
- } catch (AgentInitializationException x) {
- System.out.println(
- " - AgentInitializationException thrown as expected!");
- }
+ /**
+ * Will build a jar with the given name.
+ * Class file and manifest must already exist.
+ * @param jarName Name of the jar.
+ */
+ private static void buildJar(String jarName) throws Throwable {
+ String testClasses = System.getProperty("test.classes", "?");
+ String testSrc = System.getProperty("test.src", "?");
+ String jar = String.format("%s/%s.jar", testClasses, jarName);
+ String manifest = String.format("%s/%s.mf", testSrc, jarName.toLowerCase());
+ String clazz = String.format("%s.class", jarName);
+
+ // Arguments to the jar command has this format:
+ // "-cfm TESTCLASSES/Agent.jar TESTSRC/agent.mf -C TESTCLASSES Agent.class"
+ RunnerUtil.createJar("-cfm", jar, manifest, "-C", testClasses, clazz);
+ }
+
+ /**
+ * This is the actual test. It will attach to the running Application
+ * and perform a number of basic attach tests.
+ */
+ public static class TestMain {
+ public static void main(String args[]) throws Exception {
+ String pid = args[0];
+ String agent = args[1];
+ String badagent = args[2];
+ String redefineagent = args[3];
- // Test 4 - detach from the VM and attempt a load (should throw IOE)
- System.out.println(" - Test: Detach from VM");
- System.out.println("INFO: This test will cause error messages "
- + "to appear in the application log about a BadAgent including "
- + "a RuntimeException and an InvocationTargetException.");
- vm.detach();
- try {
- vm.loadAgent(agent);
- throw new RuntimeException("loadAgent did not throw an exception!!");
- } catch (IOException ioe) {
- System.out.println(" - IOException as expected");
- }
+ System.out.println(" - Attaching to application ...");
+ VirtualMachine vm = VirtualMachine.attach(pid);
+
+ // Test 1 - read the system properties from the target VM and
+ // check that property is set
+ System.out.println(" - Test: system properties in target VM");
+ Properties props = vm.getSystemProperties();
+ String value = props.getProperty("attach.test");
+ if (value == null || !value.equals("true")) {
+ throw new RuntimeException("attach.test property not set");
+ }
+ System.out.println(" - attach.test property set as expected");
- // Test 5 - functional "end-to-end" test.
- // Create a listener socket. Load Agent.jar into the target VM passing
- // it the port number of our listener. When agent loads it should connect
- // back to the tool.
-
- System.out.println(" - Re-attaching to application ...");
- vm = VirtualMachine.attach(pid);
+ // Test 1a - read the agent properties from the target VM.
+ // By default, the agent property contains "sun.java.command",
+ // "sun.jvm.flags", and "sun.jvm.args".
+ // Just sanity check - make sure not empty.
+ System.out.println(" - Test: agent properties in target VM");
+ props = vm.getAgentProperties();
+ if (props == null || props.size() == 0) {
+ throw new RuntimeException("Agent properties is empty");
+ }
+ System.out.println(" - agent properties non-empty as expected");
- System.out.println(" - Test: End-to-end connection with agent");
+ // Test 2 - attempt to load an agent that does not exist
+ System.out.println(" - Test: Load an agent that does not exist");
+ try {
+ vm.loadAgent("SilverBullet.jar");
+ } catch (AgentLoadException x) {
+ System.out.println(" - AgentLoadException thrown as expected!");
+ }
- ServerSocket ss = new ServerSocket(0);
- int port = ss.getLocalPort();
-
- System.out.println(" - Loading Agent.jar into target VM ...");
- vm.loadAgent(agent, Integer.toString(port));
+ // Test 3 - load an "bad" agent (agentmain throws an exception)
+ System.out.println(" - Test: Load a bad agent");
+ System.out.println("INFO: This test will cause error messages "
+ + "to appear in the application log about SilverBullet.jar "
+ + "not being found and an agent failing to start.");
+ try {
+ vm.loadAgent(badagent);
+ throw new RuntimeException(
+ "AgentInitializationException not thrown as expected!");
+ } catch (AgentInitializationException x) {
+ System.out.println(
+ " - AgentInitializationException thrown as expected!");
+ }
- System.out.println(" - Waiting for agent to connect back to tool ...");
- Socket s = ss.accept();
- System.out.println(" - Connected to agent.");
-
- // Test 5b - functional "end-to-end" test.
- // Now with an agent that does redefine.
+ // Test 4 - detach from the VM and attempt a load (should throw IOE)
+ System.out.println(" - Test: Detach from VM");
+ System.out.println("INFO: This test will cause error messages "
+ + "to appear in the application log about a BadAgent including "
+ + "a RuntimeException and an InvocationTargetException.");
+ vm.detach();
+ try {
+ vm.loadAgent(agent);
+ throw new RuntimeException("loadAgent did not throw an exception!!");
+ } catch (IOException ioe) {
+ System.out.println(" - IOException as expected");
+ }
- System.out.println(" - Re-attaching to application ...");
- vm = VirtualMachine.attach(pid);
+ // Test 5 - functional "end-to-end" test.
+ // Create a listener socket. Load Agent.jar into the target VM passing
+ // it the port number of our listener. When agent loads it should connect
+ // back to the tool.
+
+ System.out.println(" - Re-attaching to application ...");
+ vm = VirtualMachine.attach(pid);
+
+ System.out.println(" - Test: End-to-end connection with agent");
- System.out.println(" - Test: End-to-end connection with RedefineAgent");
+ ServerSocket ss = new ServerSocket(0);
+ int port = ss.getLocalPort();
- ServerSocket ss2 = new ServerSocket(0);
- int port2 = ss2.getLocalPort();
+ System.out.println(" - Loading Agent.jar into target VM ...");
+ vm.loadAgent(agent, Integer.toString(port));
+
+ System.out.println(" - Waiting for agent to connect back to tool ...");
+ Socket s = ss.accept();
+ System.out.println(" - Connected to agent.");
- System.out.println(" - Loading RedefineAgent.jar into target VM ...");
- vm.loadAgent(redefineagent, Integer.toString(port2));
+ // Test 5b - functional "end-to-end" test.
+ // Now with an agent that does redefine.
+
+ System.out.println(" - Re-attaching to application ...");
+ vm = VirtualMachine.attach(pid);
- System.out.println(" - Waiting for RedefineAgent to connect back to tool ...");
- Socket s2 = ss2.accept();
- System.out.println(" - Connected to RedefineAgent.");
+ System.out.println(" - Test: End-to-end connection with RedefineAgent");
+
+ ServerSocket ss2 = new ServerSocket(0);
+ int port2 = ss2.getLocalPort();
+
+ System.out.println(" - Loading RedefineAgent.jar into target VM ...");
+ vm.loadAgent(redefineagent, Integer.toString(port2));
- // Test 6 - list method should list the target VM
- System.out.println(" - Test: VirtualMachine.list");
- List<VirtualMachineDescriptor> l = VirtualMachine.list();
- if (!l.isEmpty()) {
- boolean found = false;
- for (VirtualMachineDescriptor vmd: l) {
- if (vmd.id().equals(pid)) {
- found = true;
- break;
+ System.out.println(" - Waiting for RedefineAgent to connect back to tool ...");
+ Socket s2 = ss2.accept();
+ System.out.println(" - Connected to RedefineAgent.");
+
+ // Test 6 - list method should list the target VM
+ System.out.println(" - Test: VirtualMachine.list");
+ List<VirtualMachineDescriptor> l = VirtualMachine.list();
+ if (!l.isEmpty()) {
+ boolean found = false;
+ for (VirtualMachineDescriptor vmd: l) {
+ if (vmd.id().equals(pid)) {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ System.out.println(" - " + pid + " found.");
+ } else {
+ throw new RuntimeException(pid + " not found in VM list");
}
}
- if (found) {
- System.out.println(" - " + pid + " found.");
- } else {
- throw new RuntimeException(pid + " not found in VM list");
- }
- }
- // test 7 - basic hashCode/equals tests
- System.out.println(" - Test: hashCode/equals");
+ // test 7 - basic hashCode/equals tests
+ System.out.println(" - Test: hashCode/equals");
- VirtualMachine vm1 = VirtualMachine.attach(pid);
- VirtualMachine vm2 = VirtualMachine.attach(pid);
- if (!vm1.equals(vm2)) {
- throw new RuntimeException("virtual machines are not equal");
- }
- if (vm.hashCode() != vm.hashCode()) {
- throw new RuntimeException("virtual machine hashCodes not equal");
+ VirtualMachine vm1 = VirtualMachine.attach(pid);
+ VirtualMachine vm2 = VirtualMachine.attach(pid);
+ if (!vm1.equals(vm2)) {
+ throw new RuntimeException("virtual machines are not equal");
+ }
+ if (vm.hashCode() != vm.hashCode()) {
+ throw new RuntimeException("virtual machine hashCodes not equal");
+ }
+ System.out.println(" - hashCode/equals okay");
+
+ // ---
+ System.out.println(" - Cleaning up...");
+ s.close();
+ ss.close();
+ s2.close();
+ ss2.close();
}
- System.out.println(" - hashCode/equals okay");
-
-
- // ---
- System.out.println(" - Cleaning up...");
- s.close();
- ss.close();
- s2.close();
- ss2.close();
}
}
--- a/jdk/test/com/sun/tools/attach/BasicTests.sh Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-
-# @test
-# @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
-# @summary Basic unit tests for the VM attach mechanism.
-#
-# @build BasicTests
-# @run shell BasicTests.sh
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-
-# Windows 2000 is a problem here, so we skip it, see 6962615
-osrev=`uname -a`
-if [ "`echo ${osrev} | grep 'CYGWIN[^ ]*-5\.0'`" != "" ] ; then
- echo "Treating as a pass, not testing Windows 2000"
- exit 0
-fi
-if [ "`echo ${osrev} | grep 'Windows'`" != "" ] ; then
- if [ "`echo ${osrev} | grep '5 00'`" != "" ] ; then
- echo "Treating as a pass, not testing Windows 2000"
- exit 0
- fi
-fi
-
-. ${TESTSRC}/CommonSetup.sh
-. ${TESTSRC}/ApplicationSetup.sh
-. ${TESTSRC}/AgentSetup.sh
-
-startApplication -Dattach.test=true
-# pid = process-id, port = shutdown port
-
-failures=0
-
-echo "Running tests ..."
-
-$JAVA ${TESTVMOPTS} -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
- BasicTests $pid $agent $badagent $redefineagent 2>&1
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-stopApplication $port
-
-# Add these info messages to $OUTPUTFILE just in case someone
-# looks at it and wonders about the failures. We have to do
-# this after the application is stopped because it is writing
-# to $OUTPUTFILE.
-(
-echo ""
-echo "INFO: Test 2 will cause error messages about SilverBullet.jar" \
- "and an agent failing to start."
-echo "INFO: Test 3 will cause error messages about BadAgent" \
- "including a RuntimeException and an InvocationTargetException."
-) >> ${OUTPUTFILE}
-
-if [ $failures = 0 ];
- then echo "All tests passed.";
- else echo "$failures test(s) failed:"; cat ${OUTPUTFILE};
-fi
-exit $failures
--- a/jdk/test/com/sun/tools/attach/CommonSetup.sh Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-
-
-#
-#
-# Common setup for the Attach API unit tests. Setups up the following variables:
-#
-# PS - path sep.
-# FS - file sep.
-# JAVA - java cmd.
-# JAVAC - javac cmd.
-# JAR - jar cmd.
-
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin )
- PS=":"
- FS="/"
- ;;
- Windows* )
- PS=";"
- OS="Windows"
- FS="\\"
- ;;
- CYGWIN* )
- PS=";"
- OS="Windows"
- FS="\\"
- isCygwin=true
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-
-if [ "${TESTCLASSES}" = "" ]
-then
- echo "TESTCLASSES not set. Test cannot execute. Failed."
- exit 1
-fi
-
-JAVA="${TESTJAVA}/bin/java"
-JAVAC="${TESTJAVA}/bin/javac"
-JAR="${TESTJAVA}/bin/jar"
-
--- a/jdk/test/com/sun/tools/attach/PermissionTest.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/com/sun/tools/attach/PermissionTest.java Thu Dec 05 10:33:57 2013 -0800
@@ -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
@@ -21,39 +21,119 @@
* questions.
*/
-/*
- *
- *
- * Unit test for Attach API - this checks that a SecurityException is thrown as
- * expected.
- */
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.AttachNotSupportedException;
import java.util.Properties;
+import java.io.File;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.ProcessThread;
+/*
+ * @test
+ * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
+ * @summary Basic unit tests for the VM attach mechanism.
+ * @library /lib/testlibrary
+ * @run build Application Shutdown
+ * @run main PermissionTest
+ *
+ * Unit test for Attach API -
+ * this checks that a SecurityException is thrown as expected.
+ */
public class PermissionTest {
- public static void main(String args[]) throws Exception {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null) {
- throw new RuntimeException("Test configuration error - no security manager set");
- }
- String pid = args[0];
- boolean shouldFail = Boolean.parseBoolean(args[1]);
-
+ /*
+ * The actual test is in the nested class TestMain.
+ * The responsibility of this class is to:
+ * 1. Start the Application class in a separate process.
+ * 2. Find the pid and shutdown port of the running Application.
+ * 3. Run the tests in TstMain that will attach to the Application.
+ * 4. Shut down the Application.
+ */
+ public static void main(String args[]) throws Throwable {
+ final String pidFile ="TestPermission.Application.pid";
+ ProcessThread processThread = null;
+ RunnerUtil.ProcessInfo info = null;
try {
- VirtualMachine.attach(pid).detach();
- if (shouldFail) {
- throw new RuntimeException("SecurityException should be thrown");
+ processThread = RunnerUtil.startApplication(pidFile);
+ info = RunnerUtil.readProcessInfo(pidFile);
+ runTests(info.pid);
+ } catch (Throwable t) {
+ System.out.println("TestPermission got unexpected exception: " + t);
+ t.printStackTrace();
+ throw t;
+ } finally {
+ // Make sure the Application process is stopped.
+ RunnerUtil.stopApplication(info.shutdownPort, processThread);
+ }
+ }
+
+ /**
+ * Runs the actual test the nested class TestMain.
+ * The test is run in a separate process because we need to add to the classpath.
+ */
+ private static void runTests(int pid) throws Throwable {
+ final String sep = File.separator;
+
+ // Need to add jdk/lib/tools.jar to classpath.
+ String classpath =
+ System.getProperty("test.class.path", "") + File.pathSeparator +
+ System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar";
+ String testSrc = System.getProperty("test.src", "") + sep;
+
+ // Use a policy that will NOT allow attach. Test will verify exception.
+ String[] args = {
+ "-classpath",
+ classpath,
+ "-Djava.security.manager",
+ String.format("-Djava.security.policy=%sjava.policy.deny", testSrc),
+ "PermissionTest$TestMain",
+ Integer.toString(pid),
+ "true" };
+ OutputAnalyzer output = ProcessTools.executeTestJvm(args);
+ output.shouldHaveExitValue(0);
+
+ // Use a policy that will allow attach.
+ args = new String[] {
+ "-classpath",
+ classpath,
+ "-Djava.security.manager",
+ String.format("-Djava.security.policy=%sjava.policy.allow", testSrc),
+ "PermissionTest$TestMain",
+ Integer.toString(pid),
+ "false" };
+ output = ProcessTools.executeTestJvm(args);
+ output.shouldHaveExitValue(0);
+ }
+
+ /**
+ * This is the actual test code. It will attach to the Application and verify
+ * that we get a SecurityException when that is expected.
+ */
+ public static class TestMain {
+ public static void main(String args[]) throws Exception {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null) {
+ throw new RuntimeException("Test configuration error - no security manager set");
}
- System.out.println(" - attached to target VM as expected.");
- } catch (Exception x) {
- // AttachNotSupportedException thrown when no providers can be loaded
- if (shouldFail && ((x instanceof AttachNotSupportedException) ||
- (x instanceof SecurityException))) {
- System.out.println(" - exception thrown as expected.");
- } else {
- throw x;
+
+ String pid = args[0];
+ boolean shouldFail = Boolean.parseBoolean(args[1]);
+
+ try {
+ VirtualMachine.attach(pid).detach();
+ if (shouldFail) {
+ throw new RuntimeException("SecurityException should be thrown");
+ }
+ System.out.println(" - attached to target VM as expected.");
+ } catch (Exception x) {
+ // AttachNotSupportedException thrown when no providers can be loaded
+ if (shouldFail && ((x instanceof AttachNotSupportedException) ||
+ (x instanceof SecurityException))) {
+ System.out.println(" - exception thrown as expected.");
+ } else {
+ throw x;
+ }
}
}
}
--- a/jdk/test/com/sun/tools/attach/PermissionTests.sh Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
-# 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 6173612
-# @summary Security manager and permission tests for Attach API
-#
-# @build PermissionTest
-# @run shell PermissionTests.sh
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-
-. ${TESTSRC}/CommonSetup.sh
-. ${TESTSRC}/ApplicationSetup.sh
-
-failures=0
-
-# Start target VM
-startApplication
-# pid = process-id, port = shutdown port
-
-echo "Deny test"
-# deny
-$JAVA ${TESTVMOPTS} -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
- -Djava.security.manager \
- -Djava.security.policy=${TESTSRC}/java.policy.deny \
- PermissionTest $pid true 2>&1
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# allow
-echo "Allow test"
-$JAVA ${TESTVMOPTS} -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
- -Djava.security.manager \
- -Djava.security.policy=${TESTSRC}/java.policy.allow \
- PermissionTest $pid false 2>&1
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# Stop target VM
-stopApplication $port
-
-if [ $failures = 0 ];
- then echo "All tests passed.";
- else echo "$failures test(s) failed:"; cat ${OUTPUTFILE};
-fi
-exit $failures
--- a/jdk/test/com/sun/tools/attach/ProviderTest.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/com/sun/tools/attach/ProviderTest.java Thu Dec 05 10:33:57 2013 -0800
@@ -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
@@ -21,24 +21,98 @@
* questions.
*/
-/*
- *
- *
- * Unit test for Attach API. Attaches to the given VM and performs a number
- * unit tests.
- */
+import java.io.File;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.ProcessTools;
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.spi.AttachProvider;
+/*
+ * @test
+ * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
+ * @summary Basic unit tests for the VM attach mechanism.
+ * @library /lib/testlibrary
+ * @run build SimpleProvider
+ * @run main ProviderTest
+ *
+ * The test will attach and detach to/from the running Application.
+ */
public class ProviderTest {
- public static void main(String args[]) throws Exception {
- // deal with internal builds where classes are loaded from the
- // 'classes' directory rather than rt.jar
- ClassLoader cl = AttachProvider.class.getClassLoader();
- if (cl != ClassLoader.getSystemClassLoader()) {
- System.out.println("Attach API not loaded by system class loader - test skipped");
- return;
+
+ /*
+ * The actual tests are in the nested class TestMain below.
+ * The responsibility of this class is to:
+ * 1. Build the needed jar.
+ * 2. Run tests in ProviderTest.TestMain.
+ */
+ public static void main(String args[]) throws Throwable {
+ try {
+ buildJar();
+ runTests();
+ } catch (Throwable t) {
+ System.out.println("TestProvider got unexpected exception: " + t);
+ t.printStackTrace();
+ throw t;
}
- VirtualMachine.attach("simple:1234").detach();
+ }
+
+ /**
+ * Runs the actual tests in the nested class TestMain.
+ * We need to run the tests in a separate process,
+ * because we need to add to the classpath.
+ */
+ private static void runTests() throws Throwable {
+ final String sep = File.separator;
+ String testClassPath = System.getProperty("test.class.path", "");
+ String testClasses = System.getProperty("test.classes", "") + sep;
+ String jdkLib = System.getProperty("test.jdk", ".") + sep + "lib" + sep;
+
+ // Need to add SimpleProvider.jar and tools.jar to classpath.
+ String classpath =
+ testClassPath + File.pathSeparator +
+ testClasses + "SimpleProvider.jar" + File.pathSeparator +
+ jdkLib + "tools.jar";
+
+ String[] args = {
+ "-classpath",
+ classpath,
+ "ProviderTest$TestMain" };
+ OutputAnalyzer output = ProcessTools.executeTestJvm(args);
+ output.shouldHaveExitValue(0);
+ }
+
+ /**
+ * Will build the SimpleProvider.jar.
+ */
+ private static void buildJar() throws Throwable {
+ final String sep = File.separator;
+ String testClasses = System.getProperty("test.classes", "?") + sep;
+ String testSrc = System.getProperty("test.src", "?") + sep;
+ String serviceDir = "META-INF" + sep + "services" + sep;
+
+ RunnerUtil.createJar(
+ "-cf", testClasses + "SimpleProvider.jar",
+ "-C", testClasses, "SimpleProvider.class",
+ "-C", testClasses, "SimpleVirtualMachine.class",
+ "-C", testSrc,
+ serviceDir + "com.sun.tools.attach.spi.AttachProvider");
+ }
+
+ /**
+ * This is the actual test code that attaches to the running Application.
+ * This class is run in a separate process.
+ */
+ public static class TestMain {
+ public static void main(String args[]) throws Exception {
+ // deal with internal builds where classes are loaded from the
+ // 'classes' directory rather than rt.jar
+ ClassLoader cl = AttachProvider.class.getClassLoader();
+ if (cl != ClassLoader.getSystemClassLoader()) {
+ System.out.println("Attach API not loaded by system class loader - test skipped");
+ return;
+ }
+ VirtualMachine.attach("simple:1234").detach();
+ }
}
}
--- a/jdk/test/com/sun/tools/attach/ProviderTests.sh Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-#
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
-# 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 6173612
-# @summary AttachProvider unit tests
-#
-# @build ProviderTest SimpleProvider
-# @run shell ProviderTests.sh
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-
-. ${TESTSRC}/CommonSetup.sh
-
-echo "Creating JAR file ..."
-
-$JAR -cf ${TESTCLASSES}/SimpleProvider.jar \
- -C ${TESTCLASSES} SimpleProvider.class \
- -C ${TESTCLASSES} SimpleVirtualMachine.class \
- -C "${TESTSRC}" META-INF/services/com.sun.tools.attach.spi.AttachProvider
-
-echo "Running test ..."
-
-$JAVA ${TESTVMOPTS} -classpath \
- "${TESTCLASSES}${PS}${TESTCLASSES}/SimpleProvider.jar${PS}${TESTJAVA}/lib/tools.jar" \
- ProviderTest
-
--- a/jdk/test/com/sun/tools/attach/RedefineAgent.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/com/sun/tools/attach/RedefineAgent.java Thu Dec 05 10:33:57 2013 -0800
@@ -43,15 +43,15 @@
public class RedefineAgent implements ClassFileTransformer {
static byte[] classfilebytes;
- static final String targetName = "java.math.BigInteger";
- static final String targetNameSlashes = "java/math/BigInteger";
+ static final String targetName = "RedefineDummy";
+ static final String targetNameSlashes = "RedefineDummy";
static boolean gotRedefineTransform = false;
// test transform and capture class bytes for redefine
public byte[] transform(ClassLoader loader,
String className,
Class<?> classBeingRedefined,
- ProtectionDomain protectionDomain,
+ ProtectionDomain protectionDomain,
byte[] classfileBuffer) {
if (className.equals(targetNameSlashes)) {
if (classBeingRedefined == null) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/tools/attach/RedefineDummy.java Thu Dec 05 10:33:57 2013 -0800
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+/*
+ * Simple dummy class used to test class retransform.
+ */
+public class RedefineDummy {
+ public String toString() {
+ return "RedefineDummy";
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/tools/attach/RunnerUtil.java Thu Dec 05 10:33:57 2013 -0800
@@ -0,0 +1,180 @@
+/*
+ * 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.IOException;
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.Utils;
+import jdk.testlibrary.ProcessThread;
+
+/*
+ * Utility functions for test runners.
+ * (Test runner = class that launch a test)
+ */
+public class RunnerUtil {
+ /**
+ * The Application process must be run concurrently with our tests since
+ * the tests will attach to the Application.
+ * We will run the Application process in a separate thread.
+ *
+ * The Application must be started with flag "-Xshare:off" for the Retransform
+ * test in TestBasics to pass on all platforms.
+ *
+ * The Application will write its pid and shutdownPort in the given outFile.
+ */
+ public static ProcessThread startApplication(String outFile) throws Throwable {
+ String classpath = System.getProperty("test.class.path", ".");
+ String[] args = Utils.addTestJavaOpts(
+ "-Dattach.test=true", "-classpath", classpath, "Application", outFile);
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
+ ProcessThread pt = new ProcessThread("runApplication", pb);
+ pt.start();
+ return pt;
+ }
+
+ /**
+ * Will stop the running Application.
+ * First tries to shutdown nicely by connecting to the shut down port.
+ * If that fails, the process will be killed hard with stopProcess().
+ *
+ * If the nice shutdown fails, then an Exception is thrown and the test should fail.
+ *
+ * @param port The shut down port.
+ * @param processThread The process to stop.
+ */
+ public static void stopApplication(int port, ProcessThread processThread) throws Throwable {
+ if (processThread == null) {
+ System.out.println("RunnerUtil.stopApplication ignored since proc is null");
+ return;
+ }
+ try {
+ System.out.println("RunnerUtil.stopApplication waiting to for shutdown");
+ OutputAnalyzer output = ProcessTools.executeTestJvm(
+ "-classpath",
+ System.getProperty("test.class.path", "."),
+ "Shutdown",
+ Integer.toString(port));
+ // Verify that both the Shutdown command and the Application finished ok.
+ output.shouldHaveExitValue(0);
+ processThread.joinAndThrow();
+ processThread.getOutput().shouldHaveExitValue(0);
+ } catch (Throwable t) {
+ System.out.println("RunnerUtil.stopApplication failed. Will kill it hard: " + t);
+ processThread.stopProcess();
+ throw t;
+ }
+ }
+
+ /**
+ * Creates a jar file.
+ * @param args Command to the jar tool.
+ */
+ public static void createJar(String... args) {
+ System.out.println("Running: jar " + Arrays.toString(args));
+ sun.tools.jar.Main jar = new sun.tools.jar.Main(System.out, System.err, "jar");
+ if (!jar.run(args)) {
+ throw new RuntimeException("jar failed: args=" + Arrays.toString(args));
+ }
+ }
+
+ /**
+ * Read process info for the running Application.
+ * The Application writes its info to a file with this format:
+ * shutdownPort=42994
+ * pid=19597
+ * done
+ *
+ * The final "done" is used to make sure the complete file has been written
+ * before we try to read it.
+ * This function will wait until the file is available.
+ *
+ * @param filename Path to file to read.
+ * @return The ProcessInfo containing pid and shutdownPort.
+ */
+ public static ProcessInfo readProcessInfo(String filename) throws Throwable {
+ System.out.println("Reading port and pid from file: " + filename);
+ File file = new File(filename);
+ String content = null;
+
+ // Read file or wait for it to be created.
+ while (true) {
+ content = readFile(file);
+ if (content != null && content.indexOf("done") >= 0) {
+ break;
+ }
+ Thread.sleep(100);
+ }
+
+ ProcessInfo info = new ProcessInfo();
+ // search for a line with format: key=nnn
+ Pattern pattern = Pattern.compile("(\\w*)=([0-9]+)\\r?\\n");
+ Matcher matcher = pattern.matcher(content);
+ while (matcher.find()) {
+ String key = matcher.group(1);
+ int value = Integer.parseInt(matcher.group(2));
+ if ("pid".equals(key)) {
+ info.pid = value;
+ } else if ("shutdownPort".equals(key)) {
+ info.shutdownPort = value;
+ }
+ }
+ System.out.println("processInfo.pid:" + info.pid);
+ System.out.println("processInfo.shutdownPort:" + info.shutdownPort);
+ return info;
+ }
+
+ /**
+ * Read the content of a file.
+ * @param file The file to read.
+ * @return The file content or null if file does not exists.
+ */
+ public static String readFile(File file) throws IOException {
+ if (!file.exists()) {
+ return null;
+ }
+ try {
+ byte[] bytes = Files.readAllBytes(file.toPath());
+ String content = new String(bytes);
+ return content;
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ /**
+ * Helper class with info of the running Application.
+ */
+ public static class ProcessInfo {
+ public int pid = -1;
+ public int shutdownPort = -1;
+ }
+
+}
--- a/jdk/test/java/io/BufferedReader/Lines.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/java/io/BufferedReader/Lines.java Thu Dec 05 10:33:57 2013 -0800
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8003258
+ * @bug 8003258 8029434
* @run testng Lines
*/
@@ -38,6 +38,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;
+import java.util.Spliterator;
import java.util.stream.Stream;
import java.util.concurrent.atomic.AtomicInteger;
import org.testng.annotations.Test;
@@ -281,4 +282,15 @@
// Read after EOL
assertFalse(it.hasNext());
}
+
+ public void testCharacteristics() {
+ try (BufferedReader br = new BufferedReader(
+ new StringReader(""))) {
+ Spliterator<String> instance = br.lines().spliterator();
+ assertTrue(instance.hasCharacteristics(Spliterator.NONNULL));
+ assertTrue(instance.hasCharacteristics(Spliterator.ORDERED));
+ } catch (IOException ioe) {
+ fail("Should not have any exception.");
+ }
+ }
}
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java Thu Dec 05 10:33:57 2013 -0800
@@ -2239,24 +2239,33 @@
childArgs.add("sleep");
final Process p = new ProcessBuilder(childArgs).start();
final long start = System.nanoTime();
- final CountDownLatch latch = new CountDownLatch(1);
+ final CountDownLatch ready = new CountDownLatch(1);
+ final CountDownLatch done = new CountDownLatch(1);
final Thread thread = new Thread() {
public void run() {
try {
+ final boolean result;
try {
- latch.countDown();
- p.waitFor(30000, TimeUnit.MILLISECONDS);
+ ready.countDown();
+ result = p.waitFor(30000, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
return;
}
- fail("waitFor() wasn't interrupted");
- } catch (Throwable t) { unexpected(t); }}};
+ fail("waitFor() wasn't interrupted, its return value was: " + result);
+ } catch (Throwable t) {
+ unexpected(t);
+ } finally {
+ done.countDown();
+ }
+ }
+ };
thread.start();
- latch.await();
+ ready.await();
Thread.sleep(1000);
thread.interrupt();
+ done.await();
p.destroy();
} catch (Throwable t) { unexpected(t); }
--- a/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java Thu Dec 05 10:33:57 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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,8 +26,11 @@
* @bug 6396794
* @summary Check that LastGcInfo contents are reasonable
* @author Eamonn McManus
- * @run main/othervm GcInfoCompositeType
+ * @run main/othervm -XX:-ExplicitGCInvokesConcurrent GcInfoCompositeType
*/
+// Passing "-XX:-ExplicitGCInvokesConcurrent" to force System.gc()
+// run on foreground when CMS is used and prevent situations when "GcInfo"
+// is missing even though System.gc() was successfuly processed.
import java.util.*;
import java.lang.management.*;
--- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java Thu Dec 05 10:33:57 2013 -0800
@@ -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
@@ -31,44 +31,45 @@
* @author Mandy Chung
*
* @build CollectionUsageThreshold MemoryUtil
- * @run main/timeout=300 CollectionUsageThreshold
+ * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseSerialGC CollectionUsageThreshold
+ * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseParallelGC CollectionUsageThreshold
+ * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseG1GC CollectionUsageThreshold
+ * @run main/othervm/timeout=300 -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC CollectionUsageThreshold
*/
-import java.lang.Thread.*;
-import java.lang.management.*;
import java.util.*;
import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicInteger;
import javax.management.*;
import javax.management.openmbean.CompositeData;
+import java.lang.management.*;
+import static java.lang.management.MemoryNotificationInfo.*;;
+import static java.lang.management.ManagementFactory.*;
public class CollectionUsageThreshold {
- private static MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
- private static List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
- private static List<MemoryManagerMXBean> managers = ManagementFactory.getMemoryManagerMXBeans();
- private static Map<String, PoolRecord> result = new HashMap<>();
+ private static final MemoryMXBean mm = getMemoryMXBean();
+ private static final Map<String, PoolRecord> result = new HashMap<>();
private static boolean trace = false;
- private static boolean testFailed = false;
- private static int numMemoryPools = 1;
+ private static volatile int numMemoryPools = 1;
private static final int NUM_GCS = 3;
private static final int THRESHOLD = 10;
- private static Checker checker;
- private static int numGCs = 0;
+ private static volatile int numGCs = 0;
// semaphore to signal the arrival of a low memory notification
- private static Semaphore signals = new Semaphore(0);
+ private static final Semaphore signals = new Semaphore(0);
// barrier for the main thread to wait until the checker thread
// finishes checking the low memory notification result
- private static CyclicBarrier barrier = new CyclicBarrier(2);
+ private static final CyclicBarrier barrier = new CyclicBarrier(2);
static class PoolRecord {
- private MemoryPoolMXBean pool;
- private int listenerInvoked = 0;
- private long notifCount = 0;
+ private final MemoryPoolMXBean pool;
+ private final AtomicInteger listenerInvoked = new AtomicInteger(0);
+ private volatile long notifCount = 0;
PoolRecord(MemoryPoolMXBean p) {
this.pool = p;
}
int getListenerInvokedCount() {
- return listenerInvoked;
+ return listenerInvoked.get();
}
long getNotifCount() {
return notifCount;
@@ -77,18 +78,17 @@
return pool;
}
void addNotification(MemoryNotificationInfo minfo) {
- listenerInvoked++;
+ listenerInvoked.incrementAndGet();
notifCount = minfo.getCount();
}
}
static class SensorListener implements NotificationListener {
- private int numNotifs = 0;
+ @Override
public void handleNotification(Notification notif, Object handback) {
String type = notif.getType();
- if (type.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED) ||
- type.equals(MemoryNotificationInfo.
- MEMORY_COLLECTION_THRESHOLD_EXCEEDED)) {
+ if (MEMORY_THRESHOLD_EXCEEDED.equals(type) ||
+ MEMORY_COLLECTION_THRESHOLD_EXCEEDED.equals(type)) {
MemoryNotificationInfo minfo = MemoryNotificationInfo.
from((CompositeData) notif.getUserData());
@@ -98,28 +98,26 @@
throw new RuntimeException("Pool " + minfo.getPoolName() +
" is not selected");
}
- if (type != MemoryNotificationInfo.
- MEMORY_COLLECTION_THRESHOLD_EXCEEDED) {
+ if (!MEMORY_COLLECTION_THRESHOLD_EXCEEDED.equals(type)) {
throw new RuntimeException("Pool " + minfo.getPoolName() +
" got unexpected notification type: " +
type);
}
pr.addNotification(minfo);
- synchronized (this) {
- System.out.println("notifying the checker thread to check result");
- numNotifs++;
- signals.release();
- }
+ System.out.println("notifying the checker thread to check result");
+ signals.release();
}
}
}
- private static long newThreshold;
public static void main(String args[]) throws Exception {
if (args.length > 0 && args[0].equals("trace")) {
trace = true;
}
+ List<MemoryPoolMXBean> pools = getMemoryPoolMXBeans();
+ List<MemoryManagerMXBean> managers = getMemoryManagerMXBeans();
+
if (trace) {
MemoryUtil.printMemoryPools(pools);
MemoryUtil.printMemoryManagers(managers);
@@ -127,7 +125,6 @@
// Find the Old generation which supports low memory detection
for (MemoryPoolMXBean p : pools) {
- MemoryUsage u = p.getUsage();
if (p.isUsageThresholdSupported() && p.isCollectionUsageThresholdSupported()) {
if (p.getName().toLowerCase().contains("perm")) {
// if we have a "perm gen" pool increase the number of expected
@@ -149,7 +146,7 @@
// This test creates a checker thread responsible for checking
// the low memory notifications. It blocks until a permit
// from the signals semaphore is available.
- checker = new Checker("Checker thread");
+ Checker checker = new Checker("Checker thread");
checker.setDaemon(true);
checker.start();
@@ -182,12 +179,7 @@
pr.getPool().setCollectionUsageThreshold(0);
}
}
-
- if (testFailed)
- throw new RuntimeException("TEST FAILED.");
-
System.out.println("Test passed.");
-
}
@@ -205,20 +197,16 @@
}
static class Checker extends Thread {
- private boolean checkerReady = false;
- private int waiters = 0;
- private boolean readyToCheck = false;
Checker(String name) {
super(name);
};
+ @Override
public void run() {
while (true) {
try {
signals.acquire(numMemoryPools);
checkResult();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- } catch (BrokenBarrierException e) {
+ } catch (InterruptedException | BrokenBarrierException e) {
throw new RuntimeException(e);
}
}
--- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdConcMarkSweepGC.sh Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-#
-# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
-# 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 4959889
-# @summary Test CollectionUsageThreshold with concurrent marksweep collector
-# @author Mandy Chung
-#
-# @ignore 6982965
-# @run build CollectionUsageThreshold
-# @run shell/timeout=300 CollectionUsageThresholdConcMarkSweepGC.sh
-#
-
-#Set appropriate jdk
-
-if [ ! -z "${TESTJAVA}" ] ; then
- jdk="$TESTJAVA"
-else
- echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."
- exit 1
-fi
-
-runOne()
-{
- echo "runOne $@"
- $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2
-}
-
-# Test CollectionUsageThreshold with concurrent collector
-runOne -XX:+UseConcMarkSweepGC CollectionUsageThreshold
-
-exit 0
--- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdParallelGC.sh Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
-# 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 4959889
-# @summary Test CollectionUsageThreshold with parallel collector
-# @author Mandy Chung
-#
-# @run build CollectionUsageThreshold
-# @run shell/timeout=300 CollectionUsageThresholdParallelGC.sh
-#
-
-#Set appropriate jdk
-
-if [ ! -z "${TESTJAVA}" ] ; then
- jdk="$TESTJAVA"
-else
- echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."
- exit 1
-fi
-
-runOne()
-{
- echo "runOne $@"
- $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2
-}
-
-# Test CollectionUsageThreshold with parallel collector
-runOne -XX:+UseParallelGC CollectionUsageThreshold
-
-exit 0
--- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdSerialGC.sh Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
-# 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 4959889
-# @summary Test CollectionUsageThreshold with serial collector
-# @author Mandy Chung
-#
-# @run build CollectionUsageThreshold
-# @run shell/timeout=300 CollectionUsageThresholdSerialGC.sh
-#
-
-#Set appropriate jdk
-
-if [ ! -z "${TESTJAVA}" ] ; then
- jdk="$TESTJAVA"
-else
- echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."
- exit 1
-fi
-
-runOne()
-{
- echo "runOne $@"
- $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@ || exit 2
-}
-
-# Test CollectionUsageThreshold with serial collector
-runOne -XX:+UseSerialGC CollectionUsageThreshold
-
-exit 0
--- a/jdk/test/java/math/BigInteger/BigIntegerTest.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/java/math/BigInteger/BigIntegerTest.java Thu Dec 05 10:33:57 2013 -0800
@@ -56,32 +56,32 @@
// Bit large number thresholds based on the int thresholds
// defined in BigInteger itself:
//
- // KARATSUBA_THRESHOLD = 50 ints = 1600 bits
- // TOOM_COOK_THRESHOLD = 75 ints = 2400 bits
- // KARATSUBA_SQUARE_THRESHOLD = 90 ints = 2880 bits
- // TOOM_COOK_SQUARE_THRESHOLD = 140 ints = 4480 bits
+ // KARATSUBA_THRESHOLD = 80 ints = 2560 bits
+ // TOOM_COOK_THRESHOLD = 240 ints = 7680 bits
+ // KARATSUBA_SQUARE_THRESHOLD = 128 ints = 4096 bits
+ // TOOM_COOK_SQUARE_THRESHOLD = 216 ints = 6912 bits
//
- // SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 8 ints = 256 bits
+ // SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 20 ints = 640 bits
//
- // BURNIKEL_ZIEGLER_THRESHOLD = 50 ints = 1600 bits
+ // BURNIKEL_ZIEGLER_THRESHOLD = 80 ints = 2560 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 BITS_BURNIKEL_ZIEGLER = 1600;
+ static final int BITS_KARATSUBA = 2560;
+ static final int BITS_TOOM_COOK = 7680;
+ static final int BITS_KARATSUBA_SQUARE = 4096;
+ static final int BITS_TOOM_COOK_SQUARE = 6912;
+ static final int BITS_SCHOENHAGE_BASE = 640;
+ static final int BITS_BURNIKEL_ZIEGLER = 2560;
static final int ORDER_SMALL = 60;
static final int ORDER_MEDIUM = 100;
// #bits for testing Karatsuba
- static final int ORDER_KARATSUBA = 1800;
+ static final int ORDER_KARATSUBA = 2760;
// #bits for testing Toom-Cook and Burnikel-Ziegler
- static final int ORDER_TOOM_COOK = 4000;
+ static final int ORDER_TOOM_COOK = 8000;
// #bits for testing Karatsuba squaring
- static final int ORDER_KARATSUBA_SQUARE = 3200;
+ static final int ORDER_KARATSUBA_SQUARE = 4200;
// #bits for testing Toom-Cook squaring
- static final int ORDER_TOOM_COOK_SQUARE = 4600;
+ static final int ORDER_TOOM_COOK_SQUARE = 7000;
static final int SIZE = 1000; // numbers per batch
--- a/jdk/test/java/net/DatagramSocket/PortUnreachable.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/java/net/DatagramSocket/PortUnreachable.java Thu Dec 05 10:33:57 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 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,20 +31,17 @@
import java.net.InetAddress;
import java.net.DatagramSocket;
import java.net.DatagramPacket;
-import java.io.InterruptedIOException;
-public class PortUnreachable implements Runnable {
+public class PortUnreachable {
DatagramSocket clientSock;
int serverPort;
int clientPort;
- public void run() {
+ public void serverSend() {
try {
InetAddress addr = InetAddress.getLocalHost();
-
- Thread.currentThread().sleep(2000);
-
+ Thread.currentThread().sleep(1000);
// send a delayed packet which should mean a delayed icmp
// port unreachable
byte b[] = "A late msg".getBytes();
@@ -52,11 +49,8 @@
serverPort);
clientSock.send(packet);
- // wait before bringing the server up
- Thread.currentThread().sleep(5000);
-
DatagramSocket sock = new DatagramSocket(serverPort);
- b = "Grettings from the server".getBytes();
+ b = "Greetings from the server".getBytes();
packet = new DatagramPacket(b, b.length, addr, clientPort);
sock.send(packet);
sock.close();
@@ -70,10 +64,13 @@
clientSock = new DatagramSocket();
clientPort = clientSock.getLocalPort();
+ }
+
+ void execute () throws Exception{
+
// pick a port for the server
DatagramSocket sock2 = new DatagramSocket();
serverPort = sock2.getLocalPort();
- sock2.close();
// send a burst of packets to the unbound port - we should get back
// icmp port unreachable messages
@@ -82,23 +79,26 @@
byte b[] = "Hello me".getBytes();
DatagramPacket packet = new DatagramPacket(b, b.length, addr,
serverPort);
+ //close just before sending
+ sock2.close();
for (int i=0; i<100; i++)
clientSock.send(packet);
- // start the server thread
- Thread thr = new Thread(this);
- thr.start();
-
+ serverSend();
// try to receive
+ b = new byte[25];
+ packet = new DatagramPacket(b, b.length, addr, serverPort);
clientSock.setSoTimeout(10000);
clientSock.receive(packet);
+ System.out.println("client received data packet " + new String(packet.getData()));
// done
clientSock.close();
}
public static void main(String[] args) throws Exception {
- new PortUnreachable();
+ PortUnreachable test = new PortUnreachable();
+ test.execute();
}
}
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/Main.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/Main.java Thu Dec 05 10:33:57 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, 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
@@ -21,8 +21,27 @@
* questions.
*/
-/*
- *
+/**
+ * @test
+ * @summary The RMI benchmark test. This java class is used to run the test
+ * under JTREG.
+ * @library ../../../../testlibrary ../../
+ * @build TestLibrary bench.BenchInfo bench.HtmlReporter bench.Util
+ * bench.Benchmark bench.Reporter bench.XmlReporter bench.ConfigFormatException
+ * bench.Harness bench.TextReporter bench.rmi.BenchServer
+ * bench.rmi.DoubleArrayCalls bench.rmi.LongCalls bench.rmi.ShortCalls
+ * bench.rmi.BenchServerImpl bench.rmi.DoubleCalls bench.rmi.Main
+ * bench.rmi.SmallObjTreeCalls bench.rmi.BooleanArrayCalls
+ * bench.rmi.ExceptionCalls bench.rmi.NullCalls bench.rmi.BooleanCalls
+ * bench.rmi.ExportObjs bench.rmi.ObjArrayCalls bench.rmi.ByteArrayCalls
+ * bench.rmi.FloatArrayCalls bench.rmi.ObjTreeCalls bench.rmi.ByteCalls
+ * bench.rmi.FloatCalls bench.rmi.ProxyArrayCalls bench.rmi.CharArrayCalls
+ * bench.rmi.IntArrayCalls bench.rmi.RemoteObjArrayCalls bench.rmi.CharCalls
+ * bench.rmi.IntCalls bench.rmi.ClassLoading bench.rmi.LongArrayCalls
+ * bench.rmi.ShortArrayCalls
+ * bench.rmi.altroot.Node
+ * @run main/othervm/policy=policy.all/timeout=1800 bench.rmi.Main -server -c config
+ * @author Mike Warres, Nigel Daley
*/
package bench.rmi;
@@ -33,21 +52,27 @@
import bench.Reporter;
import bench.TextReporter;
import bench.XmlReporter;
+import static bench.rmi.Main.OutputFormat.*;
+import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
+import java.rmi.AlreadyBoundException;
+import java.rmi.NotBoundException;
import java.rmi.RemoteException;
-import java.rmi.RMISecurityManager;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.RemoteObject;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
-/*
+/**
* RMI/Serialization benchmark tests.
*/
public class Main {
@@ -66,19 +91,20 @@
/**
* Cleanup both client and server side in between each benchmark.
*/
+ @Override
protected void cleanup() {
System.gc();
if (Main.runmode == CLIENT) {
try {
Main.server.gc();
- } catch (Exception e) {
+ } catch (RemoteException e) {
System.err.println("Warning: server gc failed: " + e);
}
}
}
}
- static final String CONFFILE = "/bench/rmi/config";
+ static final String CONFFILE = "config";
static final String VERSION = "1.3";
static final String REGNAME = "server";
@@ -86,9 +112,32 @@
static final int CLIENT = 1;
static final int SERVER = 2;
- static final int TEXT = 0;
- static final int HTML = 1;
- static final int XML = 2;
+ static enum OutputFormat {
+
+ TEXT {
+ @Override
+ Reporter getReport(String title) {
+ return new TextReporter(repstr, title);
+ }
+ },
+ HTML {
+
+ @Override
+ Reporter getReport(String title) {
+ return new HtmlReporter(repstr, title);
+ }
+ },
+ XML {
+ @Override
+ Reporter getReport(String title) {
+ return new XmlReporter(repstr, title);
+ }
+ };
+
+ abstract Reporter getReport(String title);
+ };
+
+ static final String TEST_SRC_PATH = System.getProperty("test.src") + File.separator;
static boolean verbose;
static boolean list;
@@ -96,9 +145,11 @@
static int testDurationSeconds;
static volatile boolean exitRequested;
static Timer timer;
- static int format = TEXT;
+ static OutputFormat format = TEXT;
static int runmode;
+ static String confFile;
static InputStream confstr;
+ static String repFile;
static OutputStream repstr;
static String host;
static int port;
@@ -109,6 +160,8 @@
/**
* Returns reference to benchmark server.
+ *
+ * @return a benchmark server
*/
public static BenchServer getBenchServer() {
return server;
@@ -126,44 +179,29 @@
p.println(" -l list configuration file");
p.println(" -t <num hours> repeat benchmarks for specified number of hours");
p.println(" -o <file> specify output file");
- p.println(" -c <file> specify (non-default) " +
- "configuration file");
- p.println(" -html format output as html " +
- "(default is text)");
+ p.println(" -c <file> specify (non-default) "
+ + "configuration file");
+ p.println(" -html format output as html "
+ + "(default is text)");
p.println(" -xml format output as xml");
- p.println(" -client <host:port> run benchmark client using server " +
- "on specified host/port");
- p.println(" -server <port> run benchmark server on given port");
+ p.println(" -server run benchmark server ");
+ p.println(" -client <host:port> run benchmark client using server "
+ + "on specified host/port");
}
/**
- * Print error message and exit.
+ * Throw RuntimeException that wrap message.
+ *
+ * @param mesg a message will be wrapped in the RuntimeException.
*/
static void die(String mesg) {
- System.err.println(mesg);
- System.exit(1);
- }
-
- /**
- * Stop server and exit.
- */
- public static void exit() {
- switch (runmode) {
- case CLIENT:
- if (server != null) {
- try {
- server.terminate(0);
- } catch (RemoteException re) {
- // ignore
- }
- }
- default:
- System.exit(0);
- }
+ throw new RuntimeException(mesg);
}
/**
* Benchmark mainline.
+ *
+ * @param args
*/
public static void main(String[] args) {
setupSecurity();
@@ -173,21 +211,78 @@
listConfig();
} else {
setupServer();
- if (runmode != SERVER) {
- setupHarness();
- setupReporter();
- if (exitOnTimer) {
- setupTimer(testDurationSeconds);
- while (true) {
+ switch (runmode) {
+ case SAMEVM:
+ case CLIENT:
+ setupHarness();
+ setupReporter();
+ if (exitOnTimer) {
+ setupTimer(testDurationSeconds);
+ do {
+ runBenchmarks();
+ } while (!exitRequested);
+ } else {
runBenchmarks();
- if (exitRequested) {
- exit();
- }
+ }
+ break;
+ case SERVER:
+ //Setup for client mode, server will fork client process
+ //after its initiation.
+ List<String> clientProcessStr = new ArrayList<>();
+ clientProcessStr.add(System.getProperty("test.jdk") +
+ File.separator + "bin" + File.separator + "java");
+ String classpath = System.getProperty("java.class.path");
+ if (classpath != null) {
+ clientProcessStr.add("-cp");
+ clientProcessStr.add(classpath);
+ }
+ clientProcessStr.add("-Djava.security.policy=" + TEST_SRC_PATH + "policy.all");
+ clientProcessStr.add("-Dtest.src=" + TEST_SRC_PATH);
+ clientProcessStr.add("bench.rmi.Main"); //Client mode
+ if (verbose) {
+ clientProcessStr.add("-v");
+ }
+ if (list) {
+ clientProcessStr.add("-l");
+ }
+ clientProcessStr.add("-client");
+ clientProcessStr.add("localhost:" + port);
+
+ if (exitOnTimer) {
+ clientProcessStr.add("-t");
+ clientProcessStr.add(String.valueOf(testDurationSeconds / 3600));
}
- } else {
- runBenchmarks();
- exit();
- }
+ if (repFile != null) {
+ clientProcessStr.add("-o");
+ clientProcessStr.add(repFile);
+ }
+ if (confFile != null) {
+ clientProcessStr.add("-c");
+ clientProcessStr.add(confFile);
+ }
+ switch (format) {
+ case HTML:
+ clientProcessStr.add("-html");
+ break;
+ case XML:
+ clientProcessStr.add("-xml");
+ break;
+ }
+
+ try {
+ Process client = new ProcessBuilder(clientProcessStr).
+ inheritIO().start();
+ client.waitFor();
+ int exitValue = client.exitValue();
+ if (0 != exitValue) {
+ die("Error: error happened in client process, exitValue = " + exitValue);
+ }
+ } catch (IOException ex) {
+ die("Error: Unable start client process, ex=" + ex.getMessage());
+ } catch (InterruptedException ex) {
+ die("Error: Error happening to client process, ex=" + ex.getMessage());
+ }
+ break;
}
}
}
@@ -197,78 +292,107 @@
*/
static void parseArgs(String[] args) {
for (int i = 0; i < args.length; i++) {
- if (args[i].equals("-h")) {
- usage();
- System.exit(0);
- } else if (args[i].equals("-v")) {
- verbose = true;
- } else if (args[i].equals("-l")) {
- list = true;
- } else if (args[i].equals("-t")) {
- if (++i >= args.length)
- die("Error: no timeout value specified");
- try {
- exitOnTimer = true;
- testDurationSeconds = Integer.parseInt(args[i]) * 3600;
- } catch (Exception e) {
- die("Error: unable to determine timeout value");
- }
- } else if (args[i].equals("-o")) {
- if (++i >= args.length)
- die("Error: no output file specified");
- try {
- repstr = new FileOutputStream(args[i]);
- } catch (IOException e) {
- die("Error: unable to open \"" + args[i] + "\"");
- }
- } else if (args[i].equals("-c")) {
- if (++i >= args.length)
- die("Error: no config file specified");
- try {
- confstr = new FileInputStream(args[i]);
- } catch (IOException e) {
- die("Error: unable to open \"" + args[i] + "\"");
- }
- } else if (args[i].equals("-html")) {
- if (format != TEXT)
- die("Error: conflicting formats");
- format = HTML;
- } else if (args[i].equals("-xml")) {
- if (format != TEXT)
- die("Error: conflicting formats");
- format = XML;
- } else if (args[i].equals("-client")) {
- if (runmode == CLIENT)
- die("Error: multiple -client options");
- if (runmode == SERVER)
- die("Error: -client and -server options conflict");
- if (++i >= args.length)
- die("Error: -client missing host/port");
- try {
- int sepi = args[i].indexOf(':');
- host = args[i].substring(0, sepi);
- port = Integer.parseInt(args[i].substring(sepi + 1));
- } catch (Exception e) {
- die("Error: illegal host/port specified for -client");
- }
- runmode = CLIENT;
- } else if (args[i].equals("-server")) {
- if (runmode == CLIENT)
- die("Error: -client and -server options conflict");
- if (runmode == SERVER)
- die("Error: multiple -server options");
- if (++i >= args.length)
- die("Error: -server missing port");
- try {
- port = Integer.parseInt(args[i]);
- } catch (Exception e) {
- die("Error: illegal port specified for -server");
- }
- runmode = SERVER;
- } else {
- System.err.println("Illegal option: \"" + args[i] + "\"");
- usage();
- System.exit(1);
+ switch (args[i]) {
+ case "-h":
+ usage();
+ System.exit(0);
+ break;
+ case "-v":
+ verbose = true;
+ break;
+ case "-l":
+ list = true;
+ break;
+ case "-t":
+ if (++i >= args.length) {
+ die("Error: no timeout value specified");
+ }
+ try {
+ exitOnTimer = true;
+ testDurationSeconds = Integer.parseInt(args[i]) * 3600;
+ } catch (NumberFormatException e) {
+ die("Error: unable to determine timeout value");
+ }
+ break;
+ case "-o":
+ if (++i >= args.length) {
+ die("Error: no output file specified");
+ }
+ try {
+ repFile = args[i];
+ repstr = new FileOutputStream(repFile);
+ } catch (FileNotFoundException e) {
+ die("Error: unable to open \"" + args[i] + "\"");
+ }
+ break;
+ case "-c":
+ if (++i >= args.length) {
+ die("Error: no config file specified");
+ }
+ confFile = args[i];
+ String confFullPath = TEST_SRC_PATH + confFile;
+ try {
+ confstr = new FileInputStream(confFullPath);
+ } catch (FileNotFoundException e) {
+ die("Error: unable to open \"" + confFullPath + "\"");
+ }
+ break;
+ case "-html":
+ if (format != TEXT) {
+ die("Error: conflicting formats");
+ }
+ format = HTML;
+ break;
+ case "-xml":
+ if (format != TEXT) {
+ die("Error: conflicting formats");
+ }
+ format = XML;
+ break;
+ case "-client":
+ if (runmode == CLIENT) {
+ die("Error: multiple -client options");
+ }
+ if (runmode == SERVER) {
+ die("Error: -client and -server options conflict");
+ }
+ if (++i >= args.length) {
+ die("Error: -client missing host/port");
+ }
+ try {
+ String[] hostAndPort = args[i].split(":");
+ if (hostAndPort.length != 2) {
+ die("Error: Invalid format host/port:" + args[i]);
+ }
+ host = hostAndPort[0];
+ port = Integer.parseInt(hostAndPort[1]);
+ } catch (NumberFormatException e) {
+ die("Error: illegal host/port specified for -client");
+ }
+ runmode = CLIENT;
+ break;
+ case "-server":
+ if (runmode == CLIENT) {
+ die("Error: -client and -server options conflict");
+ }
+ if (runmode == SERVER) {
+ die("Error: multiple -server options");
+ }
+ try {
+ //This is the hack code because named package class has
+ //difficulty in accessing unamed package class. This
+ //should be removed ater JDK-8003358 is finished.
+ port = (int) Class.forName("TestLibrary")
+ .getMethod("getUnusedRandomPort")
+ .invoke(null);
+ } catch (ReflectiveOperationException ex) {
+ die("Error: can't get a free port " + ex);
+ }
+ runmode = SERVER;
+ break;
+ default:
+ usage();
+ die("Illegal option: \"" + args[i] + "\"");
}
}
}
@@ -277,27 +401,31 @@
* Set up security manager and policy, if not set already.
*/
static void setupSecurity() {
- if (System.getSecurityManager() != null)
+ if (System.getSecurityManager() != null) {
return;
+ }
/* As of 1.4, it is too late to set the security policy
* file at this point so these line have been commented out.
*/
//System.setProperty("java.security.policy",
// Main.class.getResource("/bench/rmi/policy.all").toString());
- System.setSecurityManager(new RMISecurityManager());
+ System.setSecurityManager(new SecurityManager());
}
/**
* Set up configuration file and report streams, if not set already.
*/
static void setupStreams() {
- if (repstr == null)
+ if (repstr == null) {
repstr = System.out;
- if (confstr == null)
- confstr = (new Main()).getClass().getResourceAsStream(CONFFILE);
- if (confstr == null)
+ }
+ if (confstr == null) {
+ confstr = Main.class.getResourceAsStream(TEST_SRC_PATH + CONFFILE);
+ }
+ if (confstr == null) {
die("Error: unable to find default config file");
+ }
}
/**
@@ -323,7 +451,7 @@
try {
serverImpl = new BenchServerImpl();
server = (BenchServer) RemoteObject.toStub(serverImpl);
- } catch (Exception e) {
+ } catch (RemoteException e) {
die("Error: failed to create local server: " + e);
}
if (verbose)
@@ -334,7 +462,7 @@
try {
Registry reg = LocateRegistry.getRegistry(host, port);
server = (BenchServer) reg.lookup(REGNAME);
- } catch (Exception e) {
+ } catch (NotBoundException | RemoteException e) {
die("Error: failed to connect to server: " + e);
}
if (server == null) {
@@ -351,7 +479,7 @@
Registry reg = LocateRegistry.createRegistry(port);
serverImpl = new BenchServerImpl();
reg.bind(REGNAME, serverImpl);
- } catch (Exception e) {
+ } catch (AlreadyBoundException | RemoteException e) {
die("Error: failed to initialize server: " + e);
}
if (verbose) {
@@ -368,18 +496,19 @@
/**
* Set up the timer to end the test.
*
- * @param delay the amount of delay, in seconds, before requesting
- * the process exit
+ * @param delay the amount of delay, in seconds, before requesting the
+ * process exit
*/
static void setupTimer(int delay) {
timer = new Timer(true);
timer.schedule(
- new TimerTask() {
- public void run() {
- exitRequested = true;
- }
- },
- delay * 1000);
+ new TimerTask() {
+ @Override
+ public void run() {
+ exitRequested = true;
+ }
+ },
+ delay * 1000);
}
/**
@@ -404,23 +533,7 @@
* Setup benchmark reporter.
*/
static void setupReporter() {
- String title = "RMI Benchmark, v" + VERSION;
- switch (format) {
- case TEXT:
- reporter = new TextReporter(repstr, title);
- break;
-
- case HTML:
- reporter = new HtmlReporter(repstr, title);
- break;
-
- case XML:
- reporter = new XmlReporter(repstr, title);
- break;
-
- default:
- die("Error: unrecognized format type");
- }
+ reporter = format.getReport("RMI Benchmark, v" + VERSION);
}
/**
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java Thu Dec 05 10:33:57 2013 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2008, 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
@@ -22,7 +22,29 @@
*/
/*
- *
+ * @test
+ * @summary The Serialization benchmark test. This java class is used to run the
+ * test under JTREG.
+ * @library ../../
+ * @build bench.BenchInfo bench.HtmlReporter bench.Util bench.Benchmark
+ * @build bench.Reporter bench.XmlReporter bench.ConfigFormatException
+ * @build bench.Harness bench.TextReporter
+ * @build bench.serial.BooleanArrays bench.serial.Booleans
+ * @build bench.serial.ByteArrays bench.serial.Bytes bench.serial.CharArrays
+ * @build bench.serial.Chars bench.serial.ClassDesc bench.serial.Cons
+ * @build bench.serial.CustomDefaultObjTrees bench.serial.CustomObjTrees
+ * @build bench.serial.DoubleArrays bench.serial.Doubles
+ * @build bench.serial.ExternObjTrees bench.serial.FloatArrays
+ * @build bench.serial.Floats bench.serial.GetPutFieldTrees
+ * @build bench.serial.IntArrays bench.serial.Ints bench.serial.LongArrays
+ * @build bench.serial.Longs bench.serial.Main bench.serial.ObjArrays
+ * @build bench.serial.ObjTrees bench.serial.ProxyArrays
+ * @build bench.serial.ProxyClassDesc bench.serial.RepeatObjs
+ * @build bench.serial.ReplaceTrees bench.serial.ShortArrays
+ * @build bench.serial.Shorts bench.serial.SmallObjTrees
+ * @build bench.serial.StreamBuffer bench.serial.Strings
+ * @run main/othervm/timeout=1800 bench.serial.Main -c jtreg-config
+ * @author Mike Warres, Nigel Daley
*/
package bench.serial;
@@ -33,7 +55,9 @@
import bench.Reporter;
import bench.TextReporter;
import bench.XmlReporter;
+import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.IOException;
@@ -47,8 +71,9 @@
*/
public class Main {
- static final String CONFFILE = "/bench/serial/config";
+ static final String CONFFILE = "config";
static final String VERSION = "1.3";
+ static final String TEST_SRC_PATH = System.getProperty("test.src") + File.separator;
static final int TEXT = 0;
static final int HTML = 1;
@@ -84,15 +109,18 @@
}
/**
- * Print error message and exit.
+ * Throw RuntimeException that wrap message.
+ *
+ * @param mesg a message will be wrapped in the RuntimeException.
*/
static void die(String mesg) {
- System.err.println(mesg);
- System.exit(1);
+ throw new RuntimeException(mesg);
}
/**
* Mainline parses command line, then hands off to benchmark harness.
+ *
+ * @param args
*/
public static void main(String[] args) {
parseArgs(args);
@@ -104,15 +132,11 @@
setupReporter();
if (exitOnTimer) {
setupTimer(testDurationSeconds);
- while (true) {
+ do {
runBenchmarks();
- if (exitRequested) {
- System.exit(0);
- }
- }
+ } while (!exitRequested);
} else {
runBenchmarks();
- System.exit(0);
}
}
}
@@ -122,50 +146,59 @@
*/
static void parseArgs(String[] args) {
for (int i = 0; i < args.length; i++) {
- if (args[i].equals("-h")) {
- usage();
- System.exit(0);
- } else if (args[i].equals("-v")) {
- verbose = true;
- } else if (args[i].equals("-l")) {
- list = true;
- } else if (args[i].equals("-t")) {
- if (++i >= args.length)
- die("Error: no timeout value specified");
- try {
- exitOnTimer = true;
- testDurationSeconds = Integer.parseInt(args[i]) * 3600;
- } catch (Exception e) {
- die("Error: unable to determine timeout value");
- }
- } else if (args[i].equals("-o")) {
- if (++i >= args.length)
- die("Error: no output file specified");
- try {
- repstr = new FileOutputStream(args[i]);
- } catch (IOException e) {
- die("Error: unable to open \"" + args[i] + "\"");
- }
- } else if (args[i].equals("-c")) {
- if (++i >= args.length)
- die("Error: no config file specified");
- try {
- confstr = new FileInputStream(args[i]);
- } catch (IOException e) {
- die("Error: unable to open \"" + args[i] + "\"");
- }
- } else if (args[i].equals("-html")) {
- if (format != TEXT)
- die("Error: conflicting formats");
- format = HTML;
- } else if (args[i].equals("-xml")) {
- if (format != TEXT)
- die("Error: conflicting formats");
- format = XML;
- } else {
- System.err.println("Illegal option: \"" + args[i] + "\"");
- usage();
- System.exit(1);
+ switch (args[i]) {
+ case "-h":
+ usage();
+ System.exit(0);
+ break;
+ case "-v":
+ verbose = true;
+ break;
+ case "-l":
+ list = true;
+ break;
+ case "-t":
+ if (++i >= args.length)
+ die("Error: no timeout value specified");
+ try {
+ exitOnTimer = true;
+ testDurationSeconds = Integer.parseInt(args[i]) * 3600;
+ } catch (NumberFormatException e) {
+ die("Error: unable to determine timeout value");
+ }
+ break;
+ case "-o":
+ if (++i >= args.length)
+ die("Error: no output file specified");
+ try {
+ repstr = new FileOutputStream(args[i]);
+ } catch (FileNotFoundException e) {
+ die("Error: unable to open \"" + args[i] + "\"");
+ }
+ break;
+ case "-c":
+ if (++i >= args.length)
+ die("Error: no config file specified");
+ String confFileName = TEST_SRC_PATH + args[i];
+ try {
+ confstr = new FileInputStream(confFileName);
+ } catch (FileNotFoundException e) {
+ die("Error: unable to open \"" + confFileName + "\"");
+ }
+ break;
+ case "-html":
+ if (format != TEXT)
+ die("Error: conflicting formats");
+ format = HTML;
+ break;
+ case "-xml":
+ if (format != TEXT)
+ die("Error: conflicting formats");
+ format = XML;
+ break;
+ default:
+ usage();
+ die("Illegal option: \"" + args[i] + "\"");
}
}
}
@@ -177,7 +210,7 @@
if (repstr == null)
repstr = System.out;
if (confstr == null)
- confstr = (new Main()).getClass().getResourceAsStream(CONFFILE);
+ confstr = Main.class.getResourceAsStream(TEST_SRC_PATH + CONFFILE);
if (confstr == null)
die("Error: unable to find default config file");
}
@@ -206,6 +239,7 @@
timer = new Timer(true);
timer.schedule(
new TimerTask() {
+ @Override
public void run() {
exitRequested = true;
}
--- a/jdk/test/java/rmi/reliability/benchmark/runRmiBench.sh Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-#
-# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-# 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 The RMI benchmark test. This script is only
-# used to run the test under JTREG.
-#
-# @build bench.BenchInfo bench.HtmlReporter bench.Util bench.Benchmark
-# bench.Reporter bench.XmlReporter bench.ConfigFormatException
-# bench.Harness bench.TextReporter bench.rmi.BenchServer
-# bench.rmi.DoubleArrayCalls bench.rmi.LongCalls bench.rmi.ShortCalls
-# bench.rmi.BenchServerImpl bench.rmi.DoubleCalls
-# bench.rmi.Main bench.rmi.SmallObjTreeCalls
-# bench.rmi.BooleanArrayCalls bench.rmi.ExceptionCalls
-# bench.rmi.NullCalls bench.rmi.BooleanCalls bench.rmi.ExportObjs
-# bench.rmi.ObjArrayCalls bench.rmi.ByteArrayCalls
-# bench.rmi.FloatArrayCalls bench.rmi.ObjTreeCalls
-# bench.rmi.ByteCalls bench.rmi.FloatCalls bench.rmi.ProxyArrayCalls
-# bench.rmi.CharArrayCalls bench.rmi.IntArrayCalls
-# bench.rmi.RemoteObjArrayCalls bench.rmi.CharCalls bench.rmi.IntCalls
-# bench.rmi.ClassLoading bench.rmi.LongArrayCalls
-# bench.rmi.ShortArrayCalls bench.rmi.altroot.Node
-#
-# @run shell/timeout=1800 runRmiBench.sh
-#
-# @author Mike Warres, Nigel Daley
-
-echo "Starting RMI benchmark server "
-
-$TESTJAVA/bin/java \
- -server \
- -cp $TESTCLASSES \
- -Djava.security.policy=$TESTSRC/bench/rmi/policy.all \
- bench.rmi.Main \
- -server 2007 \
- -c $TESTSRC/bench/rmi/config &
-
-sleep 10
-echo "Starting RMI benchmark client "
-
-$TESTJAVA/bin/java \
- -client \
- -cp $TESTCLASSES \
- -Djava.security.policy=$TESTSRC/bench/rmi/policy.all \
- bench.rmi.Main \
- -client localhost:2007 \
- -c $TESTSRC/bench/rmi/config
-
--- a/jdk/test/java/rmi/reliability/benchmark/runSerialBench.sh Thu Dec 05 10:32:02 2013 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-#
-# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-# 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 The Serialization benchmark test. This script is only
-# used to run the test under JTREG.
-#
-# @build bench.BenchInfo bench.HtmlReporter bench.Util bench.Benchmark
-# @build bench.Reporter bench.XmlReporter bench.ConfigFormatException
-# @build bench.Harness bench.TextReporter
-# @build bench.serial.BooleanArrays bench.serial.Booleans
-# @build bench.serial.ByteArrays bench.serial.Bytes bench.serial.CharArrays
-# @build bench.serial.Chars bench.serial.ClassDesc bench.serial.Cons
-# @build bench.serial.CustomDefaultObjTrees bench.serial.CustomObjTrees
-# @build bench.serial.DoubleArrays bench.serial.Doubles
-# @build bench.serial.ExternObjTrees bench.serial.FloatArrays
-# @build bench.serial.Floats bench.serial.GetPutFieldTrees
-# @build bench.serial.IntArrays bench.serial.Ints bench.serial.LongArrays
-# @build bench.serial.Longs bench.serial.Main bench.serial.ObjArrays
-# @build bench.serial.ObjTrees bench.serial.ProxyArrays
-# @build bench.serial.ProxyClassDesc bench.serial.RepeatObjs
-# @build bench.serial.ReplaceTrees bench.serial.ShortArrays
-# @build bench.serial.Shorts bench.serial.SmallObjTrees
-# @build bench.serial.StreamBuffer bench.serial.Strings
-#
-# @run shell/timeout=1800 runSerialBench.sh
-#
-# @author Mike Warres, Nigel Daley
-
-echo "Starting serialization benchmark "
-
-$TESTJAVA/bin/java \
- ${TESTVMOPTS} \
- -cp $TESTCLASSES \
- bench.serial.Main \
- -c $TESTSRC/bench/serial/jtreg-config &
-
--- a/jdk/test/java/util/Base64/Base64GetEncoderTest.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/java/util/Base64/Base64GetEncoderTest.java Thu Dec 05 10:33:57 2013 -0800
@@ -51,30 +51,6 @@
testWrapEncode2(encoder);
- testEncodeWithByteBuffer(encoder);
-
- }
-
- private static void testEncodeWithByteBuffer(final Base64.Encoder encoder) {
- System.err.println("\n\nEncoder.encode with ByteBuffer test ");
- final byte[] secondTestBuffer =
- "api/java_util/Base64/index.html#GetEncoderMimeCustom[noLineSeparatorInEncodedString]"
- .getBytes(US_ASCII);
- String base64EncodedString;
- ByteBuffer srcData = ByteBuffer.wrap(secondTestBuffer);
- ByteBuffer dstData = ByteBuffer.allocate(secondTestBuffer.length * 2);
-
- encoder.encode(srcData, dstData, 0);
- dstData.flip();
- if (dstData.hasArray()) {
- System.err.println("\nByteBuffer test dstData is Base64 encoding = "
- + new String(dstData.array(), US_ASCII) + "\n");
- }
-
- base64EncodedString = new String(dstData.array(), US_ASCII);
- if (base64EncodedString.contains("$$$")) {
- throw new RuntimeException("Base64 encoding contains line separator after Encoder.encode ByteBuffer ... \n");
- }
}
private static void testWrapEncode2(final Base64.Encoder encoder)
--- a/jdk/test/java/util/Base64/TestBase64.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/java/util/Base64/TestBase64.java Thu Dec 05 10:33:57 2013 -0800
@@ -23,7 +23,7 @@
/**
* @test 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925
- * 8014217 8025003 8026330
+ * 8014217 8025003 8026330 8028397
* @summary tests java.util.Base64
*/
@@ -92,6 +92,9 @@
// illegal line separator
checkIAE(new Runnable() { public void run() { Base64.getMimeEncoder(10, new byte[]{'\r', 'N'}); }});
+ // malformed padding/ending
+ testMalformedPadding();
+
// illegal base64 character
decoded[2] = (byte)0xe0;
checkIAE(new Runnable() {
@@ -100,34 +103,15 @@
public void run() { Base64.getDecoder().decode(decoded, new byte[1024]); }});
checkIAE(new Runnable() { public void run() {
Base64.getDecoder().decode(ByteBuffer.wrap(decoded)); }});
- checkIAE(new Runnable() { public void run() {
- Base64.getDecoder().decode(ByteBuffer.wrap(decoded), ByteBuffer.allocate(1024)); }});
- checkIAE(new Runnable() { public void run() {
- Base64.getDecoder().decode(ByteBuffer.wrap(decoded), ByteBuffer.allocateDirect(1024)); }});
-
- // illegal ending unit
- checkIOE(new Testable() { public void test() throws IOException {
- byte[] bytes = "AA=".getBytes("ASCII");
- try (InputStream stream =
- Base64.getDecoder().wrap(new ByteArrayInputStream(bytes))) {
- while (stream.read() != -1);
- }
- }});
-
- // test return value from decode(ByteBuffer, ByteBuffer)
- testDecBufRet();
// test single-non-base64 character for mime decoding
testSingleNonBase64MimeDec();
// test decoding of unpadded data
testDecodeUnpadded();
+
// test mime decoding with ignored character after padding
testDecodeIgnoredAfterPadding();
-
- // lenient mode for ending unit
- testLenientPadding();
-
}
private static sun.misc.BASE64Encoder sunmisc = new sun.misc.BASE64Encoder();
@@ -202,24 +186,6 @@
if (encoded2 != null)
testDecode(dec, ByteBuffer.wrap(encoded2), orig);
- // -------- testing encode(Buffer, Buffer)--------
- testEncode(enc, encoded,
- ByteBuffer.wrap(orig),
- ByteBuffer.allocate(encoded.length + 10));
-
- testEncode(enc, encoded,
- ByteBuffer.wrap(orig),
- ByteBuffer.allocateDirect(encoded.length + 10));
-
- // --------testing decode(Buffer, Buffer);--------
- testDecode(dec, orig,
- ByteBuffer.wrap(encoded),
- ByteBuffer.allocate(orig.length + 10));
-
- testDecode(dec, orig,
- ByteBuffer.wrap(encoded),
- ByteBuffer.allocateDirect(orig.length + 10));
-
// --------testing decode.wrap(input stream)--------
// 1) random buf length
ByteArrayInputStream bais = new ByteArrayInputStream(encoded);
@@ -322,9 +288,7 @@
checkNull(new Runnable() { public void run() { enc.encode(ba_null, new byte[10]); }});
checkNull(new Runnable() { public void run() { enc.encode(new byte[10], ba_null); }});
checkNull(new Runnable() { public void run() { enc.encode(bb_null); }});
- checkNull(new Runnable() { public void run() { enc.encode(bb_null, ByteBuffer.allocate(10), 0); }});
- checkNull(new Runnable() { public void run() { enc.encode(ByteBuffer.allocate(10), bb_null, 0); }});
- checkNull(new Runnable() { public void run() { enc.wrap(null); }});
+ checkNull(new Runnable() { public void run() { enc.wrap((OutputStream)null); }});
}
private static void testNull(final Base64.Decoder dec) {
@@ -333,9 +297,7 @@
checkNull(new Runnable() { public void run() { dec.decode(ba_null, new byte[10]); }});
checkNull(new Runnable() { public void run() { dec.decode(new byte[10], ba_null); }});
checkNull(new Runnable() { public void run() { dec.decode(bb_null); }});
- checkNull(new Runnable() { public void run() { dec.decode(bb_null, ByteBuffer.allocate(10)); }});
- checkNull(new Runnable() { public void run() { dec.decode(ByteBuffer.allocate(10), bb_null); }});
- checkNull(new Runnable() { public void run() { dec.wrap(null); }});
+ checkNull(new Runnable() { public void run() { dec.wrap((InputStream)null); }});
}
private static interface Testable {
@@ -412,78 +374,63 @@
dec.decode(encoded);
throw new RuntimeException("No IAE for non-base64 char");
} catch (IllegalArgumentException iae) {}
-
- // decode(ByteBuffer[], ByteBuffer[])
- ByteBuffer encodedBB = ByteBuffer.wrap(encoded);
- ByteBuffer decodedBB = ByteBuffer.allocate(100);
- int ret = decM.decode(encodedBB, decodedBB);
- byte[] buf = new byte[ret];
- decodedBB.flip();
- decodedBB.get(buf);
- checkEqual(buf, src[i], "Non-base64 char is not ignored");
- try {
- encodedBB.rewind();
- decodedBB.clear();
- dec.decode(encodedBB, decodedBB);
- throw new RuntimeException("No IAE for non-base64 char");
- } catch (IllegalArgumentException iae) {}
- // direct
- encodedBB.rewind();
- decodedBB = ByteBuffer.allocateDirect(100);
- ret = decM.decode(encodedBB, decodedBB);
- buf = new byte[ret];
- decodedBB.flip();
- decodedBB.get(buf);
- checkEqual(buf, src[i], "Non-base64 char is not ignored");
- try {
- encodedBB.rewind();
- decodedBB.clear();
- dec.decode(encodedBB, decodedBB);
- throw new RuntimeException("No IAE for non-base64 char");
- } catch (IllegalArgumentException iae) {}
}
}
}
- private static void testLenientPadding() throws Throwable {
- String[] data = new String[] {
- "=", "", // unnecessary padding
- "QUJD=", "ABC", //"ABC".encode() -> "QUJD"
+ private static void testMalformedPadding() throws Throwable {
+ Object[] data = new Object[] {
+ "$=#", "", 0, // illegal ending unit
+ "A", "", 0, // dangling single byte
+ "A=", "", 0,
+ "A==", "", 0,
+ "QUJDA", "ABC", 4,
+ "QUJDA=", "ABC", 4,
+ "QUJDA==", "ABC", 4,
- "QQ=", "A", // incomplete padding
- "QQ=N", "A", // incorrect padding
- "QQ=?", "A",
- "QUJDQQ=", "ABCA",
- "QUJDQQ=N", "ABCA",
- "QUJDQQ=?", "ABCA",
+ "=", "", 0, // unnecessary padding
+ "QUJD=", "ABC", 4, //"ABC".encode() -> "QUJD"
- "QUI=X", "AB", // incorrect padding
- "QUI=?", "AB", // incorrect padding
+ "AA=", "", 0, // incomplete padding
+ "QQ=", "", 0,
+ "QQ=N", "", 0, // incorrect padding
+ "QQ=?", "", 0,
+ "QUJDQQ=", "ABC", 4,
+ "QUJDQQ=N", "ABC", 4,
+ "QUJDQQ=?", "ABC", 4,
};
- Base64.Decoder dec = Base64.getMimeDecoder();
- for (int i = 0; i < data.length; i += 2) {
- byte[] src = data[i].getBytes("ASCII");
- byte[] expected = data[i + 1].getBytes("ASCII");
- // decode(byte[])
- byte[] ret = dec.decode(src);
- checkEqual(ret, expected, "lenient padding decoding failed!");
+ Base64.Decoder[] decs = new Base64.Decoder[] {
+ Base64.getDecoder(),
+ Base64.getUrlDecoder(),
+ Base64.getMimeDecoder()
+ };
- // decode(String)
- ret = dec.decode(data[i]);
- checkEqual(ret, expected, "lenient padding decoding failed!");
+ for (Base64.Decoder dec : decs) {
+ for (int i = 0; i < data.length; i += 3) {
+ final String srcStr = (String)data[i];
+ final byte[] srcBytes = srcStr.getBytes("ASCII");
+ final ByteBuffer srcBB = ByteBuffer.wrap(srcBytes);
+ byte[] expected = ((String)data[i + 1]).getBytes("ASCII");
+ int pos = (Integer)data[i + 2];
- // decode(ByteBuffer)
- ByteBuffer srcBB = ByteBuffer.wrap(src);
- ByteBuffer retBB = dec.decode(srcBB);
- checkEqual(srcBB.remaining(), 0, "lenient padding decoding failed!");
- checkEqual(Arrays.copyOf(retBB.array(), retBB.remaining()),
- expected, "lenient padding decoding failed!");
+ // decode(byte[])
+ checkIAE(new Runnable() { public void run() { dec.decode(srcBytes); }});
+
+ // decode(String)
+ checkIAE(new Runnable() { public void run() { dec.decode(srcStr); }});
+
+ // decode(ByteBuffer)
+ checkIAE(new Runnable() { public void run() { dec.decode(srcBB); }});
- // wrap.decode(byte[])
- ret = new byte[10];
- int n = dec.wrap(new ByteArrayInputStream(src)).read(ret);
- checkEqual(Arrays.copyOf(ret, n), expected, "lenient padding decoding failed!");
+ // wrap stream
+ checkIOE(new Testable() {
+ public void test() throws IOException {
+ try (InputStream is = dec.wrap(new ByteArrayInputStream(srcBytes))) {
+ while (is.read() != -1);
+ }
+ }});
+ }
}
}
@@ -520,51 +467,6 @@
}
}
- private static void testDecBufRet() throws Throwable {
- Random rnd = new java.util.Random();
- Base64.Encoder encoder = Base64.getEncoder();
- Base64.Decoder decoder = Base64.getDecoder();
- // src pos, len expected
- int[][] tests = { { 6, 3, 3, 3}, // xxx xxx -> yyyy yyyy
- { 6, 3, 4, 3},
- { 6, 3, 5, 3},
- { 6, 3, 6, 6},
- { 6, 11, 4, 3},
- { 6, 11, 4, 3},
- { 6, 11, 5, 3},
- { 6, 11, 6, 6},
- { 7, 3, 6, 6}, // xxx xxx x -> yyyy yyyy yy==
- { 7, 3, 7, 7},
- { 7, 11, 6, 6},
- { 7, 11, 7, 7},
- { 8, 3, 6, 6}, // xxx xxx xx -> yyyy yyyy yyy=
- { 8, 3, 7, 6},
- { 8, 3, 8, 8},
- { 8, 13, 6, 6},
- { 8, 13, 7, 6},
- { 8, 13, 8, 8},
-
- };
- ByteBuffer dstBuf = ByteBuffer.allocate(100);
- for (boolean direct : new boolean[] { false, true}) {
- for (int[] test : tests) {
- byte[] src = new byte[test[0]];
- rnd.nextBytes(src);
- ByteBuffer srcBuf = direct ? ByteBuffer.allocate(100)
- : ByteBuffer.allocateDirect(100);
- srcBuf.put(encoder.encode(src)).flip();
- dstBuf.clear().position(test[1]).limit(test[1]+ test[2]);
- int ret = decoder.decode(srcBuf, dstBuf);
- if (ret != test[3]) {
- System.out.printf(" [%6s] src=%d, pos=%d, len=%d, expected=%d, ret=%d%n",
- direct?"direct":"",
- test[0], test[1], test[2], test[3], ret);
- throw new RuntimeException("ret != expected");
- }
- }
- }
- }
-
private static final void testEncode(Base64.Encoder enc, ByteBuffer bin, byte[] expected)
throws Throwable {
@@ -587,71 +489,6 @@
checkEqual(buf, expected, "Base64 dec.decode(bf) failed!");
}
- private static final void testEncode(Base64.Encoder enc, byte[] expected,
- ByteBuffer ibb, ByteBuffer obb)
- throws Throwable {
- Random rnd = new Random();
- int bytesOut = enc.encode(ibb, obb, 0);
- if (ibb.hasRemaining()) {
- throw new RuntimeException(
- "Base64 enc.encode(bf, bf) failed with wrong return!");
- }
- obb.flip();
- byte[] buf = new byte[obb.remaining()];
- obb.get(buf);
- checkEqual(buf, expected, "Base64 enc.encode(bf, bf) failed!");
- ibb.rewind();
- obb.position(0);
- obb.limit(0);
- bytesOut = 0;
-
- do { // increase the "limit" incrementally & randomly
- int n = rnd.nextInt(expected.length - obb.position());
- if (n == 0)
- n = 1;
- obb.limit(obb.limit() + n);
- //obb.limit(Math.min(obb.limit() + n, expected.length));
- bytesOut = enc.encode(ibb, obb, bytesOut);
- } while (ibb.hasRemaining());
- obb.flip();
- buf = new byte[obb.remaining()];
- obb.get(buf);
- checkEqual(buf, expected, "Base64 enc.encode(bf, bf) failed!");
- }
-
- private static final void testDecode(Base64.Decoder dec, byte[] expected,
- ByteBuffer ibb, ByteBuffer obb)
- throws Throwable {
- Random rnd = new Random();
-
- dec.decode(ibb, obb);
- if (ibb.hasRemaining()) {
- throw new RuntimeException(
- "Base64 dec.decode(bf, bf) failed with un-decoded ibb!");
- }
- obb.flip();
- byte[] buf = new byte[obb.remaining()];
- obb.get(buf);
- checkEqual(buf, expected, "Base64 dec.decode(bf, bf) failed!");
-
- ibb.rewind();
- obb.position(0);
- obb.limit(0);
- do { // increase the "limit" incrementally & randomly
- int n = rnd.nextInt(expected.length - obb.position());
- if (n == 0)
- n = 1;
- obb.limit(obb.limit() + n);
- dec.decode(ibb, obb);
- } while (ibb.hasRemaining());
-
-
- obb.flip();
- buf = new byte[obb.remaining()];
- obb.get(buf);
- checkEqual(buf, expected, "Base64 dec.decode(bf, bf) failed!");
- }
-
private static final void checkEqual(int v1, int v2, String msg)
throws Throwable {
if (v1 != v2) {
--- a/jdk/test/java/util/Base64/TestBase64Golden.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/java/util/Base64/TestBase64Golden.java Thu Dec 05 10:33:57 2013 -0800
@@ -55,7 +55,6 @@
test0(Base64Type.MIME, Base64.getMimeEncoder(), Base64.getMimeDecoder(),
"plain.txt", "mimeEncode.txt");
test1();
- test2();
}
public static void test0(Base64Type type, Encoder encoder, Decoder decoder,
@@ -113,28 +112,6 @@
assertEqual(resBuf, encodedBuf);
srcBuf.rewind(); // reset for next test
- // test encode(ByteBuffer, ByteBuffer, bytesOut)
- resBuf.clear();
- len = encoder.encode(srcBuf, resBuf, 0);
- assertEqual(len, encodedArr.length);
- assertEqual(srcBuf.position(), limit);
- assertEqual(srcBuf.limit(), limit);
- assertEqual(resBuf.position(), len);
- resBuf.flip();
- assertEqual(resBuf, encodedBuf);
- srcBuf.rewind();
-
- // test encode(ByteBuffer, ByteBuffer, bytesOut)[direct]
- ByteBuffer resBuf_d = ByteBuffer.allocateDirect(encodedArr.length);
- len = encoder.encode(srcBuf, resBuf_d, 0);
- assertEqual(len, encodedArr.length);
- assertEqual(srcBuf.position(), limit);
- assertEqual(srcBuf.limit(), limit);
- assertEqual(resBuf_d.position(), len);
- resBuf_d.flip();
- assertEqual(resBuf_d, encodedBuf);
- srcBuf.rewind();
-
// test String encodeToString(byte[])
String resEncodeStr = encoder.encodeToString(srcArr);
assertEqual(resEncodeStr, encodedStr);
@@ -157,28 +134,6 @@
assertEqual(resBuf, srcBuf);
encodedBuf.rewind(); // reset for next test
- // test int decode(ByteBuffer, ByteBuffer)
- resBuf.clear();
- len = decoder.decode(encodedBuf, resBuf);
- assertEqual(len, srcArr.length);
- assertEqual(encodedBuf.position(), limit);
- assertEqual(encodedBuf.limit(), limit);
- assertEqual(resBuf.position(), len);
- resBuf.flip();
- assertEqual(resBuf, srcBuf);
- encodedBuf.rewind(); // reset for next test
-
- // test int decode(ByteBuffer, ByteBuffer)[direct]
- resBuf_d = ByteBuffer.allocateDirect(srcArr.length);
- len = decoder.decode(encodedBuf, resBuf_d);
- assertEqual(len, srcArr.length);
- assertEqual(encodedBuf.position(), limit);
- assertEqual(encodedBuf.limit(), limit);
- assertEqual(resBuf_d.position(), len);
- resBuf_d.flip();
- assertEqual(resBuf_d, srcBuf);
- encodedBuf.rewind(); // reset for next test
-
// test byte[] decode(String)
resArr = decoder.decode(encodedStr);
assertEqual(resArr, srcArr);
@@ -197,35 +152,6 @@
}
private static void test1() throws Exception {
- byte[] src = new byte[6];
- new Random().nextBytes(src);
-
- ByteBuffer srcBuf = ByteBuffer.allocate(10);
- srcBuf.position(2);
- srcBuf.mark();
- srcBuf.limit(8);
- srcBuf.put(src);
- srcBuf.reset();
-
- ByteBuffer dstBuf = ByteBuffer.allocate((src.length + 2) / 3 * 4);
- Base64.getEncoder().encode(srcBuf, dstBuf, 0);
- dstBuf.rewind();
- byte[] dst = new byte[dstBuf.limit()];
- dstBuf.get(dst);
- System.out.printf("%n src[%d]: %s%n", src.length, new String(src));
- System.out.printf("encoded[%d]: %s%n", dst.length, new String(dst));
- assertEqual(src, Base64.getDecoder().decode(dst));
-
- dstBuf = ByteBuffer.allocateDirect((src.length + 2) / 3 * 4);
- srcBuf.reset();
- Base64.getEncoder().encode(srcBuf, dstBuf, 0);
- dstBuf.rewind();
- dst = new byte[dstBuf.limit()];
- dstBuf.get(dst);
- assertEqual(src, Base64.getDecoder().decode(dst));
- }
-
- private static void test2() throws Exception {
byte[] src = new byte[] {
46, -97, -35, -44, 127, -60, -39, -4, -112, 34, -57, 47, -14, 67,
40, 18, 90, -59, 68, 112, 23, 121, -91, 94, 35, 49, 104, 17, 30,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/concurrent/CompletableFuture/ThenComposeAsyncTest.java Thu Dec 05 10:33:57 2013 -0800
@@ -0,0 +1,69 @@
+/*
+ * 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 org.testng.Assert;
+import org.testng.annotations.Test;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CountDownLatch;
+
+
+/**
+ * @test
+ * @bug 8029164
+ * @run testng ThenComposeAsyncTest
+ * @run testng/othervm -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 ThenComposeAsyncTest
+ * @summary Test that CompletableFuture.thenCompose works correctly if the
+ * composing task is complete before composition
+ */
+@Test
+public class ThenComposeAsyncTest {
+
+ public void testThenComposeAsync() throws Exception {
+ // Composing CompletableFuture is complete
+ CompletableFuture<String> cf1 = CompletableFuture.completedFuture("one");
+
+ // Composing function returns a CompletableFuture executed asynchronously
+ CountDownLatch cdl = new CountDownLatch(1);
+ CompletableFuture<String> cf2 = cf1.thenCompose(str -> CompletableFuture.supplyAsync(() -> {
+ while (true) {
+ try {
+ cdl.await();
+ break;
+ }
+ catch (InterruptedException e) {
+ }
+ }
+ return str + ", two";
+ }));
+
+ // Ensure returned CompletableFuture completes after call to thenCompose
+ // This guarantees that any premature internal completion will be
+ // detected
+ cdl.countDown();
+
+ String val = cf2.get();
+ Assert.assertNotNull(val);
+ Assert.assertEquals(val, "one, two");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java Thu Dec 05 10:33:57 2013 -0800
@@ -0,0 +1,145 @@
+/*
+ * 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 org.testng.annotations.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.BiConsumer;
+import java.util.function.Supplier;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
+
+/**
+ * @test
+ * @bug 8028564
+ * @run testng ConcurrentAssociateTest
+ * @summary Test that association operations, such as put and compute,
+ * place entries in the map
+ */
+@Test
+public class ConcurrentAssociateTest {
+
+ // The number of entries for each thread to place in a map
+ private static final int N = Integer.getInteger("n", 128);
+ // The number of iterations of the test
+ private static final int I = Integer.getInteger("i", 256);
+
+ // Object to be placed in the concurrent map
+ static class X {
+ // Limit the hash code to trigger collisions
+ int hc = ThreadLocalRandom.current().nextInt(1, 9);
+
+ public int hashCode() { return hc; }
+ }
+
+ @Test
+ public void testPut() {
+ test("CHM.put", (m, o) -> m.put(o, o));
+ }
+
+ @Test
+ public void testCompute() {
+ test("CHM.compute", (m, o) -> m.compute(o, (k, v) -> o));
+ }
+
+ @Test
+ public void testComputeIfAbsent() {
+ test("CHM.computeIfAbsent", (m, o) -> m.computeIfAbsent(o, (k) -> o));
+ }
+
+ @Test
+ public void testMerge() {
+ test("CHM.merge", (m, o) -> m.merge(o, o, (v1, v2) -> v1));
+ }
+
+ @Test
+ public void testPutAll() {
+ test("CHM.putAll", (m, o) -> {
+ Map<Object, Object> hm = new HashMap<>();
+ hm.put(o, o);
+ m.putAll(hm);
+ });
+ }
+
+ private static void test(String desc, BiConsumer<ConcurrentMap<Object, Object>, Object> associator) {
+ for (int i = 0; i < I; i++) {
+ testOnce(desc, associator);
+ }
+ }
+
+ static class AssociationFailure extends RuntimeException {
+ AssociationFailure(String message) {
+ super(message);
+ }
+ }
+
+ private static void testOnce(String desc, BiConsumer<ConcurrentMap<Object, Object>, Object> associator) {
+ ConcurrentHashMap<Object, Object> m = new ConcurrentHashMap<>();
+ CountDownLatch s = new CountDownLatch(1);
+
+ Supplier<Runnable> sr = () -> () -> {
+ try {
+ s.await();
+ }
+ catch (InterruptedException e) {
+ }
+
+ for (int i = 0; i < N; i++) {
+ Object o = new X();
+ associator.accept(m, o);
+ if (!m.containsKey(o)) {
+ throw new AssociationFailure(desc + " failed: entry does not exist");
+ }
+ }
+ };
+
+ int ps = Runtime.getRuntime().availableProcessors();
+ Stream<CompletableFuture> runners = IntStream.range(0, ps)
+ .mapToObj(i -> sr.get())
+ .map(CompletableFuture::runAsync);
+
+ CompletableFuture all = CompletableFuture.allOf(
+ runners.toArray(CompletableFuture[]::new));
+
+ // Trigger the runners to start associating
+ s.countDown();
+ try {
+ all.join();
+ } catch (CompletionException e) {
+ Throwable t = e.getCause();
+ if (t instanceof AssociationFailure) {
+ throw (AssociationFailure) t;
+ }
+ else {
+ throw e;
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentContainsKeyTest.java Thu Dec 05 10:33:57 2013 -0800
@@ -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.
+ */
+
+import org.testng.annotations.Test;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.function.Supplier;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
+
+/**
+ * @test
+ * @bug 8028564
+ * @run testng ConcurrentContainsKeyTest
+ * @summary Test that entries are always present in the map,
+ * when entries are held within one bin that is a tree
+ */
+@Test
+public class ConcurrentContainsKeyTest {
+
+ // The number of entries for each thread to place in a map
+ // Should be > ConcurrentHashMap.TREEIFY_THRESHOLD but small
+ // enough to allow for enough iteration overlap by multiple threads
+ private static final int N = Integer.getInteger("n", 16);
+ // The number of rounds each thread performs per entry
+ private static final int R = Integer.getInteger("r", 32);
+ // The number of iterations of the test
+ private static final int I = Integer.getInteger("i", 256);
+
+ // Object to be placed in the concurrent map
+ static class X implements Comparable<X> {
+
+ private final int a;
+
+ X(int a) {
+ this.a = a;
+ }
+
+ public int compareTo(X o) {
+ return this.a - o.a;
+ }
+
+ public int hashCode() {
+ // Return the same hash code to guarantee collisions
+ return 0;
+ }
+ }
+
+ @Test
+ public void testContainsKey() {
+ X[] content = IntStream.range(0, N).mapToObj(i -> new X(i)).toArray(X[]::new);
+ // Create map with an initial size >= ConcurrentHashMap.TREEIFY_THRESHOLD
+ // ensuring tree'ification will occur for a small number of entries
+ // with the same hash code
+ ConcurrentHashMap<Object, Object> m = new ConcurrentHashMap<>(64);
+ Stream.of(content).forEach(x -> m.put(x, x));
+ test(content, m);
+ }
+
+
+ private static void test(X[] content, ConcurrentHashMap<Object, Object> m) {
+ for (int i = 0; i < I; i++) {
+ testOnce(content, m);
+ }
+ }
+
+ static class AssociationFailure extends RuntimeException {
+ AssociationFailure(String message) {
+ super(message);
+ }
+ }
+
+ private static void testOnce(Object[] content, ConcurrentHashMap<Object, Object> m) {
+ CountDownLatch s = new CountDownLatch(1);
+
+ Supplier<Runnable> sr = () -> () -> {
+ try {
+ s.await();
+ }
+ catch (InterruptedException e) {
+ }
+
+ for (int i = 0; i < R * N; i++) {
+ Object o = content[i % content.length];
+ if (!m.containsKey(o)) {
+ throw new AssociationFailure("CHM.containsKey failed: entry does not exist");
+ }
+ }
+ };
+
+ int ps = Runtime.getRuntime().availableProcessors();
+ Stream<CompletableFuture> runners = IntStream.range(0, ps)
+ .mapToObj(i -> sr.get())
+ .map(CompletableFuture::runAsync);
+
+ CompletableFuture all = CompletableFuture.allOf(
+ runners.toArray(CompletableFuture[]::new));
+
+ // Trigger the runners to start checking key membership
+ s.countDown();
+ try {
+ all.join();
+ }
+ catch (CompletionException e) {
+ Throwable t = e.getCause();
+ if (t instanceof AssociationFailure) {
+ throw (AssociationFailure) t;
+ }
+ else {
+ throw e;
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/TestLogConfigurationDeadLock.java Thu Dec 05 10:33:57 2013 -0800
@@ -0,0 +1,255 @@
+/*
+ * 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.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.security.Permission;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+
+/**
+ * @test
+ * @bug 8029281 8027670
+ * @summary Synchronization issues in Logger and LogManager. This test
+ * focusses more particularly on potential deadlock in
+ * drainLoggerRefQueueBounded / readConfiguration
+ * @run main/othervm TestLogConfigurationDeadLock
+ * @author danielfuchs
+ */
+// This test is a best effort to try & detect issues. The test itself will run
+// for 8secs. This is usually unsufficient to detect issues.
+// To get a greater confidence it is recommended to run this test in a loop:
+// e.g. use something like:
+// $ while jtreg -jdk:$JDK -verbose:all \
+// test/java/util/logging/TestLogConfigurationDeadLock.java ; \
+// do echo Running test again ; done
+// and let it run for a few hours...
+//
+public class TestLogConfigurationDeadLock {
+
+ static volatile Exception thrown = null;
+ static volatile boolean goOn = true;
+
+ static final int READERS = 2;
+ static final int LOGGERS = 2;
+ static final long TIME = 4 * 1000; // 4 sec.
+ static final long STEP = 1 * 1000; // message every 1 sec.
+ static final int LCOUNT = 50; // 50 loggers created in a row...
+ static final AtomicLong nextLogger = new AtomicLong(0);
+ static final AtomicLong readCount = new AtomicLong(0);
+ static final AtomicLong checkCount = new AtomicLong(0);
+
+ /**
+ * This test will run both with and without a security manager.
+ *
+ * The test starts a number of threads that will call
+ * LogManager.readConfiguration() concurrently (ReadConf), then starts
+ * a number of threads that will create new loggers concurrently
+ * (AddLogger), and then two additional threads: one (Stopper) that
+ * will stop the test after 4secs (TIME ms), and one DeadlockDetector
+ * that will attempt to detect deadlocks.
+ * If after 4secs no deadlock was detected and no exception was thrown
+ * then the test is considered a success and passes.
+ *
+ * This procedure is done twice: once without a security manager and once
+ * again with a security manager - which means the test takes ~8secs to
+ * run.
+ *
+ * Note that 8sec may not be enough to detect issues if there are some.
+ * This is a best effort test.
+ *
+ * @param args the command line arguments
+ */
+ public static void main(String[] args) throws Exception {
+
+ // test without security
+ System.out.println("No security");
+ test();
+
+ // test with security
+ System.out.println("\nWith security");
+ Policy.setPolicy(new Policy() {
+ @Override
+ public boolean implies(ProtectionDomain domain, Permission permission) {
+ if (super.implies(domain, permission)) return true;
+ // System.out.println("Granting " + permission);
+ return true; // all permissions
+ }
+ });
+ System.setSecurityManager(new SecurityManager());
+ test();
+ }
+
+ /**
+ * Starts all threads, wait 4secs, then stops all threads.
+ * @throws Exception if a deadlock was detected or an error occurred.
+ */
+ public static void test() throws Exception {
+ goOn = true;
+ thrown = null;
+ long sNextLogger = nextLogger.get();
+ long sReadCount = readCount.get();
+ long sCheckCount = checkCount.get();
+ List<Thread> threads = new ArrayList<>();
+ for (int i = 0; i<READERS; i++) {
+ threads.add(new ReadConf());
+ }
+ for (int i = 0; i<LOGGERS; i++) {
+ threads.add(new AddLogger());
+ }
+ threads.add(new DeadlockDetector());
+ threads.add(0, new Stopper(TIME));
+ for (Thread t : threads) {
+ t.start();
+ }
+ for (Thread t : threads) {
+ try {
+ t.join();
+ } catch (Exception x) {
+ fail(x);
+ }
+ }
+ if (thrown != null) {
+ throw thrown;
+ }
+ System.out.println("Passed: " + (nextLogger.get() - sNextLogger)
+ + " loggers created by " + LOGGERS + " Thread(s),");
+ System.out.println("\t LogManager.readConfiguration() called "
+ + (readCount.get() - sReadCount) + " times by " + READERS
+ + " Thread(s).");
+ System.out.println("\t ThreadMXBean.findDeadlockedThreads called "
+ + (checkCount.get() -sCheckCount) + " times by 1 Thread.");
+
+ }
+
+
+ final static class ReadConf extends Thread {
+ @Override
+ public void run() {
+ while (goOn) {
+ try {
+ LogManager.getLogManager().readConfiguration();
+ readCount.incrementAndGet();
+ Thread.sleep(1);
+ } catch (Exception x) {
+ fail(x);
+ }
+ }
+ }
+ }
+
+ final static class AddLogger extends Thread {
+ @Override
+ public void run() {
+ try {
+ while (goOn) {
+ Logger l;
+ Logger foo = Logger.getLogger("foo");
+ Logger bar = Logger.getLogger("foo.bar");
+ for (int i=0; i < LCOUNT ; i++) {
+ l = Logger.getLogger("foo.bar.l"+nextLogger.incrementAndGet());
+ l.fine("I'm fine");
+ if (!goOn) break;
+ Thread.sleep(1);
+ }
+ }
+ } catch (InterruptedException | RuntimeException x ) {
+ fail(x);
+ }
+ }
+ }
+
+ final static class DeadlockDetector extends Thread {
+
+ @Override
+ public void run() {
+ while(goOn) {
+ try {
+ long[] ids = ManagementFactory.getThreadMXBean().findDeadlockedThreads();
+ checkCount.incrementAndGet();
+ ids = ids == null ? new long[0] : ids;
+ if (ids.length == 1) {
+ throw new RuntimeException("Found 1 deadlocked thread: "+ids[0]);
+ } else if (ids.length > 0) {
+ ThreadInfo[] infos = ManagementFactory.getThreadMXBean().getThreadInfo(ids);
+ System.err.println("Found "+ids.length+" deadlocked threads: ");
+ for (ThreadInfo inf : infos) {
+ System.err.println(inf.toString());
+ }
+ throw new RuntimeException("Found "+ids.length+" deadlocked threads");
+ }
+ Thread.sleep(100);
+ } catch(InterruptedException | RuntimeException x) {
+ fail(x);
+ }
+ }
+ }
+
+ }
+
+ static final class Stopper extends Thread {
+ long start;
+ long time;
+
+ Stopper(long time) {
+ start = System.currentTimeMillis();
+ this.time = time;
+ }
+
+ @Override
+ public void run() {
+ try {
+ long rest, previous;
+ previous = time;
+ while (goOn && (rest = start - System.currentTimeMillis() + time) > 0) {
+ if (previous == time || previous - rest >= STEP) {
+ Logger.getLogger("remaining").info(String.valueOf(rest)+"ms remaining...");
+ previous = rest == time ? rest -1 : rest;
+ System.gc();
+ }
+ if (goOn == false) break;
+ Thread.sleep(Math.min(rest, 100));
+ }
+ System.out.println(System.currentTimeMillis() - start
+ + " ms elapsed ("+time+ " requested)");
+ goOn = false;
+ } catch(InterruptedException | RuntimeException x) {
+ fail(x);
+ }
+ }
+
+ }
+
+ static void fail(Exception x) {
+ x.printStackTrace();
+ if (thrown == null) {
+ thrown = x;
+ }
+ goOn = false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/TestLoggerBundleSync.java Thu Dec 05 10:33:57 2013 -0800
@@ -0,0 +1,534 @@
+/*
+ * 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.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.security.Permission;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListResourceBundle;
+import java.util.Objects;
+import java.util.ResourceBundle;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+/**
+ * @test
+ * @bug 8029281 8028763
+ * @summary Attempts to detect synchronization issues with getResourceBundle()
+ * and getResourceBundleName(). It might also detect issues in the way
+ * that the logger tree is cleaned up after a logger has been garbage
+ * collected. This test helped find the root cause of 8029092, so if
+ * this test fails one might also expect failures in
+ * java/util/logging/Logger/logrb/TestLogrbResourceBundle.java and
+ * java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java.
+ * Note that this is a best effort test. Running it in a loop to
+ * reproduce intermittent issues can be a good idea.
+ * @run main/othervm TestLoggerBundleSync
+ * @author danielfuchs
+ */
+public class TestLoggerBundleSync {
+
+ static volatile Exception thrown = null;
+ static volatile boolean goOn = true;
+
+ static final int READERS = 3;
+ static final long TIME = 4 * 1000; // 4 sec.
+ static final long STEP = 1 * 1000; // message every 1 sec.
+ static final int LCOUNT = 50; // change bundle 50 times...
+ static final AtomicLong setRBcount = new AtomicLong(0);
+ static final AtomicLong setRBNameCount = new AtomicLong(0);
+ static final AtomicLong getRBcount = new AtomicLong(0);
+ static final AtomicLong checkCount = new AtomicLong(0);
+ static final AtomicLong nextLong = new AtomicLong(0);
+
+ public static class MyBundle extends ListResourceBundle {
+ @Override
+ protected Object[][] getContents() {
+ return new Object[][] {
+ {"dummy", "foo"}
+ };
+ }
+ }
+
+ public static final class MyBundle1 extends MyBundle { };
+ public static final class MyBundle2 extends MyBundle { };
+ public static final class MyBundle3 extends MyBundle { };
+
+
+ public static final class LoggerRB {
+ public final String resourceBundleName;
+ public final ResourceBundle userBundle;
+ public LoggerRB(String name, ResourceBundle bundle) {
+ resourceBundleName = name;
+ userBundle = bundle;
+ }
+ }
+
+ static final List<Class<? extends ResourceBundle>> classes = new ArrayList<>();
+ static {
+ classes.add(MyBundle1.class);
+ classes.add(MyBundle2.class);
+ classes.add(MyBundle3.class);
+ }
+
+
+ /**
+ * This test will run both with and without a security manager.
+ *
+ * The test starts a number of threads that will attempt to concurrently
+ * set resource bundles on Logger, and verifies the consistency of the
+ * obtained results.
+ *
+ * This is a best effort test.
+ *
+ * @param args the command line arguments
+ */
+ public static void main(String[] args) throws Exception {
+
+ try {
+ // test without security
+ System.out.println("No security");
+ test();
+
+ // test with security
+ System.out.println("\nWith security");
+ Policy.setPolicy(new Policy() {
+ @Override
+ public boolean implies(ProtectionDomain domain, Permission permission) {
+ if (super.implies(domain, permission)) return true;
+ // System.out.println("Granting " + permission);
+ return true; // all permissions
+ }
+ });
+ System.setSecurityManager(new SecurityManager());
+ test();
+ } finally {
+ SetRB.executor.shutdownNow();
+ SetRBName.executor.shutdownNow();
+ }
+ }
+
+ /**
+ * Starts all threads, wait 15secs, then stops all threads.
+ * @throws Exception if a deadlock was detected or an error occurred.
+ */
+ public static void test() throws Exception {
+ goOn = true;
+ thrown = null;
+ long sGetRBCount = getRBcount.get();
+ long sSetRBCount = setRBcount.get();
+ long sSetRBNameCount = setRBNameCount.get();
+ long sCheckCount = checkCount.get();
+ long sNextLong = nextLong.get();
+ List<Thread> threads = new ArrayList<>();
+ for (Class<? extends ResourceBundle> type : classes) {
+ threads.add(new SetRB(type));
+ threads.add(new SetRBName(type));
+ }
+ for (int i =0 ; i < READERS ; i++) {
+ threads.add(new GetRB());
+ }
+ threads.add(new DeadlockDetector());
+ threads.add(0, new Stopper(TIME));
+ for (Thread t : threads) {
+ t.start();
+ }
+ for (Thread t : threads) {
+ try {
+ t.join();
+ } catch (Exception x) {
+ fail(x);
+ }
+ }
+ if (thrown != null) {
+ throw thrown;
+ }
+ System.out.println("Passed: " + (nextLong.longValue() - sNextLong)
+ + " unique loggers created");
+ System.out.println("\t " +(getRBcount.get() - sGetRBCount)
+ + " loggers tested by " + READERS + " Thread(s),");
+ System.out.println("\t " + (setRBcount.get() - sSetRBCount)
+ + " resource bundles set by " + classes.size() + " Thread(s),");
+ System.out.println("\t " + (setRBNameCount.get() - sSetRBNameCount)
+ + " resource bundle names set by " + classes.size() + " Thread(s),");
+ System.out.println("\t ThreadMXBean.findDeadlockedThreads called "
+ + (checkCount.get() -sCheckCount) + " times by 1 Thread.");
+
+ }
+
+ final static class GetRB extends Thread {
+ final static class MyHandler extends Handler {
+ volatile ResourceBundle rb;
+ volatile String rbName;
+ @Override
+ public synchronized void publish(LogRecord record) {
+ rb = record.getResourceBundle();
+ rbName = record.getResourceBundleName();
+ }
+
+ @Override
+ public void flush() {
+ }
+
+ @Override
+ public void close() throws SecurityException {
+ }
+ };
+ final MyHandler handler = new MyHandler();
+ @Override
+ public void run() {
+ try {
+ handler.setLevel(Level.FINEST);
+ while (goOn) {
+ Logger l;
+ Logger foo = Logger.getLogger("foo");
+ Logger bar = Logger.getLogger("foo.bar");
+ for (long i=0; i < nextLong.longValue() + 100 ; i++) {
+ if (!goOn) break;
+ l = Logger.getLogger("foo.bar.l"+i);
+ final ResourceBundle b = l.getResourceBundle();
+ final String name = l.getResourceBundleName();
+ if (b != null) {
+ if (!name.equals(b.getBaseBundleName())) {
+ throw new RuntimeException("Unexpected bundle name: "
+ +b.getBaseBundleName());
+ }
+ }
+ Logger ll = Logger.getLogger(l.getName()+".bie.bye");
+ ResourceBundle hrb;
+ String hrbName;
+ ll.setLevel(Level.FINEST);
+ ll.addHandler(handler);
+ ll.fine("dummy");
+ ll.removeHandler(handler);
+ hrb = handler.rb;
+ hrbName = handler.rbName;
+ if (name != null) {
+ if (!name.equals(hrbName)) {
+ throw new RuntimeException("Unexpected bundle name: "
+ +hrb.getBaseBundleName());
+ }
+ if (!name.equals(hrb.getBaseBundleName())) {
+ throw new RuntimeException("Unexpected bundle name: "
+ +hrb.getBaseBundleName());
+ }
+ }
+
+ getRBcount.incrementAndGet();
+ if (!goOn) break;
+ Thread.sleep(1);
+ }
+ }
+ } catch (Exception x) {
+ fail(x);
+ }
+ }
+ }
+
+ final static class SetRB extends Thread {
+ final Class<? extends ResourceBundle> type;
+ final static ExecutorService executor = Executors.newSingleThreadExecutor();
+ final static class CheckRBTask implements Callable<Exception> {
+ final Logger logger;
+ volatile String rbName;
+ volatile ResourceBundle rb;
+
+ public CheckRBTask(Logger logger) {
+ this.logger = logger;
+ }
+
+ @Override
+ public Exception call() throws Exception {
+ try {
+ final String name = logger.getResourceBundleName();
+ if (!Objects.equals(name, rbName)) {
+ throw new RuntimeException("Unexpected rbname for "
+ + logger.getName() + ": " + name);
+ }
+ final ResourceBundle b = logger.getResourceBundle();
+ if (b != rb) {
+ throw new RuntimeException("Unexpected rb for "
+ + logger.getName() + ": " + b);
+ }
+ } catch(Exception x) {
+ return x;
+ }
+ return null;
+ }
+
+ public void check() throws Exception {
+ final FutureTask<Exception> futureTask = new FutureTask<>(this);
+ executor.submit(futureTask);
+ Exception x = futureTask.get();
+ if ( x != null) {
+ throw new RuntimeException("Check failed: "+x,x);
+ }
+ }
+ }
+ SetRB(Class<? extends ResourceBundle> type) {
+ super("SetRB["+type.getSimpleName()+"]");
+ this.type = type;
+ }
+ @Override
+ public void run() {
+ try {
+ while (goOn) {
+ Logger l;
+ Logger foo = Logger.getLogger("foo");
+ Logger bar = Logger.getLogger("foo.bar");
+ l = Logger.getLogger("foo.bar.l"+nextLong.incrementAndGet());
+ final CheckRBTask checkTask = new CheckRBTask(l);
+ checkTask.check();
+
+ for (int i=0; i < LCOUNT ; i++) {
+ if (!goOn) break;
+
+ ResourceBundle b = ResourceBundle.getBundle(type.getName());
+ try {
+ l.setResourceBundle(b);
+ checkTask.rb = b;
+ checkTask.rbName = type.getName();
+ checkTask.check();
+ if (!goOn) break;
+
+ String name = l.getResourceBundleName();
+ ResourceBundle bb = l.getResourceBundle();
+ if (!type.getName().equals(name)) {
+ throw new RuntimeException(this.getName()
+ + ": Unexpected name: "+name);
+ }
+ if (!b.getBaseBundleName().equals(name)) {
+ throw new RuntimeException(this.getName()
+ + ": Unexpected base name: " +
+ b.getBaseBundleName());
+ }
+ if (b != bb) {
+ throw new RuntimeException(this.getName()
+ + ": Unexpected bundle: "+bb);
+ }
+ setRBcount.incrementAndGet();
+ } catch (IllegalArgumentException x) {
+ final String name = l.getResourceBundleName();
+ if (!name.startsWith(MyBundle.class.getName())) {
+ throw new RuntimeException(this.getName()
+ + ": Unexpected name: "+name, x);
+ } else if (type.getName().equals(name)) {
+ throw new RuntimeException(this.getName()
+ + ": Unexpected exception for "+name, x);
+ }
+ throw x;
+ }
+ l.fine("I'm fine");
+ if (!goOn) break;
+ Thread.sleep(1);
+ }
+ }
+ } catch (Exception x) {
+ fail(x);
+ }
+ }
+ }
+
+ final static class SetRBName extends Thread {
+ int nexti = 0;
+ final Class<? extends ResourceBundle> type;
+ final static ExecutorService executor = Executors.newSingleThreadExecutor();
+ final static class CheckRBNameTask implements Callable<Exception> {
+ final Logger logger;
+ volatile String rbName;
+
+ public CheckRBNameTask(Logger logger) {
+ this.logger = logger;
+ }
+
+ @Override
+ public Exception call() throws Exception {
+ try {
+ final String name = logger.getResourceBundleName();
+ if (!Objects.equals(name, rbName)) {
+ throw new RuntimeException("Unexpected rbname for "
+ + logger.getName() + ": " + name);
+ }
+ final ResourceBundle b = logger.getResourceBundle();
+ if (!Objects.equals(b == null ? null : b.getBaseBundleName(), rbName)) {
+ throw new RuntimeException("Unexpected base name for "
+ + logger.getName() + ": " + b.getBaseBundleName());
+ }
+ } catch(Exception x) {
+ return x;
+ }
+ return null;
+ }
+
+ public void check() throws Exception {
+ final FutureTask<Exception> futureTask = new FutureTask<>(this);
+ executor.submit(futureTask);
+ Exception x = futureTask.get();
+ if ( x != null) {
+ throw new RuntimeException("Check failed: "+x,x);
+ }
+ }
+
+ }
+ SetRBName(Class<? extends ResourceBundle> type) {
+ super("SetRB["+type.getSimpleName()+"]");
+ this.type = type;
+ }
+ @Override
+ public void run() {
+ try {
+ while (goOn) {
+ Logger foo = Logger.getLogger("foo");
+ Logger bar = Logger.getLogger("foo.bar");
+ Logger l = Logger.getLogger("foo.bar.l"+nextLong.incrementAndGet());
+ final CheckRBNameTask checkTask = new CheckRBNameTask(l);
+ checkTask.check();
+
+ for (int i=0; i < LCOUNT ; i++) {
+ if (!goOn) break;
+
+ try {
+ Logger l2 = Logger.getLogger(l.getName(), type.getName());
+ if (l2 != l) {
+ System.err.println("**** ERROR WITH "+l.getName());
+ throw new RuntimeException("l2 != l ["
+ + l2 + "(" + l2.getName() + ") != "
+ + l + "(" + l.getName() + ")]");
+ }
+ checkTask.rbName = type.getName();
+ checkTask.check();
+ if (!goOn) break;
+
+ String name = l.getResourceBundleName();
+ ResourceBundle bb = l.getResourceBundle();
+ if (!type.getName().equals(name)) {
+ throw new RuntimeException(this.getName()
+ + ": Unexpected name: "+name);
+ }
+ if (!bb.getBaseBundleName().equals(name)) {
+ throw new RuntimeException(this.getName()
+ + ": Unexpected base name: "
+ + bb.getBaseBundleName());
+ }
+ setRBNameCount.incrementAndGet();
+ } catch (IllegalArgumentException x) {
+ final String name = l.getResourceBundleName();
+ if (!name.startsWith(MyBundle.class.getName())) {
+ throw new RuntimeException(this.getName()
+ + ": Unexpected name: "+name, x);
+ } else if (type.getName().equals(name)) {
+ throw new RuntimeException(this.getName()
+ + ": Unexpected exception for "+name, x);
+ }
+ throw x;
+ }
+ l.fine("I'm fine");
+ if (!goOn) break;
+ Thread.sleep(1);
+ }
+ }
+ } catch (Exception x) {
+ fail(x);
+ }
+ }
+ }
+
+ final static class DeadlockDetector extends Thread {
+
+ @Override
+ public void run() {
+ while(goOn) {
+ try {
+ long[] ids = ManagementFactory.getThreadMXBean().findDeadlockedThreads();
+ checkCount.incrementAndGet();
+ ids = ids == null ? new long[0] : ids;
+ if (ids.length == 1) {
+ throw new RuntimeException("Found 1 deadlocked thread: "+ids[0]);
+ } else if (ids.length > 0) {
+ ThreadInfo[] infos = ManagementFactory.getThreadMXBean().getThreadInfo(ids);
+ System.err.println("Found "+ids.length+" deadlocked threads: ");
+ for (ThreadInfo inf : infos) {
+ System.err.println(inf.toString());
+ }
+ throw new RuntimeException("Found "+ids.length+" deadlocked threads");
+ }
+ Thread.sleep(100);
+ } catch(InterruptedException | RuntimeException x) {
+ fail(x);
+ }
+ }
+ }
+
+ }
+
+ static final class Stopper extends Thread {
+ long start;
+ long time;
+
+ Stopper(long time) {
+ start = System.currentTimeMillis();
+ this.time = time;
+ }
+
+ @Override
+ public void run() {
+ try {
+ long rest, previous;
+ previous = time;
+ while (goOn && (rest = start - System.currentTimeMillis() + time) > 0) {
+ if (previous == time || previous - rest >= STEP) {
+ Logger.getLogger("remaining").info(String.valueOf(rest)+"ms remaining...");
+ previous = rest == time ? rest -1 : rest;
+ System.gc();
+ }
+ if (goOn == false) break;
+ Thread.sleep(Math.min(rest, 100));
+ }
+ System.out.println(System.currentTimeMillis() - start
+ + " ms elapsed ("+time+ " requested)");
+ goOn = false;
+ } catch(InterruptedException | RuntimeException x) {
+ fail(x);
+ }
+ }
+
+ }
+
+ static void fail(Exception x) {
+ x.printStackTrace();
+ if (thrown == null) {
+ thrown = x;
+ }
+ goOn = false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/stream/TestDoubleSumAverage.java Thu Dec 05 10:33:57 2013 -0800
@@ -0,0 +1,108 @@
+/*
+ * 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.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+/*
+ * @test
+ * @bug 8006572
+ * @summary Test for use of non-naive summation in stream-related sum and average operations.
+ */
+public class TestDoubleSumAverage {
+ public static void main(String... args) {
+ int failures = 0;
+
+ failures += testForCompenstation();
+ failures += testZeroAverageOfNonEmptyStream();
+
+ if (failures > 0) {
+ throw new RuntimeException("Found " + failures + " numerical failure(s).");
+ }
+ }
+
+ /**
+ * Compute the sum and average of a sequence of double values in
+ * various ways and report an error if naive summation is used.
+ */
+ private static int testForCompenstation() {
+ int failures = 0;
+
+ /*
+ * The exact sum of the test stream is 1 + 1e6*ulp(1.0) but a
+ * naive summation algorithm will return 1.0 since (1.0 +
+ * ulp(1.0)/2) will round to 1.0 again.
+ */
+ double base = 1.0;
+ double increment = Math.ulp(base)/2.0;
+ int count = 1_000_001;
+
+ double expectedSum = base + (increment * (count - 1));
+ double expectedAvg = expectedSum / count;
+
+ // Factory for double a stream of [base, increment, ..., increment] limited to a size of count
+ Supplier<DoubleStream> ds = () -> DoubleStream.iterate(base, e -> increment).limit(count);
+
+ DoubleSummaryStatistics stats = ds.get().collect(DoubleSummaryStatistics::new,
+ DoubleSummaryStatistics::accept,
+ DoubleSummaryStatistics::combine);
+
+ failures += compareUlpDifference(expectedSum, stats.getSum(), 3);
+ failures += compareUlpDifference(expectedAvg, stats.getAverage(), 3);
+
+ failures += compareUlpDifference(expectedSum,
+ ds.get().sum(), 3);
+ failures += compareUlpDifference(expectedAvg,
+ ds.get().average().getAsDouble(), 3);
+
+ failures += compareUlpDifference(expectedSum,
+ ds.get().boxed().collect(Collectors.summingDouble(d -> d)), 3);
+ failures += compareUlpDifference(expectedAvg,
+ ds.get().boxed().collect(Collectors.averagingDouble(d -> d)),3);
+ return failures;
+ }
+
+ /**
+ * Test to verify that a non-empty stream with a zero average is non-empty.
+ */
+ private static int testZeroAverageOfNonEmptyStream() {
+ Supplier<DoubleStream> ds = () -> DoubleStream.iterate(0.0, e -> 0.0).limit(10);
+
+ return compareUlpDifference(0.0, ds.get().average().getAsDouble(), 0);
+ }
+
+ /**
+ * Compute the ulp difference of two double values and compare against an error threshold.
+ */
+ private static int compareUlpDifference(double expected, double computed, double threshold) {
+ double ulpDifference = Math.abs(expected - computed) / Math.ulp(expected);
+
+ if (ulpDifference > threshold) {
+ System.err.printf("Numerical summation error too large, %g ulps rather than %g.%n",
+ ulpDifference, threshold);
+ return 1;
+ } else
+ return 0;
+ }
+}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java Thu Dec 05 10:33:57 2013 -0800
@@ -37,39 +37,21 @@
/**
* Creates a new {@code ProcessThread} object.
*
- * @param cmd The list of program and its arguments to pass to {@link ProcessBuilder}
+ * @param threadName The name of thread
+ * @param cmd The string array of program and its arguments to pass to {@link ProcessBuilder}
*/
- public ProcessThread(List<String> cmd) {
- super(new ProcessRunnable(cmd));
+ public ProcessThread(String threadName, String... cmd) {
+ super(new ProcessRunnable(new ProcessBuilder(cmd)), threadName);
}
/**
* Creates a new {@code ProcessThread} object.
*
- * @param cmd The string array of program and its arguments to pass to {@link ProcessBuilder}
- */
- public ProcessThread(String... cmd) {
- super(new ProcessRunnable(cmd));
- }
-
- /**
- * Creates a new {@code ProcessThread} object.
- *
- * @param threadName The name of thread
- * @param cmd The list of program and its arguments to pass to {@link ProcessBuilder}
+ * @param threadName The name of thread.
+ * @param pb The ProcessBuilder to execute.
*/
- public ProcessThread(String threadName, List<String> cmd) {
- super(new ProcessRunnable(cmd), threadName);
- }
-
- /**
- * Creates a new {@code ProcessThread} object.
- *
- * @param threadName The name of thread
- * @param cmd The string array of program and its arguments to pass to {@link ProcessBuilder}
- */
- public ProcessThread(String threadName, String... cmd) {
- super(new ProcessRunnable(cmd), threadName);
+ public ProcessThread(String threadName, ProcessBuilder pb) {
+ super(new ProcessRunnable(pb), threadName);
}
/**
@@ -82,6 +64,13 @@
}
/**
+ * @return The process output, or null if the process has not yet completed.
+ */
+ public OutputAnalyzer getOutput() {
+ return ((ProcessRunnable) getRunnable()).getOutput();
+ }
+
+ /**
* {@link Runnable} interface for starting and stopping {@link Process}.
*/
static class ProcessRunnable extends XRun {
@@ -89,26 +78,16 @@
private final ProcessBuilder processBuilder;
private final CountDownLatch latch;
private volatile Process process;
+ private volatile OutputAnalyzer output;
/**
* Creates a new {@code ProcessRunnable} object.
*
- * @param cmd The list of program and its arguments to to pass to {@link ProcessBuilder}
+ * @param pb The {@link ProcessBuilder} to run.
*/
- public ProcessRunnable(List<String> cmd) {
+ public ProcessRunnable(ProcessBuilder pb) {
super();
- this.processBuilder = new ProcessBuilder(cmd);
- this.latch = new CountDownLatch(1);
- }
-
- /**
- * Creates a new {@code ProcessRunnable} object.
- *
- * @param cmd The string array of program and its arguments to to pass to {@link ProcessBuilder}
- */
- public ProcessRunnable(String... cmd) {
- super();
- this.processBuilder = new ProcessBuilder(cmd);
+ this.processBuilder = pb;
this.latch = new CountDownLatch(1);
}
@@ -125,12 +104,16 @@
latch.countDown();
// Will block...
- OutputAnalyzer output = new OutputAnalyzer(this.process);
-
- assertTrue(output.getOutput().isEmpty(), "Should get an empty output, got: "
- + Utils.NEW_LINE + output.getOutput());
- assertNotEquals(output.getExitValue(), 0,
- "Process exited with unexpected exit code");
+ try {
+ output = new OutputAnalyzer(this.process);
+ } catch (Throwable t) {
+ String name = Thread.currentThread().getName();
+ System.out.println(String.format("ProcessThread[%s] failed: %s", name, t.toString()));
+ throw t;
+ } finally {
+ String logMsg = ProcessTools.getProcessLog(processBuilder, output);
+ System.out.println(logMsg);
+ }
}
/**
@@ -142,10 +125,19 @@
// Wait until process is started
latch.await();
if (this.process != null) {
+ System.out.println("ProcessThread.stopProcess() will kill process");
this.process.destroy();
}
}
+ /**
+ * Returns the OutputAnalyzer with stdout/stderr from the process.
+ * @return The process output, or null if process not completed.
+ * @throws InterruptedException
+ */
+ public OutputAnalyzer getOutput() {
+ return output;
+ }
}
}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Thu Dec 05 10:33:57 2013 -0800
@@ -266,4 +266,79 @@
}
}
+ /**
+ * Executes a test jvm process, waits for it to finish and returns the process output.
+ * The default jvm options from jtreg, test.vm.opts and test.java.opts, are added.
+ * The java from the test.jdk is used to execute the command.
+ *
+ * The command line will be like:
+ * {test.jdk}/bin/java {test.vm.opts} {test.java.opts} cmds
+ *
+ * @param cmds User specifed arguments.
+ * @return The output from the process.
+ */
+ public static OutputAnalyzer executeTestJvm(String... cmds) throws Throwable {
+ ProcessBuilder pb = createJavaProcessBuilder(Utils.addTestJavaOpts(cmds));
+ return executeProcess(pb);
+ }
+
+ /**
+ * Executes a process, waits for it to finish and returns the process output.
+ * @param pb The ProcessBuilder to execute.
+ * @return The output from the process.
+ */
+ public static OutputAnalyzer executeProcess(ProcessBuilder pb) throws Throwable {
+ OutputAnalyzer output = null;
+ try {
+ output = new OutputAnalyzer(pb.start());
+ return output;
+ } catch (Throwable t) {
+ System.out.println("executeProcess() failed: " + t);
+ throw t;
+ } finally {
+ System.out.println(getProcessLog(pb, output));
+ }
+ }
+
+ /**
+ * Executes a process, waits for it to finish and returns the process output.
+ * @param cmds The command line to execute.
+ * @return The output from the process.
+ */
+ public static OutputAnalyzer executeProcess(String... cmds) throws Throwable {
+ return executeProcess(new ProcessBuilder(cmds));
+ }
+
+ /**
+ * Used to log command line, stdout, stderr and exit code from an executed process.
+ * @param pb The executed process.
+ * @param output The output from the process.
+ */
+ public static String getProcessLog(ProcessBuilder pb, OutputAnalyzer output) {
+ String stderr = output == null ? "null" : output.getStderr();
+ String stdout = output == null ? "null" : output.getStdout();
+ String exitValue = output == null ? "null": Integer.toString(output.getExitValue());
+ StringBuilder logMsg = new StringBuilder();
+ final String nl = System.getProperty("line.separator");
+ logMsg.append("--- ProcessLog ---" + nl);
+ logMsg.append("cmd: " + getCommandLine(pb) + nl);
+ logMsg.append("exitvalue: " + exitValue + nl);
+ logMsg.append("stderr: " + stderr + nl);
+ logMsg.append("stdout: " + stdout + nl);
+ return logMsg.toString();
+ }
+
+ /**
+ * @return The full command line for the ProcessBuilder.
+ */
+ public static String getCommandLine(ProcessBuilder pb) {
+ if (pb == null) {
+ return "null";
+ }
+ StringBuilder cmd = new StringBuilder();
+ for (String s : pb.command()) {
+ cmd.append(s).append(" ");
+ }
+ return cmd.toString().trim();
+ }
}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java Thu Dec 05 10:33:57 2013 -0800
@@ -33,6 +33,8 @@
import java.util.List;
import java.util.Arrays;
import java.util.Collections;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
/**
* Common library for various test helper functions.
@@ -170,4 +172,61 @@
return hostName;
}
+ /**
+ * Uses "jcmd -l" to search for a jvm pid. This function will wait
+ * forever (until jtreg timeout) for the pid to be found.
+ * @param key Regular expression to search for
+ * @return The found pid.
+ */
+ public static int waitForJvmPid(String key) throws Throwable {
+ final long iterationSleepMillis = 250;
+ System.out.println("waitForJvmPid: Waiting for key '" + key + "'");
+ System.out.flush();
+ while (true) {
+ int pid = tryFindJvmPid(key);
+ if (pid >= 0) {
+ return pid;
+ }
+ Thread.sleep(iterationSleepMillis);
+ }
+ }
+
+ /**
+ * Searches for a jvm pid in the output from "jcmd -l".
+ *
+ * Example output from jcmd is:
+ * 12498 sun.tools.jcmd.JCmd -l
+ * 12254 /tmp/jdk8/tl/jdk/JTwork/classes/com/sun/tools/attach/Application.jar
+ *
+ * @param key A regular expression to search for.
+ * @return The found pid, or -1 if Enot found.
+ * @throws Exception If multiple matching jvms are found.
+ */
+ public static int tryFindJvmPid(String key) throws Throwable {
+ ProcessBuilder pb = null;
+ OutputAnalyzer output = null;
+ try {
+ JDKToolLauncher jcmdLauncher = JDKToolLauncher.create("jcmd");
+ jcmdLauncher.addToolArg("-l");
+ output = ProcessTools.executeProcess(jcmdLauncher.getCommand());
+ output.shouldHaveExitValue(0);
+
+ // Search for a line starting with numbers (pid), follwed by the key.
+ Pattern pattern = Pattern.compile("([0-9]+)\\s.*(" + key + ").*\\r?\\n");
+ Matcher matcher = pattern.matcher(output.getStdout());
+
+ int pid = -1;
+ if (matcher.find()) {
+ pid = Integer.parseInt(matcher.group(1));
+ System.out.println("findJvmPid.pid: " + pid);
+ if (matcher.find()) {
+ throw new Exception("Found multiple JVM pids for key: " + key);
+ }
+ }
+ return pid;
+ } catch (Throwable t) {
+ System.out.println(String.format("Utils.findJvmPid(%s) failed: %s", key, t));
+ throw t;
+ }
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/www/protocol/http/RedirectOnPost.java Thu Dec 05 10:33:57 2013 -0800
@@ -0,0 +1,175 @@
+/*
+ * 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
+ * @compile ../../../../../com/sun/net/httpserver/SimpleSSLContext.java RedirectOnPost.java
+ * @run main/othervm RedirectOnPost
+ * @bug 8029127
+ * @summary A redirect POST request does not work and illegalStateException on HttpURLConnection.getInputStream
+ */
+
+import java.net.*;
+import java.io.*;
+import java.util.*;
+import com.sun.net.httpserver.*;
+import java.util.concurrent.*;
+import javax.net.ssl.*;
+
+public class RedirectOnPost {
+
+
+ public static void main(String[] args) throws Exception {
+ ExecutorService e= Executors.newFixedThreadPool(5);
+ String keysdir = System.getProperty("test.src")
+ + "/../../../../../com/sun/net/httpserver/";
+ SSLContext ctx = new SimpleSSLContext(keysdir).get();
+ HttpServer httpServer = getHttpServer(e);
+ HttpsServer httpsServer = getHttpsServer(e, ctx);
+
+ try {
+ // take the keystore from elsewhere in test hierarchy
+ int port = httpServer.getAddress().getPort();
+ int sslPort = httpsServer.getAddress().getPort();
+ httpServer.start();
+ httpsServer.start();
+ runTest("http://127.0.0.1:"+port+"/test/", null);
+ runTest("https://127.0.0.1:"+sslPort+"/test/", ctx);
+ System.out.println("Main thread waiting");
+ } finally {
+ httpServer.stop(0);
+ httpsServer.stop(0);
+ e.shutdownNow();
+ }
+ }
+
+ public static void runTest(String baseURL, SSLContext ctx) throws Exception
+ {
+ byte[] buf = "Hello world".getBytes();
+ URL url = new URL(baseURL + "a");
+ HttpURLConnection con = (HttpURLConnection)url.openConnection();
+ if (con instanceof HttpsURLConnection) {
+ HttpsURLConnection ssl = (HttpsURLConnection)con;
+ ssl.setHostnameVerifier(new HostnameVerifier() {
+ public boolean verify(String host, SSLSession sess) {
+ return true;
+ }
+ });
+ ssl.setSSLSocketFactory (ctx.getSocketFactory());
+ }
+ con.setDoOutput(true);
+ con.setDoInput(true);
+ con.setRequestMethod("POST");
+ try (OutputStream out = con.getOutputStream()) {
+ out.write(buf);
+ }
+ try (InputStream in = con.getInputStream()) {
+ byte[] newBuf = readFully(in);
+ }
+ }
+
+ private static byte[] readFully(InputStream istream) throws IOException {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ byte[] buf = new byte[1024];
+ int num = 0;
+
+ if (istream != null) {
+ while ((num = istream.read(buf)) != -1) {
+ bout.write(buf, 0, num);
+ }
+ }
+ byte[] ret = bout.toByteArray();
+ return ret;
+ }
+
+
+ static class Handler implements HttpHandler {
+
+ String baseURL;
+
+ Handler(String baseURL) {
+ this.baseURL = baseURL;
+ }
+
+ int calls = 0;
+
+ public void handle(HttpExchange msg) {
+ try {
+ String method = msg.getRequestMethod();
+ System.out.println ("Server: " + baseURL);
+ if (calls++ == 0) {
+ System.out.println ("Server: redirecting");
+ InputStream is = msg.getRequestBody();
+ byte[] buf = readFully(is);
+ is.close();
+ Headers h = msg.getResponseHeaders();
+ h.add("Location", baseURL + "b");
+ msg.sendResponseHeaders(302, -1);
+ msg.close();
+ } else {
+ System.out.println ("Server: second call");
+ InputStream is = msg.getRequestBody();
+ byte[] buf = readFully(is);
+ is.close();
+ msg.sendResponseHeaders(200, -1);
+ msg.close();
+ }
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ }
+ finally {
+ msg.close();
+ }
+ }
+ }
+
+ private static HttpServer getHttpServer(ExecutorService execs)
+ throws Exception
+ {
+ InetSocketAddress inetAddress = new InetSocketAddress(0);
+ HttpServer testServer = HttpServer.create(inetAddress, 15);
+ int port = testServer.getAddress().getPort();
+ testServer.setExecutor(execs);
+ String base = "http://127.0.0.1:"+port+"/test";
+ HttpContext context = testServer.createContext("/test");
+ context.setHandler(new Handler(base));
+ return testServer;
+ }
+
+ private static HttpsServer getHttpsServer(
+ ExecutorService execs, SSLContext ctx
+ )
+ throws Exception
+ {
+ InetSocketAddress inetAddress = new InetSocketAddress(0);
+ HttpsServer testServer = HttpsServer.create(inetAddress, 15);
+ int port = testServer.getAddress().getPort();
+ testServer.setExecutor(execs);
+ testServer.setHttpsConfigurator(new HttpsConfigurator (ctx));
+ String base = "https://127.0.0.1:"+port+"/test";
+ HttpContext context = testServer.createContext("/test");
+ context.setHandler(new Handler(base));
+ return testServer;
+ }
+}
--- a/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java Thu Dec 05 10:33:57 2013 -0800
@@ -76,6 +76,7 @@
public class CheckLogging {
private static int REGISTRY_PORT = -1;
private static String LOCATION;
+ private static Logger logger;
private static final ByteArrayOutputStream clientCallOut =
new ByteArrayOutputStream();
@@ -89,8 +90,8 @@
System.err.println("set default stream");
LogStream.setDefaultStream(new PrintStream(clientCallOut));
} else {
- Logger.getLogger("sun.rmi.client.call").
- addHandler(new InternalStreamHandler(clientCallOut));
+ logger = Logger.getLogger("sun.rmi.client.call");
+ logger.addHandler(new InternalStreamHandler(clientCallOut));
}
}
--- a/jdk/test/sun/security/krb5/auto/KDC.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/security/krb5/auto/KDC.java Thu Dec 05 10:33:57 2013 -0800
@@ -605,7 +605,7 @@
* @return the response
* @throws java.lang.Exception for various errors
*/
- private byte[] processMessage(byte[] in) throws Exception {
+ protected byte[] processMessage(byte[] in) throws Exception {
if ((in[0] & 0x1f) == Krb5.KRB_AS_REQ)
return processAsReq(in);
else
@@ -618,7 +618,7 @@
* @return the response
* @throws java.lang.Exception for various errors
*/
- private byte[] processTgsReq(byte[] in) throws Exception {
+ protected byte[] processTgsReq(byte[] in) throws Exception {
TGSReq tgsReq = new TGSReq(in);
PrincipalName service = tgsReq.reqBody.sname;
if (options.containsKey(KDC.Option.RESP_NT)) {
@@ -841,7 +841,7 @@
* @return the response
* @throws java.lang.Exception for various errors
*/
- private byte[] processAsReq(byte[] in) throws Exception {
+ protected byte[] processAsReq(byte[] in) throws Exception {
ASReq asReq = new ASReq(in);
int[] eTypes = null;
List<PAData> outPAs = new ArrayList<>();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/LoginNoPass.java Thu Dec 05 10:33:57 2013 -0800
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8028351
+ * @summary JWS doesn't get authenticated when using kerberos auth proxy
+ * @compile -XDignore.symbol.file LoginNoPass.java
+ * @run main/othervm LoginNoPass
+ */
+
+import sun.security.jgss.GSSUtil;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import java.security.Security;
+
+public class LoginNoPass {
+
+ static boolean kdcTouched = false;
+ public static void main(String[] args) throws Exception {
+
+ new OneKDC(null) {
+ protected byte[] processAsReq(byte[] in) throws Exception {
+ kdcTouched = true;
+ return super.processAsReq(in);
+ }
+ }.writeJAASConf();
+ Security.setProperty("auth.login.defaultCallbackHandler",
+ "LoginNoPass$CallbackForClient");
+ System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
+
+ try {
+ Context c;
+ c = Context.fromJAAS("client");
+ c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+ c.take(new byte[0]);
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ // OK
+ }
+ if (kdcTouched) {
+ throw new Exception("Failed");
+ }
+ }
+ public static class CallbackForClient implements CallbackHandler {
+ public void handle(Callback[] callbacks) {
+ // Do nothing
+ }
+ }
+}
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh Thu Dec 05 10:33:57 2013 -0800
@@ -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
@@ -170,7 +170,8 @@
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-d ${TESTCLASSES} \
- ${TESTSRC}${FS}Basic.java
+ ${TESTSRC}${FS}Basic.java \
+ ${TESTSRC}${FS}..${FS}PKCS11Test.java
fi
# run test
--- a/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh Thu Dec 05 10:33:57 2013 -0800
@@ -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
@@ -128,7 +128,8 @@
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-d ${TESTCLASSES} \
- ${TESTSRC}${FS}ClientAuth.java
+ ${TESTSRC}${FS}ClientAuth.java \
+ ${TESTSRC}${FS}..${FS}PKCS11Test.java
# run test
echo "Run ClientAuth ..."
--- a/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh Thu Dec 05 10:33:57 2013 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
@@ -140,7 +140,8 @@
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-d ${TESTCLASSES} \
- ${TESTSRC}${FS}Basic.java
+ ${TESTSRC}${FS}Basic.java \
+ ${TESTSRC}${FS}..${FS}PKCS11Test.java
fi
# run test
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java Thu Dec 05 10:33:57 2013 -0800
@@ -29,6 +29,8 @@
import java.lang.reflect.*;
import java.security.*;
+import java.security.spec.ECGenParameterSpec;
+import java.security.spec.ECParameterSpec;
public abstract class PKCS11Test {
@@ -357,6 +359,93 @@
test.premain(p);
}
+ // Generate a vector of supported elliptic curves of a given provider
+ static Vector<ECParameterSpec> getKnownCurves(Provider p) throws Exception {
+ int index;
+ int begin;
+ int end;
+ String curve;
+ KeyPair kp = null;
+
+ Vector<ECParameterSpec> results = new Vector<ECParameterSpec>();
+ // Get Curves to test from SunEC.
+ String kcProp = Security.getProvider("SunEC").
+ getProperty("AlgorithmParameters.EC SupportedCurves");
+
+ if (kcProp == null) {
+ throw new RuntimeException(
+ "\"AlgorithmParameters.EC SupportedCurves property\" not found");
+ }
+
+ System.out.println("Finding supported curves using list from SunEC\n");
+ index = 0;
+ for (;;) {
+ // Each set of curve names is enclosed with brackets.
+ begin = kcProp.indexOf('[', index);
+ end = kcProp.indexOf(']', index);
+ if (begin == -1 || end == -1) {
+ break;
+ }
+
+ /*
+ * Each name is separated by a comma.
+ * Just get the first name in the set.
+ */
+ index = end + 1;
+ begin++;
+ end = kcProp.indexOf(',', begin);
+ if (end == -1) {
+ // Only one name in the set.
+ end = index -1;
+ }
+
+ curve = kcProp.substring(begin, end);
+ ECParameterSpec e = getECParameterSpec(p, curve);
+ System.out.print("\t "+ curve + ": ");
+ try {
+ KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", p);
+ kpg.initialize(e);
+ kp = kpg.generateKeyPair();
+ results.add(e);
+ System.out.println("Supported");
+ } catch (ProviderException ex) {
+ System.out.println("Unsupported: PKCS11: " +
+ ex.getCause().getMessage());
+ } catch (InvalidAlgorithmParameterException ex) {
+ System.out.println("Unsupported: Key Length: " +
+ ex.getMessage());
+ }
+ }
+
+ if (results.size() == 0) {
+ throw new RuntimeException("No supported EC curves found");
+ }
+
+ return results;
+ }
+
+ private static ECParameterSpec getECParameterSpec(Provider p, String name)
+ throws Exception {
+
+ AlgorithmParameters parameters =
+ AlgorithmParameters.getInstance("EC", p);
+
+ parameters.init(new ECGenParameterSpec(name));
+
+ return parameters.getParameterSpec(ECParameterSpec.class);
+ }
+
+ // Check support for a curve with a provided Vector of EC support
+ boolean checkSupport(Vector<ECParameterSpec> supportedEC,
+ ECParameterSpec curve) {
+ boolean found = false;
+ for (ECParameterSpec ec: supportedEC) {
+ if (ec.equals(curve)) {
+ return true;
+ }
+ }
+ return false;
+ }
private static final Map<String,String[]> osMap;
--- a/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh Thu Dec 05 10:33:57 2013 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
@@ -99,7 +99,8 @@
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}.. \
-d ${TESTCLASSES} \
- ${TESTSRC}${FS}ConfigQuotedString.java
+ ${TESTSRC}${FS}ConfigQuotedString.java \
+ ${TESTSRC}${FS}..${FS}PKCS11Test.java
# run test
--- a/jdk/test/sun/security/pkcs11/Provider/Login.sh Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.sh Thu Dec 05 10:33:57 2013 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
@@ -108,7 +108,8 @@
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}.. \
-d ${TESTCLASSES} \
- ${TESTSRC}${FS}Login.java
+ ${TESTSRC}${FS}Login.java \
+ ${TESTSRC}${FS}..${FS}PKCS11Test.java
# run test
--- a/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java Thu Dec 05 10:33:57 2013 -0800
@@ -22,10 +22,10 @@
*/
/*
* @test
- * @bug 7200306
- * @run main/othervm/timeout=250 TestDSAKeyLength
+ * @bug 7200306 8029158
* @summary verify that P11Signature impl will error out when initialized
* with unsupported key sizes
+ * @library ..
*/
@@ -40,6 +40,11 @@
}
public void main(Provider provider) throws Exception {
+ if (isNSS(provider) && getNSSVersion() >= 3.14) {
+ System.out.println("Skip testing NSS " + getNSSVersion());
+ return;
+ }
+
KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA", "SUN");
kpg.initialize(2048, new SecureRandom());
KeyPair pair = kpg.generateKeyPair();
--- a/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java Thu Dec 05 10:33:57 2013 -0800
@@ -37,6 +37,7 @@
import java.security.cert.*;
import java.security.*;
import java.security.interfaces.*;
+import java.security.spec.ECParameterSpec;
import javax.security.auth.x500.X500Principal;
@@ -101,33 +102,44 @@
}
System.out.println("OK: " + certs.size() + " certificates.");
+ // Get supported curves
+ Vector<ECParameterSpec> supportedEC = getKnownCurves(p);
+
+ System.out.println("Test Certs:\n");
for (X509Certificate cert : certs.values()) {
X509Certificate issuer = certs.get(cert.getIssuerX500Principal());
- System.out.println("Verifying " + cert.getSubjectX500Principal() + "...");
+ System.out.print("Verifying " + cert.getSubjectX500Principal() +
+ "... ");
PublicKey key = issuer.getPublicKey();
- // First try the provider under test (if it does not support the
- // necessary algorithm then try any registered provider).
- try {
- cert.verify(key, p.getName());
- } catch (NoSuchAlgorithmException e) {
- System.out.println("Warning: " + e.getMessage() +
- ". Trying another provider...");
- cert.verify(key);
- } catch (InvalidKeyException e) {
- // The root cause of the exception might be NSS not having
- // "ECC Extended" support curves. If so, we can ignore it.
- Throwable t = e;
- while (t.getCause() != null) {
- t = t.getCause();
- }
- if (t instanceof sun.security.pkcs11.wrapper.PKCS11Exception &&
- t.getMessage().equals("CKR_DOMAIN_PARAMS_INVALID") &&
- isNSS(p) && getNSSECC() == ECCState.Basic) {
- System.out.println("Failed as expected. NSS Basic ECC.");
+ // Check if curve is supported
+ if (issuer.getPublicKey() instanceof ECPublicKey) {
+ if (!checkSupport(supportedEC,
+ ((ECPublicKey)key).getParams())) {
+ System.out.println("Curve not found. Skipped.");
continue;
}
- throw e;
}
+
+ try {
+ cert.verify(key, p.getName());
+ System.out.println("Pass.");
+ } catch (NoSuchAlgorithmException e) {
+ System.out.println("Warning: " + e.getMessage() +
+ ". Trying another provider...");
+ cert.verify(key);
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ if (key instanceof ECPublicKey) {
+ System.out.println("Failed.\n\tCurve: " +
+ ((ECPublicKey)key).getParams() +
+ "\n\tSignature Alg: " + cert.getSigAlgName());
+ } else {
+ System.out.println("Key: "+key.toString());
+ }
+
+ System.err.println("Verifying " + cert.getSubjectX500Principal());
+ e.printStackTrace();
+ }
}
// try some random invalid signatures to make sure we get the correct
--- a/jdk/test/sun/security/pkcs11/ec/TestCurves.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/security/pkcs11/ec/TestCurves.java Thu Dec 05 10:33:57 2013 -0800
@@ -56,47 +56,49 @@
return;
}
+ // Check if this is sparc for later failure avoidance.
+ boolean sparc = false;
+ if (System.getProperty("os.arch").equals("sparcv9")) {
+ sparc = true;
+ System.out.println("This is a sparcv9");
+ }
+
Random random = new Random();
byte[] data = new byte[2048];
random.nextBytes(data);
Vector<ECParameterSpec> curves = getKnownCurves(p);
-
for (ECParameterSpec params : curves) {
System.out.println("Testing " + params + "...");
KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", p);
kpg.initialize(params);
KeyPair kp1, kp2;
- try {
- kp1 = kpg.generateKeyPair();
- kp2 = kpg.generateKeyPair();
- } catch (Exception e) {
- // The root cause of the exception might be NSS not having
- // "ECC Extended" support curves. If so, we can ignore it.
- if (e instanceof java.security.ProviderException) {
- Throwable t = e.getCause();
- if (t instanceof
- sun.security.pkcs11.wrapper.PKCS11Exception &&
- t.getMessage().equals("CKR_DOMAIN_PARAMS_INVALID") &&
- isNSS(p) && (getNSSECC() == ECCState.Basic) &&
- (!params.toString().startsWith("secp256r1") &&
- !params.toString().startsWith("secp384r1") &&
- !params.toString().startsWith("secp521r1"))) {
- System.out.println("NSS Basic ECC. Failure expected");
- continue;
- }
- }
-
- throw e;
- }
+ kp1 = kpg.generateKeyPair();
+ kp2 = kpg.generateKeyPair();
testSigning(p, "SHA1withECDSA", data, kp1, kp2);
- testSigning(p, "SHA224withECDSA", data, kp1, kp2);
- testSigning(p, "SHA256withECDSA", data, kp1, kp2);
- testSigning(p, "SHA384withECDSA", data, kp1, kp2);
- testSigning(p, "SHA512withECDSA", data, kp1, kp2);
- // System.out.println();
+ // Check because Solaris ncp driver does not support these but
+ // Solaris metaslot causes them to be run.
+ try {
+ testSigning(p, "SHA224withECDSA", data, kp1, kp2);
+ testSigning(p, "SHA256withECDSA", data, kp1, kp2);
+ testSigning(p, "SHA384withECDSA", data, kp1, kp2);
+ testSigning(p, "SHA512withECDSA", data, kp1, kp2);
+ } catch (ProviderException e) {
+ if (sparc) {
+ Throwable t = e.getCause();
+ if (t instanceof sun.security.pkcs11.wrapper.PKCS11Exception &&
+ t.getMessage().equals("CKR_ATTRIBUTE_VALUE_INVALID")) {
+ System.out.print("-Failure not uncommon. Probably pre-T4.");
+ } else {
+ throw e;
+ }
+ } else {
+ throw e;
+ }
+ }
+ System.out.println();
KeyAgreement ka1 = KeyAgreement.getInstance("ECDH", p);
ka1.init(kp1.getPrivate());
@@ -116,70 +118,9 @@
System.out.println("OK");
}
- private static Vector<ECParameterSpec>
- getKnownCurves(Provider p) throws Exception {
-
- int index;
- int begin;
- int end;
- String curve;
- Vector<ECParameterSpec> results = new Vector<ECParameterSpec>();
- // Get Curves to test from SunEC.
- String kcProp = Security.getProvider("SunEC").
- getProperty("AlgorithmParameters.EC SupportedCurves");
-
- if (kcProp == null) {
- throw new RuntimeException(
- "\"AlgorithmParameters.EC SupportedCurves property\" not found");
- }
-
- index = 0;
- for (;;) {
- // Each set of curve names is enclosed with brackets.
- begin = kcProp.indexOf('[', index);
- end = kcProp.indexOf(']', index);
- if (begin == -1 || end == -1) {
- break;
- }
-
- /*
- * Each name is separated by a comma.
- * Just get the first name in the set.
- */
- index = end + 1;
- begin++;
- end = kcProp.indexOf(',', begin);
- if (end == -1) {
- // Only one name in the set.
- end = index -1;
- }
-
- curve = kcProp.substring(begin, end);
-
- results.add(getECParameterSpec(p, curve));
- }
-
- if (results.size() == 0) {
- throw new RuntimeException("No supported EC curves found");
- }
-
- return results;
- }
-
- private static ECParameterSpec getECParameterSpec(Provider p, String name)
- throws Exception {
-
- AlgorithmParameters parameters =
- AlgorithmParameters.getInstance("EC", p);
-
- parameters.init(new ECGenParameterSpec(name));
-
- return parameters.getParameterSpec(ECParameterSpec.class);
- }
-
private static void testSigning(Provider p, String algorithm,
byte[] data, KeyPair kp1, KeyPair kp2) throws Exception {
- // System.out.print(" " + algorithm);
+ System.out.print(" " + algorithm);
Signature s = Signature.getInstance(algorithm, p);
s.initSign(kp1.getPrivate());
s.update(data);
--- a/jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java Thu Dec 05 10:33:57 2013 -0800
@@ -206,7 +206,9 @@
private void runTest(boolean direct) throws Exception {
boolean serverClose = direct;
- serverSocket = new ServerSocket(0);
+ serverSocket = new ServerSocket();
+ serverSocket.setReuseAddress(false);
+ serverSocket.bind(null);
int port = serverSocket.getLocalPort();
Thread thread = createClientThread(port, serverClose);
--- a/jdk/test/sun/tools/jstatd/JstatdTest.java Thu Dec 05 10:32:02 2013 -0800
+++ b/jdk/test/sun/tools/jstatd/JstatdTest.java Thu Dec 05 10:33:57 2013 -0800
@@ -353,6 +353,14 @@
} finally {
cleanUpThread(jstatdThread);
}
+
+ // Verify output from jstatd
+ OutputAnalyzer output = jstatdThread.getOutput();
+ assertTrue(output.getOutput().isEmpty(),
+ "jstatd should get an empty output, got: "
+ + Utils.NEW_LINE + output.getOutput());
+ assertNotEquals(output.getExitValue(), 0,
+ "jstatd process exited with unexpected exit code");
}
}