diff --git a/jdk/make/CreateSecurityJars.gmk b/jdk/make/CreateSecurityJars.gmk index 337ea5f40a4..d5b3b8ea54b 100644 --- a/jdk/make/CreateSecurityJars.gmk +++ b/jdk/make/CreateSecurityJars.gmk @@ -54,7 +54,7 @@ $(JCE_MANIFEST): $(MAINMANIFEST) ########################################################################################## # 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 @@ $(JCE_MANIFEST): $(MAINMANIFEST) # 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 @@ $(SUNPKCS11_JAR_UNSIGNED): $(JCE_MANIFEST) 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 @@ $(SUNEC_JAR_UNSIGNED): $(JCE_MANIFEST) 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 @@ ifneq ($(BUILD_CRYPTO), no) $(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 @@ ifneq ($(BUILD_CRYPTO), no) $(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 @@ ifneq ($(BUILD_CRYPTO), no) $(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_TMP)/%: $(LOCAL_POLICY_JAR_SRC_DIR)/% + $(LOCAL_POLICY_JAR_LIMITED_TMP)/%: $(JDK_TOPDIR)/make/data/cryptopolicy/limited/% $(install-file) - $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR, $(LOCAL_POLICY_JAR_DEPS), \ - SRCS := $(LOCAL_POLICY_JAR_TMP), \ + $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/%: $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited/% + $(install-file) + + $(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 @@ ifeq ($(OPENJDK_TARGET_OS), windows) 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 @@ ifeq ($(OPENJDK_TARGET_OS), solaris) 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 @@ ifeq ($(OPENJDK_TARGET_OS), solaris) $(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 diff --git a/jdk/make/SignJars.gmk b/jdk/make/SignJars.gmk index 5365bb8312c..21647889201 100644 --- a/jdk/make/SignJars.gmk +++ b/jdk/make/SignJars.gmk @@ -80,7 +80,7 @@ check-keystore: 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 @@ $(JCE_OUTPUTDIR)/%: $(JDK_OUTPUTDIR)/unsigned/% 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*** ***" diff --git a/jdk/make/data/cryptopolicy/limited/LIMITED b/jdk/make/data/cryptopolicy/limited/LIMITED deleted file mode 100644 index b58f7acd930..00000000000 --- a/jdk/make/data/cryptopolicy/limited/LIMITED +++ /dev/null @@ -1 +0,0 @@ -Crypto-Strength: limited diff --git a/jdk/make/data/cryptopolicy/unlimited/UNLIMITED b/jdk/make/data/cryptopolicy/unlimited/UNLIMITED deleted file mode 100644 index 7fc7743c416..00000000000 --- a/jdk/make/data/cryptopolicy/unlimited/UNLIMITED +++ /dev/null @@ -1 +0,0 @@ -Crypto-Strength: unlimited diff --git a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java index c5b26892073..9a598171986 100644 --- a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java +++ b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java @@ -916,8 +916,7 @@ public class Krb5LoginModule implements LoginModule { 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, diff --git a/jdk/src/share/classes/java/applet/Applet.java b/jdk/src/share/classes/java/applet/Applet.java index 2e8e39a19ff..63d3f0a9f3c 100644 --- a/jdk/src/share/classes/java/applet/Applet.java +++ b/jdk/src/share/classes/java/applet/Applet.java @@ -392,7 +392,7 @@ public class Applet extends Panel { * Each element of the array should be a set of three * Strings containing the name, the type, and a * description. For example: - *

+     * 
      * String pinfo[][] = {
      *   {"fps",    "1-10",    "frames per second"},
      *   {"repeat", "boolean", "repeat image loop"},
diff --git a/jdk/src/share/classes/java/applet/AppletContext.java b/jdk/src/share/classes/java/applet/AppletContext.java
index f28308cfb11..c031686acc0 100644
--- a/jdk/src/share/classes/java/applet/AppletContext.java
+++ b/jdk/src/share/classes/java/applet/AppletContext.java
@@ -107,7 +107,7 @@ public interface AppletContext {
      * target argument indicates in which HTML frame the
      * document is to be displayed.
      * The target argument is interpreted as follows:
-     * 

+ * *

* *
Target ArgumentDescription
"_self" Show in the window and frame that diff --git a/jdk/src/share/classes/java/awt/AWTPermission.java b/jdk/src/share/classes/java/awt/AWTPermission.java index 2b371bce714..0859872cb7a 100644 --- a/jdk/src/share/classes/java/awt/AWTPermission.java +++ b/jdk/src/share/classes/java/awt/AWTPermission.java @@ -43,7 +43,6 @@ import java.security.BasicPermission; * target names, and for each provides a description of what the * permission allows and a discussion of the risks of granting code * the permission. - *

* * * diff --git a/jdk/src/share/classes/java/awt/AlphaComposite.java b/jdk/src/share/classes/java/awt/AlphaComposite.java index 9f8b64f2684..f08ea2b47bf 100644 --- a/jdk/src/share/classes/java/awt/AlphaComposite.java +++ b/jdk/src/share/classes/java/awt/AlphaComposite.java @@ -175,7 +175,6 @@ import sun.java2d.SunCompositeContext; * Fs and Fd and then the resulting * premultiplied components Ar and Cr. * - *

*

Preparing Results

* *

@@ -193,7 +192,6 @@ import sun.java2d.SunCompositeContext; * by zero" and the color components are left as * all zeros. * - *

*

Performance Considerations

* *

@@ -216,7 +214,6 @@ import sun.java2d.SunCompositeContext; * for their pixels. Such sources supply an alpha of 1.0 for * all of their pixels. * - *

*

  • * 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 @@ import sun.java2d.SunCompositeContext; * values by the resulting alpha value before storing the color * values and discarding the alpha value. * - *

    *

  • * The accuracy of the results depends on the manner in which pixels * are stored in the destination. @@ -248,7 +244,6 @@ import sun.java2d.SunCompositeContext; * the need to choose a pixel from a limited palette to match the * results of the blending equations. * - *

    *

  • * Nearly all formats store pixels as discrete integers rather than * the floating point values used in the reference equations above. @@ -268,7 +263,6 @@ import sun.java2d.SunCompositeContext; * represents 0.0 and 0xff represents * 1.0. * - *

    *

  • * The internal implementation can approximate some of the equations * and it can also eliminate some steps to avoid unnecessary operations. @@ -332,7 +326,6 @@ import sun.java2d.SunCompositeContext; *

    * and thus they would all match. * - *

    *

  • * Because of the technique of simplifying the equations for * calculation efficiency, some implementations might perform diff --git a/jdk/src/share/classes/java/awt/BasicStroke.java b/jdk/src/share/classes/java/awt/BasicStroke.java index 5cc466640c2..80b4a3d3eb3 100644 --- a/jdk/src/share/classes/java/awt/BasicStroke.java +++ b/jdk/src/share/classes/java/awt/BasicStroke.java @@ -39,7 +39,7 @@ import java.lang.annotation.Native; * {@link Shape} and the decorations applied at the ends and joins of * path segments of the Shape. * These rendering attributes include: - *
    + *
    *
    width *
    The pen width, measured perpendicularly to the pen trajectory. *
    end caps diff --git a/jdk/src/share/classes/java/awt/BorderLayout.java b/jdk/src/share/classes/java/awt/BorderLayout.java index 8b131c485d3..52f56ed8bf2 100644 --- a/jdk/src/share/classes/java/awt/BorderLayout.java +++ b/jdk/src/share/classes/java/awt/BorderLayout.java @@ -99,7 +99,7 @@ import java.util.Hashtable; * style="float:center; margin: 7px 10px;"> *

    * The code for this applet is as follows: - *

    + * *


      * import java.awt.*;
      * import java.applet.Applet;
    diff --git a/jdk/src/share/classes/java/awt/Button.java b/jdk/src/share/classes/java/awt/Button.java
    index 83506b6fdb1..da7a01f8535 100644
    --- a/jdk/src/share/classes/java/awt/Button.java
    +++ b/jdk/src/share/classes/java/awt/Button.java
    @@ -388,7 +388,7 @@ public class Button extends Component implements Accessible {
          * This method is not called unless action events are
          * enabled for this button. Action events are enabled
          * when one of the following occurs:
    -     * 

      + *
        *
      • An ActionListener object is registered * via addActionListener. *
      • Action events are enabled via enableEvents. diff --git a/jdk/src/share/classes/java/awt/Checkbox.java b/jdk/src/share/classes/java/awt/Checkbox.java index 7568b0c5aee..0215382df3e 100644 --- a/jdk/src/share/classes/java/awt/Checkbox.java +++ b/jdk/src/share/classes/java/awt/Checkbox.java @@ -41,7 +41,7 @@ import javax.accessibility.*; *

        * The following code example creates a set of check boxes in * a grid layout: - *

        + * *


          * setLayout(new GridLayout(3, 1));
          * add(new Checkbox("one", null, true));
        @@ -558,7 +558,7 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
              * This method is not called unless item events are
              * enabled for this component. Item events are enabled
              * when one of the following occurs:
        -     * 

          + *
            *
          • An ItemListener object is registered * via addItemListener. *
          • Item events are enabled via enableEvents. diff --git a/jdk/src/share/classes/java/awt/CheckboxGroup.java b/jdk/src/share/classes/java/awt/CheckboxGroup.java index 25b0697f117..90994f4a72d 100644 --- a/jdk/src/share/classes/java/awt/CheckboxGroup.java +++ b/jdk/src/share/classes/java/awt/CheckboxGroup.java @@ -35,7 +35,7 @@ package java.awt; *

            * The following code example produces a new check box group, * with three check boxes: - *

            + * *


              * setLayout(new GridLayout(3, 1));
              * CheckboxGroup cbg = new CheckboxGroup();
            diff --git a/jdk/src/share/classes/java/awt/CheckboxMenuItem.java b/jdk/src/share/classes/java/awt/CheckboxMenuItem.java
            index 20265c7ad12..424a53102e8 100644
            --- a/jdk/src/share/classes/java/awt/CheckboxMenuItem.java
            +++ b/jdk/src/share/classes/java/awt/CheckboxMenuItem.java
            @@ -367,7 +367,7 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
                  * This method is not called unless item events are
                  * enabled for this menu item. Item events are enabled
                  * when one of the following occurs:
            -     * 

              + *
                *
              • An ItemListener object is registered * via addItemListener. *
              • Item events are enabled via enableEvents. diff --git a/jdk/src/share/classes/java/awt/Choice.java b/jdk/src/share/classes/java/awt/Choice.java index b50746205d9..1a75f903c3d 100644 --- a/jdk/src/share/classes/java/awt/Choice.java +++ b/jdk/src/share/classes/java/awt/Choice.java @@ -40,7 +40,7 @@ import javax.accessibility.*; * The current choice is displayed as the title of the menu. *

                * The following code example produces a pop-up menu: - *

                + * *


                  * Choice ColorChooser = new Choice();
                  * ColorChooser.add("Green");
                @@ -609,7 +609,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
                      * This method is not called unless item events are
                      * enabled for this component. Item events are enabled
                      * when one of the following occurs:
                -     * 

                  + *
                    *
                  • An ItemListener object is registered * via addItemListener. *
                  • Item events are enabled via enableEvents. diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index bd913cbd50e..87c8879d0b6 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -106,7 +106,7 @@ import sun.util.logging.PlatformLogger; * 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. - *

                    + * *

                    Serialization

                    * It is important to note that only AWT listeners which conform * to the Serializable protocol will be saved when @@ -3859,7 +3859,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * 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 @@ public abstract class Component implements ImageObserver, MenuContainer, * 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 @@ public abstract class Component implements ImageObserver, MenuContainer, * This method is not called unless component events are * enabled for this component. Component events are enabled * when one of the following occurs: - *

                      + *
                        *
                      • A ComponentListener object is registered * via addComponentListener. *
                      • Component events are enabled via enableEvents. @@ -6373,7 +6373,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * This method is not called unless focus events are * enabled for this component. Focus events are enabled * when one of the following occurs: - *

                          + *
                            *
                          • A FocusListener object is registered * via addFocusListener. *
                          • Focus events are enabled via enableEvents. @@ -6393,7 +6393,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * with a FocusEvent as the argument will result in a * call to the Component's processFocusEvent * method regardless of the current KeyboardFocusManager. - *

                            + * *

                            Note that if the event parameter is null * the behavior is unspecified and may result in an * exception. @@ -6430,7 +6430,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * This method is not called unless key events are * enabled for this component. Key events are enabled * when one of the following occurs: - *

                              + *
                                *
                              • A KeyListener object is registered * via addKeyListener. *
                              • Key events are enabled via enableEvents. @@ -6499,7 +6499,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * This method is not called unless mouse events are * enabled for this component. Mouse events are enabled * when one of the following occurs: - *

                                  + *
                                    *
                                  • A MouseListener object is registered * via addMouseListener. *
                                  • Mouse events are enabled via enableEvents. @@ -6547,7 +6547,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * 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: - *

                                      + *
                                        *
                                      • A MouseMotionListener object is registered * via addMouseMotionListener. *
                                      • Mouse motion events are enabled via enableEvents. @@ -6586,7 +6586,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * 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: - *

                                          + *
                                            *
                                          • A MouseWheelListener object is registered * via addMouseWheelListener. *
                                          • Mouse wheel events are enabled via enableEvents. @@ -6630,7 +6630,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * 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: - *

                                              + *
                                                *
                                              • An InputMethodListener object is registered * via addInputMethodListener. *
                                              • Input method events are enabled via enableEvents. @@ -6669,7 +6669,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * This method is not called unless hierarchy events * are enabled for this component. Hierarchy events are enabled * when one of the following occurs: - *

                                                  + *
                                                    *
                                                  • An HierarchyListener object is registered * via addHierarchyListener. *
                                                  • Hierarchy events are enabled via enableEvents. @@ -6705,7 +6705,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * 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: - *

                                                      + *
                                                        *
                                                      • An HierarchyBoundsListener object is registered * via addHierarchyBoundsListener. *
                                                      • Hierarchy bounds events are enabled via enableEvents. diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java index 7bb4da9bb56..deca54fca51 100644 --- a/jdk/src/share/classes/java/awt/Container.java +++ b/jdk/src/share/classes/java/awt/Container.java @@ -185,7 +185,7 @@ public class Container extends Component { * 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 @@ public class Container extends Component { * of getMouseEventTarget. 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 @@ public class Container extends Component { * 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: - *

                                                        + * *

                                                        * super.addImpl(comp, constraints, index) *
                                                        diff --git a/jdk/src/share/classes/java/awt/EventFilter.java b/jdk/src/share/classes/java/awt/EventFilter.java index 56c69dd050c..1c38467f010 100644 --- a/jdk/src/share/classes/java/awt/EventFilter.java +++ b/jdk/src/share/classes/java/awt/EventFilter.java @@ -28,20 +28,20 @@ interface EventFilter { /** * Enumeration for possible values for acceptEvent(AWTEvent ev) 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 EventDispatchThread - * @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 EventDispatchedThread - * @see EventDispatchThread#pumpEventsForFilters(EventFilter) + * @see EventDispatchThread#pumpEventsForFilter */ REJECT, /** @@ -51,7 +51,7 @@ interface EventFilter { * 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 diff --git a/jdk/src/share/classes/java/awt/EventQueue.java b/jdk/src/share/classes/java/awt/EventQueue.java index af9e1bf08f3..efe0421f711 100644 --- a/jdk/src/share/classes/java/awt/EventQueue.java +++ b/jdk/src/share/classes/java/awt/EventQueue.java @@ -652,7 +652,7 @@ public class EventQueue { * 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: - *

                                                        + * *

  • * * diff --git a/jdk/src/share/classes/java/awt/FileDialog.java b/jdk/src/share/classes/java/awt/FileDialog.java index 0fc63c7fde4..b693b9b8788 100644 --- a/jdk/src/share/classes/java/awt/FileDialog.java +++ b/jdk/src/share/classes/java/awt/FileDialog.java @@ -439,7 +439,6 @@ public class FileDialog extends Dialog { * 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. * diff --git a/jdk/src/share/classes/java/awt/FlowLayout.java b/jdk/src/share/classes/java/awt/FlowLayout.java index 4675bbc573e..9961c9bfdbb 100644 --- a/jdk/src/share/classes/java/awt/FlowLayout.java +++ b/jdk/src/share/classes/java/awt/FlowLayout.java @@ -57,7 +57,7 @@ import java.io.IOException; * style="float:center; margin: 7px 10px;"> *

    * Here is the code for this applet: - *

    + * *


      * import java.awt.*;
      * import java.applet.Applet;
    @@ -129,9 +129,9 @@ public class FlowLayout implements LayoutManager, java.io.Serializable {
          * how each row distributes empty space.
          * It can be one of the following values:
          * 
      - * LEFT - * RIGHT - * CENTER + *
    • LEFT + *
    • RIGHT + *
    • CENTER *
    * * @serial @@ -146,11 +146,11 @@ public class FlowLayout implements LayoutManager, java.io.Serializable { * v1.2 and greater. * It can be one of the following three values: *
      - * LEFT - * RIGHT - * CENTER - * LEADING - * TRAILING + *
    • LEFT + *
    • RIGHT + *
    • CENTER + *
    • LEADING + *
    • TRAILING *
    * * @serial diff --git a/jdk/src/share/classes/java/awt/Font.java b/jdk/src/share/classes/java/awt/Font.java index e6363c8c5b7..7f3657c4950 100644 --- a/jdk/src/share/classes/java/awt/Font.java +++ b/jdk/src/share/classes/java/awt/Font.java @@ -75,13 +75,13 @@ import static sun.font.EAttribute.*; * * A character is a symbol that represents an item such as a letter, * a digit, or punctuation in an abstract way. For example, 'g', - * LATIN SMALL LETTER G, is a character. + * LATIN SMALL LETTER G, is a character. *

    * A glyph 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 'á' - * LATIN SMALL LETTER A WITH ACUTE, 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 @@ import static sun.font.EAttribute.*; * of characters as well as the tables needed to map sequences of characters to * corresponding sequences of glyphs. * - *

    Physical and Logical Fonts

    + *

    Physical and Logical Fonts

    * * The Java Platform distinguishes between two kinds of fonts: * physical fonts and logical fonts. @@ -130,7 +130,7 @@ import static sun.font.EAttribute.*; * Internationalization FAQ * document. * - *

    Font Faces and Names

    + *

    Font Faces and Names

    * * A Font * can have many faces, such as heavy, medium, oblique, gothic and @@ -160,7 +160,7 @@ import static sun.font.EAttribute.*; * with varying sizes, styles, transforms and font features via the * deriveFont methods in this class. * - *

    Font and TextAttribute

    + *

    Font and TextAttribute

    * *

    Font supports most * TextAttributes. This makes some operations, such as @@ -197,7 +197,7 @@ import static sun.font.EAttribute.*; * 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.

    + * a workaround. * *

    The Map-based constructor and * deriveFont APIs ignore the FONT attribute, and it is @@ -1419,7 +1419,7 @@ public class Font implements java.io.Serializable * To ensure that this method returns the desired Font, * format the str parameter in * one of these ways - *

    + * *

      *
    • fontname-style-pointsize *
    • fontname-pointsize diff --git a/jdk/src/share/classes/java/awt/Graphics.java b/jdk/src/share/classes/java/awt/Graphics.java index 3e2dcb55008..c440b0a8fa1 100644 --- a/jdk/src/share/classes/java/awt/Graphics.java +++ b/jdk/src/share/classes/java/awt/Graphics.java @@ -39,7 +39,7 @@ import java.text.AttributedCharacterIterator; * A Graphics object encapsulates state information needed * for the basic rendering operations that Java supports. This * state information includes the following properties: - *

      + * *

        *
      • The Component object on which to draw. *
      • A translation origin for rendering and clipping coordinates. @@ -63,7 +63,7 @@ import java.text.AttributedCharacterIterator; *

        * The graphics pen hangs down and to the right from the path it traverses. * This has the following implications: - *

          + *
            *
          • 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 @@ public abstract class Graphics { * interpreted in the coordinate system of the original * Graphics object. The new graphics context is * identical to the original, except in two respects: - *

            + * *

              *
            • * The new graphics context is translated by (xy). diff --git a/jdk/src/share/classes/java/awt/GridBagConstraints.java b/jdk/src/share/classes/java/awt/GridBagConstraints.java index 3651b39be92..bf53b39b21f 100644 --- a/jdk/src/share/classes/java/awt/GridBagConstraints.java +++ b/jdk/src/share/classes/java/awt/GridBagConstraints.java @@ -457,7 +457,7 @@ public class GridBagConstraints implements Cloneable, java.io.Serializable { * resize the component, and if so, how. *

              * The following values are valid for fill: - *

              + * *

                *
              • * NONE: Do not resize the component. diff --git a/jdk/src/share/classes/java/awt/GridBagLayout.java b/jdk/src/share/classes/java/awt/GridBagLayout.java index 8ac290a7a42..0b0f2bc5dea 100644 --- a/jdk/src/share/classes/java/awt/GridBagLayout.java +++ b/jdk/src/share/classes/java/awt/GridBagLayout.java @@ -55,7 +55,7 @@ import java.util.Arrays; * of the GridBagConstraints objects that are associated * with its components. You customize a GridBagConstraints * object by setting one or more of its instance variables: - *

                + * *

                *
                {@link GridBagConstraints#gridx}, * {@link GridBagConstraints#gridy} @@ -121,7 +121,7 @@ import java.util.Arrays; * ComponentOrientation property while absolute values * are not. Baseline relative values are calculated relative to the * baseline. Valid values are: - *

                + * *

    Event Type
    * @@ -251,7 +251,7 @@ import java.util.Arrays; * 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. - *

    + * *

    * *
    @@ -270,7 +270,7 @@ import java.util.Arrays; * of its associated GridBagConstraints object * set to GridBagConstraints.BOTH. * In addition, the components have the following non-default constraints: - *

    + * *

      *
    • Button1, Button2, Button3: weightx = 1.0 *
    • Button4: weightx = 1.0, @@ -285,7 +285,7 @@ import java.util.Arrays; *
    *

    * Here is the code that implements the example shown above: - *

    + * *


      * import java.awt.*;
      * import java.util.*;
    diff --git a/jdk/src/share/classes/java/awt/GridLayout.java b/jdk/src/share/classes/java/awt/GridLayout.java
    index 596208c3e65..ef506b025ef 100644
    --- a/jdk/src/share/classes/java/awt/GridLayout.java
    +++ b/jdk/src/share/classes/java/awt/GridLayout.java
    @@ -32,7 +32,7 @@ package java.awt;
      * 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:
    - * 

    + * *


    *
      * import java.awt.*;
    @@ -54,7 +54,7 @@ package java.awt;
      * and left-to-right, the above example produces the output shown in Figure 1.
      * If the container's ComponentOrientation property is horizontal
      * and right-to-left, the example produces the output shown in Figure 2.
    - * 

    + * * * *
    * For example, the code . . . - *

    + * *


      * setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
      * add(new Label("Hi There!"));
    diff --git a/jdk/src/share/classes/java/awt/LinearGradientPaint.java b/jdk/src/share/classes/java/awt/LinearGradientPaint.java
    index f4af6026da2..eed1f34333c 100644
    --- a/jdk/src/share/classes/java/awt/LinearGradientPaint.java
    +++ b/jdk/src/share/classes/java/awt/LinearGradientPaint.java
    @@ -75,7 +75,6 @@ import java.beans.ConstructorProperties;
      * 

    * The following code demonstrates typical usage of * {@code LinearGradientPaint}: - *

    *

      *     Point2D start = new Point2D.Float(0, 0);
      *     Point2D end = new Point2D.Float(50, 50);
    @@ -92,7 +91,6 @@ import java.beans.ConstructorProperties;
      * 

    * This image demonstrates the example code above for each * of the three cycle methods: - *

    *

    * image showing the output of the example code diff --git a/jdk/src/share/classes/java/awt/LinearGradientPaintContext.java b/jdk/src/share/classes/java/awt/LinearGradientPaintContext.java index c0da02bffa2..965e1484ec4 100644 --- a/jdk/src/share/classes/java/awt/LinearGradientPaintContext.java +++ b/jdk/src/share/classes/java/awt/LinearGradientPaintContext.java @@ -66,8 +66,8 @@ final class LinearGradientPaintContext extends MultipleGradientPaintContext { * 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 diff --git a/jdk/src/share/classes/java/awt/List.java b/jdk/src/share/classes/java/awt/List.java index b3be9aeaf2e..754291809e6 100644 --- a/jdk/src/share/classes/java/awt/List.java +++ b/jdk/src/share/classes/java/awt/List.java @@ -41,7 +41,7 @@ import javax.accessibility.*; * the user can choose either one item or multiple items. *

    * For example, the code . . . - *

    + * *


      * List lst = new List(4, false);
      * lst.add("Mercury");
    @@ -1082,7 +1082,7 @@ public class List extends Component implements ItemSelectable, Accessible {
          * This method is not called unless item events are
          * enabled for this component. Item events are enabled
          * when one of the following occurs:
    -     * 

      + *
        *
      • An ItemListener object is registered * via addItemListener. *
      • Item events are enabled via enableEvents. @@ -1113,7 +1113,7 @@ public class List extends Component implements ItemSelectable, Accessible { * This method is not called unless action events are * enabled for this component. Action events are enabled * when one of the following occurs: - *

          + *
            *
          • An ActionListener object is registered * via addActionListener. *
          • Action events are enabled via enableEvents. diff --git a/jdk/src/share/classes/java/awt/MenuItem.java b/jdk/src/share/classes/java/awt/MenuItem.java index b660e20d96d..134469106a7 100644 --- a/jdk/src/share/classes/java/awt/MenuItem.java +++ b/jdk/src/share/classes/java/awt/MenuItem.java @@ -648,7 +648,7 @@ public class MenuItem extends MenuComponent implements Accessible { * This method is not called unless action events are * enabled for this component. Action events are enabled * when one of the following occurs: - *

              + *
                *
              • An ActionListener object is registered * via addActionListener. *
              • Action events are enabled via enableEvents. diff --git a/jdk/src/share/classes/java/awt/RadialGradientPaint.java b/jdk/src/share/classes/java/awt/RadialGradientPaint.java index 5fd08734f14..9f569f4f023 100644 --- a/jdk/src/share/classes/java/awt/RadialGradientPaint.java +++ b/jdk/src/share/classes/java/awt/RadialGradientPaint.java @@ -104,7 +104,6 @@ import java.beans.ConstructorProperties; * The following code demonstrates typical usage of * {@code RadialGradientPaint}, where the center and focus points are * the same: - *

                *

                  *     Point2D center = new Point2D.Float(50, 50);
                  *     float radius = 25;
                @@ -117,7 +116,6 @@ import java.beans.ConstructorProperties;
                  * 

                * This image demonstrates the example code above, with default * (centered) focus for each of the three cycle methods: - *

                *

                * image showing the
  * output of the sameple code @@ -126,7 +124,6 @@ import java.beans.ConstructorProperties; *

                * It is also possible to specify a non-centered focus point, as * in the following code: - *

                *

                  *     Point2D center = new Point2D.Float(50, 50);
                  *     float radius = 25;
                @@ -142,7 +139,6 @@ import java.beans.ConstructorProperties;
                  * 

                * This image demonstrates the previous example code, with non-centered * focus for each of the three cycle methods: - *

                *

                * image showing the
  * output of the sample code diff --git a/jdk/src/share/classes/java/awt/Scrollbar.java b/jdk/src/share/classes/java/awt/Scrollbar.java index 9849480719d..0c980b3bf4b 100644 --- a/jdk/src/share/classes/java/awt/Scrollbar.java +++ b/jdk/src/share/classes/java/awt/Scrollbar.java @@ -46,7 +46,7 @@ import javax.accessibility.*; *

                * Each scroll bar in this example could be created with * code similar to the following: - *

                + * *


                  * redSlider=new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, 255);
                  * add(redSlider);
                @@ -65,7 +65,7 @@ import javax.accessibility.*;
                  * The value range represented by the bubble in this example
                  * is the visible amount. The horizontal scroll bar
                  * in this example could be created with code like the following:
                - * 

                + * *


                  * ranger = new Scrollbar(Scrollbar.HORIZONTAL, 0, 60, 0, 300);
                  * add(ranger);
                @@ -103,7 +103,7 @@ import javax.accessibility.*;
                  * 

                * The AdjustmentEvent class defines five types * of adjustment event, listed here: - *

                + * *

                  *
                • AdjustmentEvent.TRACK is sent out when the * user drags the scroll bar's bubble. @@ -136,7 +136,7 @@ import javax.accessibility.*; * 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. - *

                  + * *

                    *
                  • AdjustmentEvent.TRACK replaces * Event.SCROLL_ABSOLUTE @@ -295,7 +295,7 @@ public class Scrollbar extends Component implements Adjustable, Accessible { * Constructs a new vertical scroll bar. * The default properties of the scroll bar are listed in * the following table: - *

                    + * * * * @@ -1104,11 +1104,11 @@ public class Scrollbar extends Component implements Adjustable, Accessible { * This method is not called unless adjustment events are * enabled for this component. Adjustment events are enabled * when one of the following occurs: - *

                      + *
                        *
                      • An AdjustmentListener object is registered * via addAdjustmentListener. *
                      • Adjustment events are enabled via enableEvents. - *

                      + *

                    *

                    Note that if the event parameter is null * the behavior is unspecified and may result in an * exception. diff --git a/jdk/src/share/classes/java/awt/SystemColor.java b/jdk/src/share/classes/java/awt/SystemColor.java index 931cf326fb5..ed5a26b4947 100644 --- a/jdk/src/share/classes/java/awt/SystemColor.java +++ b/jdk/src/share/classes/java/awt/SystemColor.java @@ -463,7 +463,7 @@ public final class SystemColor extends Color implements java.io.Serializable { } /** - * Called from & toolkit to update the above systemColors cache. + * Called from {@code } and toolkit to update the above systemColors cache. */ private static void updateSystemColors() { if (!GraphicsEnvironment.isHeadless()) { diff --git a/jdk/src/share/classes/java/awt/SystemTray.java b/jdk/src/share/classes/java/awt/SystemTray.java index 20ba912870c..58f3a0b2686 100644 --- a/jdk/src/share/classes/java/awt/SystemTray.java +++ b/jdk/src/share/classes/java/awt/SystemTray.java @@ -361,7 +361,7 @@ public class SystemTray { /** * Adds a {@code PropertyChangeListener} to the list of listeners for the * specific property. The following properties are currently supported: - *

                    + * *

                    Property
                    * * diff --git a/jdk/src/share/classes/java/awt/TextArea.java b/jdk/src/share/classes/java/awt/TextArea.java index 6fc979f2835..0528c0addfe 100644 --- a/jdk/src/share/classes/java/awt/TextArea.java +++ b/jdk/src/share/classes/java/awt/TextArea.java @@ -45,7 +45,7 @@ import javax.accessibility.*; * style="float:center; margin: 7px 10px;"> *

                    * This text area could be created by the following line of code: - *

                    + * *


                      * new TextArea("Hello", 5, 40);
                      * 

                    diff --git a/jdk/src/share/classes/java/awt/TextField.java b/jdk/src/share/classes/java/awt/TextField.java index 85eaba2d17b..e7088218180 100644 --- a/jdk/src/share/classes/java/awt/TextField.java +++ b/jdk/src/share/classes/java/awt/TextField.java @@ -45,7 +45,7 @@ import javax.accessibility.*; * style="float:center; margin: 7px 10px;"> *

                    * Here is the code that produces these four text fields: - *

                    + * *


                      * TextField tf1, tf2, tf3, tf4;
                      * // a blank text field
                    @@ -596,7 +596,7 @@ public class TextField extends TextComponent {
                          * This method is not called unless action events are
                          * enabled for this component. Action events are enabled
                          * when one of the following occurs:
                    -     * 

                      + *
                        *
                      • An ActionListener object is registered * via addActionListener. *
                      • Action events are enabled via enableEvents. diff --git a/jdk/src/share/classes/java/awt/Toolkit.java b/jdk/src/share/classes/java/awt/Toolkit.java index dcc1fa15b4e..e1f86f22e53 100644 --- a/jdk/src/share/classes/java/awt/Toolkit.java +++ b/jdk/src/share/classes/java/awt/Toolkit.java @@ -80,19 +80,19 @@ import sun.util.CoreResourceBundleControl; *
                        For example, calling ScrollPane.setScrollPosition * and then getScrollPosition may return an incorrect * value if the original request has not yet been processed. - *

                        + * *

                      • Moving the focus from one component to another. *
                        For more information, see * Timing * Focus Transfers, a section in * The Swing * Tutorial. - *

                        + * *

                      • Making a top-level container visible. *
                        Calling setVisible(true) on a Window, * Frame or Dialog may occur * asynchronously. - *

                        + * *

                      • Setting the size or location of a top-level container. *
                        Calls to setSize, setBounds or * setLocation on a Window, diff --git a/jdk/src/share/classes/java/awt/WaitDispatchSupport.java b/jdk/src/share/classes/java/awt/WaitDispatchSupport.java index c9a671838a9..ac59d77855c 100644 --- a/jdk/src/share/classes/java/awt/WaitDispatchSupport.java +++ b/jdk/src/share/classes/java/awt/WaitDispatchSupport.java @@ -91,7 +91,7 @@ class WaitDispatchSupport implements SecondaryLoop { * * @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 @@ class WaitDispatchSupport implements SecondaryLoop { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public boolean enter() { @@ -281,7 +281,7 @@ class WaitDispatchSupport implements SecondaryLoop { } /** - * @inheritDoc + * {@inheritDoc} */ public boolean exit() { if (log.isLoggable(PlatformLogger.Level.FINE)) { diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java index ceb901a3c4b..13779fd4129 100644 --- a/jdk/src/share/classes/java/awt/Window.java +++ b/jdk/src/share/classes/java/awt/Window.java @@ -212,7 +212,7 @@ public class Window extends Container implements Accessible { * * @serial * @see #getIconImages - * @see #setIconImages(List) + * @see #setIconImages */ transient java.util.List icons; diff --git a/jdk/src/share/classes/java/awt/color/CMMException.java b/jdk/src/share/classes/java/awt/color/CMMException.java index 9aca938a307..04497f69cc4 100644 --- a/jdk/src/share/classes/java/awt/color/CMMException.java +++ b/jdk/src/share/classes/java/awt/color/CMMException.java @@ -27,7 +27,8 @@ * */ -/********************************************************************** +/* + ********************************************************************** ********************************************************************** ********************************************************************** *** COPYRIGHT (c) Eastman Kodak Company, 1997 *** diff --git a/jdk/src/share/classes/java/awt/color/ColorSpace.java b/jdk/src/share/classes/java/awt/color/ColorSpace.java index c0bcb4938c3..ac21273d415 100644 --- a/jdk/src/share/classes/java/awt/color/ColorSpace.java +++ b/jdk/src/share/classes/java/awt/color/ColorSpace.java @@ -23,7 +23,8 @@ * questions. */ -/********************************************************************** +/* + ********************************************************************** ********************************************************************** ********************************************************************** *** COPYRIGHT (c) Eastman Kodak Company, 1997 *** @@ -91,7 +92,6 @@ import sun.java2d.cmm.CMSManager;
                    * - *

                    * @see ICC_ColorSpace */ diff --git a/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java b/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java index ace7f3db3a9..53edefb5992 100644 --- a/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java +++ b/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java @@ -23,7 +23,8 @@ * questions. */ -/********************************************************************** +/* + ********************************************************************** ********************************************************************** ********************************************************************** *** COPYRIGHT (c) Eastman Kodak Company, 1997 *** @@ -77,7 +78,6 @@ import sun.java2d.cmm.PCMM; * imported images with a known color space. At most, such applets * would need to get one of the default color spaces via * ColorSpace.getInstance(). - *

                    * @see ColorSpace * @see ICC_Profile */ @@ -481,7 +481,6 @@ public class ICC_ColorSpace extends ColorSpace { * be the same as the media white point tag XYZ value in the ICC * profile for an sRGB device. *

                    - *

                    * @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. diff --git a/jdk/src/share/classes/java/awt/color/ICC_Profile.java b/jdk/src/share/classes/java/awt/color/ICC_Profile.java index 7e44947477d..89abeca03d6 100644 --- a/jdk/src/share/classes/java/awt/color/ICC_Profile.java +++ b/jdk/src/share/classes/java/awt/color/ICC_Profile.java @@ -23,7 +23,8 @@ * questions. */ -/********************************************************************** +/* + ********************************************************************** ********************************************************************** ********************************************************************** *** COPYRIGHT (c) Eastman Kodak Company, 1997 *** @@ -86,7 +87,6 @@ import java.security.PrivilegedAction; * ICC Profile Format Specification. Most profiles of interest * either have invertible transformations or explicitly specify * transformations going both directions. - *

                    * @see ICC_ColorSpace */ diff --git a/jdk/src/share/classes/java/awt/color/ICC_ProfileGray.java b/jdk/src/share/classes/java/awt/color/ICC_ProfileGray.java index a868a6f50fc..1b076a6f81a 100644 --- a/jdk/src/share/classes/java/awt/color/ICC_ProfileGray.java +++ b/jdk/src/share/classes/java/awt/color/ICC_ProfileGray.java @@ -23,7 +23,8 @@ * questions. */ -/********************************************************************** +/* + ********************************************************************** ********************************************************************** ********************************************************************** *** COPYRIGHT (c) Eastman Kodak Company, 1997 *** @@ -63,7 +64,6 @@ import sun.java2d.cmm.ProfileDeferralInfo; * The inverse transform is done by converting the PCS Y components to * device Gray via the inverse of the grayTRC. - *

                    */ diff --git a/jdk/src/share/classes/java/awt/color/ICC_ProfileRGB.java b/jdk/src/share/classes/java/awt/color/ICC_ProfileRGB.java index dcf65828650..c26697a85d4 100644 --- a/jdk/src/share/classes/java/awt/color/ICC_ProfileRGB.java +++ b/jdk/src/share/classes/java/awt/color/ICC_ProfileRGB.java @@ -23,7 +23,8 @@ * questions. */ -/********************************************************************** +/* + ********************************************************************** ********************************************************************** ********************************************************************** *** COPYRIGHT (c) Eastman Kodak Company, 1997 *** @@ -82,7 +83,6 @@ import sun.java2d.cmm.ProfileDeferralInfo; * 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. - *

                    */ @@ -111,7 +111,7 @@ extends ICC_Profile { /** * Constructs an new ICC_ProfileRGB from a CMM ID. * - * @param ID The CMM ID for the profile. + * @param p The CMM ID for the profile. * */ ICC_ProfileRGB(Profile p) { diff --git a/jdk/src/share/classes/java/awt/dnd/DnDEventMulticaster.java b/jdk/src/share/classes/java/awt/dnd/DnDEventMulticaster.java index 2e6c13a0551..a9d9e6587ff 100644 --- a/jdk/src/share/classes/java/awt/dnd/DnDEventMulticaster.java +++ b/jdk/src/share/classes/java/awt/dnd/DnDEventMulticaster.java @@ -71,7 +71,7 @@ class DnDEventMulticaster extends AWTEventMulticaster * Handles the DragSourceDragEvent by invoking * dragOver on listener-a and listener-b. * - * @param e the DragSourceDragEvent + * @param dsde the DragSourceDragEvent */ public void dragOver(DragSourceDragEvent dsde) { ((DragSourceListener)a).dragOver(dsde); diff --git a/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java b/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java index e1116bc68d5..25f7630dd76 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java +++ b/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java @@ -37,7 +37,6 @@ package java.awt.dnd; * to provide appropriate feedback to the end user * when the operation completes. *

                    - *

                    * @since 1.2 */ diff --git a/jdk/src/share/classes/java/awt/dnd/DropTarget.java b/jdk/src/share/classes/java/awt/dnd/DropTarget.java index 0480ba5f67e..ad672936078 100644 --- a/jdk/src/share/classes/java/awt/dnd/DropTarget.java +++ b/jdk/src/share/classes/java/awt/dnd/DropTarget.java @@ -197,7 +197,7 @@ public class DropTarget implements DropTargetListener, Serializable { *

                    * The Component will receive drops only if it is enabled. * @param c The new Component this DropTarget - * is to be associated with.

                    + * is to be associated with. */ public synchronized void setComponent(Component c) { @@ -246,7 +246,6 @@ public class DropTarget implements DropTargetListener, Serializable { * Sets the default acceptable actions for this DropTarget *

                    * @param ops the default actions - *

                    * @see java.awt.dnd.DnDConstants */ diff --git a/jdk/src/share/classes/java/awt/event/MouseAdapter.java b/jdk/src/share/classes/java/awt/event/MouseAdapter.java index b908a6626df..dfc16d9c8be 100644 --- a/jdk/src/share/classes/java/awt/event/MouseAdapter.java +++ b/jdk/src/share/classes/java/awt/event/MouseAdapter.java @@ -49,7 +49,7 @@ package java.awt.event; * methods. * The relevant method in the listener object is invoked and the {@code MouseEvent} * or {@code MouseWheelEvent} is passed to it in following cases: - *

                      + *
                        *
                      • when a mouse button is pressed, released, or clicked (pressed and released) *
                      • when the mouse cursor enters or exits the component *
                      • when the mouse wheel rotated, or mouse moved or dragged diff --git a/jdk/src/share/classes/java/awt/font/FontRenderContext.java b/jdk/src/share/classes/java/awt/font/FontRenderContext.java index f9f5f1eec79..240ea895320 100644 --- a/jdk/src/share/classes/java/awt/font/FontRenderContext.java +++ b/jdk/src/share/classes/java/awt/font/FontRenderContext.java @@ -57,7 +57,6 @@ import java.awt.geom.AffineTransform; * FontRenderContext which is directly constructed will * most likely not represent any actual graphics device, and may lead * to unexpected or incorrect results. -*

                        * @see java.awt.RenderingHints#KEY_TEXT_ANTIALIASING * @see java.awt.RenderingHints#KEY_FRACTIONALMETRICS * @see java.awt.Graphics2D#getFontRenderContext() diff --git a/jdk/src/share/classes/java/awt/font/StyledParagraph.java b/jdk/src/share/classes/java/awt/font/StyledParagraph.java index df231bf5300..e0447dfcf3b 100644 --- a/jdk/src/share/classes/java/awt/font/StyledParagraph.java +++ b/jdk/src/share/classes/java/awt/font/StyledParagraph.java @@ -322,7 +322,7 @@ final class StyledParagraph { } /** - * 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. */ diff --git a/jdk/src/share/classes/java/awt/geom/AffineTransform.java b/jdk/src/share/classes/java/awt/geom/AffineTransform.java index d3c27ffa87e..494e3c8e31f 100644 --- a/jdk/src/share/classes/java/awt/geom/AffineTransform.java +++ b/jdk/src/share/classes/java/awt/geom/AffineTransform.java @@ -46,8 +46,7 @@ import java.beans.ConstructorProperties; * [ y'] = [ m10 m11 m12 ] [ y ] = [ m10x + m11y + m12 ] * [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ] * - *

                        - *

                        Handling 90-Degree Rotations

                        + *

                        Handling 90-Degree Rotations

                        *

                        * In some variations of the rotate methods in the * AffineTransform class, a double-precision argument diff --git a/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java b/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java index a2c41d91fae..56d435f0f5d 100644 --- a/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java +++ b/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java @@ -1047,7 +1047,7 @@ public abstract class QuadCurve2D implements Shape, Cloneable { /** * 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 @@ public abstract class QuadCurve2D implements Shape, Cloneable { /** * 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. */ diff --git a/jdk/src/share/classes/java/awt/image/BufferStrategy.java b/jdk/src/share/classes/java/awt/image/BufferStrategy.java index 7a4f793b791..1bd882c1573 100644 --- a/jdk/src/share/classes/java/awt/image/BufferStrategy.java +++ b/jdk/src/share/classes/java/awt/image/BufferStrategy.java @@ -54,7 +54,6 @@ import java.awt.Image; *

                        * Alternatively, the contents of the back buffer can be copied, or * blitted forward in a chain instead of moving the video pointer. - *

                        *

                        {@code
                          * Double buffering:
                          *
                        diff --git a/jdk/src/share/classes/java/awt/image/BufferedImage.java b/jdk/src/share/classes/java/awt/image/BufferedImage.java
                        index 811c209a983..df968838d7c 100644
                        --- a/jdk/src/share/classes/java/awt/image/BufferedImage.java
                        +++ b/jdk/src/share/classes/java/awt/image/BufferedImage.java
                        @@ -927,7 +927,6 @@ public class BufferedImage extends java.awt.Image
                              * 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:
                        -     * 

                        * *

                              *    pixel   = rgbArray[offset + (y-startY)*scansize + (x-startX)]; 
                        diff --git a/jdk/src/share/classes/java/awt/image/ColorConvertOp.java b/jdk/src/share/classes/java/awt/image/ColorConvertOp.java index 7ba11582be9..712eae48269 100644 --- a/jdk/src/share/classes/java/awt/image/ColorConvertOp.java +++ b/jdk/src/share/classes/java/awt/image/ColorConvertOp.java @@ -23,7 +23,8 @@ * questions. */ -/********************************************************************** +/* + ********************************************************************** ********************************************************************** ********************************************************************** *** COPYRIGHT (c) Eastman Kodak Company, 1997 *** @@ -64,7 +65,6 @@ import java.awt.RenderingHints; * color conversion. *

                        * Note that Source and Destination may be the same object. - *

                        * @see java.awt.RenderingHints#KEY_COLOR_RENDERING * @see java.awt.RenderingHints#KEY_DITHERING */ diff --git a/jdk/src/share/classes/java/awt/peer/CheckboxPeer.java b/jdk/src/share/classes/java/awt/peer/CheckboxPeer.java index fb4c4e6608a..abdbec9fa68 100644 --- a/jdk/src/share/classes/java/awt/peer/CheckboxPeer.java +++ b/jdk/src/share/classes/java/awt/peer/CheckboxPeer.java @@ -41,7 +41,7 @@ public interface CheckboxPeer extends ComponentPeer { * 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) */ diff --git a/jdk/src/share/classes/java/awt/peer/DesktopPeer.java b/jdk/src/share/classes/java/awt/peer/DesktopPeer.java index 72a87eccea8..48603d6c517 100644 --- a/jdk/src/share/classes/java/awt/peer/DesktopPeer.java +++ b/jdk/src/share/classes/java/awt/peer/DesktopPeer.java @@ -87,7 +87,7 @@ public interface DesktopPeer { * 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 * RFC2368: The mailto * URL scheme @@ -103,5 +103,5 @@ public interface DesktopPeer { * @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; } diff --git a/jdk/src/share/classes/java/io/BufferedReader.java b/jdk/src/share/classes/java/io/BufferedReader.java index 98fe47c7a59..ee9f66a4231 100644 --- a/jdk/src/share/classes/java/io/BufferedReader.java +++ b/jdk/src/share/classes/java/io/BufferedReader.java @@ -533,7 +533,7 @@ public class BufferedReader extends Reader { /** * 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 * terminal * stream operation. * @@ -550,8 +550,8 @@ public class BufferedReader extends Reader { * 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} providing the lines of text * described by this {@code BufferedReader} @@ -587,6 +587,7 @@ public class BufferedReader extends Reader { } } }; - return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iter, Spliterator.ORDERED), false); + return StreamSupport.stream(Spliterators.spliteratorUnknownSize( + iter, Spliterator.ORDERED | Spliterator.NONNULL), false); } } diff --git a/jdk/src/share/classes/java/lang/CharSequence.java b/jdk/src/share/classes/java/lang/CharSequence.java index a74a9d0d424..4d9ab3f7bc1 100644 --- a/jdk/src/share/classes/java/lang/CharSequence.java +++ b/jdk/src/share/classes/java/lang/CharSequence.java @@ -87,7 +87,7 @@ public interface CharSequence { char charAt(int index); /** - * Returns a new CharSequence that is a subsequence of this sequence. + * Returns a CharSequence that is a subsequence of this sequence. * The subsequence starts with the char value at the specified index and * ends with the char value at index end - 1. The length * (in chars) of the diff --git a/jdk/src/share/classes/java/lang/Class.java b/jdk/src/share/classes/java/lang/Class.java index 45c00913f6c..ea47cca2fca 100644 --- a/jdk/src/share/classes/java/lang/Class.java +++ b/jdk/src/share/classes/java/lang/Class.java @@ -1565,8 +1565,12 @@ public final class Class implements java.io.Serializable, * methods inherited by the array type from {@code Object}. It does not * contain a {@code Method} object for {@code clone()}. * - *

                        If this {@code Class} object represents a class or interface with no - * public methods, then the returned array has length 0. + *

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

                        If this {@code Class} object represents a primitive type or void, * then the returned array has length 0. @@ -1699,25 +1703,29 @@ public final class Class implements java.io.Serializable, * order. If {@code parameterTypes} is {@code null}, it is * treated as if it were an empty array. * - *

                        If the {@code name} is "{@code };"or "{@code }" a + *

                        If the {@code name} is "{@code }" or "{@code }" 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: *

                          - *
                        1. C is searched for any matching methods. If no matching - * method is found, the algorithm of step 1 is invoked recursively on - * the superclass of C.
                        2. - *
                        3. 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.
                        4. + *
                        5. C is searched for a matching method, as defined below. If a + * matching method is found, it is reflected.
                        6. + *
                        7. If no matching method is found by step 1 then: + *
                            + *
                          1. If C is a class other than {@code Object}, then this algorithm is + * invoked recursively on the superclass of C.
                          2. + *
                          3. 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.
                          4. + *
                        8. *
                        * - * 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. + *

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

                        Note that there may be more than one matching method in a * class because while the Java language forbids a class to diff --git a/jdk/src/share/classes/java/lang/String.java b/jdk/src/share/classes/java/lang/String.java index 4efec83389a..6565f6434e8 100644 --- a/jdk/src/share/classes/java/lang/String.java +++ b/jdk/src/share/classes/java/lang/String.java @@ -1958,7 +1958,7 @@ public final class String } /** - * Returns a new character sequence that is a subsequence of this sequence. + * Returns a character sequence that is a subsequence of this sequence. * *

                        An invocation of this method of the form * diff --git a/jdk/src/share/classes/java/lang/doc-files/ValueBased.html b/jdk/src/share/classes/java/lang/doc-files/ValueBased.html new file mode 100644 index 00000000000..7e1ee8bbf2c --- /dev/null +++ b/jdk/src/share/classes/java/lang/doc-files/ValueBased.html @@ -0,0 +1,42 @@ + + + + Value-based Classes + + + +

                        Value-based Classes

                        + +Some classes, such as java.util.Optional and +java.time.LocalDateTime, are value-based. Instances of a +value-based class: +
                          +
                        • are final and immutable (though may contain references to mutable + objects);
                        • +
                        • have implementations of equals, + hashCode, and toString which are computed + solely from the instance's state and not from its identity or the state + of any other object or variable;
                        • +
                        • make no use of identity-sensitive operations such as reference + equality (==) between instances, identity hash code of + instances, or synchronization on an instances's intrinsic lock;
                        • +
                        • are considered equal solely based on equals(), not + based on reference equality (==);
                        • +
                        • do not have accessible constructors, but are instead instantiated + through factory methods which make no committment as to the identity + of returned instances;
                        • +
                        • are freely substitutable when equal, meaning that interchanging + any two instances x and y that are equal + according to equals() in any computation or method + invocation should produce no visible change in behavior. +
                        • +
                        + +

                        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.

                        + + diff --git a/jdk/src/share/classes/java/math/BigInteger.java b/jdk/src/share/classes/java/math/BigInteger.java index 5fab7443295..79291ee34d2 100644 --- a/jdk/src/share/classes/java/math/BigInteger.java +++ b/jdk/src/share/classes/java/math/BigInteger.java @@ -215,7 +215,7 @@ public class BigInteger extends Number implements Comparable { * 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 @@ public class BigInteger extends Number implements Comparable { * 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 @@ public class BigInteger extends Number implements Comparable { * 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 @@ public class BigInteger extends Number implements Comparable { * 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 @@ public class BigInteger extends Number implements Comparable { * 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 @@ public class BigInteger extends Number implements Comparable { int len = mag.length; if (len <= n) { - return this; + return abs(); } int lowerInts[] = new int[n]; @@ -2017,8 +2025,8 @@ public class BigInteger extends Number implements Comparable { * @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 @@ public class BigInteger extends Number implements Comparable { * @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 @@ public class BigInteger extends Number implements Comparable { * @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); diff --git a/jdk/src/share/classes/java/math/MutableBigInteger.java b/jdk/src/share/classes/java/math/MutableBigInteger.java index bc4e4841344..5bb5c37d9d7 100644 --- a/jdk/src/share/classes/java/math/MutableBigInteger.java +++ b/jdk/src/share/classes/java/math/MutableBigInteger.java @@ -1148,8 +1148,8 @@ class MutableBigInteger { } 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); diff --git a/jdk/src/share/classes/java/security/Provider.java b/jdk/src/share/classes/java/security/Provider.java index 0d5309ca32e..7e3def8f516 100644 --- a/jdk/src/share/classes/java/security/Provider.java +++ b/jdk/src/share/classes/java/security/Provider.java @@ -336,6 +336,8 @@ public abstract class Provider extends Properties { * 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 @@ public abstract class Provider extends Properties { * 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 @@ public abstract class Provider extends Properties { * 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 @@ public abstract class Provider extends Properties { * 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 @@ public abstract class Provider extends Properties { * 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 function) { @@ -485,6 +495,8 @@ public abstract class Provider extends Properties { * 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 @@ public abstract class Provider extends Properties { * 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 mappingFunction) { @@ -541,6 +555,8 @@ public abstract class Provider extends Properties { * 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 remappingFunction) { @@ -571,6 +587,8 @@ public abstract class Provider extends Properties { * 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 remappingFunction) { @@ -589,13 +607,18 @@ public abstract class Provider extends Properties { 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 action) { checkInitialized(); diff --git a/jdk/src/share/classes/java/sql/CallableStatement.java b/jdk/src/share/classes/java/sql/CallableStatement.java index 9e593ae32db..a830b63ea8b 100644 --- a/jdk/src/share/classes/java/sql/CallableStatement.java +++ b/jdk/src/share/classes/java/sql/CallableStatement.java @@ -1108,7 +1108,7 @@ public interface CallableStatement extends PreparedStatement { * parameter; if a database access error occurs or * this method is called on a closed CallableStatement * @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 @@ public interface CallableStatement extends PreparedStatement { * parameter; if a database access error occurs or * this method is called on a closed CallableStatement * @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 @@ public interface CallableStatement extends PreparedStatement { * 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 @@ public interface CallableStatement extends PreparedStatement { * 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 @@ public interface CallableStatement extends PreparedStatement { * 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 @@ public interface CallableStatement extends PreparedStatement { * 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 @@ public interface CallableStatement extends PreparedStatement { * 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 @@ public interface CallableStatement extends PreparedStatement { * 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 @@ public interface CallableStatement extends PreparedStatement { * 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 @@ public interface CallableStatement extends PreparedStatement { * 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 diff --git a/jdk/src/share/classes/java/sql/DriverManager.java b/jdk/src/share/classes/java/sql/DriverManager.java index 53b4762d562..a9190a4851e 100644 --- a/jdk/src/share/classes/java/sql/DriverManager.java +++ b/jdk/src/share/classes/java/sql/DriverManager.java @@ -213,8 +213,8 @@ public class DriverManager { * The DriverManager attempts to select an appropriate driver from * the set of registered JDBC drivers. *

                        - * Note: If a property is specified as part of the {@code url} and - * is also specified in the {@code Properties} object, it is + * Note: 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 @@ public class DriverManager { * 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 @@ public class DriverManager { * 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 @@ public class DriverManager { * {@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) diff --git a/jdk/src/share/classes/java/sql/JDBCType.java b/jdk/src/share/classes/java/sql/JDBCType.java index 74ee8e01682..89db37bbf59 100644 --- a/jdk/src/share/classes/java/sql/JDBCType.java +++ b/jdk/src/share/classes/java/sql/JDBCType.java @@ -218,8 +218,8 @@ public enum JDBCType implements SQLType { } /** - * 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(); diff --git a/jdk/src/share/classes/java/sql/PreparedStatement.java b/jdk/src/share/classes/java/sql/PreparedStatement.java index 20cde7fb985..2b2e7f3374b 100644 --- a/jdk/src/share/classes/java/sql/PreparedStatement.java +++ b/jdk/src/share/classes/java/sql/PreparedStatement.java @@ -401,7 +401,7 @@ public interface PreparedStatement extends Statement { * 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 @@ public interface PreparedStatement extends Statement { * 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 @@ public interface PreparedStatement extends Statement { * 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 @@ public interface PreparedStatement extends Statement { * 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 diff --git a/jdk/src/share/classes/java/sql/ResultSet.java b/jdk/src/share/classes/java/sql/ResultSet.java index 5ac61d1d4c1..d939a9a582e 100644 --- a/jdk/src/share/classes/java/sql/ResultSet.java +++ b/jdk/src/share/classes/java/sql/ResultSet.java @@ -4178,7 +4178,7 @@ public interface ResultSet extends Wrapper, AutoCloseable { * 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 @@ public interface ResultSet extends Wrapper, AutoCloseable { * 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 @@ public interface ResultSet extends Wrapper, AutoCloseable { * 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 @@ public interface ResultSet extends Wrapper, AutoCloseable { * 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 diff --git a/jdk/src/share/classes/java/sql/SQLPermission.java b/jdk/src/share/classes/java/sql/SQLPermission.java index e3a24225fec..951430d90cc 100644 --- a/jdk/src/share/classes/java/sql/SQLPermission.java +++ b/jdk/src/share/classes/java/sql/SQLPermission.java @@ -122,7 +122,7 @@ public final class SQLPermission extends BasicPermission { * * @param name the name of this SQLPermission object, which must * be either {@code setLog}, {@code callAbort}, {@code setSyncFactory}, - * or {@code setNetworkTimeout} + * {@code deregisterDriver}, or {@code setNetworkTimeout} * @throws NullPointerException if name is null. * @throws IllegalArgumentException if name is empty. @@ -140,7 +140,7 @@ public final class SQLPermission extends BasicPermission { * * @param name the name of this SQLPermission object, which must * be either {@code setLog}, {@code callAbort}, {@code setSyncFactory}, - * or {@code setNetworkTimeout} + * {@code deregisterDriver}, or {@code setNetworkTimeout} * @param actions should be null * @throws NullPointerException if name is null. * @throws IllegalArgumentException if name is empty. diff --git a/jdk/src/share/classes/java/util/Base64.java b/jdk/src/share/classes/java/util/Base64.java index ac5a5d6be92..172acbeab58 100644 --- a/jdk/src/share/classes/java/util/Base64.java +++ b/jdk/src/share/classes/java/util/Base64.java @@ -350,62 +350,6 @@ public class Base64 { return ByteBuffer.wrap(dst); } - /** - * 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. - * - *

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

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

                        Recommended Usage Example - *

                        -         *    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();
                        -         *        ...
                        -         *    }
                        -         * 
                        - * - * @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 @@ public class Base64 { 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 @@ public class Base64 { * 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). - *

                        - * For decoders that use the Basic and - * URL and Filename safe 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. - *

                        - * Decoders that use the MIME 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. * *

                        Instances of {@link Decoder} class are safe for use by * multiple concurrent threads. @@ -810,6 +591,10 @@ public class Base64 { * output buffer's position will be zero and its limit will be the * number of resulting decoded bytes * + *

                        {@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 * @@ -842,76 +627,6 @@ public class Base64 { } } - /** - * 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. - * - *

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

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

                        The decoding operation will end and return if all remaining - * bytes in the input buffer have been decoded and written to the - * output buffer. - * - *

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

                        Recommended Usage Example - *

                        -         *    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();
                        -         *        ...
                        -         *    }
                        -         * 
                        - * - * @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. * @@ -932,150 +647,6 @@ public class Base64 { 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 @@ public class Base64 { 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 @@ public class Base64 { 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 @@ public class Base64 { // 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; diff --git a/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java index be9d4b5ae56..8a4a0f49f18 100644 --- a/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java +++ b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java @@ -63,6 +63,7 @@ import java.util.stream.Collector; 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 @@ public class DoubleSummaryStatistics implements DoubleConsumer { @Override public void accept(double value) { ++count; - sum += value; + sumWithCompensation(value); min = Math.min(min, value); max = Math.max(max, value); } @@ -95,11 +96,23 @@ public class DoubleSummaryStatistics implements DoubleConsumer { */ 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. * @@ -133,7 +146,8 @@ public class DoubleSummaryStatistics implements DoubleConsumer { * @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; } /** diff --git a/jdk/src/share/classes/java/util/ListResourceBundle.java b/jdk/src/share/classes/java/util/ListResourceBundle.java index 9aa7fdba550..1c1e5f04e89 100644 --- a/jdk/src/share/classes/java/util/ListResourceBundle.java +++ b/jdk/src/share/classes/java/util/ListResourceBundle.java @@ -105,6 +105,12 @@ import sun.util.ResourceBundleEnumeration; * } *
                        *
                    + * + *

                    + * 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 diff --git a/jdk/src/share/classes/java/util/Optional.java b/jdk/src/share/classes/java/util/Optional.java index 10b79234b18..d471058ec16 100644 --- a/jdk/src/share/classes/java/util/Optional.java +++ b/jdk/src/share/classes/java/util/Optional.java @@ -40,6 +40,11 @@ import java.util.function.Supplier; * {@link #ifPresent(java.util.function.Consumer) ifPresent()} (execute a block * of code if the value is present). * + *

                    This is a value-based + * 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 { diff --git a/jdk/src/share/classes/java/util/OptionalDouble.java b/jdk/src/share/classes/java/util/OptionalDouble.java index eda306cf7d4..0efc770fa03 100644 --- a/jdk/src/share/classes/java/util/OptionalDouble.java +++ b/jdk/src/share/classes/java/util/OptionalDouble.java @@ -31,7 +31,7 @@ import java.util.function.Supplier; /** * 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. * *

                    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 @@ import java.util.function.Supplier; * {@link #ifPresent(java.util.function.DoubleConsumer) ifPresent()} (execute a block * of code if the value is present). * + *

                    This is a value-based + * 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 { diff --git a/jdk/src/share/classes/java/util/OptionalInt.java b/jdk/src/share/classes/java/util/OptionalInt.java index 66478ce4713..5cb9275242b 100644 --- a/jdk/src/share/classes/java/util/OptionalInt.java +++ b/jdk/src/share/classes/java/util/OptionalInt.java @@ -31,7 +31,7 @@ import java.util.function.Supplier; /** * 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. * *

                    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 @@ import java.util.function.Supplier; * {@link #ifPresent(java.util.function.IntConsumer) ifPresent()} (execute a block * of code if the value is present). * + *

                    This is a value-based + * 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 { diff --git a/jdk/src/share/classes/java/util/OptionalLong.java b/jdk/src/share/classes/java/util/OptionalLong.java index f07cc0d3d3a..589a59fd3ae 100644 --- a/jdk/src/share/classes/java/util/OptionalLong.java +++ b/jdk/src/share/classes/java/util/OptionalLong.java @@ -31,7 +31,7 @@ import java.util.function.Supplier; /** * 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. * *

                    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 @@ import java.util.function.Supplier; * {@link #ifPresent(java.util.function.LongConsumer) ifPresent()} (execute a block * of code if the value is present). * + *

                    This is a value-based + * 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 { diff --git a/jdk/src/share/classes/java/util/PropertyResourceBundle.java b/jdk/src/share/classes/java/util/PropertyResourceBundle.java index 841d7d759a2..3d784d3ac10 100644 --- a/jdk/src/share/classes/java/util/PropertyResourceBundle.java +++ b/jdk/src/share/classes/java/util/PropertyResourceBundle.java @@ -100,6 +100,11 @@ import sun.util.ResourceBundleEnumeration; * * *

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

                    * Note: PropertyResourceBundle can be constructed either * from an InputStream or a Reader, which represents a property file. * Constructing a PropertyResourceBundle instance from an InputStream requires diff --git a/jdk/src/share/classes/java/util/ResourceBundle.java b/jdk/src/share/classes/java/util/ResourceBundle.java index 95948c5abcc..9e041f24aa7 100644 --- a/jdk/src/share/classes/java/util/ResourceBundle.java +++ b/jdk/src/share/classes/java/util/ResourceBundle.java @@ -184,6 +184,13 @@ import sun.util.locale.LocaleObjectCache; * subclass. Your subclasses must override two methods: handleGetObject * and getKeys(). * + *

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

                    ResourceBundle.Control

                    * * The {@link ResourceBundle.Control} class provides information necessary diff --git a/jdk/src/share/classes/java/util/StringJoiner.java b/jdk/src/share/classes/java/util/StringJoiner.java index d4050a4afd5..b6ba84c5df8 100644 --- a/jdk/src/share/classes/java/util/StringJoiner.java +++ b/jdk/src/share/classes/java/util/StringJoiner.java @@ -131,7 +131,7 @@ public final class StringJoiner { /** * 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 @@ public final class StringJoiner { } /** - * 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 diff --git a/jdk/src/share/classes/java/util/concurrent/Callable.java b/jdk/src/share/classes/java/util/concurrent/Callable.java index 53bde82bebd..04bc6075063 100644 --- a/jdk/src/share/classes/java/util/concurrent/Callable.java +++ b/jdk/src/share/classes/java/util/concurrent/Callable.java @@ -54,6 +54,7 @@ package java.util.concurrent; * @author Doug Lea * @param the result type of method {@code call} */ +@FunctionalInterface public interface Callable { /** * Computes a result, or throws an exception if unable to do so. diff --git a/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java b/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java index 8f2354cd1f8..9e89169e15f 100644 --- a/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java +++ b/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java @@ -2004,7 +2004,7 @@ public class CompletableFuture implements Future, CompletionStage { } if (dst == null) dst = new CompletableFuture(); - if (e == null || ex != null) + if (ex != null) dst.internalComplete(null, ex); } helpPostComplete(); diff --git a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java index c8c52a76ffd..880ecb2bbdd 100644 --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java @@ -49,7 +49,6 @@ import java.util.Hashtable; 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 @@ public class ConcurrentHashMap extends AbstractMap * 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 @@ public class ConcurrentHashMap extends AbstractMap */ 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 @@ public class ConcurrentHashMap extends AbstractMap * 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. */ @@ -2191,6 +2209,14 @@ public class ConcurrentHashMap extends AbstractMap /* ---------------- 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. */ @@ -2245,17 +2271,20 @@ public class ConcurrentHashMap extends AbstractMap s = sumCount(); } if (check >= 0) { - Node[] tab, nt; int sc; + Node[] 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 @@ public class ConcurrentHashMap extends AbstractMap */ final Node[] helpTransfer(Node[] tab, Node f) { Node[] nextTab; int sc; - if ((f instanceof ForwardingNode) && + if (tab != null && (f instanceof ForwardingNode) && (nextTab = ((ForwardingNode)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 @@ public class ConcurrentHashMap extends AbstractMap } 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[] 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 @@ public class ConcurrentHashMap extends AbstractMap 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 @@ public class ConcurrentHashMap extends AbstractMap private final void treeifyBin(Node[] tab, int index) { Node 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 @@ public class ConcurrentHashMap extends AbstractMap 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 @@ public class ConcurrentHashMap extends AbstractMap */ final Node find(int h, Object k) { if (k != null) { - for (Node e = first; e != null; e = e.next) { + for (Node 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 class ConcurrentHashMap extends AbstractMap } public final boolean removeAll(Collection c) { - Objects.requireNonNull(c); + if (c == null) throw new NullPointerException(); boolean modified = false; for (Iterator it = iterator(); it.hasNext();) { if (c.contains(it.next())) { @@ -4466,7 +4509,7 @@ public class ConcurrentHashMap extends AbstractMap } public final boolean retainAll(Collection c) { - Objects.requireNonNull(c); + if (c == null) throw new NullPointerException(); boolean modified = false; for (Iterator it = iterator(); it.hasNext();) { if (!c.contains(it.next())) { diff --git a/jdk/src/share/classes/java/util/logging/LogManager.java b/jdk/src/share/classes/java/util/logging/LogManager.java index 9a5e9518f7d..733eeefdb8b 100644 --- a/jdk/src/share/classes/java/util/logging/LogManager.java +++ b/jdk/src/share/classes/java/util/logging/LogManager.java @@ -146,7 +146,14 @@ public class LogManager { // 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 @@ public class LogManager { 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 @@ public class LogManager { // 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 @@ public class LogManager { 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 getLoggerNames() { @@ -993,6 +998,7 @@ public class LogManager { private String name; // for namedLoggers cleanup private LogNode node; // for loggerRef cleanup private WeakReference parentRef; // for kids cleanup + private boolean disposed = false; // avoid calling dispose twice LoggerWeakRef(Logger logger) { super(logger, loggerRefQueue); @@ -1002,14 +1008,45 @@ public class LogManager { // 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 @@ public class LogManager { // - 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 diff --git a/jdk/src/share/classes/java/util/logging/Logger.java b/jdk/src/share/classes/java/util/logging/Logger.java index 1976512cac8..21d6e393e05 100644 --- a/jdk/src/share/classes/java/util/logging/Logger.java +++ b/jdk/src/share/classes/java/util/logging/Logger.java @@ -218,12 +218,46 @@ import sun.reflect.Reflection; 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 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 @@ public class Logger { * @return localization bundle name (may be {@code null}) */ public String getResourceBundleName() { - return resourceBundleName; + return loggerBundle.resourceBundleName; } /** @@ -710,8 +744,9 @@ public class Logger { // 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 @@ public class Logger { 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() { @@ -1801,11 +1834,12 @@ public class Logger { } 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 @@ public class Logger { // 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 @@ public class Logger { 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 @@ public class Logger { } 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 @@ public class Logger { // 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; } } diff --git a/jdk/src/share/classes/java/util/stream/Collectors.java b/jdk/src/share/classes/java/util/stream/Collectors.java index 93ffb0113c6..f52ccba57ad 100644 --- a/jdk/src/share/classes/java/util/stream/Collectors.java +++ b/jdk/src/share/classes/java/util/stream/Collectors.java @@ -505,13 +505,42 @@ public final class Collectors { */ public static Collector summingDouble(ToDoubleFunction 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, @@ -560,17 +589,31 @@ public final class Collectors { * 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 -253 to + * 253. If the pipeline has more than 253 + * values, the divisor in the average computation will saturate at + * 253, leading to additional numerical errors. + * * @param 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 Collector averagingDouble(ToDoubleFunction 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); } /** diff --git a/jdk/src/share/classes/java/util/stream/DoublePipeline.java b/jdk/src/share/classes/java/util/stream/DoublePipeline.java index 6af346c56b1..ad9c0563824 100644 --- a/jdk/src/share/classes/java/util/stream/DoublePipeline.java +++ b/jdk/src/share/classes/java/util/stream/DoublePipeline.java @@ -377,8 +377,23 @@ abstract class DoublePipeline @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 @@ abstract class DoublePipeline return reduce(Math::max); } + /** + * {@inheritDoc} + * + * @implNote The {@code double} format can represent all + * consecutive integers in the range -253 to + * 253. If the pipeline has more than 253 + * values, the divisor in the average computation will saturate at + * 253, 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 diff --git a/jdk/src/share/classes/javax/crypto/Cipher.java b/jdk/src/share/classes/javax/crypto/Cipher.java index d16c579469c..ffcc7cf329c 100644 --- a/jdk/src/share/classes/javax/crypto/Cipher.java +++ b/jdk/src/share/classes/javax/crypto/Cipher.java @@ -62,17 +62,17 @@ import sun.security.jca.*; * algorithm (e.g., DES), and may be followed by a feedback mode and * padding scheme. * - *

                    A transformation is of the form:

                    + *

                    A transformation is of the form: * *

                      *
                    • "algorithm/mode/padding" or - *

                      + * *

                    • "algorithm" *
                    * *

                    (in the latter case, * provider-specific default values for the mode and padding scheme are used). - * For example, the following is a valid transformation:

                    + * For example, the following is a valid transformation: * *

                      *     Cipher c = Cipher.getInstance("DES/CBC/PKCS5Padding");
                    diff --git a/jdk/src/share/classes/javax/crypto/CipherSpi.java b/jdk/src/share/classes/javax/crypto/CipherSpi.java
                    index aae33318d1c..ce7258157d5 100644
                    --- a/jdk/src/share/classes/javax/crypto/CipherSpi.java
                    +++ b/jdk/src/share/classes/javax/crypto/CipherSpi.java
                    @@ -62,17 +62,17 @@ import java.nio.ByteBuffer;
                      * algorithm (e.g., DES), and may be followed by a feedback mode and
                      * padding scheme.
                      *
                    - * 

                    A transformation is of the form:

                    + *

                    A transformation is of the form: * *

                      *
                    • "algorithm/mode/padding" or - *

                      + * *

                    • "algorithm" *
                    * *

                    (in the latter case, * provider-specific default values for the mode and padding scheme are used). - * For example, the following is a valid transformation:

                    + * For example, the following is a valid transformation: * *

                      *     Cipher c = Cipher.getInstance("DES/CBC/PKCS5Padding");
                    @@ -129,7 +129,7 @@ import java.nio.ByteBuffer;
                      * DES/CBC/PKCS5Padding, one that implements
                      * DES/CFB/PKCS5Padding, and yet another one that implements
                      * DES/OFB/PKCS5Padding. That provider would have the following
                    - * Cipher properties in its master class:

                    + * Cipher properties in its master class: * *

                      * @@ -160,7 +160,7 @@ import java.nio.ByteBuffer; * and one for OFB), one class for PKCS5Padding, * and a generic DES class that subclasses from CipherSpi. * That provider would have the following - * Cipher properties in its master class:

                      + * Cipher properties in its master class: * *

                        * @@ -197,20 +197,20 @@ import java.nio.ByteBuffer; * Check if the provider has registered a subclass of CipherSpi * for the specified "algorithm/mode/padding" transformation. *

                        If the answer is YES, instantiate it. - *

                        If the answer is NO, go to the next step.

                        + *

                        If the answer is NO, go to the next step. *

                      • * Check if the provider has registered a subclass of CipherSpi * for the sub-transformation "algorithm/mode". *

                        If the answer is YES, instantiate it, and call * engineSetPadding(padding) on the new instance. - *

                        If the answer is NO, go to the next step.

                        + *

                        If the answer is NO, go to the next step. *

                      • * Check if the provider has registered a subclass of CipherSpi * for the sub-transformation "algorithm//padding" (note the double * slashes). *

                        If the answer is YES, instantiate it, and call * engineSetMode(mode) on the new instance. - *

                        If the answer is NO, go to the next step.

                        + *

                        If the answer is NO, go to the next step. *

                      • * Check if the provider has registered a subclass of CipherSpi * for the sub-transformation "algorithm". diff --git a/jdk/src/share/classes/javax/crypto/KeyGenerator.java b/jdk/src/share/classes/javax/crypto/KeyGenerator.java index 961f0ea9eb3..030207eab51 100644 --- a/jdk/src/share/classes/javax/crypto/KeyGenerator.java +++ b/jdk/src/share/classes/javax/crypto/KeyGenerator.java @@ -66,7 +66,6 @@ import sun.security.jca.GetInstance.Instance; * algorithm-independent init 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. - *

                        * *

                      • Algorithm-Specific Initialization *

                        For situations where a set of algorithm-specific parameters already diff --git a/jdk/src/share/classes/javax/crypto/SealedObject.java b/jdk/src/share/classes/javax/crypto/SealedObject.java index 9166c28d10c..9cee4d070f1 100644 --- a/jdk/src/share/classes/javax/crypto/SealedObject.java +++ b/jdk/src/share/classes/javax/crypto/SealedObject.java @@ -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 @@ import java.security.NoSuchProviderException; * to a SealedObject. * *

                        The original object that was sealed can be recovered in two different - * ways:

                        + * ways: * *

                          * @@ -68,8 +68,6 @@ import java.security.NoSuchProviderException; * decryption key, it could hand over the cipher object to * another party who then unseals the sealed object. * - *

                          - * *

                        • by using one of the * {@link #getObject(java.security.Key) getObject} methods * that take a Key object. diff --git a/jdk/src/share/classes/javax/net/ssl/SSLEngine.java b/jdk/src/share/classes/javax/net/ssl/SSLEngine.java index 92e838623f4..64110880258 100644 --- a/jdk/src/share/classes/javax/net/ssl/SSLEngine.java +++ b/jdk/src/share/classes/javax/net/ssl/SSLEngine.java @@ -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 @@ import java.nio.ReadOnlyBufferException; * 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. - *

                          + * *


                          * * Concurrency Notes: @@ -345,7 +345,7 @@ import java.nio.ReadOnlyBufferException; * out-of-order, unexpected or fatal results may occur. *

                          * For example: - *

                          + * *

                            *              synchronized (outboundLock) {
                            *                  sslEngine.wrap(src, dst);
                          diff --git a/jdk/src/share/classes/javax/net/ssl/SSLPermission.java b/jdk/src/share/classes/javax/net/ssl/SSLPermission.java
                          index bac011d6579..b27142128ae 100644
                          --- a/jdk/src/share/classes/javax/net/ssl/SSLPermission.java
                          +++ b/jdk/src/share/classes/javax/net/ssl/SSLPermission.java
                          @@ -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 @@ import java.security.*;
                            * 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.
                          - * 

                          * *

                    Property
                    diff --git a/jdk/src/share/classes/javax/script/ScriptEngineFactory.java b/jdk/src/share/classes/javax/script/ScriptEngineFactory.java index 38c665df5bd..87d931570b2 100644 --- a/jdk/src/share/classes/javax/script/ScriptEngineFactory.java +++ b/jdk/src/share/classes/javax/script/ScriptEngineFactory.java @@ -144,7 +144,7 @@ public interface ScriptEngineFactory { * 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; - *

                    + * *

                    {@code
                          * public String getMethodCallSyntax(String obj,
                          *                                   String m, String... args) {
                    @@ -180,7 +180,7 @@ public interface ScriptEngineFactory {
                          * 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;
                    -     * 

                    + * *

                    
                          * public String getOutputStatement(String toDisplay) {
                          *      return "print(" + toDisplay + ")";
                    @@ -198,7 +198,7 @@ public interface ScriptEngineFactory {
                         /**
                          * Returns a valid scripting language executable program with given statements.
                          * For instance an implementation for a PHP engine might be:
                    -     * 

                    + * *

                    {@code
                          * public String getProgram(String... statements) {
                          *      String retval = "
                          *
                          * This method returns true if:
                    -     * 

                      - *
                    • p is an instanceof PrivateCredentialPermission and

                      + *

                        + *
                      • p is an instanceof PrivateCredentialPermission and *
                      • the target name for p is implied by this object's * target name. For example: *
                        diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java b/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java
                        index 77aabb8b9d6..bdd3ff9c4a9 100644
                        --- a/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java
                        +++ b/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java
                        @@ -48,14 +48,14 @@ import java.io.IOException;
                          * 

                        * For example, to specify the "host" service use of a forwardable TGT the * target permission is specified as follows: - *

                        + * *

                          *  DelegationPermission("\"host/foo.example.com@EXAMPLE.COM\" \"krbtgt/EXAMPLE.COM@EXAMPLE.COM\"");
                          * 
                        *

                        * To give the "backup" service a proxiable nfs service ticket the target permission * might be specified: - *

                        + * *

                          *  DelegationPermission("\"backup/bar.example.com@EXAMPLE.COM\" \"nfs/home.EXAMPLE.COM@EXAMPLE.COM\"");
                          * 
                        diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java b/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java index 50a0517fa44..893284e548c 100644 --- a/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java +++ b/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java @@ -62,7 +62,7 @@ import java.io.IOException; * Authentication Service exchange. *

                        * The possible actions are: - *

                        + * *

                          *    initiate -              allow the caller to use the credential to
                          *                            initiate a security context with a service
                        @@ -75,7 +75,7 @@ import java.io.IOException;
                          *
                          * For example, to specify the permission to access to the TGT to
                          * initiate a security context the permission is constructed as follows:
                        - * 

                        + * *

                          *     ServicePermission("krbtgt/EXAMPLE.COM@EXAMPLE.COM", "initiate");
                          * 
                        @@ -89,7 +89,7 @@ import java.io.IOException; * 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: - *

                        + * *

                          *     ServicePermission("host/foo.example.com@EXAMPLE.COM", "accept");
                          * 
                        diff --git a/jdk/src/share/classes/javax/security/auth/login/LoginContext.java b/jdk/src/share/classes/javax/security/auth/login/LoginContext.java index a9685bca811..ba18e5ce6a0 100644 --- a/jdk/src/share/classes/javax/security/auth/login/LoginContext.java +++ b/jdk/src/share/classes/javax/security/auth/login/LoginContext.java @@ -101,11 +101,11 @@ import sun.security.util.ResourcesMgr; *
                      • If the constructor has a Subject * input parameter, the LoginContext uses the caller-specified * Subject object. - *

                        + * *

                      • If the caller specifies a {@code null} Subject * and a {@code null} value is permitted, * the LoginContext instantiates a new Subject. - *

                        + * *

                      • If the constructor does not have a Subject * input parameter, the LoginContext instantiates a new Subject. *

                        @@ -132,7 +132,7 @@ import sun.security.util.ResourcesMgr; * {@code getAppConfigurationEntry} with the name, "other" * (the default entry name). If there is no entry for "other", * then a {@code LoginException} is thrown. - *

                        + * *

                      • When LoginContext uses the installed Configuration, the caller * requires the createLoginContext.name and possibly * createLoginContext.other AuthPermissions. Furthermore, the @@ -141,7 +141,7 @@ import sun.security.util.ResourcesMgr; * 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. - *

                        + * *

                      • 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 @@ import sun.security.util.ResourcesMgr; *
                      • If the constructor has a CallbackHandler * input parameter, the LoginContext uses the caller-specified * CallbackHandler object. - *

                        + * *

                      • If the constructor does not 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 @@ import sun.security.util.ResourcesMgr; * with users. The caller thus assumes that the configured * modules have alternative means for authenticating the user. * - *

                        + * *

                      • When the LoginContext uses the installed Configuration (instead of * a caller-specified Configuration, see above), * then this LoginContext must wrap any diff --git a/jdk/src/share/classes/javax/security/auth/x500/X500Principal.java b/jdk/src/share/classes/javax/security/auth/x500/X500Principal.java index 5c0a5621261..77292b0be22 100644 --- a/jdk/src/share/classes/javax/security/auth/x500/X500Principal.java +++ b/jdk/src/share/classes/javax/security/auth/x500/X500Principal.java @@ -314,7 +314,7 @@ public final class X500Principal implements Principal, java.io.Serializable { * this method returns an RFC 2253 conformant string representation * with the following additional canonicalizations: * - *

                          + *
                            *
                          1. Leading zeros are removed from attribute types * that are encoded as dotted decimal OIDs *
                          2. DirectoryString attribute values of type diff --git a/jdk/src/share/classes/javax/swing/Action.java b/jdk/src/share/classes/javax/swing/Action.java index 7223d819681..66fcf836d59 100644 --- a/jdk/src/share/classes/javax/swing/Action.java +++ b/jdk/src/share/classes/javax/swing/Action.java @@ -67,7 +67,7 @@ import java.beans.*; * functionality and broadcast of property changes. For this reason, * you should take care to only use Actions where their benefits * are desired, and use simple ActionListeners elsewhere. - *

                            + *
                            * *

                            Swing Components Supporting Action

                            *

                            @@ -93,7 +93,7 @@ import java.beans.*; * null property value in an Action (or a * Action that is null) results in the * button's corresponding property being set to null. - *

                            + * *

                    * diff --git a/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java b/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java index 6e35b6156f0..3cb3c6f22d5 100644 --- a/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java +++ b/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java @@ -83,7 +83,7 @@ public class DefaultComboBoxModel extends AbstractListModel implements Mut // implements javax.swing.ComboBoxModel /** * Set the value of the selected item. The selected item may be null. - *

                    + * * @param anObject The combo box value or null for no selection. */ public void setSelectedItem(Object anObject) { diff --git a/jdk/src/share/classes/javax/swing/GroupLayout.java b/jdk/src/share/classes/javax/swing/GroupLayout.java index e3be1ddfdd5..582c96116ca 100644 --- a/jdk/src/share/classes/javax/swing/GroupLayout.java +++ b/jdk/src/share/classes/javax/swing/GroupLayout.java @@ -100,7 +100,7 @@ import static javax.swing.SwingConstants.VERTICAL; * 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. - *

                    + * *

                    * Sequential group along the vertical axis in three components *

                    diff --git a/jdk/src/share/classes/javax/swing/InputVerifier.java b/jdk/src/share/classes/javax/swing/InputVerifier.java index aa2a0eeba1f..2cf4ddcaae6 100644 --- a/jdk/src/share/classes/javax/swing/InputVerifier.java +++ b/jdk/src/share/classes/javax/swing/InputVerifier.java @@ -47,7 +47,7 @@ import java.util.*; * 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. - *

                    + * *

                      * import java.awt.*;
                      * import java.util.*;
                    diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java
                    index 3f4d3f25606..d6f35ac3fea 100644
                    --- a/jdk/src/share/classes/javax/swing/JComponent.java
                    +++ b/jdk/src/share/classes/javax/swing/JComponent.java
                    @@ -4827,7 +4827,6 @@ public abstract class JComponent extends Container implements Serializable,
                          * updating differs from the AWT because programs generally no
                          * longer need to invoke validate to get the contents of the
                          * GUI to update.
                    -     * 

                    * * @see java.awt.Component#invalidate * @see java.awt.Container#validate diff --git a/jdk/src/share/classes/javax/swing/JDialog.java b/jdk/src/share/classes/javax/swing/JDialog.java index 92febed0843..2d8980e3056 100644 --- a/jdk/src/share/classes/javax/swing/JDialog.java +++ b/jdk/src/share/classes/javax/swing/JDialog.java @@ -701,7 +701,7 @@ public class JDialog extends Dialog implements WindowConstants, * 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: - *

                    + *

                    *

                      *
                    • {@code DO_NOTHING_ON_CLOSE} * (defined in {@code WindowConstants}): diff --git a/jdk/src/share/classes/javax/swing/JFrame.java b/jdk/src/share/classes/javax/swing/JFrame.java index 27a5a04e276..308320c8ecc 100644 --- a/jdk/src/share/classes/javax/swing/JFrame.java +++ b/jdk/src/share/classes/javax/swing/JFrame.java @@ -324,7 +324,7 @@ public class JFrame extends Frame implements WindowConstants, * 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: - *

                      + *

                      *

                        *
                      • DO_NOTHING_ON_CLOSE * (defined in WindowConstants): diff --git a/jdk/src/share/classes/javax/swing/JInternalFrame.java b/jdk/src/share/classes/javax/swing/JInternalFrame.java index 901f1371b81..3183d5c4e90 100644 --- a/jdk/src/share/classes/javax/swing/JInternalFrame.java +++ b/jdk/src/share/classes/javax/swing/JInternalFrame.java @@ -1645,7 +1645,7 @@ public class JInternalFrame extends JComponent implements * Sets the operation that will happen by default when * the user initiates a "close" on this internal frame. * The possible choices are: - *

                        + *

                        *

                        *
                        DO_NOTHING_ON_CLOSE *
                        Do nothing. diff --git a/jdk/src/share/classes/javax/swing/JLayeredPane.java b/jdk/src/share/classes/javax/swing/JLayeredPane.java index 052fcf34c31..71d57bdabb8 100644 --- a/jdk/src/share/classes/javax/swing/JLayeredPane.java +++ b/jdk/src/share/classes/javax/swing/JLayeredPane.java @@ -43,7 +43,7 @@ import javax.accessibility.*; * For task-oriented documentation and examples of using layered panes see * How to Use a Layered Pane, * a section in The Java Tutorial. - *

                        + * *

                    * *
                    diff --git a/jdk/src/share/classes/javax/swing/JList.java b/jdk/src/share/classes/javax/swing/JList.java index e62bc80135b..1aae62e861f 100644 --- a/jdk/src/share/classes/javax/swing/JList.java +++ b/jdk/src/share/classes/javax/swing/JList.java @@ -950,7 +950,7 @@ public class JList extends JComponent implements Scrollable, Accessible /** * 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: - *

                    + * *

                          * VERTICAL:          0
                          *                    1
                    diff --git a/jdk/src/share/classes/javax/swing/JOptionPane.java b/jdk/src/share/classes/javax/swing/JOptionPane.java
                    index 8bbd49db63a..a2dbf810a1d 100644
                    --- a/jdk/src/share/classes/javax/swing/JOptionPane.java
                    +++ b/jdk/src/share/classes/javax/swing/JOptionPane.java
                    @@ -106,7 +106,6 @@ import static javax.swing.ClientPropertyKey.PopupFactory_FORCE_HEAVYWEIGHT_POPUP
                      * 

                    * All dialogs are modal. Each showXxxDialog method blocks * the caller until the user's interaction is complete. - *

                    * * * @@ -143,7 +142,7 @@ import static javax.swing.ClientPropertyKey.PopupFactory_FORCE_HEAVYWEIGHT_POPUP * just below the component. This parameter may be null, * in which case a default Frame 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}). *
                    message
                    * A descriptive message to be placed in the dialog box. * In the most common usage, message is just a String or @@ -225,42 +224,42 @@ import static javax.swing.ClientPropertyKey.PopupFactory_FORCE_HEAVYWEIGHT_POPUP *
                    Show an error dialog that displays the message, 'alert': *
                    * JOptionPane.showMessageDialog(null, "alert", "alert", JOptionPane.ERROR_MESSAGE); - *

                    + * *

                    Show an internal information dialog with the message, 'information': - *
                    - * JOptionPane.showInternalMessageDialog(frame, "information",
                    - *
                        "information", JOptionPane.INFORMATION_MESSAGE);
                    - *

                    + *

                    + * JOptionPane.showInternalMessageDialog(frame, "information",
                    + *             "information", JOptionPane.INFORMATION_MESSAGE);
                    + * 
                    *
                    Show an information panel with the options yes/no and message 'choose one': - *
                    JOptionPane.showConfirmDialog(null, - *
                        "choose one", "choose one", JOptionPane.YES_NO_OPTION);
                    - *

                    + *

                    JOptionPane.showConfirmDialog(null,
                    + *             "choose one", "choose one", JOptionPane.YES_NO_OPTION);
                    + * 
                    *
                    Show an internal information dialog with the options yes/no/cancel and * message 'please choose one' and title information: - *
                    JOptionPane.showInternalConfirmDialog(frame, - *
                        "please choose one", "information",
                    - *
                        JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
                    - *

                    + *

                    JOptionPane.showInternalConfirmDialog(frame,
                    + *             "please choose one", "information",
                    + *             JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
                    + * 
                    *
                    Show a warning dialog with the options OK, CANCEL, title 'Warning', and * message 'Click OK to continue': - *
                    - * Object[] options = { "OK", "CANCEL" };
                    + *
                    + * Object[] options = { "OK", "CANCEL" };
                      * JOptionPane.showOptionDialog(null, "Click OK to continue", "Warning",
                    - *             
                        JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
                    - *
                        null, options, options[0]);
                    - *

                    + * JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, + * null, options, options[0]); + *

                    *
                    Show a dialog asking the user to type in a String: *
                    * String inputValue = JOptionPane.showInputDialog("Please input a value"); - *

                    + * *

                    Show a dialog asking the user to select a String: - *
                    + *
                      * Object[] possibleValues = { "First", "Second", "Third" };
                    * Object selectedValue = JOptionPane.showInputDialog(null, - *
                        "Choose one", "Input",
                    - *
                        JOptionPane.INFORMATION_MESSAGE, null,
                    - *
                        possibleValues, possibleValues[0]);
                    - *

                    + * "Choose one", "Input", + * JOptionPane.INFORMATION_MESSAGE, null, + * possibleValues, possibleValues[0]); + *

                    * * Direct Use:
                    * To create and use an JOptionPane directly, the @@ -281,7 +280,7 @@ import static javax.swing.ClientPropertyKey.PopupFactory_FORCE_HEAVYWEIGHT_POPUP * } * //If there is an array of option buttons: * for(int counter = 0, maxCounter = options.length; - * counter < maxCounter; counter++) { + * counter < maxCounter; counter++) { * if(options[counter].equals(selectedValue)) * return counter; * } @@ -1847,9 +1846,9 @@ public class JOptionPane extends JComponent implements Accessible } /** - * 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 OptionPaneUI L&F object + * @param ui the OptionPaneUI {@literal L&F} object * @see UIDefaults#getUI * @beaninfo * bound: true @@ -1864,7 +1863,7 @@ public class JOptionPane extends JComponent implements Accessible } /** - * 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 OptionPaneUI object */ @@ -1873,7 +1872,7 @@ public class JOptionPane extends JComponent implements Accessible } /** - * Notification from the UIManager that the L&F has changed. + * Notification from the UIManager that the {@literal L&F} has changed. * Replaces the current UI object with the latest version from the * UIManager. * @@ -1886,7 +1885,7 @@ public class JOptionPane extends JComponent implements Accessible /** * 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 @@ public class JOptionPane extends JComponent implements Accessible * 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: * DEFAULT_OPTION, * YES_NO_OPTION, * YES_NO_CANCEL_OPTION, diff --git a/jdk/src/share/classes/javax/swing/JScrollBar.java b/jdk/src/share/classes/javax/swing/JScrollBar.java index efcac811546..1c0eac1af7f 100644 --- a/jdk/src/share/classes/javax/swing/JScrollBar.java +++ b/jdk/src/share/classes/javax/swing/JScrollBar.java @@ -192,9 +192,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible /** - * Sets the L&F object that renders this component. + * Sets the {@literal L&F} object that renders this component. * - * @param ui the ScrollBarUI L&F object + * @param ui the ScrollBarUI {@literal L&F} object * @see UIDefaults#getUI * @since 1.4 * @beaninfo @@ -606,9 +606,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * Sets the four BoundedRangeModel properties after forcing * the arguments to obey the usual constraints: *

                    -     * minimum <= value <= value+extent <= maximum
                    +     * minimum ≤ value ≤ value+extent ≤ maximum
                          * 
                    - *

                    + * * * @see BoundedRangeModel#setRangeProperties * @see #setValue diff --git a/jdk/src/share/classes/javax/swing/JScrollPane.java b/jdk/src/share/classes/javax/swing/JScrollPane.java index 4c5f1e88823..ecb3d8f34d9 100644 --- a/jdk/src/share/classes/javax/swing/JScrollPane.java +++ b/jdk/src/share/classes/javax/swing/JScrollPane.java @@ -53,7 +53,7 @@ import java.beans.Transient; * How to Use Scroll Panes, * a section in The Java Tutorial. Note that * JScrollPane does not support heavyweight components. - *

                    + * *

                    * *
                    diff --git a/jdk/src/share/classes/javax/swing/JTable.java b/jdk/src/share/classes/javax/swing/JTable.java index bdcb27b1b17..526afcf66bf 100644 --- a/jdk/src/share/classes/javax/swing/JTable.java +++ b/jdk/src/share/classes/javax/swing/JTable.java @@ -73,7 +73,7 @@ import sun.swing.SwingLazyValue; * 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: - *

                    + * *

                      *      TableModel dataModel = new AbstractTableModel() {
                      *          public int getColumnCount() { return 10; }
                    @@ -659,7 +659,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
                          * 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:
                    -     * 

                    + * *

                    ((Vector)rowData.elementAt(1)).elementAt(5);
                    *

                    * @param rowData the data for the new table @@ -674,7 +674,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * rowData, with column names, columnNames. * rowData is an array of rows, so the value of the cell at row 1, * column 5 can be obtained with the following code: - *

                    + * *

                     rowData[1][5]; 
                    *

                    * All rows must be of the same length as columnNames. @@ -3062,9 +3062,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * 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. - *

                    + * *

                    Distributing the delta

                    - *

                    + * *

                    Overview

                    *

                    * Call "DELTA" the difference between the target size and the @@ -3073,7 +3073,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * 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). - *

                    + * *

                    Definition

                    *

                    * Call the individual constraints min[i], max[i], and pref[i]. @@ -3081,21 +3081,21 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * Call their respective sums: MIN, MAX, and PREF. *

                    * Each new size will be calculated using: - *

                    + * *

                          *          size[i] = pref[i] + delta[i]
                          * 
                    * where each individual delta[i] is calculated according to: *

                    * If (DELTA < 0) we are in shrink mode where: - *

                    + * *

                          *                        DELTA
                          *          delta[i] = ------------ * (pref[i] - min[i])
                          *                     (PREF - MIN)
                          * 
                    * If (DELTA > 0) we are in expand mode where: - *

                    + * *

                          *                        DELTA
                          *          delta[i] = ------------ * (max[i] - pref[i])
                    @@ -6373,7 +6373,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
                          * 

                    * Here's an example of creating a MessageFormat that can be * used to print "Duke's Table: Page - " and the current page number: - *

                    + * *

                          *     // notice the escaping of the single quote
                          *     // notice how the page number is included with "{0}"
                    @@ -7686,7 +7686,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
                                  * 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
                    diff --git a/jdk/src/share/classes/javax/swing/JTextArea.java b/jdk/src/share/classes/javax/swing/JTextArea.java
                    index 80b2bb729e3..06b6ea593b7 100644
                    --- a/jdk/src/share/classes/javax/swing/JTextArea.java
                    +++ b/jdk/src/share/classes/javax/swing/JTextArea.java
                    @@ -93,7 +93,7 @@ import java.io.IOException;
                      *    JTextArea myArea = ??;
                      *    myArea.getDocument().addDocumentListener(myListener);
                      * 
                    - *

                    + * *

                    *
                    Newlines *
                    diff --git a/jdk/src/share/classes/javax/swing/JTextPane.java b/jdk/src/share/classes/javax/swing/JTextPane.java index a6a76edcf32..b2ca7fc89a4 100644 --- a/jdk/src/share/classes/javax/swing/JTextPane.java +++ b/jdk/src/share/classes/javax/swing/JTextPane.java @@ -49,7 +49,7 @@ import javax.swing.plaf.*; * 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. - *

                    + * *

                    *
                    Newlines *
                    diff --git a/jdk/src/share/classes/javax/swing/JTree.java b/jdk/src/share/classes/javax/swing/JTree.java index fdacb72aa3c..196cde453ab 100644 --- a/jdk/src/share/classes/javax/swing/JTree.java +++ b/jdk/src/share/classes/javax/swing/JTree.java @@ -3956,7 +3956,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * 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(); diff --git a/jdk/src/share/classes/javax/swing/LookAndFeel.java b/jdk/src/share/classes/javax/swing/LookAndFeel.java index 024162cfa50..2aad9290fc9 100644 --- a/jdk/src/share/classes/javax/swing/LookAndFeel.java +++ b/jdk/src/share/classes/javax/swing/LookAndFeel.java @@ -91,7 +91,7 @@ import java.util.StringTokenizer; * to provide a specific set of defaults. These are documented in the * classes that require the specific default. * - *

                    ComponentUIs and defaults

                    + *

                    ComponentUIs and defaults

                    * * All {@code ComponentUIs} typically need to set various properties * on the {@code JComponent} the {@code ComponentUI} is providing the @@ -120,7 +120,7 @@ import java.util.StringTokenizer; * {@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. - *

                    + * *

                    Exceptions

                    * * All of the install methods provided by {@code LookAndFeel} need to diff --git a/jdk/src/share/classes/javax/swing/Painter.java b/jdk/src/share/classes/javax/swing/Painter.java index 7b2e3ef11ef..57ac21fb1e4 100644 --- a/jdk/src/share/classes/javax/swing/Painter.java +++ b/jdk/src/share/classes/javax/swing/Painter.java @@ -54,7 +54,7 @@ import java.awt.Graphics2D; * } * } * } - *

                    + *
                    * *

                    This interface makes no guarantees of threadsafety.

                    * diff --git a/jdk/src/share/classes/javax/swing/RowFilter.java b/jdk/src/share/classes/javax/swing/RowFilter.java index 6d9fc7f33f8..ccf779cf137 100644 --- a/jdk/src/share/classes/javax/swing/RowFilter.java +++ b/jdk/src/share/classes/javax/swing/RowFilter.java @@ -31,6 +31,7 @@ import java.util.Date; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; /** * RowFilter is used to filter out entries from the @@ -129,7 +130,7 @@ public abstract class RowFilter { /** * 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--) { diff --git a/jdk/src/share/classes/javax/swing/SizeSequence.java b/jdk/src/share/classes/javax/swing/SizeSequence.java index a04fe2cb867..4d8d65e13a8 100644 --- a/jdk/src/share/classes/javax/swing/SizeSequence.java +++ b/jdk/src/share/classes/javax/swing/SizeSequence.java @@ -52,7 +52,7 @@ package javax.swing; *

                    * The following figure shows the relationship between size and position data * for a multi-column component. - *

                    + * *

                    * The first item begins at position 0, the second at the position equal
@@ -76,7 +76,6 @@ package javax.swing;
  * However, any other unit of measure (for example, time in days)
  * could be just as valid.
  *
- * <p>
  *
  * <h3>Implementation Notes</h3>
  *
diff --git a/jdk/src/share/classes/javax/swing/Spring.java b/jdk/src/share/classes/javax/swing/Spring.java
index 2b18313e7c6..40320734219 100644
--- a/jdk/src/share/classes/javax/swing/Spring.java
+++ b/jdk/src/share/classes/javax/swing/Spring.java
@@ -65,7 +65,7 @@ import java.awt.Component;
  *  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 @@ import java.awt.Component;
  *  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 @@ import java.awt.Component;
  *  <p>
  *  With both intervals and <code>Spring</code>s we can define min * in terms of negation: - *

                    + * *

                      *      X - Y = X + (-Y)
                      *
                    diff --git a/jdk/src/share/classes/javax/swing/SpringLayout.java b/jdk/src/share/classes/javax/swing/SpringLayout.java
                    index dc85b2c1dcd..95444bfed59 100644
                    --- a/jdk/src/share/classes/javax/swing/SpringLayout.java
                    +++ b/jdk/src/share/classes/javax/swing/SpringLayout.java
                    @@ -297,7 +297,7 @@ public class SpringLayout implements LayoutManager2 {
                          * and "a - b" is equal to
                          * Spring.sum(a, Spring.minus(b)).
                          * See the
                    -     * {@link Spring Spring API documentation}
                    +     * {@link Spring Spring API documentation}
                          * for further details
                          * of spring arithmetic.
                          *
                    diff --git a/jdk/src/share/classes/javax/swing/SwingWorker.java b/jdk/src/share/classes/javax/swing/SwingWorker.java
                    index 5775bcb4ea9..746b78aa7d2 100644
                    --- a/jdk/src/share/classes/javax/swing/SwingWorker.java
                    +++ b/jdk/src/share/classes/javax/swing/SwingWorker.java
                    @@ -62,7 +62,6 @@ import sun.swing.AccumulativeRunnable;
                      *   
                      * 
                      *
                    - * 

                    * *

                    * These constraints mean that a GUI application with time intensive diff --git a/jdk/src/share/classes/javax/swing/border/CompoundBorder.java b/jdk/src/share/classes/javax/swing/border/CompoundBorder.java index f1a6d8538e6..6a28c1a3893 100644 --- a/jdk/src/share/classes/javax/swing/border/CompoundBorder.java +++ b/jdk/src/share/classes/javax/swing/border/CompoundBorder.java @@ -36,7 +36,7 @@ import java.beans.ConstructorProperties; * * For example, this class may be used to add blank margin space * to a component with an existing decorative border: - *

                    + * *

                      *    Border border = comp.getBorder();
                      *    Border margin = new EmptyBorder(10,10,10,10);
                    diff --git a/jdk/src/share/classes/javax/swing/event/TableModelEvent.java b/jdk/src/share/classes/javax/swing/event/TableModelEvent.java
                    index 05c5c7bdc76..ab450cbd72d 100644
                    --- a/jdk/src/share/classes/javax/swing/event/TableModelEvent.java
                    +++ b/jdk/src/share/classes/javax/swing/event/TableModelEvent.java
                    @@ -34,7 +34,7 @@ import javax.swing.table.*;
                      * 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: 

                    + * can be used to specify the following types of changes: * *

                      * TableModelEvent(source);              //  The data, ie. all rows changed
                    diff --git a/jdk/src/share/classes/javax/swing/event/TreeModelListener.java b/jdk/src/share/classes/javax/swing/event/TreeModelListener.java
                    index b48fdfb2548..48a945f116f 100644
                    --- a/jdk/src/share/classes/javax/swing/event/TreeModelListener.java
                    +++ b/jdk/src/share/classes/javax/swing/event/TreeModelListener.java
                    @@ -86,7 +86,7 @@ public interface TreeModelListener extends EventListener {
                          * 

                    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.

                    + * the first element should become the new root of the tree. * *

                    Use e.getPath() * to get the path to the node. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java index 28b1d0a09bb..b55f8ab0fbc 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java @@ -48,7 +48,7 @@ import sun.security.action.GetPropertyAction; * Provides the basic look and feel for a JOptionPane. * BasicMessagePaneUI provides a means to place an icon, * message and buttons into a Container. - * Generally, the layout will look like:

                    + * Generally, the layout will look like: *

                      *        ------------------
                      *        | i | message    |
                    diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java
                    index 9a56bd7b3b8..9704705b2f5 100644
                    --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java
                    +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java
                    @@ -521,7 +521,7 @@ public class BasicSplitPaneDivider extends Container
                          * MouseHandler is responsible for converting mouse events
                          * (released, dragged...) into the appropriate DragController
                          * methods.
                    -     * 

                    + * */ protected class MouseHandler extends MouseAdapter implements MouseMotionListener @@ -890,7 +890,7 @@ public class BasicSplitPaneDivider extends Container * Used to layout a BasicSplitPaneDivider. * Layout for the divider * involves appropriately moving the left/right buttons around. - *

                    + * */ protected class DividerLayout implements LayoutManager { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java index 0f47e8965c5..1ec9921426f 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java @@ -2015,7 +2015,7 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * LayoutManager used for JSplitPanes with an orientation of * VERTICAL_SPLIT. - *

                    + * */ public class BasicVerticalLayoutManager extends BasicHorizontalLayoutManager diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java index 821483049f0..cd41f852715 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java @@ -1398,7 +1398,7 @@ public class BasicTreeUI extends TreeUI /** * Paints the vertical part of the leg. The receiver should - * NOT modify clipBounds, insets.

                    + * NOT modify clipBounds, insets. */ protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path) { diff --git a/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java b/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java index 5abf1e82aa1..6bf39981d3d 100644 --- a/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java +++ b/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java @@ -182,7 +182,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * each a single row of values. In other words, to get to the cell * at row 1, column 5:

                    * - * ((Vector)getDataVector().elementAt(1)).elementAt(5);

                    + * ((Vector)getDataVector().elementAt(1)).elementAt(5); * * @return the vector of vectors containing the tables data values * @@ -306,7 +306,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * 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 rowCount and greater are discarded.

                    + * rows at index rowCount and greater are discarded. * * @param rowCount the new number of rows * @see #setRowCount @@ -330,7 +330,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * 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 rowCount and greater are discarded.

                    + * rows at index rowCount and greater are discarded. * * @see #setColumnCount * @since 1.3 @@ -414,7 +414,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * After the move, the row that was at index start * will be at index to. * This method will send a tableChanged notification - * message to all the listeners.

                    + message to all the listeners. * *

                          *  Examples of moves:
                    @@ -473,7 +473,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl
                          * of columns, new columns are added to the end of each row in the model.
                          * If the number of newIdentifiers is less than the current
                          * number of columns, all the extra columns at the end of a row are
                    -     * discarded. 

                    + * discarded. * * @param columnIdentifiers vector of column identifiers. If * null, set the model @@ -490,7 +490,7 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl * of columns, new columns are added to the end of each row in the model. * If the number of newIdentifiers is less than the current * number of columns, all the extra columns at the end of a row are - * discarded.

                    + * discarded. * * @param newIdentifiers array of column identifiers. * If null, set diff --git a/jdk/src/share/classes/javax/swing/table/TableModel.java b/jdk/src/share/classes/javax/swing/table/TableModel.java index 2c4794bc980..5b13fc1aede 100644 --- a/jdk/src/share/classes/javax/swing/table/TableModel.java +++ b/jdk/src/share/classes/javax/swing/table/TableModel.java @@ -34,7 +34,7 @@ import javax.swing.event.*; * * The JTable can be set up to display any data * model which implements the - * TableModel interface with a couple of lines of code:

                    + * TableModel interface with a couple of lines of code: *

                      *      TableModel myData = new MyTableModel();
                      *      JTable table = new JTable(myData);
                    @@ -42,7 +42,7 @@ import javax.swing.event.*;
                      *
                      * For further documentation, see Creating a Table Model
                      * in The Java Tutorial.
                    - * 

                    + * * @author Philip Milne * @see JTable */ diff --git a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java index 71e9d5d8c60..f8a4332a839 100644 --- a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java +++ b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java @@ -804,7 +804,7 @@ public abstract class AbstractDocument implements Document, Serializable { * 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: - *

                    + * *

                          *   int nleft = doc.getDocumentLength();
                          *   Segment text = new Segment();
                    diff --git a/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java b/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java
                    index f47a1c62c62..139615bdf0e 100644
                    --- a/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java
                    +++ b/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java
                    @@ -41,7 +41,7 @@ import javax.swing.UIManager;
                      * 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.
                    - * 

                    + * *

                    *
                    Newlines *
                    diff --git a/jdk/src/share/classes/javax/swing/text/Document.java b/jdk/src/share/classes/javax/swing/text/Document.java index 5b79ac41a28..946e18ae222 100644 --- a/jdk/src/share/classes/javax/swing/text/Document.java +++ b/jdk/src/share/classes/javax/swing/text/Document.java @@ -354,7 +354,7 @@ public interface Document { * 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: - *

                    + * *

                    
                          *
                          *   int nleft = doc.getDocumentLength();
                    diff --git a/jdk/src/share/classes/javax/swing/text/JTextComponent.java b/jdk/src/share/classes/javax/swing/text/JTextComponent.java
                    index 2ec12639cfb..5f4fd2021be 100644
                    --- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java
                    +++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java
                    @@ -87,7 +87,6 @@ import sun.swing.SwingAccessor;
                      * General Rules for Using Text Components,
                      * a section in The Java Tutorial.
                      *
                    - * 

                    *

                    *
                    Caret Changes *
                    @@ -108,7 +107,6 @@ import sun.swing.SwingAccessor; * Note: Non-editable text components also have a caret though * it may not be painted. * - *

                    *

                    Commands *
                    * Text components provide a number of commands that can be used @@ -120,7 +118,6 @@ import sun.swing.SwingAccessor; * found with the {@link #getActions} method. These actions * can be bound to key events, fired from buttons, etc. * - *

                    *

                    Text Input *
                    * The text components support flexible and internationalized text input, using @@ -206,7 +203,6 @@ import sun.swing.SwingAccessor; *
                  • caret movement forward and backward * * - *

                    *

                    Model/View Split *
                    * The text components have a model-view split. A text component pulls @@ -231,14 +227,12 @@ import sun.swing.SwingAccessor; * {@link DocumentListener} * interface and registered interest with the model being observed. * - *

                    *

                    Location Information *
                    * 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. * - *

                    *

                    Undo/Redo support *
                    * Support for an edit history mechanism is provided to allow @@ -249,7 +243,6 @@ import sun.swing.SwingAccessor; * The support is provided by the Document model, which allows * one to attach UndoableEditListener implementations. * - *

                    *

                    Thread Safety *
                    * The swing text components provide some support of thread @@ -261,13 +254,12 @@ import sun.swing.SwingAccessor; * The methods that are safe to call asynchronously are marked * with comments. * - *

                    *

                    Newlines *
                    * For a discussion on how newlines are handled, see * DefaultEditorKit. * - *

                    + * *

                    Printing support *
                    * Several {@link #print print} methods are provided for basic diff --git a/jdk/src/share/classes/javax/swing/text/View.java b/jdk/src/share/classes/javax/swing/text/View.java index 675aad55530..2b49055ab59 100644 --- a/jdk/src/share/classes/javax/swing/text/View.java +++ b/jdk/src/share/classes/javax/swing/text/View.java @@ -144,7 +144,6 @@ A view has the following responsibilities:
                    • {@link #paint(java.awt.Graphics, java.awt.Shape) paint}
                    -

                    Translate between the model and view coordinate systems.
                    diff --git a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java index 8b84bf73ba5..852776e61c7 100644 --- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java +++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java @@ -2089,7 +2089,7 @@ public class HTMLDocument extends DefaultStyledDocument { * *

                    * The assignment of the actions described is shown in the - * following table for the tags defined in HTML.Tag.

                    + * following table for the tags defined in HTML.Tag. * * *
                    TagAction
                    HTML.Tag.A CharacterAction @@ -3968,7 +3968,7 @@ public class HTMLDocument extends DefaultStyledDocument { } /** - * This is set to true when and end is invoked for . + * This is set to true when and end is invoked for {@literal }. */ private boolean receivedEndHTML; /** Number of times flushBuffer has been invoked. */ @@ -3990,7 +3990,7 @@ public class HTMLDocument extends DefaultStyledDocument { 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. */ diff --git a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java index 9cca8f95313..468f8626d2f 100644 --- a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java +++ b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java @@ -71,7 +71,7 @@ import java.lang.ref.*; * The modeling of HTML is provided by the class HTMLDocument. * Its documentation describes the details of how the HTML is modeled. * The editing support leverages heavily off of the text package. - *

                    + * *

                    * Extendable/Scalable *
                    @@ -114,7 +114,7 @@ import java.lang.ref.*; * attributes for display. This helps make the View implementations * more general purpose * - *

                    + * *

                    * Asynchronous Loading *
                    @@ -127,7 +127,7 @@ import java.lang.ref.*; * by the HTMLDocument.HTMLReader class. The actual * work is done by the DefaultStyledDocument and * AbstractDocument classes in the text package. - *

                    + * *

                    * Customization from current LAF *
                    @@ -141,7 +141,7 @@ import java.lang.ref.*; * The support for this is provided by the StyleSheet * class. The presentation of the HTML can be heavily influenced * by the setting of the StyleSheet property on the EditorKit. - *

                    + * *

                    * Not lossy *
                    @@ -839,7 +839,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { * if the given position represents a link. If this was the result * of a mouse click, x and * y 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 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { * 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 diff --git a/jdk/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java b/jdk/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java index c31a96e2f79..0cd55cb843d 100644 --- a/jdk/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java +++ b/jdk/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java @@ -469,7 +469,7 @@ public class FixedHeightLayoutCache extends AbstractLayoutCache { *

                    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.

                    + * the first element should become the new root of the tree. * *

                    e.path() holds the path to the node.

                    *

                    e.childIndices() returns null.

                    @@ -677,7 +677,7 @@ public class FixedHeightLayoutCache extends AbstractLayoutCache { /** * 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 @@ public class FixedHeightLayoutCache extends AbstractLayoutCache { /** * 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, diff --git a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java index e12abb17a70..5b332243dfb 100644 --- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java +++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java @@ -2594,7 +2594,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { requests = new MessageHeader(); setRequests = false; - setRequestMethod("GET"); + super.setRequestMethod("GET"); // avoid the connecting check poster = null; if (!checkReuseConnection()) connect(); diff --git a/jdk/src/share/classes/sun/tools/jar/resources/jar_de.properties b/jdk/src/share/classes/sun/tools/jar/resources/jar_de.properties index 4dd5d5f9129..23f986c9797 100644 --- a/jdk/src/share/classes/sun/tools/jar/resources/jar_de.properties +++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_de.properties @@ -33,6 +33,7 @@ error.nosuch.fileordir={0}: Datei oder Verzeichnis nicht vorhanden 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.extracted=extrahiert: {0} 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 diff --git a/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties b/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties index 39e71f8825b..7a8645067ca 100644 --- a/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties +++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties @@ -33,6 +33,7 @@ error.nosuch.fileordir={0} : no existe tal archivo o directorio 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.extracted=extra\u00EDdo: {0} 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 diff --git a/jdk/src/share/classes/sun/tools/jar/resources/jar_fr.properties b/jdk/src/share/classes/sun/tools/jar/resources/jar_fr.properties index c7cae813be4..8f41319f0f6 100644 --- a/jdk/src/share/classes/sun/tools/jar/resources/jar_fr.properties +++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_fr.properties @@ -33,6 +33,7 @@ error.nosuch.fileordir={0} : fichier ou r\u00E9pertoire introuvable 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.extracted=extrait : {0} 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 diff --git a/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties b/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties index 54099b7fd6a..74bc9b7f836 100644 --- a/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties +++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties @@ -33,6 +33,7 @@ error.nosuch.fileordir={0} : file o directory inesistente 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.extracted=estratto: {0} 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 diff --git a/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties b/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties index 0a1457eb1b3..1705543b3be 100644 --- a/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties +++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties @@ -33,6 +33,7 @@ error.nosuch.fileordir={0}\u3068\u3044\u3046\u30D5\u30A1\u30A4\u30EB\u307E\u305F 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.extracted={0}\u304C\u62BD\u51FA\u3055\u308C\u307E\u3057\u305F 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 diff --git a/jdk/src/share/classes/sun/tools/jar/resources/jar_ko.properties b/jdk/src/share/classes/sun/tools/jar/resources/jar_ko.properties index 2b414a0369d..079dee84ab2 100644 --- a/jdk/src/share/classes/sun/tools/jar/resources/jar_ko.properties +++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_ko.properties @@ -33,6 +33,7 @@ error.nosuch.fileordir={0}: \uD574\uB2F9 \uD30C\uC77C \uB610\uB294 \uB514\uB809\ 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.extracted=\uCD94\uCD9C\uB428: {0} 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/ . diff --git a/jdk/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties b/jdk/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties index db6bd74b1e3..c2d31475e7b 100644 --- a/jdk/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties +++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties @@ -33,6 +33,7 @@ error.nosuch.fileordir={0} : n\u00E3o h\u00E1 tal arquivo ou diret\u00F3rio 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.extracted=extra\u00EDdo: {0} 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 diff --git a/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties b/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties index 90ca52ac999..b88532fa330 100644 --- a/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties +++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties @@ -33,6 +33,7 @@ error.nosuch.fileordir={0} : det finns ingen s\u00E5dan fil eller katalog 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.extracted=extraherat: {0} 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 diff --git a/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties b/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties index 146e06c3cdf..08607cce375 100644 --- a/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties +++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties @@ -33,6 +33,7 @@ error.nosuch.fileordir={0}: \u6CA1\u6709\u8FD9\u4E2A\u6587\u4EF6\u6216\u76EE\u5F 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.extracted=\u5DF2\u63D0\u53D6: {0} 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 diff --git a/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_TW.properties b/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_TW.properties index 7dd4f65390b..76ce56184cf 100644 --- a/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_TW.properties +++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_TW.properties @@ -33,6 +33,7 @@ error.nosuch.fileordir={0} : \u6C92\u6709\u9019\u985E\u6A94\u6848\u6216\u76EE\u9 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.extracted=\u64F7\u53D6: {0} 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 diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index ec7f3d6ffb9..7c83f52f75c 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -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 @@ java/nio/file/WatchService/LotsOfEvents.java solaris-all # 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 @@ sun/security/krb5/auto/BadKdc4.java solaris-sparcv9 # jdk_tools -# 6461635 -com/sun/tools/attach/BasicTests.sh generic-all - # 7132203 sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all @@ -299,9 +290,6 @@ com/sun/jdi/RedefineCrossEvent.java generic-all # jdk_util -# Filed 6933803 -java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java generic-all - # Filed 6772009 java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all diff --git a/jdk/test/com/sun/jmx/snmp/NoInfoLeakTest.java b/jdk/test/com/sun/jmx/snmp/NoInfoLeakTest.java deleted file mode 100644 index dcf54416a08..00000000000 --- a/jdk/test/com/sun/jmx/snmp/NoInfoLeakTest.java +++ /dev/null @@ -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."); - } - } -} diff --git a/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java b/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java index fe06d0a7fcf..a60ae8a4d3b 100644 --- a/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java +++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java @@ -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; diff --git a/jdk/test/com/sun/tools/attach/AgentSetup.sh b/jdk/test/com/sun/tools/attach/AgentSetup.sh deleted file mode 100644 index dee69a3133e..00000000000 --- a/jdk/test/com/sun/tools/attach/AgentSetup.sh +++ /dev/null @@ -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" - diff --git a/jdk/test/com/sun/tools/attach/Application.java b/jdk/test/com/sun/tools/attach/Application.java index 5db6c8a6260..d29b1381dfb 100644 --- a/jdk/test/com/sun/tools/attach/Application.java +++ b/jdk/test/com/sun/tools/attach/Application.java @@ -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(); diff --git a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh b/jdk/test/com/sun/tools/attach/ApplicationSetup.sh deleted file mode 100644 index e8296df6300..00000000000 --- a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh +++ /dev/null @@ -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 -} - diff --git a/jdk/test/com/sun/tools/attach/BasicTests.java b/jdk/test/com/sun/tools/attach/BasicTests.java index 79056e614b3..51f202becdb 100644 --- a/jdk/test/com/sun/tools/attach/BasicTests.java +++ b/jdk/test/com/sun/tools/attach/BasicTests.java @@ -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); - - // 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 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"); - - // Test 2 - attempt to load an agent that does not exist - System.out.println(" - Test: Load an agent that does not exist"); + /* + * 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 { - vm.loadAgent("SilverBullet.jar"); - } catch (AgentLoadException x) { - System.out.println(" - AgentLoadException thrown as expected!"); + 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 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!"); + /** + * 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; + + // 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); + } + + /** + * 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 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"); - } + /** + * 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); - // 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. + // 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); + } - System.out.println(" - Re-attaching to application ..."); - vm = VirtualMachine.attach(pid); + /** + * 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]; - System.out.println(" - Test: End-to-end connection with agent"); + System.out.println(" - Attaching to application ..."); + VirtualMachine vm = VirtualMachine.attach(pid); - ServerSocket ss = new ServerSocket(0); - int port = ss.getLocalPort(); + // 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"); - System.out.println(" - Loading Agent.jar into target VM ..."); - vm.loadAgent(agent, Integer.toString(port)); + // 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(" - Waiting for agent to connect back to tool ..."); - Socket s = ss.accept(); - System.out.println(" - Connected to 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!"); + } - // Test 5b - functional "end-to-end" test. - // Now with an agent that does redefine. + // 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(" - Re-attaching to application ..."); - vm = VirtualMachine.attach(pid); + // 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(" - Test: End-to-end connection with RedefineAgent"); + // 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. - ServerSocket ss2 = new ServerSocket(0); - int port2 = ss2.getLocalPort(); + System.out.println(" - Re-attaching to application ..."); + vm = VirtualMachine.attach(pid); - System.out.println(" - Loading RedefineAgent.jar into target VM ..."); - vm.loadAgent(redefineagent, Integer.toString(port2)); + System.out.println(" - Test: End-to-end connection with agent"); - System.out.println(" - Waiting for RedefineAgent to connect back to tool ..."); - Socket s2 = ss2.accept(); - System.out.println(" - Connected to RedefineAgent."); + ServerSocket ss = new ServerSocket(0); + int port = ss.getLocalPort(); - // Test 6 - list method should list the target VM - System.out.println(" - Test: VirtualMachine.list"); - List l = VirtualMachine.list(); - if (!l.isEmpty()) { - boolean found = false; - for (VirtualMachineDescriptor vmd: l) { - if (vmd.id().equals(pid)) { - found = true; - break; + 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."); + + // 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(" - 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)); + + 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 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"); + + 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(); } - - // 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"); - } - System.out.println(" - hashCode/equals okay"); - - - // --- - System.out.println(" - Cleaning up..."); - s.close(); - ss.close(); - s2.close(); - ss2.close(); } } diff --git a/jdk/test/com/sun/tools/attach/BasicTests.sh b/jdk/test/com/sun/tools/attach/BasicTests.sh deleted file mode 100644 index fc5a7fb245f..00000000000 --- a/jdk/test/com/sun/tools/attach/BasicTests.sh +++ /dev/null @@ -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 diff --git a/jdk/test/com/sun/tools/attach/CommonSetup.sh b/jdk/test/com/sun/tools/attach/CommonSetup.sh deleted file mode 100644 index 13554918178..00000000000 --- a/jdk/test/com/sun/tools/attach/CommonSetup.sh +++ /dev/null @@ -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" - diff --git a/jdk/test/com/sun/tools/attach/PermissionTest.java b/jdk/test/com/sun/tools/attach/PermissionTest.java index 5be6c05099a..933ec2c23e8 100644 --- a/jdk/test/com/sun/tools/attach/PermissionTest.java +++ b/jdk/test/com/sun/tools/attach/PermissionTest.java @@ -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; + } } } } diff --git a/jdk/test/com/sun/tools/attach/PermissionTests.sh b/jdk/test/com/sun/tools/attach/PermissionTests.sh deleted file mode 100644 index d1cfb3cccaa..00000000000 --- a/jdk/test/com/sun/tools/attach/PermissionTests.sh +++ /dev/null @@ -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 diff --git a/jdk/test/com/sun/tools/attach/ProviderTest.java b/jdk/test/com/sun/tools/attach/ProviderTest.java index 5391209e041..58ea6d5e75a 100644 --- a/jdk/test/com/sun/tools/attach/ProviderTest.java +++ b/jdk/test/com/sun/tools/attach/ProviderTest.java @@ -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; + } + } + + /** + * 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(); } - VirtualMachine.attach("simple:1234").detach(); } } diff --git a/jdk/test/com/sun/tools/attach/ProviderTests.sh b/jdk/test/com/sun/tools/attach/ProviderTests.sh deleted file mode 100644 index f5d6411931f..00000000000 --- a/jdk/test/com/sun/tools/attach/ProviderTests.sh +++ /dev/null @@ -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 - diff --git a/jdk/test/com/sun/tools/attach/RedefineAgent.java b/jdk/test/com/sun/tools/attach/RedefineAgent.java index fc514b7d613..1650b354be6 100644 --- a/jdk/test/com/sun/tools/attach/RedefineAgent.java +++ b/jdk/test/com/sun/tools/attach/RedefineAgent.java @@ -43,15 +43,15 @@ import java.lang.instrument.ClassDefinition; 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) { diff --git a/jdk/test/com/sun/tools/attach/RedefineDummy.java b/jdk/test/com/sun/tools/attach/RedefineDummy.java new file mode 100644 index 00000000000..44204a525ff --- /dev/null +++ b/jdk/test/com/sun/tools/attach/RedefineDummy.java @@ -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"; + } +} diff --git a/jdk/test/com/sun/tools/attach/RunnerUtil.java b/jdk/test/com/sun/tools/attach/RunnerUtil.java new file mode 100644 index 00000000000..0adbbbf3586 --- /dev/null +++ b/jdk/test/com/sun/tools/attach/RunnerUtil.java @@ -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; + } + +} diff --git a/jdk/test/java/io/BufferedReader/Lines.java b/jdk/test/java/io/BufferedReader/Lines.java index 2e83e1afc70..2e35f75887d 100644 --- a/jdk/test/java/io/BufferedReader/Lines.java +++ b/jdk/test/java/io/BufferedReader/Lines.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8003258 + * @bug 8003258 8029434 * @run testng Lines */ @@ -38,6 +38,7 @@ import java.util.Map; 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 @@ public class Lines { // Read after EOL assertFalse(it.hasNext()); } + + public void testCharacteristics() { + try (BufferedReader br = new BufferedReader( + new StringReader(""))) { + Spliterator instance = br.lines().spliterator(); + assertTrue(instance.hasCharacteristics(Spliterator.NONNULL)); + assertTrue(instance.hasCharacteristics(Spliterator.ORDERED)); + } catch (IOException ioe) { + fail("Should not have any exception."); + } + } } diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java index 4434e9b1ae5..ff4c3744321 100644 --- a/jdk/test/java/lang/ProcessBuilder/Basic.java +++ b/jdk/test/java/lang/ProcessBuilder/Basic.java @@ -2239,24 +2239,33 @@ public class Basic { 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); } diff --git a/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java b/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java index 73488d9f955..0c4a4804153 100644 --- a/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java +++ b/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java @@ -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.*; diff --git a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java index 62dc211d913..42ae7d05ab1 100644 --- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java +++ b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java @@ -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 pools = ManagementFactory.getMemoryPoolMXBeans(); - private static List managers = ManagementFactory.getMemoryManagerMXBeans(); - private static Map result = new HashMap<>(); + private static final MemoryMXBean mm = getMemoryMXBean(); + private static final Map 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 @@ public class CollectionUsageThreshold { 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 @@ public class CollectionUsageThreshold { 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 pools = getMemoryPoolMXBeans(); + List managers = getMemoryManagerMXBeans(); + if (trace) { MemoryUtil.printMemoryPools(pools); MemoryUtil.printMemoryManagers(managers); @@ -127,7 +125,6 @@ public class CollectionUsageThreshold { // 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 @@ public class CollectionUsageThreshold { // 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 @@ public class CollectionUsageThreshold { pr.getPool().setCollectionUsageThreshold(0); } } - - if (testFailed) - throw new RuntimeException("TEST FAILED."); - System.out.println("Test passed."); - } @@ -205,20 +197,16 @@ public class CollectionUsageThreshold { } 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); } } diff --git a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdConcMarkSweepGC.sh b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdConcMarkSweepGC.sh deleted file mode 100644 index afdaaa4444d..00000000000 --- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdConcMarkSweepGC.sh +++ /dev/null @@ -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 diff --git a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdParallelGC.sh b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdParallelGC.sh deleted file mode 100644 index b0749b1592f..00000000000 --- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdParallelGC.sh +++ /dev/null @@ -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 diff --git a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdSerialGC.sh b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdSerialGC.sh deleted file mode 100644 index 2baa9b960e8..00000000000 --- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThresholdSerialGC.sh +++ /dev/null @@ -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 diff --git a/jdk/test/java/math/BigInteger/BigIntegerTest.java b/jdk/test/java/math/BigInteger/BigIntegerTest.java index 279f5546b58..8d7ad255dd0 100644 --- a/jdk/test/java/math/BigInteger/BigIntegerTest.java +++ b/jdk/test/java/math/BigInteger/BigIntegerTest.java @@ -56,32 +56,32 @@ public class BigIntegerTest { // 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 diff --git a/jdk/test/java/net/DatagramSocket/PortUnreachable.java b/jdk/test/java/net/DatagramSocket/PortUnreachable.java index c6dcf40e1e0..91e68472af8 100644 --- a/jdk/test/java/net/DatagramSocket/PortUnreachable.java +++ b/jdk/test/java/net/DatagramSocket/PortUnreachable.java @@ -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 @@ public class PortUnreachable implements Runnable { 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 @@ public class PortUnreachable implements Runnable { 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 @@ public class PortUnreachable implements Runnable { 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(); } } diff --git a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/Main.java b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/Main.java index d43b7a2cc4f..efc4d5eac71 100644 --- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/Main.java +++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/Main.java @@ -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.HtmlReporter; 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 @@ public class Main { /** * 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 @@ public class Main { 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 @@ public class Main { 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 @@ public class Main { /** * Returns reference to benchmark server. + * + * @return a benchmark server */ public static BenchServer getBenchServer() { return server; @@ -126,44 +179,29 @@ public class Main { p.println(" -l list configuration file"); p.println(" -t repeat benchmarks for specified number of hours"); p.println(" -o specify output file"); - p.println(" -c specify (non-default) " + - "configuration file"); - p.println(" -html format output as html " + - "(default is text)"); + p.println(" -c 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 run benchmark client using server " + - "on specified host/port"); - p.println(" -server run benchmark server on given port"); + p.println(" -server run benchmark server "); + p.println(" -client 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 @@ public class Main { 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(); - } } - } else { - runBenchmarks(); - exit(); - } + break; + case SERVER: + //Setup for client mode, server will fork client process + //after its initiation. + List 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)); + } + 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 @@ public class Main { */ 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 @@ public class Main { * 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 @@ public class Main { 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 @@ public class Main { 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 @@ public class Main { 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 @@ public class Main { /** * 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 @@ public class Main { * 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); } /** diff --git a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java index a031b08b6ac..3e83a5babd8 100644 --- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java +++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java @@ -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.HtmlReporter; 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 @@ import java.util.TimerTask; */ 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 @@ public class Main { } /** - * 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 @@ public class Main { 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 @@ public class Main { */ 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 @@ public class Main { 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 @@ public class Main { timer = new Timer(true); timer.schedule( new TimerTask() { + @Override public void run() { exitRequested = true; } diff --git a/jdk/test/java/rmi/reliability/benchmark/runRmiBench.sh b/jdk/test/java/rmi/reliability/benchmark/runRmiBench.sh deleted file mode 100644 index 98a31d1ddd1..00000000000 --- a/jdk/test/java/rmi/reliability/benchmark/runRmiBench.sh +++ /dev/null @@ -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 - diff --git a/jdk/test/java/rmi/reliability/benchmark/runSerialBench.sh b/jdk/test/java/rmi/reliability/benchmark/runSerialBench.sh deleted file mode 100644 index 82a2837bcff..00000000000 --- a/jdk/test/java/rmi/reliability/benchmark/runSerialBench.sh +++ /dev/null @@ -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 & - diff --git a/jdk/test/java/util/Base64/Base64GetEncoderTest.java b/jdk/test/java/util/Base64/Base64GetEncoderTest.java index c5658d2039e..563cb797021 100644 --- a/jdk/test/java/util/Base64/Base64GetEncoderTest.java +++ b/jdk/test/java/util/Base64/Base64GetEncoderTest.java @@ -51,30 +51,6 @@ public class Base64GetEncoderTest { 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) diff --git a/jdk/test/java/util/Base64/TestBase64.java b/jdk/test/java/util/Base64/TestBase64.java index 9f7babeeeac..afa41b3d26f 100644 --- a/jdk/test/java/util/Base64/TestBase64.java +++ b/jdk/test/java/util/Base64/TestBase64.java @@ -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 @@ public class TestBase64 { // 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 class TestBase64 { 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 @@ public class TestBase64 { 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 @@ public class TestBase64 { 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 @@ public class TestBase64 { 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 @@ public class TestBase64 { 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); }}); - // 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!"); + // decode(String) + checkIAE(new Runnable() { public void run() { dec.decode(srcStr); }}); + + // decode(ByteBuffer) + checkIAE(new Runnable() { public void run() { dec.decode(srcBB); }}); + + // 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 @@ public class TestBase64 { } } - 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 @@ public class TestBase64 { 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) { diff --git a/jdk/test/java/util/Base64/TestBase64Golden.java b/jdk/test/java/util/Base64/TestBase64Golden.java index 192f2ed2391..bcee18c0829 100644 --- a/jdk/test/java/util/Base64/TestBase64Golden.java +++ b/jdk/test/java/util/Base64/TestBase64Golden.java @@ -55,7 +55,6 @@ public class TestBase64Golden { 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 @@ public class TestBase64Golden { 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 @@ public class TestBase64Golden { 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 @@ public class TestBase64Golden { } 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, diff --git a/jdk/test/java/util/concurrent/CompletableFuture/ThenComposeAsyncTest.java b/jdk/test/java/util/concurrent/CompletableFuture/ThenComposeAsyncTest.java new file mode 100644 index 00000000000..2ee785bc958 --- /dev/null +++ b/jdk/test/java/util/concurrent/CompletableFuture/ThenComposeAsyncTest.java @@ -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 cf1 = CompletableFuture.completedFuture("one"); + + // Composing function returns a CompletableFuture executed asynchronously + CountDownLatch cdl = new CountDownLatch(1); + CompletableFuture 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"); + } +} diff --git a/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java b/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java new file mode 100644 index 00000000000..b0a1ecc8be8 --- /dev/null +++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java @@ -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 hm = new HashMap<>(); + hm.put(o, o); + m.putAll(hm); + }); + } + + private static void test(String desc, BiConsumer, 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, Object> associator) { + ConcurrentHashMap m = new ConcurrentHashMap<>(); + CountDownLatch s = new CountDownLatch(1); + + Supplier 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 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; + } + } + } +} diff --git a/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentContainsKeyTest.java b/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentContainsKeyTest.java new file mode 100644 index 00000000000..84929de0b55 --- /dev/null +++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/ConcurrentContainsKeyTest.java @@ -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 { + + 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 m = new ConcurrentHashMap<>(64); + Stream.of(content).forEach(x -> m.put(x, x)); + test(content, m); + } + + + private static void test(X[] content, ConcurrentHashMap 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 m) { + CountDownLatch s = new CountDownLatch(1); + + Supplier 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 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; + } + } + } +} diff --git a/jdk/test/java/util/logging/TestLogConfigurationDeadLock.java b/jdk/test/java/util/logging/TestLogConfigurationDeadLock.java new file mode 100644 index 00000000000..3d1e3d2da52 --- /dev/null +++ b/jdk/test/java/util/logging/TestLogConfigurationDeadLock.java @@ -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 threads = new ArrayList<>(); + for (int i = 0; i 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; + } +} diff --git a/jdk/test/java/util/logging/TestLoggerBundleSync.java b/jdk/test/java/util/logging/TestLoggerBundleSync.java new file mode 100644 index 00000000000..bbac23c665f --- /dev/null +++ b/jdk/test/java/util/logging/TestLoggerBundleSync.java @@ -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> 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 threads = new ArrayList<>(); + for (Class 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 type; + final static ExecutorService executor = Executors.newSingleThreadExecutor(); + final static class CheckRBTask implements Callable { + 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 futureTask = new FutureTask<>(this); + executor.submit(futureTask); + Exception x = futureTask.get(); + if ( x != null) { + throw new RuntimeException("Check failed: "+x,x); + } + } + } + SetRB(Class 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 type; + final static ExecutorService executor = Executors.newSingleThreadExecutor(); + final static class CheckRBNameTask implements Callable { + 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 futureTask = new FutureTask<>(this); + executor.submit(futureTask); + Exception x = futureTask.get(); + if ( x != null) { + throw new RuntimeException("Check failed: "+x,x); + } + } + + } + SetRBName(Class 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; + } +} diff --git a/jdk/test/java/util/stream/TestDoubleSumAverage.java b/jdk/test/java/util/stream/TestDoubleSumAverage.java new file mode 100644 index 00000000000..01453bd06d4 --- /dev/null +++ b/jdk/test/java/util/stream/TestDoubleSumAverage.java @@ -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 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 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; + } +} diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java index 32e324eff65..dc6b32cdbc7 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java @@ -34,34 +34,6 @@ import java.util.concurrent.CountDownLatch; */ public class ProcessThread extends TestThread { - /** - * Creates a new {@code ProcessThread} object. - * - * @param cmd The list of program and its arguments to pass to {@link ProcessBuilder} - */ - public ProcessThread(List cmd) { - super(new ProcessRunnable(cmd)); - } - - /** - * 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} - */ - public ProcessThread(String threadName, List cmd) { - super(new ProcessRunnable(cmd), threadName); - } - /** * Creates a new {@code ProcessThread} object. * @@ -69,7 +41,17 @@ public class ProcessThread extends TestThread { * @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); + super(new ProcessRunnable(new ProcessBuilder(cmd)), threadName); + } + + /** + * Creates a new {@code ProcessThread} object. + * + * @param threadName The name of thread. + * @param pb The ProcessBuilder to execute. + */ + public ProcessThread(String threadName, ProcessBuilder pb) { + super(new ProcessRunnable(pb), threadName); } /** @@ -81,6 +63,13 @@ public class ProcessThread extends TestThread { ((ProcessRunnable) getRunnable()).stopProcess(); } + /** + * @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}. */ @@ -89,26 +78,16 @@ public class ProcessThread extends TestThread { 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 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 @@ public class ProcessThread extends TestThread { 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 @@ public class ProcessThread extends TestThread { // 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; + } } } diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java index 9f96baaefbe..a454ce5c9b7 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java @@ -266,4 +266,79 @@ public final class ProcessTools { } } + /** + * 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(); + } } diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java index 387c0e3388c..d557a7ef439 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java @@ -33,6 +33,8 @@ import java.util.ArrayList; 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 @@ public final class Utils { 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; + } + } } diff --git a/jdk/test/sun/net/www/protocol/http/RedirectOnPost.java b/jdk/test/sun/net/www/protocol/http/RedirectOnPost.java new file mode 100644 index 00000000000..ebbbadb27e3 --- /dev/null +++ b/jdk/test/sun/net/www/protocol/http/RedirectOnPost.java @@ -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; + } +} diff --git a/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java b/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java index 347725a3d6d..cf43fbf8123 100644 --- a/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java +++ b/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java @@ -76,6 +76,7 @@ import java.rmi.registry.Registry; 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 @@ public class CheckLogging { 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)); } } diff --git a/jdk/test/sun/security/krb5/auto/KDC.java b/jdk/test/sun/security/krb5/auto/KDC.java index 0157a930909..6b82a6b4d57 100644 --- a/jdk/test/sun/security/krb5/auto/KDC.java +++ b/jdk/test/sun/security/krb5/auto/KDC.java @@ -605,7 +605,7 @@ public class KDC { * @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 @@ public class KDC { * @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 @@ public class KDC { * @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 outPAs = new ArrayList<>(); diff --git a/jdk/test/sun/security/krb5/auto/LoginNoPass.java b/jdk/test/sun/security/krb5/auto/LoginNoPass.java new file mode 100644 index 00000000000..73de94001ae --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/LoginNoPass.java @@ -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 + } + } +} diff --git a/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh b/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh index ab7045f12a9..037b5d792ce 100644 --- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh +++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh @@ -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 @@ if [ "${RECOMPILE}" = "yes" ] ; then ${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 diff --git a/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh b/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh index eb340c919d5..f889417d228 100644 --- a/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh +++ b/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh @@ -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 @@ ${CHMOD} +w ${TESTCLASSES}${FS}key3.db ${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 ..." diff --git a/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh b/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh index 302ce50b3ed..2d34ef440af 100644 --- a/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh +++ b/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh @@ -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 @@ if [ "${RECOMPILE}" = "yes" ] ; then ${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 diff --git a/jdk/test/sun/security/pkcs11/PKCS11Test.java b/jdk/test/sun/security/pkcs11/PKCS11Test.java index 1382524750b..3699f880456 100644 --- a/jdk/test/sun/security/pkcs11/PKCS11Test.java +++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java @@ -29,6 +29,8 @@ import java.util.*; 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 @@ public abstract class PKCS11Test { test.premain(p); } + // Generate a vector of supported elliptic curves of a given provider + static Vector getKnownCurves(Provider p) throws Exception { + int index; + int begin; + int end; + String curve; + KeyPair kp = null; + + Vector results = new Vector(); + // 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 supportedEC, + ECParameterSpec curve) { + boolean found = false; + for (ECParameterSpec ec: supportedEC) { + if (ec.equals(curve)) { + return true; + } + } + return false; + } private static final Map osMap; diff --git a/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh b/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh index b1cf0d9082c..30b245c81a0 100644 --- a/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh +++ b/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh @@ -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 @@ esac ${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 diff --git a/jdk/test/sun/security/pkcs11/Provider/Login.sh b/jdk/test/sun/security/pkcs11/Provider/Login.sh index cbbcb06d318..a1f6b132c9e 100644 --- a/jdk/test/sun/security/pkcs11/Provider/Login.sh +++ b/jdk/test/sun/security/pkcs11/Provider/Login.sh @@ -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 @@ ${CHMOD} +w ${TESTCLASSES}${FS}key3.db ${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 diff --git a/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java b/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java index a3ad441bf42..89b2b7a1c18 100644 --- a/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java +++ b/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java @@ -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 class TestDSAKeyLength extends PKCS11Test { } 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(); diff --git a/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java b/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java index ff0a62ba221..8311b8d1e20 100644 --- a/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java +++ b/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java @@ -37,6 +37,7 @@ import java.util.*; 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 @@ public class ReadCertificates extends PKCS11Test { } System.out.println("OK: " + certs.size() + " certificates."); + // Get supported curves + Vector 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 diff --git a/jdk/test/sun/security/pkcs11/ec/TestCurves.java b/jdk/test/sun/security/pkcs11/ec/TestCurves.java index 511bbaf7568..de53e2147fc 100644 --- a/jdk/test/sun/security/pkcs11/ec/TestCurves.java +++ b/jdk/test/sun/security/pkcs11/ec/TestCurves.java @@ -56,47 +56,49 @@ public class TestCurves extends PKCS11Test { 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 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 @@ public class TestCurves extends PKCS11Test { System.out.println("OK"); } - private static Vector - getKnownCurves(Provider p) throws Exception { - - int index; - int begin; - int end; - String curve; - Vector results = new Vector(); - // 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); diff --git a/jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java b/jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java index 7e97d8e0410..16696dbe414 100644 --- a/jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java +++ b/jdk/test/sun/security/ssl/templates/SSLSocketSSLEngineTemplate.java @@ -206,7 +206,9 @@ public class SSLSocketSSLEngineTemplate { 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); diff --git a/jdk/test/sun/tools/jstatd/JstatdTest.java b/jdk/test/sun/tools/jstatd/JstatdTest.java index 1a11788e09f..f07ce6b1742 100644 --- a/jdk/test/sun/tools/jstatd/JstatdTest.java +++ b/jdk/test/sun/tools/jstatd/JstatdTest.java @@ -353,6 +353,14 @@ public final class JstatdTest { } 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"); } }